From a9e8311f80faa5c216a985734787dbedddbf0c8e Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 27 Feb 2018 11:16:59 +0100 Subject: [PATCH 001/363] server.AdminExists --- connection/websocket/web_socket.go | 43 ------------------------------ kuzzle/kuzzle.go | 13 ++++----- 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 1590f38b..3c51a2ae 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -281,49 +281,6 @@ func (ws *webSocket) UnregisterRoom(roomId string) { } } -/* -func (ws *webSocket) listen() { - for { - var message types.KuzzleResponse - var r collection.Room - - msg := <-ws.listenChan - - json.Unmarshal(msg, &message) - m := message - - json.Unmarshal(m.Result, &r) - - s, ok := ws.subscriptions.Load(m.RoomId) - if m.RoomId != "" && ok { - var notification types.KuzzleNotification - - json.Unmarshal(msg, ¬ification) - - s.(*sync.Map).Range(func(key, value interface{}) bool { - channel := value.(types.IRoom).RealtimeChannel() - if channel != nil { - value.(types.IRoom).RealtimeChannel() <- ¬ification - } - return true - }) - } - - c, ok := ws.channelsResult.Load(m.RequestId) - if ok { - if message.Error != nil && message.Error.Message == "Token expired" { - ws.EmitEvent(event.JwtExpired, nil) - } - - // If this is a response to a query we simply broadcast the response to the corresponding channel - c.(chan<- *types.KuzzleResponse) <- &message - close(c.(chan<- *types.KuzzleResponse)) - ws.channelsResult.Delete(m.RequestId) - } - } -} -*/ - func (ws *webSocket) listen() { for { msg := <-ws.listenChan diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index ae7650b2..f2ec83b6 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -9,6 +9,7 @@ import ( "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/ms" "github.com/kuzzleio/sdk-go/security" + "github.com/kuzzleio/sdk-go/server" "github.com/kuzzleio/sdk-go/types" ) @@ -33,6 +34,7 @@ type Kuzzle struct { MemoryStorage *ms.Ms Security *security.Security + Server *server.Server } // NewKuzzle is the Kuzzle constructor @@ -46,16 +48,15 @@ func NewKuzzle(c connection.Connection, options types.Options) (*Kuzzle, error) } k := &Kuzzle{ - socket: c, - version: version, + socket: c, + version: version, + defaultIndex: options.DefaultIndex(), } + k.RequestHistory = k.socket.RequestHistory() k.MemoryStorage = &ms.Ms{k} k.Security = &security.Security{k} - - k.RequestHistory = k.socket.RequestHistory() - - k.defaultIndex = options.DefaultIndex() + k.Server = server.NewServer(k) var err error From 106378fe34e8bf9ec55279cb564d5a452a7ff2d5 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 27 Feb 2018 12:09:59 +0100 Subject: [PATCH 002/363] server.stats* --- internal/wrappers/cgo/kuzzle/root_api.go | 48 -------------- internal/wrappers/cpp/kuzzle.cpp | 18 ------ internal/wrappers/headers/kuzzlesdk.h | 5 ++ internal/wrappers/kcore.i | 2 + internal/wrappers/templates/java/core.i | 4 +- kuzzle/get_all_statistics.go | 41 ------------ kuzzle/get_all_statistics_test.go | 81 ------------------------ kuzzle/get_statistics.go | 44 ------------- kuzzle/get_statistics_test.go | 74 ---------------------- 9 files changed, 10 insertions(+), 307 deletions(-) delete mode 100644 kuzzle/get_all_statistics.go delete mode 100644 kuzzle/get_all_statistics_test.go delete mode 100644 kuzzle/get_statistics.go delete mode 100644 kuzzle/get_statistics_test.go diff --git a/internal/wrappers/cgo/kuzzle/root_api.go b/internal/wrappers/cgo/kuzzle/root_api.go index 95362779..67c07ba8 100644 --- a/internal/wrappers/cgo/kuzzle/root_api.go +++ b/internal/wrappers/cgo/kuzzle/root_api.go @@ -11,9 +11,6 @@ package main import "C" import ( "github.com/kuzzleio/sdk-go/kuzzle" - "strconv" - "time" - "unsafe" ) //export kuzzle_list_collections @@ -83,51 +80,6 @@ func kuzzle_get_server_info(k *C.kuzzle, options *C.query_options) *C.json_resul return goToCJsonResult(res, err) } -//export kuzzle_get_all_statistics -func kuzzle_get_all_statistics(k *C.kuzzle, options *C.query_options) *C.all_statistics_result { - result := (*C.all_statistics_result)(C.calloc(1, C.sizeof_statistics_result)) - opts := SetQueryOptions(options) - - stats, err := (*kuzzle.Kuzzle)(k.instance).GetAllStatistics(opts) - - if err != nil { - Set_all_statistics_error(result, err) - return result - } - - result.result = (*C.statistics)(C.calloc(C.size_t(len(stats)), C.sizeof_statistics)) - result.result_length = C.size_t(len(stats)) - statistics := (*[1<<30 - 1]C.statistics)(unsafe.Pointer(result.result))[:len(stats):len(stats)] - - for i, stat := range stats { - fillStatistics(stat, &statistics[i]) - } - - return result -} - -//export kuzzle_get_statistics -func kuzzle_get_statistics(k *C.kuzzle, start_time C.time_t, stop_time C.time_t, options *C.query_options) *C.statistics_result { - result := (*C.statistics_result)(C.calloc(1, C.sizeof_statistics_result)) - opts := SetQueryOptions(options) - - t, _ := strconv.ParseInt(C.GoString(C.ctime(&start_time)), 10, 64) - start := time.Unix(t, 0) - t, _ = strconv.ParseInt(C.GoString(C.ctime(&stop_time)), 10, 64) - stop := time.Unix(t, 0) - - res, err := (*kuzzle.Kuzzle)(k.instance).GetStatistics(&start, &stop, opts) - - if err != nil { - Set_statistics_error(result, err) - return result - } - - fillStatistics(res, result.result) - - return result -} - //export kuzzle_now func kuzzle_now(k *C.kuzzle, options *C.query_options) *C.date_result { time, err := (*kuzzle.Kuzzle)(k.instance).Now(SetQueryOptions(options)) diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 53da4700..dd9f48c3 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -103,24 +103,6 @@ namespace kuzzleio { return ret; } - statistics* Kuzzle::getAllStatistics(query_options* options) Kuz_Throw_KuzzleException { - all_statistics_result* r = kuzzle_get_all_statistics(_kuzzle, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - statistics *ret = r->result; - delete(r); - return ret; - } - - statistics* Kuzzle::getStatistics(time_t start, time_t end, query_options* options) Kuz_Throw_KuzzleException { - statistics_result* r = kuzzle_get_statistics(_kuzzle, start, end, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - statistics *ret = r->result; - delete(r); - return ret; - } - bool Kuzzle::getAutoRefresh(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_get_auto_refresh(_kuzzle, const_cast(index.c_str()), options); if (r->error != NULL) diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 08631d34..cf4ed216 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -93,6 +93,11 @@ typedef struct { kuzzle_offline_queue_loader loader; } kuzzle; +typedef struct { + void *instance; + kuzzle* kuzzle; +} server; + //options passed to room constructor typedef struct { char *scope; diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index c1c717c7..19eb3b87 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -9,6 +9,7 @@ #include "collection.hpp" #include "room.hpp" #include "document.hpp" +#include "server.hpp" #include #include %} @@ -25,3 +26,4 @@ %include "collection.hpp" %include "room.hpp" %include "document.hpp" +%include "server.hpp" \ No newline at end of file diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 115d108e..fdd88749 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -36,6 +36,7 @@ #include "collection.cpp" #include "room.cpp" #include "document.cpp" +#include "server.cpp" %} %include "exceptions.i" @@ -140,4 +141,5 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" %include "room.cpp" -%include "document.cpp" \ No newline at end of file +%include "document.cpp" +%include "server.cpp" \ No newline at end of file diff --git a/kuzzle/get_all_statistics.go b/kuzzle/get_all_statistics.go deleted file mode 100644 index 4988b806..00000000 --- a/kuzzle/get_all_statistics.go +++ /dev/null @@ -1,41 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// GetAllStatistics get all Kuzzle usage statistics frames -func (k *Kuzzle) GetAllStatistics(options types.QueryOptions) ([]*types.Statistics, error) { - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "server", - Action: "getAllStats", - } - - type stats struct { - Hits []json.RawMessage `json:"hits"` - } - - go k.Query(query, nil, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - s := stats{} - json.Unmarshal(res.Result, &s) - - var stat []*types.Statistics - for _, hit := range s.Hits { - h := &types.Statistics{} - - json.Unmarshal(hit, h) - stat = append(stat, h) - } - - return stat, nil -} diff --git a/kuzzle/get_all_statistics_test.go b/kuzzle/get_all_statistics_test.go deleted file mode 100644 index 2c431b61..00000000 --- a/kuzzle/get_all_statistics_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "log" - "testing" -) - -func TestGetAllStatisticsQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "server", request.Controller) - assert.Equal(t, "getAllStats", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.GetAllStatistics(nil) - assert.NotNil(t, err) -} - -func TestGetAllStatistics(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "server", request.Controller) - assert.Equal(t, "getAllStats", request.Action) - - type hits struct { - Hits []*types.Statistics `json:"hits"` - } - - m := map[string]int{} - m["websocket"] = 42 - - stats := types.Statistics{ - CompletedRequests: m, - } - - hitsArray := []*types.Statistics{&stats} - toMarshal := hits{hitsArray} - - h, err := json.Marshal(toMarshal) - if err != nil { - log.Fatal(err) - } - - return &types.KuzzleResponse{Result: h} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.GetAllStatistics(nil) - - assert.Equal(t, 42, res[0].CompletedRequests["websocket"]) -} - -func ExampleKuzzle_GetAllStatistics() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.GetAllStatistics(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - for _, stat := range res { - fmt.Println(stat.Timestamp, stat.FailedRequests, stat.Connections, stat.CompletedRequests, stat.OngoingRequests) - } -} diff --git a/kuzzle/get_statistics.go b/kuzzle/get_statistics.go deleted file mode 100644 index 2133f31e..00000000 --- a/kuzzle/get_statistics.go +++ /dev/null @@ -1,44 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" - "time" -) - -// GetStatistics get Kuzzle usage statistics -func (k *Kuzzle) GetStatistics(startTime *time.Time, stopTime *time.Time, options types.QueryOptions) (*types.Statistics, error) { - result := make(chan *types.KuzzleResponse) - - type data struct { - startTime string `json:"startTime"` - stopTime string `json:"stopTime"` - } - - var d data - if startTime != nil { - d = data{ - startTime.String(), - stopTime.String(), - } - } - - query := &types.KuzzleRequest{ - Controller: "server", - Action: "getLastStats", - Body: d, - } - - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - s := &types.Statistics{} - json.Unmarshal(res.Result, s) - - return s, nil -} diff --git a/kuzzle/get_statistics_test.go b/kuzzle/get_statistics_test.go deleted file mode 100644 index 02abf509..00000000 --- a/kuzzle/get_statistics_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "log" - "testing" - "time" -) - -func TestGetStatisticsQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "server", request.Controller) - assert.Equal(t, "getLastStats", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.GetStatistics(nil, nil, nil) - assert.NotNil(t, err) -} - -func TestGetStatistics(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "server", request.Controller) - assert.Equal(t, "getLastStats", request.Action) - - m := make(map[string]int) - m["websocket"] = 42 - - stats := types.Statistics{ - CompletedRequests: m, - } - - h, err := json.Marshal(stats) - if err != nil { - log.Fatal(err) - } - - return &types.KuzzleResponse{Result: h} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.GetStatistics(nil, nil, nil) - - assert.Equal(t, 42, res.CompletedRequests["websocket"]) -} - -func ExampleKuzzle_GetStatistics() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - now := time.Now() - res, err := k.GetStatistics(&now, nil, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} From 1de0921930f3dc9077e7ba764aaf1d14cdf54cde Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 28 Feb 2018 11:04:24 +0100 Subject: [PATCH 003/363] Fix tests for 1.10 portage --- collection/subscribe_test.go | 2 +- kuzzle/kuzzle_test.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/collection/subscribe_test.go b/collection/subscribe_test.go index 3ff68b5a..325524f3 100644 --- a/collection/subscribe_test.go +++ b/collection/subscribe_test.go @@ -53,5 +53,5 @@ func ExampleCollection_Subscribe() { r := <-room.ResponseChannel() - fmt.Println(r.Room.RoomId) + fmt.Println(r.Room.RoomId()) } diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index 8578096d..93f6f59c 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -3,12 +3,13 @@ package kuzzle_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func ExampleKuzzle_Connect() { @@ -25,7 +26,7 @@ func ExampleKuzzle_Connect() { return } - fmt.Println(k.State) + fmt.Println(k.State()) } func ExampleKuzzle_Jwt() { From 2674facada94e723ed146e443af91971c20ff03c Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 28 Feb 2018 14:52:37 +0100 Subject: [PATCH 004/363] server.AdminExists --- server/adminExists.go | 30 ++++++++++++++ server/adminExists_test.go | 64 +++++++++++++++++++++++++++++ server/getAllStats.go | 26 ++++++++++++ server/getAllStats_test.go | 82 +++++++++++++++++++++++++++++++++++++ server/getConfig.go | 26 ++++++++++++ server/getConfig_test.go | 62 ++++++++++++++++++++++++++++ server/getLastStats.go | 42 +++++++++++++++++++ server/getLastStats_test.go | 62 ++++++++++++++++++++++++++++ server/server.go | 13 ++++++ 9 files changed, 407 insertions(+) create mode 100644 server/adminExists.go create mode 100644 server/adminExists_test.go create mode 100644 server/getAllStats.go create mode 100644 server/getAllStats_test.go create mode 100644 server/getConfig.go create mode 100644 server/getConfig_test.go create mode 100644 server/getLastStats.go create mode 100644 server/getLastStats_test.go create mode 100644 server/server.go diff --git a/server/adminExists.go b/server/adminExists.go new file mode 100644 index 00000000..e0fb8911 --- /dev/null +++ b/server/adminExists.go @@ -0,0 +1,30 @@ +package server + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +//AdminExists checks if an administrator account has been created, and return a boolean as a result. +func (s *Server) AdminExists(options types.QueryOptions) (bool, error) { + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "server", + Action: "adminExists", + } + + go s.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return false, res.Error + } + + var r bool + json.Unmarshal(res.Result, &r) + + return r, nil +} diff --git a/server/adminExists_test.go b/server/adminExists_test.go new file mode 100644 index 00000000..e033ea18 --- /dev/null +++ b/server/adminExists_test.go @@ -0,0 +1,64 @@ +package server_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestAdminExistsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "adminExists", request.Action) + + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + _, err := k.Server.AdminExists(nil) + assert.NotNil(t, err) +} + +func TestAdminExists(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "adminExists", request.Action) + + ret, _ := json.Marshal(true) + return &types.KuzzleResponse{Result: ret} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + res, _ := k.Server.AdminExists(nil) + assert.Equal(t, true, res) +} + +func ExampleAdminExists(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "adminExists", request.Action) + + ret, _ := json.Marshal(true) + return &types.KuzzleResponse{Result: ret} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + res, _ := k.Server.AdminExists(nil) + assert.Equal(t, true, res) +} diff --git a/server/getAllStats.go b/server/getAllStats.go new file mode 100644 index 00000000..1bdc21ee --- /dev/null +++ b/server/getAllStats.go @@ -0,0 +1,26 @@ +package server + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +//GetAllStats get all Kuzzle usage statistics frames +func (s *Server) GetAllStats(options types.QueryOptions) (json.RawMessage, error) { + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "server", + Action: "getAllStats", + } + + go s.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + return res.Result, nil +} diff --git a/server/getAllStats_test.go b/server/getAllStats_test.go new file mode 100644 index 00000000..447cd2c0 --- /dev/null +++ b/server/getAllStats_test.go @@ -0,0 +1,82 @@ +package server_test + +import ( + "encoding/json" + "fmt" + "log" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetAllStatsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "getAllStats", request.Action) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Server.GetAllStats(nil) + assert.NotNil(t, err) +} + +func TestGetAllStats(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "getAllStats", request.Action) + + type hits struct { + Hits []*types.Statistics `json:"hits"` + } + + m := map[string]int{} + m["websocket"] = 42 + + stats := types.Statistics{ + CompletedRequests: m, + } + + hitsArray := []*types.Statistics{&stats} + toMarshal := hits{hitsArray} + + h, err := json.Marshal(toMarshal) + if err != nil { + log.Fatal(err) + } + + return &types.KuzzleResponse{Result: h} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := k.Server.GetAllStats(nil) + + assert.Equal(t, 42, res[0].CompletedRequests["websocket"]) +} + +func ExampleKuzzle_GetAllStats() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + res, err := k.Server.GetAllStats(nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + for _, stat := range res { + fmt.Println(stat.Timestamp, stat.FailedRequests, stat.Connections, stat.CompletedRequests, stat.OngoingRequests) + } +} diff --git a/server/getConfig.go b/server/getConfig.go new file mode 100644 index 00000000..cc312225 --- /dev/null +++ b/server/getConfig.go @@ -0,0 +1,26 @@ +package server + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +//GetConfig returns the current Kuzzle configuration. +func (s *Server) GetConfig(options types.QueryOptions) (json.RawMessage, error) { + result := make(chan *types.KuzzleResponse) + query := &types.KuzzleRequest{ + Controller: "server", + Action: "getConfig", + } + + go s.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/server/getConfig_test.go b/server/getConfig_test.go new file mode 100644 index 00000000..d6623760 --- /dev/null +++ b/server/getConfig_test.go @@ -0,0 +1,62 @@ +package server_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetConfigQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "getConfig", request.Action) + + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + _, err := k.Server.GetConfig(nil) + assert.NotNil(t, err) +} + +func TestGetConfig(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "getConfig", request.Action) + + ret, _ := json.Marshal(true) + return &types.KuzzleResponse{Result: ret} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + res, _ := k.Server.GetConfig(nil) + assert.Equal(t, true, res) +} + +func ExampleGetConfig() { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + + ret, _ := json.Marshal(true) + return &types.KuzzleResponse{Result: ret} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + res, _ := k.Server.GetConfig(nil) + println(res) +} diff --git a/server/getLastStats.go b/server/getLastStats.go new file mode 100644 index 00000000..7789d574 --- /dev/null +++ b/server/getLastStats.go @@ -0,0 +1,42 @@ +package server + +import ( + "encoding/json" + "time" + + "github.com/kuzzleio/sdk-go/types" +) + +//GetLastStats get Kuzzle usage statistics +func (s *Server) GetLastStats(startTime *time.Time, stopTime *time.Time, options types.QueryOptions) (json.RawMessage, error) { + result := make(chan *types.KuzzleResponse) + + type data struct { + StartTime string `json:"startTime"` + StopTime string `json:"stopTime"` + } + + var d data + if startTime != nil { + d = data{ + startTime.String(), + stopTime.String(), + } + } + + query := &types.KuzzleRequest{ + Controller: "server", + Action: "getLastStats", + Body: d, + } + + go s.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/server/getLastStats_test.go b/server/getLastStats_test.go new file mode 100644 index 00000000..6107d3bc --- /dev/null +++ b/server/getLastStats_test.go @@ -0,0 +1,62 @@ +package server_test + +import ( + "encoding/json" + "fmt" + "testing" + "time" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetLastStatsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "getLastStats", request.Action) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Server.GetLastStats(nil, nil, nil) + assert.NotNil(t, err) +} + +func TestGetLastStats(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "getLastStats", request.Action) + + return &types.KuzzleResponse{Result: json.RawMessage(`{"foo": "bar"}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := k.Server.GetLastStats(nil, nil, nil) + + assert.Equal(t, json.RawMessage(`{"foo": "bar"}`), res) +} + +func ExampleKuzzle_GetLastStats() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + now := time.Now() + res, err := k.Server.GetLastStats(&now, nil, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/server/server.go b/server/server.go new file mode 100644 index 00000000..9e2e94bf --- /dev/null +++ b/server/server.go @@ -0,0 +1,13 @@ +package server + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +type Server struct { + k types.IKuzzle +} + +func NewServer(k types.IKuzzle) *Server { + return &Server{k} +} From dc68d9bc886591d2fd767a9da6035e50ae6bb47b Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 28 Feb 2018 15:39:21 +0100 Subject: [PATCH 005/363] Go functions created (#73) --- index/create.go | 29 +++++++++++++++ index/create_test.go | 68 +++++++++++++++++++++++++++++++++++ index/delete.go | 27 ++++++++++++++ index/delete_test.go | 0 index/exists.go | 40 +++++++++++++++++++++ index/exists_test.go | 0 index/mDelete.go | 29 +++++++++++++++ index/mDelete_test.go | 0 index/refresh.go | 28 +++++++++++++++ index/refreshInternal.go | 0 index/refreshInternal_test.go | 0 index/refresh_test.go | 0 index/setAutoRefresh.go | 30 ++++++++++++++++ index/setAutoRefresh_test.go | 0 test.sh | 6 ++-- 15 files changed, 254 insertions(+), 3 deletions(-) create mode 100644 index/create.go create mode 100644 index/create_test.go create mode 100644 index/delete.go create mode 100644 index/delete_test.go create mode 100644 index/exists.go create mode 100644 index/exists_test.go create mode 100644 index/mDelete.go create mode 100644 index/mDelete_test.go create mode 100644 index/refresh.go create mode 100644 index/refreshInternal.go create mode 100644 index/refreshInternal_test.go create mode 100644 index/refresh_test.go create mode 100644 index/setAutoRefresh.go create mode 100644 index/setAutoRefresh_test.go diff --git a/index/create.go b/index/create.go new file mode 100644 index 00000000..cb567c86 --- /dev/null +++ b/index/create.go @@ -0,0 +1,29 @@ +package index + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// CreateIndex create a new empty data index, with no associated mapping. +func (Index) Create(index string) error { + if index == "" { + return types.NewError("Index.Create: index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Controller: "index", + Action: "create", + } + go k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/index/create_test.go b/index/create_test.go new file mode 100644 index 00000000..99a24920 --- /dev/null +++ b/index/create_test.go @@ -0,0 +1,68 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.CreateIndex("", nil) + assert.NotNil(t, err) +} + +func TestCreateIndexQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.CreateIndex("index", nil) + assert.NotNil(t, err) +} + +func TestCreateIndex(t *testing.T) { + type ackResult struct { + Acknowledged bool + ShardsAcknowledged bool + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + q := &types.KuzzleRequest{} + json.Unmarshal(query, q) + + assert.Equal(t, "index", q.Controller) + assert.Equal(t, "create", q.Action) + assert.Equal(t, "index", q.Index) + + return &types.KuzzleResponse{Result: []byte(`{"acknowledged":true}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.CreateIndex("index", nil) + + assert.Nil(t, err) +} + +func ExampleKuzzle_CreateIndex() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + res, err := k.CreateIndex("index", nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Printf("%#v\n", res) +} diff --git a/index/delete.go b/index/delete.go new file mode 100644 index 00000000..3bcfc41e --- /dev/null +++ b/index/delete.go @@ -0,0 +1,27 @@ +package index + +import "github.com/kuzzleio/sdk-go/types" + +// Delete delete the index +func (Index) Delete(index string) error { + if index == "" { + return types.NewError("Index.Delete: index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Controller: "index", + Action: "delete", + } + go k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/index/delete_test.go b/index/delete_test.go new file mode 100644 index 00000000..e69de29b diff --git a/index/exists.go b/index/exists.go new file mode 100644 index 00000000..e498277f --- /dev/null +++ b/index/exists.go @@ -0,0 +1,40 @@ +package index + +import ( + "encoding/json" + "fmt" + + "github.com/kuzzleio/sdk-go/types" +) + +// Exists check if the index exists +func (Index) Exists(index string) (bool, error) { + if index == "" { + return false, types.NewError("Index.Exists: index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Controller: "index", + Action: "exists", + } + + go k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return false, res.Error + } + + var exists bool + + err := json.Unmarshal(res.Result, &exists) + if err != nil { + return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + } + return exists, nil + +} diff --git a/index/exists_test.go b/index/exists_test.go new file mode 100644 index 00000000..e69de29b diff --git a/index/mDelete.go b/index/mDelete.go new file mode 100644 index 00000000..466838bd --- /dev/null +++ b/index/mDelete.go @@ -0,0 +1,29 @@ +package index + +import "github.com/kuzzleio/sdk-go/types" + +// Delete delete the index +func (Index) MDelete(indexes []string) error { + if indexes.len() == 0 { + return types.NewError("Index.MDelete: at least one index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + for _, index := range indexes { + query := &types.KuzzleRequest{ + Index: index, + Controller: "index", + Action: "delete", + } + go k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + } + + return nil +} diff --git a/index/mDelete_test.go b/index/mDelete_test.go new file mode 100644 index 00000000..e69de29b diff --git a/index/refresh.go b/index/refresh.go new file mode 100644 index 00000000..0e15337a --- /dev/null +++ b/index/refresh.go @@ -0,0 +1,28 @@ +package index + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +func (Index) Refresh(index string) error { + if index == "" { + return types.NewError("Index.Refresh: index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "index", + Action: "refresh", + Index: index, + } + go k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return nil +} diff --git a/index/refreshInternal.go b/index/refreshInternal.go new file mode 100644 index 00000000..e69de29b diff --git a/index/refreshInternal_test.go b/index/refreshInternal_test.go new file mode 100644 index 00000000..e69de29b diff --git a/index/refresh_test.go b/index/refresh_test.go new file mode 100644 index 00000000..e69de29b diff --git a/index/setAutoRefresh.go b/index/setAutoRefresh.go new file mode 100644 index 00000000..0b9cd38e --- /dev/null +++ b/index/setAutoRefresh.go @@ -0,0 +1,30 @@ +package index + +import "github.com/kuzzleio/sdk-go/types" + +func (Index) SetAutoRefresh(index string, autoRefresh bool) error { + if index == "" { + return false, types.NewError("Index.SetAutoRefresh: index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "index", + Action: "setAutoRefresh", + Index: index, + Body: struct { + AutoRefresh bool `json:"autoRefresh"` + }{autoRefresh}, + } + + go k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return false, res.Error + } + + return nil +} diff --git a/index/setAutoRefresh_test.go b/index/setAutoRefresh_test.go new file mode 100644 index 00000000..e69de29b diff --git a/test.sh b/test.sh index e351d94a..895c9166 100755 --- a/test.sh +++ b/test.sh @@ -5,7 +5,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" workdir=$dir/.cover profile="$workdir/cover.out" mode=count -dirs=(kuzzle connection/websocket collection security ms) +dirs=(kuzzle connection/websocket collection security ms index) timeout=${TIMEOUT:=1m} generate_cover_data() { @@ -36,7 +36,7 @@ linter_check() { make_wrappers() { cd "${dir}/internal/wrappers" - make all + make all } cd "$dir" @@ -53,4 +53,4 @@ case "$1" in show_cover_report html ;; *) echo >&2 "error: invalid option: $1"; exit 1 ;; -esac \ No newline at end of file +esac From 40cb8cdf2e22c7fe21c0d26309a8000309d5140e Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 28 Feb 2018 16:43:29 +0100 Subject: [PATCH 006/363] server.now --- internal/wrappers/cgo/kuzzle/root_api.go | 14 --- internal/wrappers/cgo/kuzzle/server.go | 104 ++++++++++++++++++ internal/wrappers/cpp/kuzzle.cpp | 19 ---- internal/wrappers/cpp/server.cpp | 60 ++++++++++ internal/wrappers/headers/kuzzle.hpp | 2 - internal/wrappers/headers/server.hpp | 23 ++++ internal/wrappers/templates/java/typemap.i | 10 +- kuzzle/get_server_info.go | 32 ------ server/adminExists_test.go | 17 +-- server/getAllStats_test.go | 30 +---- server/getConfig_test.go | 16 +-- server/getLastStats_test.go | 2 +- server/info.go | 26 +++++ .../info_test.go | 59 +++------- {kuzzle => server}/now.go | 7 +- {kuzzle => server}/now_test.go | 11 +- test.sh | 2 +- 17 files changed, 259 insertions(+), 175 deletions(-) create mode 100644 internal/wrappers/cgo/kuzzle/server.go create mode 100644 internal/wrappers/cpp/server.cpp create mode 100644 internal/wrappers/headers/server.hpp delete mode 100644 kuzzle/get_server_info.go create mode 100644 server/info.go rename kuzzle/get_server_info_test.go => server/info_test.go (50%) rename {kuzzle => server}/now.go (77%) rename {kuzzle => server}/now_test.go (91%) diff --git a/internal/wrappers/cgo/kuzzle/root_api.go b/internal/wrappers/cgo/kuzzle/root_api.go index 67c07ba8..e4a616d1 100644 --- a/internal/wrappers/cgo/kuzzle/root_api.go +++ b/internal/wrappers/cgo/kuzzle/root_api.go @@ -72,17 +72,3 @@ func kuzzle_get_auto_refresh(k *C.kuzzle, index *C.char, options *C.query_option return goToCBoolResult(res, err) } - -//export kuzzle_get_server_info -func kuzzle_get_server_info(k *C.kuzzle, options *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).GetServerInfo(SetQueryOptions(options)) - - return goToCJsonResult(res, err) -} - -//export kuzzle_now -func kuzzle_now(k *C.kuzzle, options *C.query_options) *C.date_result { - time, err := (*kuzzle.Kuzzle)(k.instance).Now(SetQueryOptions(options)) - - return goToCDateResult(time, err) -} diff --git a/internal/wrappers/cgo/kuzzle/server.go b/internal/wrappers/cgo/kuzzle/server.go new file mode 100644 index 00000000..ffbe01a7 --- /dev/null +++ b/internal/wrappers/cgo/kuzzle/server.go @@ -0,0 +1,104 @@ +package main + +/* + #cgo CFLAGS: -I../../headers + #include + #include + #include "kuzzlesdk.h" + #include "sdk_wrappers_internal.h" +*/ +import "C" +import ( + "strconv" + "time" + "unsafe" + + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/server" +) + +// map which stores instances to keep references in case the gc passes +var serverInstances map[interface{}]bool + +//register new instance of server +func registerServer(instance interface{}) { + serverInstances[instance] = true +} + +// unregister an instance from the instances map +//export unregisterServer +func unregisterServer(d *C.server) { + delete(serverInstances, (*server.Server)(d.instance)) +} + +// Allocates memory +//export kuzzle_new_server +func kuzzle_new_server(s *C.server, k *C.kuzzle) { + kuz := (*kuzzle.Kuzzle)(k.instance) + server := server.NewServer(kuz) + + if serverInstances == nil { + serverInstances = make(map[interface{}]bool) + } + + s.instance = unsafe.Pointer(server) + s.kuzzle = k + + registerServer(s) +} + +//export kuzzle_admin_exists +func kuzzle_admin_exists(s *C.server, options *C.query_options) *C.bool_result { + opts := SetQueryOptions(options) + + res, err := (*server.Server)(s.instance).AdminExists(opts) + return goToCBoolResult(res, err) +} + +//export kuzzle_get_all_stats +func kuzzle_get_all_stats(s *C.server, options *C.query_options) *C.string_result { + opts := SetQueryOptions(options) + + stats, err := (*server.Server)(s.instance).GetAllStats(opts) + + str := string(stats) + return goToCStringResult(&str, err) +} + +//export kuzzle_get_last_stats +func kuzzle_get_last_stats(s *C.server, start_time C.time_t, stop_time C.time_t, options *C.query_options) *C.string_result { + opts := SetQueryOptions(options) + + t, _ := strconv.ParseInt(C.GoString(C.ctime(&start_time)), 10, 64) + start := time.Unix(t, 0) + t, _ = strconv.ParseInt(C.GoString(C.ctime(&stop_time)), 10, 64) + stop := time.Unix(t, 0) + + res, err := (*server.Server)(s.instance).GetLastStats(&start, &stop, opts) + + str := string(res) + return goToCStringResult(&str, err) +} + +//export kuzzle_get_config +func kuzzle_get_config(s *C.server, options *C.query_options) *C.string_result { + res, err := (*server.Server)(s.instance).GetConfig(SetQueryOptions(options)) + + str := string(res) + return goToCStringResult(&str, err) +} + +//export kuzzle_info +func kuzzle_info(s *C.server, options *C.query_options) *C.string_result { + res, err := (*server.Server)(s.instance).Info(SetQueryOptions(options)) + + str := string(res) + return goToCStringResult(&str, err) +} + +//export kuzzle_now +func kuzzle_now(s *C.server, options *C.query_options) *C.date_result { + time, err := (*server.Server)(s.instance).Now(SetQueryOptions(options)) + + return goToCDateResult(time, err) +} diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index dd9f48c3..97a044de 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -125,15 +125,6 @@ namespace kuzzleio { return ret; } - json_object* Kuzzle::getServerInfo(query_options* options) Kuz_Throw_KuzzleException { - json_result *r = kuzzle_get_server_info(_kuzzle, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - json_object *ret = r->result; - delete(r); - return ret; - } - collection_entry* Kuzzle::listCollections(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { collection_entry_result *r = kuzzle_list_collections(_kuzzle, const_cast(index.c_str()), options); if (r->error != NULL) @@ -180,16 +171,6 @@ namespace kuzzleio { return ret; } - // java wrapper for this method is in typemap.i - long long Kuzzle::now(query_options* options) Kuz_Throw_KuzzleException { - date_result *r = kuzzle_now(_kuzzle, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - long long ret = r->result; - delete(r); - return ret; - } - Kuzzle* Kuzzle::replayQueue() { kuzzle_replay_queue(_kuzzle); return this; diff --git a/internal/wrappers/cpp/server.cpp b/internal/wrappers/cpp/server.cpp new file mode 100644 index 00000000..15a6dfe4 --- /dev/null +++ b/internal/wrappers/cpp/server.cpp @@ -0,0 +1,60 @@ +#include "server.hpp" + +namespace kuzzleio { + Server::Server(Kuzzle* kuzzle) { + _server = new server(); + kuzzle_new_server(_server, kuzzle->_kuzzle); + } + + Server::~Server() { + unregisterServer(_server); + delete(_server); + } + + std::string Server::getAllStats(query_options* options) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_get_all_stats(_server, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + delete(r); + return ret; + } + + std::string Server::getLastStats(time_t start, time_t end, query_options* options) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_get_last_stats(_server, start, end, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + delete(r); + return ret; + } + + std::string Server::getConfig(query_options* options) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_get_config(_server, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + delete(r); + return ret; + } + + std::string Server::info(query_options* options) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_info(_server, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + delete(r); + return ret; + } + + // java wrapper for this method is in typemap.i + long long Server::now(query_options* options) Kuz_Throw_KuzzleException { + date_result *r = kuzzle_now(_server, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + long long ret = r->result; + delete(r); + return ret; + } + +} \ No newline at end of file diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index cb3b09c5..0cca82f3 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -38,14 +38,12 @@ namespace kuzzleio { bool getAutoRefresh(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; std::string getJwt(); json_object* getMyRights(query_options* options=NULL) Kuz_Throw_KuzzleException; - json_object* getServerInfo(query_options* options=NULL) Kuz_Throw_KuzzleException; collection_entry* listCollections(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; std::vector listIndexes(query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); void logout(); kuzzle_response* query(kuzzle_request* query, query_options* options=NULL) Kuz_Throw_KuzzleException; shards* refreshIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - long long now(query_options* options=NULL) Kuz_Throw_KuzzleException; Kuzzle* replayQueue(); Kuzzle* setAutoReplay(bool autoReplay); Kuzzle* setDefaultIndex(const std::string& index); diff --git a/internal/wrappers/headers/server.hpp b/internal/wrappers/headers/server.hpp new file mode 100644 index 00000000..62715512 --- /dev/null +++ b/internal/wrappers/headers/server.hpp @@ -0,0 +1,23 @@ +#ifndef _KUZZLE_SERVER_HPP +#define _KUZZLE_SERVER_HPP + +#include "exceptions.hpp" +#include "core.hpp" + +namespace kuzzleio { + class Server { + server *_server; + Server(); + + public: + Server(Kuzzle* kuzzle); + virtual ~Server(); + std::string getAllStats(query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string getLastStats(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string getConfig(query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string info(query_options* options=NULL) Kuz_Throw_KuzzleException; + long long now(query_options* options=NULL) Kuz_Throw_KuzzleException; + }; +} + +#endif \ No newline at end of file diff --git a/internal/wrappers/templates/java/typemap.i b/internal/wrappers/templates/java/typemap.i index af9d8d7c..b644ca10 100644 --- a/internal/wrappers/templates/java/typemap.i +++ b/internal/wrappers/templates/java/typemap.i @@ -1,9 +1,9 @@ -%rename (_now) kuzzleio::Kuzzle::now(query_options*); -%rename (_now) kuzzleio::Kuzzle::now(); +%rename (_now) kuzzleio::Server::now(query_options*); +%rename (_now) kuzzleio::Server::now(); -%javamethodmodifiers kuzzleio::Kuzzle::now(query_options* options) "private"; -%javamethodmodifiers kuzzleio::Kuzzle::now() "private"; -%typemap(javacode) kuzzleio::Kuzzle %{ +%javamethodmodifiers kuzzleio::Server::now(query_options* options) "private"; +%javamethodmodifiers kuzzleio::Server::now() "private"; +%typemap(javacode) kuzzleio::Server %{ /** * {@link #now(QueryOptions)} */ diff --git a/kuzzle/get_server_info.go b/kuzzle/get_server_info.go deleted file mode 100644 index fb4cf297..00000000 --- a/kuzzle/get_server_info.go +++ /dev/null @@ -1,32 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// GetServerInfo retrieves information about Kuzzle, its plugins and active services. -func (k *Kuzzle) GetServerInfo(options types.QueryOptions) (json.RawMessage, error) { - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "server", - Action: "info", - } - - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - type serverInfo struct { - ServerInfo json.RawMessage `json:"serverInfo"` - } - info := serverInfo{} - json.Unmarshal(res.Result, &info) - - return info.ServerInfo, nil -} diff --git a/server/adminExists_test.go b/server/adminExists_test.go index e033ea18..f45d625b 100644 --- a/server/adminExists_test.go +++ b/server/adminExists_test.go @@ -4,6 +4,7 @@ import ( "encoding/json" "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" @@ -45,20 +46,10 @@ func TestAdminExists(t *testing.T) { assert.Equal(t, true, res) } -func ExampleAdminExists(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "server", request.Controller) - assert.Equal(t, "adminExists", request.Action) - - ret, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: ret} - }, - } +func ExampleAdminExists() { + c := websocket.NewWebSocket("localhost", nil) k, _ := kuzzle.NewKuzzle(c, nil) k.Connect() res, _ := k.Server.AdminExists(nil) - assert.Equal(t, true, res) + println(res) } diff --git a/server/getAllStats_test.go b/server/getAllStats_test.go index 447cd2c0..116255aa 100644 --- a/server/getAllStats_test.go +++ b/server/getAllStats_test.go @@ -3,7 +3,6 @@ package server_test import ( "encoding/json" "fmt" - "log" "testing" "github.com/kuzzleio/sdk-go/connection/websocket" @@ -36,37 +35,18 @@ func TestGetAllStats(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "getAllStats", request.Action) - type hits struct { - Hits []*types.Statistics `json:"hits"` - } - - m := map[string]int{} - m["websocket"] = 42 - - stats := types.Statistics{ - CompletedRequests: m, - } - - hitsArray := []*types.Statistics{&stats} - toMarshal := hits{hitsArray} - - h, err := json.Marshal(toMarshal) - if err != nil { - log.Fatal(err) - } - - return &types.KuzzleResponse{Result: h} + return &types.KuzzleResponse{Result: json.RawMessage(`{"foo": "bar"}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) res, _ := k.Server.GetAllStats(nil) - assert.Equal(t, 42, res[0].CompletedRequests["websocket"]) + assert.Equal(t, json.RawMessage(`{"foo": "bar"}`), res) } func ExampleKuzzle_GetAllStats() { - conn := websocket.NewWebSocket("localhost:7512", nil) + conn := websocket.NewWebSocket("localhost", nil) k, _ := kuzzle.NewKuzzle(conn, nil) res, err := k.Server.GetAllStats(nil) @@ -76,7 +56,5 @@ func ExampleKuzzle_GetAllStats() { return } - for _, stat := range res { - fmt.Println(stat.Timestamp, stat.FailedRequests, stat.Connections, stat.CompletedRequests, stat.OngoingRequests) - } + fmt.Println(res) } diff --git a/server/getConfig_test.go b/server/getConfig_test.go index d6623760..4a9ad6cb 100644 --- a/server/getConfig_test.go +++ b/server/getConfig_test.go @@ -4,6 +4,7 @@ import ( "encoding/json" "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" @@ -35,26 +36,17 @@ func TestGetConfig(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "getConfig", request.Action) - ret, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: ret} + return &types.KuzzleResponse{Result: json.RawMessage(`{"foo": "bar"}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) k.Connect() res, _ := k.Server.GetConfig(nil) - assert.Equal(t, true, res) + assert.Equal(t, json.RawMessage(`{"foo": "bar"}`), res) } func ExampleGetConfig() { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - - ret, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: ret} - }, - } + c := websocket.NewWebSocket("localhost", nil) k, _ := kuzzle.NewKuzzle(c, nil) k.Connect() res, _ := k.Server.GetConfig(nil) diff --git a/server/getLastStats_test.go b/server/getLastStats_test.go index 6107d3bc..c0e8d5cd 100644 --- a/server/getLastStats_test.go +++ b/server/getLastStats_test.go @@ -47,7 +47,7 @@ func TestGetLastStats(t *testing.T) { } func ExampleKuzzle_GetLastStats() { - conn := websocket.NewWebSocket("localhost:7512", nil) + conn := websocket.NewWebSocket("localhost", nil) k, _ := kuzzle.NewKuzzle(conn, nil) now := time.Now() diff --git a/server/info.go b/server/info.go new file mode 100644 index 00000000..dda630bb --- /dev/null +++ b/server/info.go @@ -0,0 +1,26 @@ +package server + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +//Info retrieves information about Kuzzle, its plugins and active services. +func (s *Server) Info(options types.QueryOptions) (json.RawMessage, error) { + result := make(chan *types.KuzzleResponse) + query := &types.KuzzleRequest{ + Controller: "server", + Action: "info", + } + + go s.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/kuzzle/get_server_info_test.go b/server/info_test.go similarity index 50% rename from kuzzle/get_server_info_test.go rename to server/info_test.go index 4ad0034d..6d3d513c 100644 --- a/kuzzle/get_server_info_test.go +++ b/server/info_test.go @@ -1,17 +1,17 @@ -package kuzzle_test +package server_test import ( "encoding/json" - "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) -func TestGetServerInfoQueryError(t *testing.T) { +func TestInfoQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { request := types.KuzzleRequest{} @@ -23,17 +23,12 @@ func TestGetServerInfoQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.GetServerInfo(nil) + k.Connect() + _, err := k.Server.Info(nil) assert.NotNil(t, err) } -func TestGetServerInfo(t *testing.T) { - type myServerInfo struct { - Kuzzle struct { - Version string `json:"version"` - } `json:"kuzzle"` - } - +func TestInfo(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { request := types.KuzzleRequest{} @@ -41,39 +36,19 @@ func TestGetServerInfo(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "info", request.Action) - msi := myServerInfo{struct { - Version string `json:"version"` - }{"1.0.1"}} - msiMarsh, _ := json.Marshal(msi) - - type serverInfo struct { - ServerInfo json.RawMessage `json:"serverInfo"` - } - si := serverInfo{msiMarsh} - - info, _ := json.Marshal(si) - return &types.KuzzleResponse{Result: info} + return &types.KuzzleResponse{Result: json.RawMessage(`{"foo": "bar"}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.GetServerInfo(nil) - fmt.Printf("%s\n", res) - - var info myServerInfo - json.Unmarshal(res, &info) - assert.Equal(t, "1.0.1", info.Kuzzle.Version) + k.Connect() + res, _ := k.Server.Info(nil) + assert.Equal(t, json.RawMessage(`{"foo": "bar"}`), res) } -func ExampleKuzzle_GetServerInfo() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.GetServerInfo(nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) +func ExampleInfo() { + c := websocket.NewWebSocket("localhost", nil) + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + res, _ := k.Server.Info(nil) + println(res) } diff --git a/kuzzle/now.go b/server/now.go similarity index 77% rename from kuzzle/now.go rename to server/now.go index 7f9a07a3..f6e45642 100644 --- a/kuzzle/now.go +++ b/server/now.go @@ -1,19 +1,20 @@ -package kuzzle +package server import ( "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // Now retrieves the current Kuzzle time. -func (k *Kuzzle) Now(options types.QueryOptions) (int, error) { +func (s *Server) Now(options types.QueryOptions) (int, error) { result := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ Controller: "server", Action: "now", } - go k.Query(query, options, result) + go s.k.Query(query, options, result) res := <-result diff --git a/kuzzle/now_test.go b/server/now_test.go similarity index 91% rename from kuzzle/now_test.go rename to server/now_test.go index 5e27479e..e506a152 100644 --- a/kuzzle/now_test.go +++ b/server/now_test.go @@ -1,14 +1,15 @@ -package kuzzle_test +package server_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestNowQueryError(t *testing.T) { @@ -19,7 +20,7 @@ func TestNowQueryError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) k.Connect() - _, err := k.Now(nil) + _, err := k.Server.Now(nil) assert.NotNil(t, err) } @@ -38,7 +39,7 @@ func TestNow(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Now(nil) + res, _ := k.Server.Now(nil) assert.Equal(t, 1500646351073, res) } @@ -46,7 +47,7 @@ func ExampleKuzzle_Now() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) - now, err := k.Now(nil) + now, err := k.Server.Now(nil) if err != nil { fmt.Println(err.Error()) return diff --git a/test.sh b/test.sh index e351d94a..b2fe1bc5 100755 --- a/test.sh +++ b/test.sh @@ -5,7 +5,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" workdir=$dir/.cover profile="$workdir/cover.out" mode=count -dirs=(kuzzle connection/websocket collection security ms) +dirs=(kuzzle connection/websocket collection security ms server) timeout=${TIMEOUT:=1m} generate_cover_data() { From e752b1f25a61355df2f67c12f48562ec68935f8a Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 28 Feb 2018 22:53:15 +0100 Subject: [PATCH 007/363] Lasts Go functions and tests (#99) --- index/create.go | 6 +-- index/create_test.go | 27 ++++++------ index/delete.go | 6 +-- index/delete_test.go | 70 +++++++++++++++++++++++++++++++ index/exists.go | 4 +- index/exists_test.go | 71 +++++++++++++++++++++++++++++++ index/index.go | 13 ++++++ index/mDelete.go | 24 +++++------ index/mDelete_test.go | 78 +++++++++++++++++++++++++++++++++++ index/refresh.go | 6 +-- index/refreshInternal.go | 22 ++++++++++ index/refreshInternal_test.go | 61 +++++++++++++++++++++++++++ index/refresh_test.go | 70 +++++++++++++++++++++++++++++++ index/setAutoRefresh.go | 8 ++-- index/setAutoRefresh_test.go | 69 +++++++++++++++++++++++++++++++ 15 files changed, 494 insertions(+), 41 deletions(-) create mode 100644 index/index.go diff --git a/index/create.go b/index/create.go index cb567c86..ff16d0b1 100644 --- a/index/create.go +++ b/index/create.go @@ -4,8 +4,8 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// CreateIndex create a new empty data index, with no associated mapping. -func (Index) Create(index string) error { +// Create a new empty data index, with no associated mapping. +func (i *Index) Create(index string) error { if index == "" { return types.NewError("Index.Create: index required", 400) } @@ -17,7 +17,7 @@ func (Index) Create(index string) error { Controller: "index", Action: "create", } - go k.Query(query, options, result) + go i.k.Query(query, nil, result) res := <-result diff --git a/index/create_test.go b/index/create_test.go index 99a24920..28a162da 100644 --- a/index/create_test.go +++ b/index/create_test.go @@ -6,30 +6,33 @@ import ( "testing" "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) -func TestCreateIndexNull(t *testing.T) { +func TestCreateNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.CreateIndex("", nil) + i := index.NewIndex(k) + err := i.Create("") assert.NotNil(t, err) } -func TestCreateIndexQueryError(t *testing.T) { +func TestCreateQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.CreateIndex("index", nil) + i := index.NewIndex(k) + err := i.Create("index") assert.NotNil(t, err) } -func TestCreateIndex(t *testing.T) { +func TestCreate(t *testing.T) { type ackResult struct { Acknowledged bool ShardsAcknowledged bool @@ -44,25 +47,23 @@ func TestCreateIndex(t *testing.T) { assert.Equal(t, "create", q.Action) assert.Equal(t, "index", q.Index) - return &types.KuzzleResponse{Result: []byte(`{"acknowledged":true}`)} + return &types.KuzzleResponse{Result: []byte(`{"acknowledged":true, "shards_acknowledged": true}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := k.CreateIndex("index", nil) + i := index.NewIndex(k) + err := i.Create("index") assert.Nil(t, err) } -func ExampleKuzzle_CreateIndex() { +func ExampleIndex_Create() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.CreateIndex("index", nil) + i := index.NewIndex(k) + err := i.Create("index") if err != nil { fmt.Println(err.Error()) return } - - fmt.Printf("%#v\n", res) } diff --git a/index/delete.go b/index/delete.go index 3bcfc41e..9271a9e0 100644 --- a/index/delete.go +++ b/index/delete.go @@ -2,8 +2,8 @@ package index import "github.com/kuzzleio/sdk-go/types" -// Delete delete the index -func (Index) Delete(index string) error { +// Delete the given index +func (i *Index) Delete(index string) error { if index == "" { return types.NewError("Index.Delete: index required", 400) } @@ -15,7 +15,7 @@ func (Index) Delete(index string) error { Controller: "index", Action: "delete", } - go k.Query(query, nil, result) + go i.k.Query(query, nil, result) res := <-result diff --git a/index/delete_test.go b/index/delete_test.go index e69de29b..c502eccd 100644 --- a/index/delete_test.go +++ b/index/delete_test.go @@ -0,0 +1,70 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestDeleteNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + i := index.NewIndex(k) + err := i.Delete("") + assert.NotNil(t, err) +} + +func TestDeleteQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + err := i.Delete("index") + assert.NotNil(t, err) +} + +func TestDelete(t *testing.T) { + type ackResult struct { + Acknowledged bool + ShardsAcknowledged bool + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + q := &types.KuzzleRequest{} + json.Unmarshal(query, q) + + assert.Equal(t, "index", q.Controller) + assert.Equal(t, "delete", q.Action) + assert.Equal(t, "index", q.Index) + + return &types.KuzzleResponse{Result: []byte(`{"acknowledged":true}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + err := i.Delete("index") + + assert.Nil(t, err) +} + +func ExampleIndex_Delete() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + i := index.NewIndex(k) + i.Create("index") + err := i.Delete("index") + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/index/exists.go b/index/exists.go index e498277f..6b877b9a 100644 --- a/index/exists.go +++ b/index/exists.go @@ -8,7 +8,7 @@ import ( ) // Exists check if the index exists -func (Index) Exists(index string) (bool, error) { +func (i *Index) Exists(index string) (bool, error) { if index == "" { return false, types.NewError("Index.Exists: index required", 400) } @@ -21,7 +21,7 @@ func (Index) Exists(index string) (bool, error) { Action: "exists", } - go k.Query(query, nil, result) + go i.k.Query(query, nil, result) res := <-result diff --git a/index/exists_test.go b/index/exists_test.go index e69de29b..994883e9 100644 --- a/index/exists_test.go +++ b/index/exists_test.go @@ -0,0 +1,71 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestExistsNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + i := index.NewIndex(k) + _, err := i.Exists("") + assert.NotNil(t, err) +} + +func TestExistsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + _, err := i.Exists("index") + assert.NotNil(t, err) +} + +func TestExists(t *testing.T) { + type ackResult struct { + Acknowledged bool + ShardsAcknowledged bool + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + q := &types.KuzzleRequest{} + json.Unmarshal(query, q) + + assert.Equal(t, "index", q.Controller) + assert.Equal(t, "exists", q.Action) + assert.Equal(t, "index", q.Index) + + return &types.KuzzleResponse{Result: []byte(`true`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + _, err := i.Exists("index") + + assert.Nil(t, err) +} + +func ExampleIndex_Exists() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + i := index.NewIndex(k) + i.Create("index") + _, err := i.Exists("index") + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/index/index.go b/index/index.go new file mode 100644 index 00000000..562c2e48 --- /dev/null +++ b/index/index.go @@ -0,0 +1,13 @@ +package index + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +type Index struct { + k types.IKuzzle +} + +func NewIndex(k types.IKuzzle) *Index { + return &Index{k} +} diff --git a/index/mDelete.go b/index/mDelete.go index 466838bd..2abd7234 100644 --- a/index/mDelete.go +++ b/index/mDelete.go @@ -3,26 +3,24 @@ package index import "github.com/kuzzleio/sdk-go/types" // Delete delete the index -func (Index) MDelete(indexes []string) error { - if indexes.len() == 0 { +func (i *Index) MDelete(indexes []string) error { + if len(indexes) == 0 { return types.NewError("Index.MDelete: at least one index required", 400) } result := make(chan *types.KuzzleResponse) - for _, index := range indexes { - query := &types.KuzzleRequest{ - Index: index, - Controller: "index", - Action: "delete", - } - go k.Query(query, nil, result) + query := &types.KuzzleRequest{ + Controller: "index", + Action: "mDelete", + Body: indexes, + } + go i.k.Query(query, nil, result) - res := <-result + res := <-result - if res.Error != nil { - return res.Error - } + if res.Error != nil { + return res.Error } return nil diff --git a/index/mDelete_test.go b/index/mDelete_test.go index e69de29b..80bafa6f 100644 --- a/index/mDelete_test.go +++ b/index/mDelete_test.go @@ -0,0 +1,78 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMDeleteNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + i := index.NewIndex(k) + indexes := []string{} + err := i.MDelete(indexes) + assert.NotNil(t, err) +} + +func TestMDeleteQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + indexes := []string{"index"} + err := i.MDelete(indexes) + assert.NotNil(t, err) +} + +func TestMDelete(t *testing.T) { + type ackResult struct { + Acknowledged bool + ShardsAcknowledged bool + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + q := &types.KuzzleRequest{} + json.Unmarshal(query, q) + + assert.Equal(t, "index", q.Controller) + assert.Equal(t, "mDelete", q.Action) + + return &types.KuzzleResponse{Result: []byte(`"deleted":["index1"]`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + indexes := []string{"index"} + err := i.MDelete(indexes) + + assert.Nil(t, err) +} + +func ExampleIndex_MDelete() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + i := index.NewIndex(k) + i.Create("index1") + i.Create("index2") + indexes := []string{ + "index1", + "index2", + } + err := i.MDelete(indexes) + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/index/refresh.go b/index/refresh.go index 0e15337a..1516195c 100644 --- a/index/refresh.go +++ b/index/refresh.go @@ -4,7 +4,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (Index) Refresh(index string) error { +func (i *Index) Refresh(index string) error { if index == "" { return types.NewError("Index.Refresh: index required", 400) } @@ -16,12 +16,12 @@ func (Index) Refresh(index string) error { Action: "refresh", Index: index, } - go k.Query(query, nil, result) + go i.k.Query(query, nil, result) res := <-result if res.Error != nil { - return nil, res.Error + return res.Error } return nil diff --git a/index/refreshInternal.go b/index/refreshInternal.go index e69de29b..0cc4745a 100644 --- a/index/refreshInternal.go +++ b/index/refreshInternal.go @@ -0,0 +1,22 @@ +package index + +import "github.com/kuzzleio/sdk-go/types" + +func (i *Index) RefreshInternal() error { + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "index", + Action: "refreshInternal", + } + go i.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/index/refreshInternal_test.go b/index/refreshInternal_test.go index e69de29b..536cbe9f 100644 --- a/index/refreshInternal_test.go +++ b/index/refreshInternal_test.go @@ -0,0 +1,61 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestRefreshInternalQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + err := i.RefreshInternal() + assert.NotNil(t, err) +} + +func TestRefreshInternal(t *testing.T) { + type ackResult struct { + Acknowledged bool + ShardsAcknowledged bool + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + q := &types.KuzzleRequest{} + json.Unmarshal(query, q) + + assert.Equal(t, "index", q.Controller) + assert.Equal(t, "refreshInternal", q.Action) + + return &types.KuzzleResponse{Result: []byte(`"result":true`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + err := i.RefreshInternal() + + assert.Nil(t, err) +} + +func ExampleIndex_RefreshInternal() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + i := index.NewIndex(k) + err := i.RefreshInternal() + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/index/refresh_test.go b/index/refresh_test.go index e69de29b..826da00f 100644 --- a/index/refresh_test.go +++ b/index/refresh_test.go @@ -0,0 +1,70 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestRefreshNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + i := index.NewIndex(k) + err := i.Refresh("") + assert.NotNil(t, err) +} + +func TestRefreshQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + err := i.Refresh("index") + assert.NotNil(t, err) +} + +func TestRefresh(t *testing.T) { + type ackResult struct { + Acknowledged bool + ShardsAcknowledged bool + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + q := &types.KuzzleRequest{} + json.Unmarshal(query, q) + + assert.Equal(t, "index", q.Controller) + assert.Equal(t, "refresh", q.Action) + assert.Equal(t, "index", q.Index) + + return &types.KuzzleResponse{Result: []byte(`"_shards": {"failed": 0,"succressful": 5,"total": 10}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + err := i.Refresh("index") + + assert.Nil(t, err) +} + +func ExampleIndex_Refresh() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + i := index.NewIndex(k) + i.Create("index") + err := i.Refresh("index") + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/index/setAutoRefresh.go b/index/setAutoRefresh.go index 0b9cd38e..da4314a1 100644 --- a/index/setAutoRefresh.go +++ b/index/setAutoRefresh.go @@ -2,9 +2,9 @@ package index import "github.com/kuzzleio/sdk-go/types" -func (Index) SetAutoRefresh(index string, autoRefresh bool) error { +func (i *Index) SetAutoRefresh(index string, autoRefresh bool) error { if index == "" { - return false, types.NewError("Index.SetAutoRefresh: index required", 400) + return types.NewError("Index.SetAutoRefresh: index required", 400) } result := make(chan *types.KuzzleResponse) @@ -18,12 +18,12 @@ func (Index) SetAutoRefresh(index string, autoRefresh bool) error { }{autoRefresh}, } - go k.Query(query, nil, result) + go i.k.Query(query, nil, result) res := <-result if res.Error != nil { - return false, res.Error + return res.Error } return nil diff --git a/index/setAutoRefresh_test.go b/index/setAutoRefresh_test.go index e69de29b..1f832a94 100644 --- a/index/setAutoRefresh_test.go +++ b/index/setAutoRefresh_test.go @@ -0,0 +1,69 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestSetAutoRefreshNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + i := index.NewIndex(k) + err := i.SetAutoRefresh("", true) + assert.NotNil(t, err) +} + +func TestSetAutoRefreshQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + err := i.SetAutoRefresh("index", true) + assert.NotNil(t, err) +} + +func TestSetAutoRefresh(t *testing.T) { + type ackResult struct { + Acknowledged bool + ShardsAcknowledged bool + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + q := &types.KuzzleRequest{} + json.Unmarshal(query, q) + + assert.Equal(t, "index", q.Controller) + assert.Equal(t, "setAutoRefresh", q.Action) + assert.Equal(t, "index", q.Index) + + return &types.KuzzleResponse{Result: []byte(`true`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + err := i.SetAutoRefresh("index", true) + + assert.Nil(t, err) +} + +func ExampleIndex_SetAutoRefresh() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + i := index.NewIndex(k) + err := i.SetAutoRefresh("index", true) + if err != nil { + fmt.Println(err.Error()) + return + } +} From ef1a31de7629a06233dc65fab9e20ef41fbae1bf Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 1 Mar 2018 11:39:51 +0100 Subject: [PATCH 008/363] realtime.count --- collection/room_count.go | 40 --------------- internal/wrappers/cgo/kuzzle/realtime.go | 51 +++++++++++++++++++ internal/wrappers/cgo/kuzzle/room.go | 6 --- internal/wrappers/cpp/realtime.cpp | 22 ++++++++ internal/wrappers/cpp/room.cpp | 9 ---- internal/wrappers/headers/kuzzlesdk.h | 5 ++ internal/wrappers/headers/realtime.hpp | 19 +++++++ internal/wrappers/headers/room.hpp | 1 - internal/wrappers/templates/java/core.i | 4 +- kuzzle/kuzzle.go | 3 ++ realtime/count.go | 38 ++++++++++++++ .../count_test.go | 25 +++++---- realtime/realtime.go | 11 ++++ test.sh | 4 +- 14 files changed, 166 insertions(+), 72 deletions(-) delete mode 100644 collection/room_count.go create mode 100644 internal/wrappers/cgo/kuzzle/realtime.go create mode 100644 internal/wrappers/cpp/realtime.cpp create mode 100644 internal/wrappers/headers/realtime.hpp create mode 100644 realtime/count.go rename collection/room_count_test.go => realtime/count_test.go (68%) create mode 100644 realtime/realtime.go diff --git a/collection/room_count.go b/collection/room_count.go deleted file mode 100644 index 4bf69c11..00000000 --- a/collection/room_count.go +++ /dev/null @@ -1,40 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/types" -) - -// Count returns the number of other subscriptions on that room. -func (room *Room) Count() (int, error) { - if room.internalState != active { - return -1, types.NewError("Cannot count subscriptions on a non-active room", 400) - } - - query := &types.KuzzleRequest{ - Controller: "realtime", - Action: "count", - Body: struct { - RoomId string `json:"roomId"` - }{room.roomId}, - } - - result := make(chan *types.KuzzleResponse) - - go room.collection.Kuzzle.Query(query, nil, result) - - res := <-result - - if res.Error != nil { - return -1, res.Error - } - - count := struct { - Count int `json:"count"` - }{} - - json.Unmarshal(res.Result, &count) - - return count.Count, nil -} diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go new file mode 100644 index 00000000..3951f995 --- /dev/null +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -0,0 +1,51 @@ +package main + +/* + #cgo CFLAGS: -I../../headers + #include "kuzzlesdk.h" + #include "sdk_wrappers_internal.h" +*/ +import "C" + +import ( + "unsafe" + + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/realtime" +) + +// map which stores instances to keep references in case the gc passes +var realtimeInstances map[interface{}]bool + +// register new instance to the instances map +func registerRealtime(instance interface{}) { + realtimeInstances[instance] = true +} + +// unregister an instance from the instances map +//export unregisterRealtime +func unregisterRealtime(rt *C.realtime) { + delete(realtimeInstances, (*realtime.Realtime)(rt.instance)) +} + +// Allocates memory +//export kuzzle_new_realtime +func kuzzle_new_realtime(rt *C.realtime, k *C.kuzzle) { + kuz := (*kuzzle.Kuzzle)(k.instance) + gort := realtime.NewRealtime(kuz) + + if realtimeInstances == nil { + realtimeInstances = make(map[interface{}]bool) + } + + rt.instance = unsafe.Pointer(gort) + rt.kuzzle = k + + registerRealtime(rt) +} + +//export kuzzle_realtime_count +func kuzzle_realtime_count(rt *C.realtime, index, collection, roomId *C.char) *C.int_result { + res, err := (*realtime.Realtime)(rt.instance).Count(C.GoString(index), C.GoString(collection), C.GoString(roomId)) + return goToCIntResult(res, err) +} diff --git a/internal/wrappers/cgo/kuzzle/room.go b/internal/wrappers/cgo/kuzzle/room.go index 23910d24..1bd2de39 100644 --- a/internal/wrappers/cgo/kuzzle/room.go +++ b/internal/wrappers/cgo/kuzzle/room.go @@ -44,12 +44,6 @@ func room_new_room(room *C.room, col *C.collection, filters *C.json_object, opti room.options = options } -//export room_count -func room_count(room *C.room) *C.int_result { - res, err := (*collection.Room)(room.instance).Count() - return goToCIntResult(res, err) -} - //export room_on_done func room_on_done(room *C.room, cb C.kuzzle_subscribe_listener, data unsafe.Pointer) { c := make(chan types.SubscribeResponse) diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp new file mode 100644 index 00000000..66564f80 --- /dev/null +++ b/internal/wrappers/cpp/realtime.cpp @@ -0,0 +1,22 @@ +#include "realtime.hpp" + +namespace kuzzleio { + Realtime::Realtime(Kuzzle *kuzzle) { + _realtime = new realtime(); + kuzzle_new_realtime(_realtime, kuzzle->_kuzzle); + } + + Realtime::~Realtime() { + unregisterRealtime(_realtime); + delete(_realtime); + } + + int Realtime::count(const std::string& index, const std::string collection, const std::string roomId) Kuz_Throw_KuzzleException { + int_result *r = kuzzle_realtime_count(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + int ret = r->result; + delete(r); + return ret; + } +} \ No newline at end of file diff --git a/internal/wrappers/cpp/room.cpp b/internal/wrappers/cpp/room.cpp index b975ab63..fa271570 100644 --- a/internal/wrappers/cpp/room.cpp +++ b/internal/wrappers/cpp/room.cpp @@ -18,15 +18,6 @@ namespace kuzzleio { delete(this->_room); } - int Room::count() Kuz_Throw_KuzzleException { - int_result *r = room_count(_room); - if (r->error != NULL) - throwExceptionFromStatus(r); - int ret = r->result; - delete(r); - return ret; - } - void call_cb(room_result* res, void* data) { ((Room*)data)->getSubscribeListener()->onSubscribe(res); } diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 08631d34..bd35e28f 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -93,6 +93,11 @@ typedef struct { kuzzle_offline_queue_loader loader; } kuzzle; +typedef struct { + void *instance; + kuzzle* kuzzle; +} realtime; + //options passed to room constructor typedef struct { char *scope; diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp new file mode 100644 index 00000000..3d40750a --- /dev/null +++ b/internal/wrappers/headers/realtime.hpp @@ -0,0 +1,19 @@ +#ifndef _KUZZLE_REALTIME_HPP +#define _KUZZLE_REALTIME_HPP + +#include "exceptions.hpp" +#include "core.hpp" + +namespace kuzzleio { + class Realtime { + realtime *_realtime; + Realtime(); + + public: + Realtime(Kuzzle* kuzzle); + virtual ~Realtime(); + int count(const std::string& index, const std::string collection, const std::string roomId) Kuz_Throw_KuzzleException; + }; +} + +#endif \ No newline at end of file diff --git a/internal/wrappers/headers/room.hpp b/internal/wrappers/headers/room.hpp index 1640e54c..7386b135 100644 --- a/internal/wrappers/headers/room.hpp +++ b/internal/wrappers/headers/room.hpp @@ -20,7 +20,6 @@ namespace kuzzleio { Room(Collection *collection, json_object *filters=NULL, room_options* options=NULL); Room(room* r, SubscribeListener* subscribe_listener, NotificationListener* notification_listener); virtual ~Room(); - int count() Kuz_Throw_KuzzleException; SubscribeListener *getSubscribeListener(); NotificationListener *getNotificationListener(); Room* onDone(SubscribeListener* listener); diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 115d108e..2c36ce04 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -36,6 +36,7 @@ #include "collection.cpp" #include "room.cpp" #include "document.cpp" +#include "realtime.cpp" %} %include "exceptions.i" @@ -140,4 +141,5 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" %include "room.cpp" -%include "document.cpp" \ No newline at end of file +%include "document.cpp" +%include "realtime.hpp" \ No newline at end of file diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index ae7650b2..b60f2ec9 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -8,6 +8,7 @@ import ( "github.com/kuzzleio/sdk-go/connection" "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/ms" + "github.com/kuzzleio/sdk-go/realtime" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" ) @@ -33,6 +34,7 @@ type Kuzzle struct { MemoryStorage *ms.Ms Security *security.Security + Realtime *realtime.Realtime } // NewKuzzle is the Kuzzle constructor @@ -52,6 +54,7 @@ func NewKuzzle(c connection.Connection, options types.Options) (*Kuzzle, error) k.MemoryStorage = &ms.Ms{k} k.Security = &security.Security{k} + k.Realtime = realtime.NewRealtime(k) k.RequestHistory = k.socket.RequestHistory() diff --git a/realtime/count.go b/realtime/count.go new file mode 100644 index 00000000..c03b2d3e --- /dev/null +++ b/realtime/count.go @@ -0,0 +1,38 @@ +package realtime + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +//Count returns the number of other subscriptions on that room. +func (r *Realtime) Count(index, collection, roomId string) (int, error) { + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "count", + Index: index, + Collection: collection, + Body: struct { + RoomId string `json:"roomId"` + }{roomId}, + } + + result := make(chan *types.KuzzleResponse) + + go r.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return -1, res.Error + } + + type countRes struct { + Count int `json:"count"` + } + c := &countRes{} + json.Unmarshal(res.Result, c) + + return c.Count, nil +} diff --git a/collection/room_count_test.go b/realtime/count_test.go similarity index 68% rename from collection/room_count_test.go rename to realtime/count_test.go index a43c41d2..46000ed4 100644 --- a/collection/room_count_test.go +++ b/realtime/count_test.go @@ -1,29 +1,32 @@ -package collection +package realtime_test import ( "encoding/json" "fmt" "testing" + "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) -func TestRoomCountError(t *testing.T) { +func TestCountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) + realTime := realtime.NewRealtime(k) - _, err := NewRoom(NewCollection(k, "collection", "index"), nil, nil).Count() + _, err := realTime.Count("index", "collection", "42") assert.NotNil(t, err) } -func TestRoomCount(t *testing.T) { +func TestCount(t *testing.T) { type result struct { Count int `json:"count"` } @@ -36,22 +39,18 @@ func TestRoomCount(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) + realTime := realtime.NewRealtime(k) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.internalState = active - res, _ := r.Count() + res, _ := realTime.Count("index", "collection", "42") assert.Equal(t, 10, res) } -func ExampleRoom_Count() { - type result struct { - Count int `json:"count"` - } - +func Example_Count() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) + realTime := realtime.NewRealtime(k) - res, err := NewRoom(NewCollection(k, "collection", "index"), nil, nil).Count() + res, err := realTime.Count("index", "collection", "42") if err != nil { fmt.Println(err.Error()) diff --git a/realtime/realtime.go b/realtime/realtime.go new file mode 100644 index 00000000..ec6362a8 --- /dev/null +++ b/realtime/realtime.go @@ -0,0 +1,11 @@ +package realtime + +import "github.com/kuzzleio/sdk-go/types" + +type Realtime struct { + k types.IKuzzle +} + +func NewRealtime(k types.IKuzzle) *Realtime { + return &Realtime{k} +} diff --git a/test.sh b/test.sh index e351d94a..df52e84a 100755 --- a/test.sh +++ b/test.sh @@ -5,7 +5,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" workdir=$dir/.cover profile="$workdir/cover.out" mode=count -dirs=(kuzzle connection/websocket collection security ms) +dirs=(kuzzle connection/websocket collection security ms realtime) timeout=${TIMEOUT:=1m} generate_cover_data() { @@ -53,4 +53,4 @@ case "$1" in show_cover_report html ;; *) echo >&2 "error: invalid option: $1"; exit 1 ;; -esac \ No newline at end of file +esac From d9843da7f110e8418491a11ee2e6b39e959303d3 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 1 Mar 2018 12:56:02 +0100 Subject: [PATCH 009/363] fixes --- internal/wrappers/cgo/kuzzle/server.go | 16 +++++-- internal/wrappers/cpp/server.cpp | 38 +++++++++++----- internal/wrappers/headers/server.hpp | 4 +- server/getLastStats.go | 17 +------ server/getLastStats_test.go | 8 ++-- server/getStats.go | 42 +++++++++++++++++ server/getStats_test.go | 62 ++++++++++++++++++++++++++ 7 files changed, 152 insertions(+), 35 deletions(-) create mode 100644 server/getStats.go create mode 100644 server/getStats_test.go diff --git a/internal/wrappers/cgo/kuzzle/server.go b/internal/wrappers/cgo/kuzzle/server.go index ffbe01a7..5cfc5f16 100644 --- a/internal/wrappers/cgo/kuzzle/server.go +++ b/internal/wrappers/cgo/kuzzle/server.go @@ -65,8 +65,8 @@ func kuzzle_get_all_stats(s *C.server, options *C.query_options) *C.string_resul return goToCStringResult(&str, err) } -//export kuzzle_get_last_stats -func kuzzle_get_last_stats(s *C.server, start_time C.time_t, stop_time C.time_t, options *C.query_options) *C.string_result { +//export kuzzle_get_stats +func kuzzle_get_stats(s *C.server, start_time C.time_t, stop_time C.time_t, options *C.query_options) *C.string_result { opts := SetQueryOptions(options) t, _ := strconv.ParseInt(C.GoString(C.ctime(&start_time)), 10, 64) @@ -74,7 +74,17 @@ func kuzzle_get_last_stats(s *C.server, start_time C.time_t, stop_time C.time_t, t, _ = strconv.ParseInt(C.GoString(C.ctime(&stop_time)), 10, 64) stop := time.Unix(t, 0) - res, err := (*server.Server)(s.instance).GetLastStats(&start, &stop, opts) + res, err := (*server.Server)(s.instance).GetStats(&start, &stop, opts) + + str := string(res) + return goToCStringResult(&str, err) +} + +//export kuzzle_get_last_stats +func kuzzle_get_last_stats(s *C.server, options *C.query_options) *C.string_result { + opts := SetQueryOptions(options) + + res, err := (*server.Server)(s.instance).GetLastStats(opts) str := string(res) return goToCStringResult(&str, err) diff --git a/internal/wrappers/cpp/server.cpp b/internal/wrappers/cpp/server.cpp index 15a6dfe4..c6b1f167 100644 --- a/internal/wrappers/cpp/server.cpp +++ b/internal/wrappers/cpp/server.cpp @@ -1,15 +1,24 @@ #include "server.hpp" namespace kuzzleio { - Server::Server(Kuzzle* kuzzle) { - _server = new server(); - kuzzle_new_server(_server, kuzzle->_kuzzle); - } + Server::Server(Kuzzle* kuzzle) { + _server = new server(); + kuzzle_new_server(_server, kuzzle->_kuzzle); + } + + Server::~Server() { + unregisterServer(_server); + delete(_server); + } - Server::~Server() { - unregisterServer(_server); - delete(_server); - } + bool Server::adminExists(query_options *options) Kuz_Throw_KuzzleException { + bool_result* r = kuzzle_admin_exists(_server, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + bool ret = r->result; + delete(r); + return ret; + } std::string Server::getAllStats(query_options* options) Kuz_Throw_KuzzleException { string_result* r = kuzzle_get_all_stats(_server, options); @@ -20,8 +29,17 @@ namespace kuzzleio { return ret; } - std::string Server::getLastStats(time_t start, time_t end, query_options* options) Kuz_Throw_KuzzleException { - string_result* r = kuzzle_get_last_stats(_server, start, end, options); + std::string Server::getStats(time_t start, time_t end, query_options* options) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_get_stats(_server, start, end, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + delete(r); + return ret; + } + + std::string Server::getLastStats(query_options* options) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_get_last_stats(_server, options); if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; diff --git a/internal/wrappers/headers/server.hpp b/internal/wrappers/headers/server.hpp index 62715512..f40b14b5 100644 --- a/internal/wrappers/headers/server.hpp +++ b/internal/wrappers/headers/server.hpp @@ -12,8 +12,10 @@ namespace kuzzleio { public: Server(Kuzzle* kuzzle); virtual ~Server(); + bool adminExists(query_options *options) Kuz_Throw_KuzzleException; std::string getAllStats(query_options* options=NULL) Kuz_Throw_KuzzleException; - std::string getLastStats(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string getStats(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string getLastStats(query_options* options=NULL) Kuz_Throw_KuzzleException; std::string getConfig(query_options* options=NULL) Kuz_Throw_KuzzleException; std::string info(query_options* options=NULL) Kuz_Throw_KuzzleException; long long now(query_options* options=NULL) Kuz_Throw_KuzzleException; diff --git a/server/getLastStats.go b/server/getLastStats.go index 7789d574..c07d3088 100644 --- a/server/getLastStats.go +++ b/server/getLastStats.go @@ -2,32 +2,17 @@ package server import ( "encoding/json" - "time" "github.com/kuzzleio/sdk-go/types" ) //GetLastStats get Kuzzle usage statistics -func (s *Server) GetLastStats(startTime *time.Time, stopTime *time.Time, options types.QueryOptions) (json.RawMessage, error) { +func (s *Server) GetLastStats(options types.QueryOptions) (json.RawMessage, error) { result := make(chan *types.KuzzleResponse) - type data struct { - StartTime string `json:"startTime"` - StopTime string `json:"stopTime"` - } - - var d data - if startTime != nil { - d = data{ - startTime.String(), - stopTime.String(), - } - } - query := &types.KuzzleRequest{ Controller: "server", Action: "getLastStats", - Body: d, } go s.k.Query(query, options, result) diff --git a/server/getLastStats_test.go b/server/getLastStats_test.go index c0e8d5cd..0a7c63dd 100644 --- a/server/getLastStats_test.go +++ b/server/getLastStats_test.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "testing" - "time" "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" @@ -24,7 +23,7 @@ func TestGetLastStatsQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Server.GetLastStats(nil, nil, nil) + _, err := k.Server.GetLastStats(nil) assert.NotNil(t, err) } @@ -41,7 +40,7 @@ func TestGetLastStats(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Server.GetLastStats(nil, nil, nil) + res, _ := k.Server.GetLastStats(nil) assert.Equal(t, json.RawMessage(`{"foo": "bar"}`), res) } @@ -50,8 +49,7 @@ func ExampleKuzzle_GetLastStats() { conn := websocket.NewWebSocket("localhost", nil) k, _ := kuzzle.NewKuzzle(conn, nil) - now := time.Now() - res, err := k.Server.GetLastStats(&now, nil, nil) + res, err := k.Server.GetLastStats(nil) if err != nil { fmt.Println(err.Error()) diff --git a/server/getStats.go b/server/getStats.go new file mode 100644 index 00000000..a7b85c94 --- /dev/null +++ b/server/getStats.go @@ -0,0 +1,42 @@ +package server + +import ( + "encoding/json" + "time" + + "github.com/kuzzleio/sdk-go/types" +) + +//GetStats get Kuzzle usage statistics +func (s *Server) GetStats(startTime *time.Time, stopTime *time.Time, options types.QueryOptions) (json.RawMessage, error) { + result := make(chan *types.KuzzleResponse) + + type data struct { + StartTime string `json:"startTime"` + StopTime string `json:"stopTime"` + } + + var d data + if startTime != nil { + d = data{ + startTime.String(), + stopTime.String(), + } + } + + query := &types.KuzzleRequest{ + Controller: "server", + Action: "getLastStats", + Body: d, + } + + go s.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/server/getStats_test.go b/server/getStats_test.go new file mode 100644 index 00000000..2b78897c --- /dev/null +++ b/server/getStats_test.go @@ -0,0 +1,62 @@ +package server_test + +import ( + "encoding/json" + "fmt" + "testing" + "time" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetStatsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "getLastStats", request.Action) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Server.GetStats(nil, nil, nil) + assert.NotNil(t, err) +} + +func TestGetStats(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "server", request.Controller) + assert.Equal(t, "getLastStats", request.Action) + + return &types.KuzzleResponse{Result: json.RawMessage(`{"foo": "bar"}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := k.Server.GetStats(nil, nil, nil) + + assert.Equal(t, json.RawMessage(`{"foo": "bar"}`), res) +} + +func ExampleKuzzle_GetStats() { + conn := websocket.NewWebSocket("localhost", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + now := time.Now() + res, err := k.Server.GetStats(&now, nil, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} From 2a3b75ac676df3173f7bdb1c497e59c0a6284499 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 1 Mar 2018 14:18:37 +0100 Subject: [PATCH 010/363] fix adminExists --- server/adminExists.go | 9 ++++++--- server/adminExists_test.go | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/server/adminExists.go b/server/adminExists.go index e0fb8911..100a6f79 100644 --- a/server/adminExists.go +++ b/server/adminExists.go @@ -23,8 +23,11 @@ func (s *Server) AdminExists(options types.QueryOptions) (bool, error) { return false, res.Error } - var r bool - json.Unmarshal(res.Result, &r) + type exists struct { + Exists bool `json:"exists"` + } - return r, nil + r := exists{} + json.Unmarshal(res.Result, &r) + return r.Exists, nil } diff --git a/server/adminExists_test.go b/server/adminExists_test.go index f45d625b..8a1a6c2d 100644 --- a/server/adminExists_test.go +++ b/server/adminExists_test.go @@ -36,7 +36,10 @@ func TestAdminExists(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "adminExists", request.Action) - ret, _ := json.Marshal(true) + type response struct { + Exists bool + } + ret, _ := json.Marshal(response{true}) return &types.KuzzleResponse{Result: ret} }, } From ece7814cb74ec7698d49f5b26ac0ab1f761d7de3 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Thu, 1 Mar 2018 15:55:13 +0100 Subject: [PATCH 011/363] All tests passing but compilation errors --- index/mDelete.go | 22 +++++-- index/mDelete_test.go | 10 +-- internal/wrappers/cgo/kuzzle/index.go | 88 +++++++++++++++++++++++++ internal/wrappers/cpp/index.cpp | 65 ++++++++++++++++++ internal/wrappers/cpp/kuzzle.cpp | 20 +----- internal/wrappers/headers/document.hpp | 4 +- internal/wrappers/headers/index.hpp | 25 +++++++ internal/wrappers/headers/kuzzle.hpp | 4 +- internal/wrappers/headers/kuzzlesdk.h | 6 ++ internal/wrappers/kcore.i | 4 +- internal/wrappers/templates/java/core.i | 4 +- 11 files changed, 216 insertions(+), 36 deletions(-) create mode 100644 internal/wrappers/cgo/kuzzle/index.go create mode 100644 internal/wrappers/cpp/index.cpp create mode 100644 internal/wrappers/headers/index.hpp diff --git a/index/mDelete.go b/index/mDelete.go index 2abd7234..f50f06f5 100644 --- a/index/mDelete.go +++ b/index/mDelete.go @@ -1,11 +1,16 @@ package index -import "github.com/kuzzleio/sdk-go/types" +import ( + "encoding/json" + "fmt" + + "github.com/kuzzleio/sdk-go/types" +) // Delete delete the index -func (i *Index) MDelete(indexes []string) error { +func (i *Index) MDelete(indexes []string) ([]string, error) { if len(indexes) == 0 { - return types.NewError("Index.MDelete: at least one index required", 400) + return nil, types.NewError("Index.MDelete: at least one index required", 400) } result := make(chan *types.KuzzleResponse) @@ -20,8 +25,15 @@ func (i *Index) MDelete(indexes []string) error { res := <-result if res.Error != nil { - return res.Error + return nil, res.Error + } + + var deletedIndexes []string + + err := json.Unmarshal(res.Result, &deletedIndexes) + if err != nil { + return nil, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) } - return nil + return deletedIndexes, nil } diff --git a/index/mDelete_test.go b/index/mDelete_test.go index 80bafa6f..7787fc92 100644 --- a/index/mDelete_test.go +++ b/index/mDelete_test.go @@ -17,7 +17,7 @@ func TestMDeleteNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) i := index.NewIndex(k) indexes := []string{} - err := i.MDelete(indexes) + _, err := i.MDelete(indexes) assert.NotNil(t, err) } @@ -30,7 +30,7 @@ func TestMDeleteQueryError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) indexes := []string{"index"} - err := i.MDelete(indexes) + _, err := i.MDelete(indexes) assert.NotNil(t, err) } @@ -48,14 +48,14 @@ func TestMDelete(t *testing.T) { assert.Equal(t, "index", q.Controller) assert.Equal(t, "mDelete", q.Action) - return &types.KuzzleResponse{Result: []byte(`"deleted":["index1"]`)} + return &types.KuzzleResponse{Result: []byte(`["index1"]`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) indexes := []string{"index"} - err := i.MDelete(indexes) + _, err := i.MDelete(indexes) assert.Nil(t, err) } @@ -70,7 +70,7 @@ func ExampleIndex_MDelete() { "index1", "index2", } - err := i.MDelete(indexes) + _, err := i.MDelete(indexes) if err != nil { fmt.Println(err.Error()) return diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go new file mode 100644 index 00000000..91cbc3df --- /dev/null +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -0,0 +1,88 @@ +package main + +/* + #cgo CFLAGS: -I../../headers + #include + #include + #include "kuzzlesdk.h" + #include "sdk_wrappers_internal.h" +*/ +import "C" +import ( + "unsafe" + + indexPkg "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/kuzzle" +) + +// map which stores instances to keep references in case the gc passes +var indexInstances map[interface{}]bool + +//register new instance of index +func registerIndex(instance interface{}) { + indexInstances[instance] = true +} + +// unregister an instance from the instances map +//export unregisterIndex +func unregisterIndex(i *C.index) { + delete(indexInstances, (*indexPkg.Index)(i.instance)) +} + +// Allocates memory +//export kuzzle_new_index +func kuzzle_new_index(i *C.index, k *C.kuzzle) { + kuz := (*kuzzle.Kuzzle)(k.instance) + index := indexPkg.NewIndex(kuz) + + if indexInstances == nil { + indexInstances = make(map[interface{}]bool) + } + + i.instance = unsafe.Pointer(index) + i.kuzzle = k + + registerIndex(i) +} + +//export kuzzle_index_create +func kuzzle_index_create(i *C.index, index string) *C.void_result { + err := (*indexPkg.Index)(i.instance).Create(index) + return goToCVoidResult(err) +} + +//export kuzzle_index_delete +func kuzzle_index_delete(i *C.index, index string) *C.void_result { + err := (*indexPkg.Index)(i.instance).Delete(index) + return goToCVoidResult(err) +} + +//export kuzzle_index_mdelete +func kuzzle_index_mdelete(i *C.index, indexes []string) *C.string_array_result { + res, err := (*indexPkg.Index)(i.instance).MDelete(indexes) + return goToCStringArrayResult(res, err) +} + +//export kuzzle_index_exists +func kuzzle_index_exists(i *C.index, index string) *C.bool_result { + res, err := (*indexPkg.Index)(i.instance).Exists(index) + return goToCBoolResult(res, err) +} + +//export kuzzle_index_refresh +func kuzzle_index_refresh(i *C.index, index string) *C.void_result { + err := (*indexPkg.Index)(i.instance).Refresh(index) + return goToCVoidResult(err) +} + +//export kuzzle_index_refresh_internal +func kuzzle_index_refresh_internal(i *C.index, index string) *C.void_result { + err := (*indexPkg.Index)(i.instance).RefreshInternal() + return goToCVoidResult(err) +} + +//export kuzzle_index_set_auto_refresh +func kuzzle_index_set_auto_refresh(i *C.index, index string, autoRefresh bool) *C.void_result { + err := (*indexPkg.Index)(i.instance).SetAutoRefresh(index, autoRefresh) + return goToCVoidResult(err) +} diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp new file mode 100644 index 00000000..023ef081 --- /dev/null +++ b/internal/wrappers/cpp/index.cpp @@ -0,0 +1,65 @@ +#include "index.hpp" + +namespace kuzzleio { + + Index::Index(Kuzzle* kuzzle) Kuz_Throw_KuzzleException { + _index = new index(); + kuzzle_new_index(_index, kuzzle->_kuzzle); + } + + Index::~Index() { + unregisterIndex(_index); + delete(_index); + } + + void Index::create(const std::string& index) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_create(_index, const_cast(index.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + delete(r); + } + + void Index::delete_(const std::string& index) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_delete(_index, const_cast(index.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + delete(r); + } + + string* Index::mDelete(string* indexes) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_mdelete(_index, const_cast(index.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + delete(r); + } + + bool Index::exists(const std::string& index) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_index_exists(_index, const_cast(index.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + bool ret = r->result; + delete(r); + return ret; + } + + void Index::refresh(const std::string& index) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + delete(r); + } + + void Index::refreshInternal() Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_refresh_internal(_index); + if (r->error != NULL) + throwExceptionFromStatus(r); + delete(r); + } + + void Index::setAutoRefresh(const std::string& index, bool autoRefresh) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh); + if (r->error != NULL) + throwExceptionFromStatus(r); + delete(r); + } +} diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 53da4700..3d7dc126 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -32,15 +32,6 @@ namespace kuzzleio { return kuzzle_connect(_kuzzle); } - bool Kuzzle::createIndex(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_create_index(_kuzzle, const_cast(index.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - json_object* Kuzzle::createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { json_result* r = kuzzle_create_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); if (r->error) @@ -189,15 +180,6 @@ namespace kuzzleio { return r; } - shards* Kuzzle::refreshIndex(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { - shards_result *r = kuzzle_refresh_index(_kuzzle, const_cast(index.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - shards* ret = r->result; - delete(r); - return ret; - } - // java wrapper for this method is in typemap.i long long Kuzzle::now(query_options* options) Kuz_Throw_KuzzleException { date_result *r = kuzzle_now(_kuzzle, options); @@ -310,5 +292,5 @@ namespace kuzzleio { int Kuzzle::listenerCount(Event event) { return kuzzle_listener_count(_kuzzle, event); } - + } diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp index 5e4e121c..f6151528 100644 --- a/internal/wrappers/headers/document.hpp +++ b/internal/wrappers/headers/document.hpp @@ -9,7 +9,7 @@ #include #include -namespace kuzzleio { +namespace kuzzleio { class Collection; class Document { @@ -33,4 +33,4 @@ namespace kuzzleio { }; } -#endif \ No newline at end of file +#endif diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp new file mode 100644 index 00000000..b369a182 --- /dev/null +++ b/internal/wrappers/headers/index.hpp @@ -0,0 +1,25 @@ +#ifndef _KUZZLE_INDEX_HPP +#define _KUZZLE_INDEX_HPP + +#include "exceptions.hpp" +#include "core.hpp" + +namespace kuzzleio { + class Index { + index *_index; + Index(); + + public: + Index(Kuzzle* kuzzle); + virtual ~Index(); + void create(const std::string& index) Kuz_Throw_KuzzleException; + void delete_(const std::string& index) Kuz_Throw_KuzzleException; + string* mDelete(const std::string* indexes) Kuz_Throw_KuzzleException; + bool exists(const std::string& index) Kuz_Throw_KuzzleException; + void refresh(const std::string& index) Kuz_Throw_KuzzleException; + void refreshInternal() Kuz_Throw_KuzzleException; + void setAutoRefresh(const std::string& index, bool autoRefresh) Kuz_Throw_KuzzleException; + }; +} + +#endif diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index cb3b09c5..ccf49c13 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -24,7 +24,6 @@ namespace kuzzleio { token_validity* checkToken(const std::string& token); char* connect(); - bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; bool deleteMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; @@ -44,7 +43,6 @@ namespace kuzzleio { void disconnect(); void logout(); kuzzle_response* query(kuzzle_request* query, query_options* options=NULL) Kuz_Throw_KuzzleException; - shards* refreshIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; long long now(query_options* options=NULL) Kuz_Throw_KuzzleException; Kuzzle* replayQueue(); Kuzzle* setAutoReplay(bool autoReplay); @@ -69,4 +67,4 @@ namespace kuzzleio { }; } -#endif \ No newline at end of file +#endif diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 08631d34..8336a139 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -93,6 +93,12 @@ typedef struct { kuzzle_offline_queue_loader loader; } kuzzle; +typedef struct { + void *instance; + kuzzle* kuzzle; +} index; + + //options passed to room constructor typedef struct { char *scope; diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index c1c717c7..010ff22e 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -2,13 +2,14 @@ %module(directors="1") kcore %{ -#include "listeners.hpp" +#include "listeners.hpp" #include "exceptions.hpp" #include "event_emitter.hpp" #include "kuzzle.hpp" #include "collection.hpp" #include "room.hpp" #include "document.hpp" +#include "index.hpp" #include #include %} @@ -25,3 +26,4 @@ %include "collection.hpp" %include "room.hpp" %include "document.hpp" +%include "index.hpp" diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 115d108e..fa3026b0 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -36,6 +36,7 @@ #include "collection.cpp" #include "room.cpp" #include "document.cpp" +#include "index.cpp" %} %include "exceptions.i" @@ -140,4 +141,5 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" %include "room.cpp" -%include "document.cpp" \ No newline at end of file +%include "document.cpp" +%include "index.cpp" From 3447e85e5a65ebcef1d5d507bcc530932a362960 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 1 Mar 2018 15:56:55 +0100 Subject: [PATCH 012/363] wip --- auth/auth.go | 11 +++++++ auth/checkToken.go | 44 +++++++++++++++++++++++++ auth/checkToken_test.go | 71 +++++++++++++++++++++++++++++++++++++++++ kuzzle/kuzzle.go | 3 ++ 4 files changed, 129 insertions(+) create mode 100644 auth/auth.go create mode 100644 auth/checkToken.go create mode 100644 auth/checkToken_test.go diff --git a/auth/auth.go b/auth/auth.go new file mode 100644 index 00000000..9957134d --- /dev/null +++ b/auth/auth.go @@ -0,0 +1,11 @@ +package auth + +import "github.com/kuzzleio/sdk-go/types" + +type Auth struct { + k types.IKuzzle +} + +func NewAuth(k types.IKuzzle) *Auth { + return &Auth{k} +} diff --git a/auth/checkToken.go b/auth/checkToken.go new file mode 100644 index 00000000..813d8959 --- /dev/null +++ b/auth/checkToken.go @@ -0,0 +1,44 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +type TokenValidity struct { + Valid bool `json:"valid"` + State string `json:"state"` + ExpiresAt int `json:"expiresAt"` +} + +// CheckToken checks the validity of a JSON Web Token. +func (a *Auth) CheckToken(token string) (*TokenValidity, error) { + if token == "" { + return nil, types.NewError("Kuzzle.CheckToken: token required", 400) + } + + result := make(chan *types.KuzzleResponse) + + type body struct { + Token string `json:"token"` + } + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "checkToken", + Body: &body{token}, + } + go a.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + tokenValidity := &TokenValidity{} + json.Unmarshal(res.Result, tokenValidity) + + return tokenValidity, nil +} diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go new file mode 100644 index 00000000..4eb6d6f2 --- /dev/null +++ b/auth/checkToken_test.go @@ -0,0 +1,71 @@ +package kuzzle_test + +import ( + "encoding/json" + "fmt" + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestCheckTokenTokenNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.CheckToken("") + assert.NotNil(t, err) +} + +func TestCheckTokenQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("error", 123)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.CheckToken("token") + assert.NotNil(t, err) + assert.Equal(t, 123, err.(*types.KuzzleError).Status) +} + +func TestCheckToken(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + tokenValidity := kuzzle.TokenValidity{Valid: true} + r, _ := json.Marshal(tokenValidity) + + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := k.CheckToken("token") + assert.Equal(t, true, res.Valid) +} + +func ExampleKuzzle_CheckToken() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + type credentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + myCredentials := credentials{"foo", "bar"} + + jwt, err := k.Login("local", myCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + res, err := k.CheckToken(jwt) + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res.Valid, res.ExpiresAt, res.State) +} diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index ae7650b2..4d7891c1 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -5,6 +5,7 @@ import ( "sync" "time" + "github.com/kuzzleio/sdk-go/auth" "github.com/kuzzleio/sdk-go/connection" "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/ms" @@ -33,6 +34,7 @@ type Kuzzle struct { MemoryStorage *ms.Ms Security *security.Security + Auth *auth.Auth } // NewKuzzle is the Kuzzle constructor @@ -52,6 +54,7 @@ func NewKuzzle(c connection.Connection, options types.Options) (*Kuzzle, error) k.MemoryStorage = &ms.Ms{k} k.Security = &security.Security{k} + k.Auth = auth.NewAuth(k) k.RequestHistory = k.socket.RequestHistory() From 11339e86292d5a1e2f2ebc21f8f1a934684e3ac7 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 2 Mar 2018 01:05:09 +0100 Subject: [PATCH 013/363] C++ compilation Ok some bug with Java --- internal/wrappers/cgo/kuzzle/index.go | 30 +++++++++++++-------------- internal/wrappers/cpp/index.cpp | 26 ++++++++++++++++++----- internal/wrappers/cpp/kuzzle.cpp | 1 - internal/wrappers/headers/index.hpp | 4 ++-- internal/wrappers/headers/kuzzlesdk.h | 2 +- 5 files changed, 39 insertions(+), 24 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index 91cbc3df..7a2647ef 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -25,13 +25,13 @@ func registerIndex(instance interface{}) { // unregister an instance from the instances map //export unregisterIndex -func unregisterIndex(i *C.index) { +func unregisterIndex(i *C.kuzzle_index) { delete(indexInstances, (*indexPkg.Index)(i.instance)) } // Allocates memory //export kuzzle_new_index -func kuzzle_new_index(i *C.index, k *C.kuzzle) { +func kuzzle_new_index(i *C.kuzzle_index, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) index := indexPkg.NewIndex(kuz) @@ -46,43 +46,43 @@ func kuzzle_new_index(i *C.index, k *C.kuzzle) { } //export kuzzle_index_create -func kuzzle_index_create(i *C.index, index string) *C.void_result { - err := (*indexPkg.Index)(i.instance).Create(index) +func kuzzle_index_create(i *C.kuzzle_index, index *C.char) *C.void_result { + err := (*indexPkg.Index)(i.instance).Create(C.GoString(index)) return goToCVoidResult(err) } //export kuzzle_index_delete -func kuzzle_index_delete(i *C.index, index string) *C.void_result { - err := (*indexPkg.Index)(i.instance).Delete(index) +func kuzzle_index_delete(i *C.kuzzle_index, index *C.char) *C.void_result { + err := (*indexPkg.Index)(i.instance).Delete(C.GoString(index)) return goToCVoidResult(err) } //export kuzzle_index_mdelete -func kuzzle_index_mdelete(i *C.index, indexes []string) *C.string_array_result { - res, err := (*indexPkg.Index)(i.instance).MDelete(indexes) +func kuzzle_index_mdelete(i *C.kuzzle_index, indexes **C.char, l C.size_t) *C.string_array_result { + res, err := (*indexPkg.Index)(i.instance).MDelete(cToGoStrings(indexes, l)) return goToCStringArrayResult(res, err) } //export kuzzle_index_exists -func kuzzle_index_exists(i *C.index, index string) *C.bool_result { - res, err := (*indexPkg.Index)(i.instance).Exists(index) +func kuzzle_index_exists(i *C.kuzzle_index, index *C.char) *C.bool_result { + res, err := (*indexPkg.Index)(i.instance).Exists(C.GoString(index)) return goToCBoolResult(res, err) } //export kuzzle_index_refresh -func kuzzle_index_refresh(i *C.index, index string) *C.void_result { - err := (*indexPkg.Index)(i.instance).Refresh(index) +func kuzzle_index_refresh(i *C.kuzzle_index, index *C.char) *C.void_result { + err := (*indexPkg.Index)(i.instance).Refresh(C.GoString(index)) return goToCVoidResult(err) } //export kuzzle_index_refresh_internal -func kuzzle_index_refresh_internal(i *C.index, index string) *C.void_result { +func kuzzle_index_refresh_internal(i *C.kuzzle_index) *C.void_result { err := (*indexPkg.Index)(i.instance).RefreshInternal() return goToCVoidResult(err) } //export kuzzle_index_set_auto_refresh -func kuzzle_index_set_auto_refresh(i *C.index, index string, autoRefresh bool) *C.void_result { - err := (*indexPkg.Index)(i.instance).SetAutoRefresh(index, autoRefresh) +func kuzzle_index_set_auto_refresh(i *C.kuzzle_index, index *C.char, autoRefresh C.bool) *C.void_result { + err := (*indexPkg.Index)(i.instance).SetAutoRefresh(C.GoString(index), bool(autoRefresh)) return goToCVoidResult(err) } diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index 023ef081..aafc7dc5 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -1,9 +1,11 @@ #include "index.hpp" +#include +#include namespace kuzzleio { - Index::Index(Kuzzle* kuzzle) Kuz_Throw_KuzzleException { - _index = new index(); + Index::Index(Kuzzle* kuzzle) { + _index = new kuzzle_index(); kuzzle_new_index(_index, kuzzle->_kuzzle); } @@ -26,11 +28,25 @@ namespace kuzzleio { delete(r); } - string* Index::mDelete(string* indexes) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_mdelete(_index, const_cast(index.c_str())); + std::vector Index::mDelete(const std::vector& indexes) Kuz_Throw_KuzzleException { + char **indexesArray = new char *[indexes.size()]; + int i = 0; + for (auto const& index : indexes) { + indexesArray[i] = const_cast(index.c_str()); + i++; + } + string_array_result *r = kuzzle_index_mdelete(_index, indexesArray, indexes.size()); + + delete[] indexesArray; if (r->error != NULL) - throwExceptionFromStatus(r); + throwExceptionFromStatus(r); + + std::vector v; + for (int i = 0; i < r->result_length; i++) + v.push_back(r->result[i]); + delete(r); + return v; } bool Index::exists(const std::string& index) Kuz_Throw_KuzzleException { diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 3d7dc126..2ad827a3 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -1,6 +1,5 @@ #include #include -#include #include "kuzzle.hpp" #include #include diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp index b369a182..8479f430 100644 --- a/internal/wrappers/headers/index.hpp +++ b/internal/wrappers/headers/index.hpp @@ -6,7 +6,7 @@ namespace kuzzleio { class Index { - index *_index; + kuzzle_index *_index; Index(); public: @@ -14,7 +14,7 @@ namespace kuzzleio { virtual ~Index(); void create(const std::string& index) Kuz_Throw_KuzzleException; void delete_(const std::string& index) Kuz_Throw_KuzzleException; - string* mDelete(const std::string* indexes) Kuz_Throw_KuzzleException; + std::vector mDelete(const std::vector& indexes) Kuz_Throw_KuzzleException; bool exists(const std::string& index) Kuz_Throw_KuzzleException; void refresh(const std::string& index) Kuz_Throw_KuzzleException; void refreshInternal() Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 8336a139..f4f3ff0a 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -96,7 +96,7 @@ typedef struct { typedef struct { void *instance; kuzzle* kuzzle; -} index; +} kuzzle_index; //options passed to room constructor From 4f48062189933378e428ea607ee277ad997e7b4a Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 2 Mar 2018 01:24:37 +0100 Subject: [PATCH 014/363] Delete old Go files --- kuzzle/create_index.go | 38 ------------- kuzzle/create_index_test.go | 67 ----------------------- kuzzle/refresh_index.go | 34 ------------ kuzzle/refresh_index_test.go | 67 ----------------------- kuzzle/set_auto_refresh.go | 43 --------------- kuzzle/set_auto_refresh_test.go | 94 --------------------------------- 6 files changed, 343 deletions(-) delete mode 100644 kuzzle/create_index.go delete mode 100644 kuzzle/create_index_test.go delete mode 100644 kuzzle/refresh_index.go delete mode 100644 kuzzle/refresh_index_test.go delete mode 100644 kuzzle/set_auto_refresh.go delete mode 100644 kuzzle/set_auto_refresh_test.go diff --git a/kuzzle/create_index.go b/kuzzle/create_index.go deleted file mode 100644 index 9a495350..00000000 --- a/kuzzle/create_index.go +++ /dev/null @@ -1,38 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" -) - -// CreateIndex create a new empty data index, with no associated mapping. -func (k *Kuzzle) CreateIndex(index string, options types.QueryOptions) (bool, error) { - if index == "" { - return false, types.NewError("Kuzzle.createIndex: index required", 400) - } - - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: index, - Controller: "index", - Action: "create", - } - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return false, res.Error - } - - ack := &struct { - Acknowledged bool `json:"acknowledged"` - }{} - err := json.Unmarshal(res.Result, ack) - if err != nil { - return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) - } - return ack.Acknowledged, nil -} diff --git a/kuzzle/create_index_test.go b/kuzzle/create_index_test.go deleted file mode 100644 index a25e59b6..00000000 --- a/kuzzle/create_index_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestCreateIndexNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.CreateIndex("", nil) - assert.NotNil(t, err) -} - -func TestCreateIndexQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.CreateIndex("index", nil) - assert.NotNil(t, err) -} - -func TestCreateIndex(t *testing.T) { - type ackResult struct { - Acknowledged bool - ShardsAcknowledged bool - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - q := &types.KuzzleRequest{} - json.Unmarshal(query, q) - - assert.Equal(t, "index", q.Controller) - assert.Equal(t, "create", q.Action) - assert.Equal(t, "index", q.Index) - - return &types.KuzzleResponse{Result: []byte(`{"acknowledged":true}`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := k.CreateIndex("index", nil) - - assert.Nil(t, err) -} - -func ExampleKuzzle_CreateIndex() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.CreateIndex("index", nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Printf("%#v\n", res) -} diff --git a/kuzzle/refresh_index.go b/kuzzle/refresh_index.go deleted file mode 100644 index 43896afa..00000000 --- a/kuzzle/refresh_index.go +++ /dev/null @@ -1,34 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// RefreshIndex forces the provided data index to refresh on each modification -func (k *Kuzzle) RefreshIndex(index string, options types.QueryOptions) (*types.Shards, error) { - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "index", - Action: "refresh", - Index: index, - } - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - type s struct { - Shards *types.Shards `json:"_shards"` - } - - shards := s{} - - json.Unmarshal(res.Result, &shards) - - return shards.Shards, nil -} diff --git a/kuzzle/refresh_index_test.go b/kuzzle/refresh_index_test.go deleted file mode 100644 index 9fe054eb..00000000 --- a/kuzzle/refresh_index_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestRefreshIndexQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "index", request.Controller) - assert.Equal(t, "refresh", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.RefreshIndex("index", nil) - assert.NotNil(t, err) -} - -func TestRefreshIndex(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - type shards struct { - Shards types.Shards `json:"_shards"` - } - - ack := shards{types.Shards{10, 9, 8}} - r, _ := json.Marshal(ack) - - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "index", request.Controller) - assert.Equal(t, "refresh", request.Action) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.RefreshIndex("index", nil) - - assert.Equal(t, 10, res.Total) - assert.Equal(t, 9, res.Successful) - assert.Equal(t, 8, res.Failed) -} - -func ExampleKuzzle_RefreshIndex() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.RefreshIndex("index", nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Failed, res.Successful, res.Total) -} diff --git a/kuzzle/set_auto_refresh.go b/kuzzle/set_auto_refresh.go deleted file mode 100644 index ee21de57..00000000 --- a/kuzzle/set_auto_refresh.go +++ /dev/null @@ -1,43 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// SetAutoRefresh autorefresh status setter for the provided data index name -func (k *Kuzzle) SetAutoRefresh(index string, autoRefresh bool, options types.QueryOptions) (bool, error) { - if index == "" { - if k.defaultIndex == "" { - return false, types.NewError("Kuzzle.SetAutoRefresh: index required", 400) - } - index = k.defaultIndex - } - - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "index", - Action: "setAutoRefresh", - Index: index, - Body: struct { - AutoRefresh bool `json:"autoRefresh"` - }{autoRefresh}, - } - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return false, res.Error - } - - type autoRefreshResponse struct { - Response bool `json:"response"` - } - - var r autoRefreshResponse - json.Unmarshal(res.Result, &r) - - return r.Response, nil -} diff --git a/kuzzle/set_auto_refresh_test.go b/kuzzle/set_auto_refresh_test.go deleted file mode 100644 index 0ce9eacb..00000000 --- a/kuzzle/set_auto_refresh_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestSetAutoRefreshDefaultIndexNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.SetAutoRefresh("", true, nil) - assert.NotNil(t, err) -} - -func TestSetAutoRefreshIndexNull(t *testing.T) { - opts := types.NewOptions() - opts.SetDefaultIndex("myIndex") - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Result: json.RawMessage("true")} - }, - } - - k, _ := kuzzle.NewKuzzle(c, opts) - _, err := k.SetAutoRefresh("", true, nil) - assert.Nil(t, err) -} - -func TestSetAutoRefreshQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "index", request.Controller) - assert.Equal(t, "setAutoRefresh", request.Action) - - type autoRefresh struct { - AutoRefresh bool `json:"autoRefresh"` - } - assert.Equal(t, true, request.Body.(map[string]interface{})["autoRefresh"]) - - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - k.Connect() - _, err := k.SetAutoRefresh("index", true, nil) - assert.NotNil(t, err) -} - -func TestSetAutoRefresh(t *testing.T) { - type autorefresh struct { - Response bool `json:"response"` - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "index", request.Controller) - assert.Equal(t, "setAutoRefresh", request.Action) - - ar := autorefresh{true} - marshaled, _ := json.Marshal(ar) - - return &types.KuzzleResponse{Result: marshaled} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.SetAutoRefresh("index", true, nil) - - assert.Equal(t, true, res) -} - -func ExampleKuzzle_SetAutoRefresh() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.SetAutoRefresh("index", true, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} From e2f9b220ed0c19a3209493d98a78b319c5d2ba27 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 2 Mar 2018 01:29:17 +0100 Subject: [PATCH 015/363] Delete old function call in root_api CGO --- internal/wrappers/cgo/kuzzle/root_api.go | 38 ++---------------------- 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/root_api.go b/internal/wrappers/cgo/kuzzle/root_api.go index 95362779..73cfccbd 100644 --- a/internal/wrappers/cgo/kuzzle/root_api.go +++ b/internal/wrappers/cgo/kuzzle/root_api.go @@ -10,10 +10,11 @@ package main */ import "C" import ( - "github.com/kuzzleio/sdk-go/kuzzle" "strconv" "time" "unsafe" + + "github.com/kuzzleio/sdk-go/kuzzle" ) //export kuzzle_list_collections @@ -32,41 +33,6 @@ func kuzzle_list_indexes(k *C.kuzzle, options *C.query_options) *C.string_array_ return goToCStringArrayResult(res, err) } -//export kuzzle_create_index -func kuzzle_create_index(k *C.kuzzle, index *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).CreateIndex( - C.GoString(index), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_refresh_index -func kuzzle_refresh_index(k *C.kuzzle, index *C.char, options *C.query_options) *C.shards_result { - result := (*C.shards_result)(C.calloc(1, C.sizeof_shards_result)) - opts := SetQueryOptions(options) - - shards, err := (*kuzzle.Kuzzle)(k.instance).RefreshIndex(C.GoString(index), opts) - if err != nil { - Set_shards_result_error(result, err) - return result - } - - result.result = goToCShards(shards) - - return result -} - -//export kuzzle_set_auto_refresh -func kuzzle_set_auto_refresh(k *C.kuzzle, index *C.char, auto_refresh C.bool, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).SetAutoRefresh( - C.GoString(index), - bool(auto_refresh), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - //export kuzzle_get_auto_refresh func kuzzle_get_auto_refresh(k *C.kuzzle, index *C.char, options *C.query_options) *C.bool_result { res, err := (*kuzzle.Kuzzle)(k.instance).GetAutoRefresh( From 154013bc01ef2a59f636edee8aa892b9b3f1f11f Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 2 Mar 2018 10:07:55 +0100 Subject: [PATCH 016/363] auth.checkToken --- auth/checkToken_test.go | 13 ++--- internal/wrappers/cgo/kuzzle/auth.go | 46 +++++++++------- internal/wrappers/cpp/auth.cpp | 17 ++++++ internal/wrappers/cpp/kuzzle.cpp | 29 +--------- internal/wrappers/headers/kuzzle.hpp | 6 +-- internal/wrappers/headers/kuzzlesdk.h | 5 ++ internal/wrappers/templates/java/core.i | 4 +- kuzzle/check_token.go | 43 --------------- kuzzle/check_token_test.go | 71 ------------------------- kuzzle/kuzzle.go | 2 +- 10 files changed, 63 insertions(+), 173 deletions(-) create mode 100644 internal/wrappers/cpp/auth.cpp delete mode 100644 kuzzle/check_token.go delete mode 100644 kuzzle/check_token_test.go diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go index 4eb6d6f2..e3cdcfcd 100644 --- a/auth/checkToken_test.go +++ b/auth/checkToken_test.go @@ -1,19 +1,20 @@ -package kuzzle_test +package auth_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestCheckTokenTokenNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.CheckToken("") + _, err := k.Auth.CheckToken("") assert.NotNil(t, err) } @@ -24,7 +25,7 @@ func TestCheckTokenQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.CheckToken("token") + _, err := k.Auth.CheckToken("token") assert.NotNil(t, err) assert.Equal(t, 123, err.(*types.KuzzleError).Status) } @@ -40,7 +41,7 @@ func TestCheckToken(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.CheckToken("token") + res, _ := k.Auth.CheckToken("token") assert.Equal(t, true, res.Valid) } @@ -61,7 +62,7 @@ func ExampleKuzzle_CheckToken() { return } - res, err := k.CheckToken(jwt) + res, err := k.Auth.CheckToken(jwt) if err != nil { fmt.Println(err.Error()) return diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 216debbc..283f0413 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -11,23 +11,40 @@ package main */ import "C" import ( + "unsafe" + + "github.com/kuzzleio/sdk-go/auth" "github.com/kuzzleio/sdk-go/kuzzle" ) -//export kuzzle_set_jwt -func kuzzle_set_jwt(k *C.kuzzle, token *C.char) { - (*kuzzle.Kuzzle)(k.instance).SetJwt(C.GoString(token)) +// map which stores instances to keep references in case the gc passes +var authInstances map[interface{}]bool + +//register new instance of server +func registerAuth(instance interface{}) { + authInstances[instance] = true } -//export kuzzle_unset_jwt -func kuzzle_unset_jwt(k *C.kuzzle) { - (*kuzzle.Kuzzle)(k.instance).UnsetJwt() +// unregister an instance from the instances map +//export unregisterAuth +func unregisterAuth(a *C.auth) { + delete(authInstances, (*auth.Auth)(a.instance)) } // Allocates memory -//export kuzzle_get_jwt -func kuzzle_get_jwt(k *C.kuzzle) *C.char { - return C.CString((*kuzzle.Kuzzle)(k.instance).Jwt()) +//export kuzzle_new_auth +func kuzzle_new_auth(a *C.auth, k *C.kuzzle) { + kuz := (*kuzzle.Kuzzle)(k.instance) + auth := auth.NewAuth(kuz) + + if authInstances == nil { + authInstances = make(map[interface{}]bool) + } + + a.instance = unsafe.Pointer(auth) + a.kuzzle = k + + registerAuth(a) } //export kuzzle_login @@ -53,10 +70,10 @@ func kuzzle_logout(k *C.kuzzle) *C.char { } //export kuzzle_check_token -func kuzzle_check_token(k *C.kuzzle, token *C.char) *C.token_validity { +func kuzzle_check_token(a *C.auth, token *C.char) *C.token_validity { result := (*C.token_validity)(C.calloc(1, C.sizeof_token_validity)) - res, err := (*kuzzle.Kuzzle)(k.instance).CheckToken(C.GoString(token)) + res, err := (*auth.Auth)(a.instance).CheckToken(C.GoString(token)) if err != nil { Set_token_validity_error(result, err) return result @@ -137,10 +154,3 @@ func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options return goToCJsonResult(res, err) } - -//export kuzzle_who_am_i -func kuzzle_who_am_i(k *C.kuzzle) *C.user_result { - res, err := (*kuzzle.Kuzzle)(k.instance).WhoAmI() - - return goToCUserResult(k, res, err) -} diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp new file mode 100644 index 00000000..def9d346 --- /dev/null +++ b/internal/wrappers/cpp/auth.cpp @@ -0,0 +1,17 @@ +#include "auth.hpp" + +namespace kuzzleio { + Auth::Auth(Kuzzle* kuzzle) { + _auth = new auth(); + kuzzle_new_auth(_auth, kuzzle->_kuzzle); + } + + Auth::~Auth() { + unregisterAuth(_auth); + delete(_auth); + } + + token_validity* Auth::checkToken(const std::string& token) { + return kuzzle_check_token(_auth, const_cast(token.c_str())); + } +} \ No newline at end of file diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 53da4700..9c102895 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -24,10 +24,6 @@ namespace kuzzleio { delete(this->_kuzzle); } - token_validity* Kuzzle::checkToken(const std::string& token) { - return kuzzle_check_token(_kuzzle, const_cast(token.c_str())); - } - char* Kuzzle::connect() { return kuzzle_connect(_kuzzle); } @@ -130,10 +126,6 @@ namespace kuzzleio { return ret; } - std::string Kuzzle::getJwt() { - return kuzzle_get_jwt(_kuzzle); - } - json_object* Kuzzle::getMyRights(query_options* options) Kuz_Throw_KuzzleException { json_result *r = kuzzle_get_my_rights(_kuzzle, options); if (r->error != NULL) @@ -223,11 +215,6 @@ namespace kuzzleio { return this; } - Kuzzle* Kuzzle::setJwt(const std::string& jwt) { - kuzzle_set_jwt(_kuzzle, const_cast(jwt.c_str())); - return this; - } - Kuzzle* Kuzzle::startQueuing() { kuzzle_start_queuing(_kuzzle); return this; @@ -238,11 +225,6 @@ namespace kuzzleio { return this; } - Kuzzle* Kuzzle::unsetJwt() { - kuzzle_unset_jwt(_kuzzle); - return this; - } - json_object* Kuzzle::updateSelf(user_data* content, query_options* options) Kuz_Throw_KuzzleException { json_result *r = kuzzle_update_self(_kuzzle, content, options); if (r->error != NULL) @@ -251,16 +233,7 @@ namespace kuzzleio { delete(r); return ret; } - - user* Kuzzle::whoAmI() Kuz_Throw_KuzzleException { - user_result *r = kuzzle_who_am_i(_kuzzle); - if (r->error != NULL) - throwExceptionFromStatus(r); - user *ret = r->user; - delete(r); - return ret; - } - + Kuzzle* Kuzzle::flushQueue() { kuzzle_flush_queue(_kuzzle); return this; diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index cb3b09c5..ac2946be 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -22,7 +22,6 @@ namespace kuzzleio { Kuzzle(const std::string& host, options *options=NULL); virtual ~Kuzzle(); - token_validity* checkToken(const std::string& token); char* connect(); bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; @@ -36,7 +35,7 @@ namespace kuzzleio { statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; bool getAutoRefresh(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::string getJwt(); + json_object* getMyRights(query_options* options=NULL) Kuz_Throw_KuzzleException; json_object* getServerInfo(query_options* options=NULL) Kuz_Throw_KuzzleException; collection_entry* listCollections(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; @@ -49,12 +48,9 @@ namespace kuzzleio { Kuzzle* replayQueue(); Kuzzle* setAutoReplay(bool autoReplay); Kuzzle* setDefaultIndex(const std::string& index); - Kuzzle* setJwt(const std::string& jwt); Kuzzle* startQueuing(); Kuzzle* stopQueuing(); - Kuzzle* unsetJwt(); json_object* updateSelf(user_data* content, query_options* options=NULL) Kuz_Throw_KuzzleException; - user* whoAmI() Kuz_Throw_KuzzleException; Kuzzle* flushQueue(); json_object* getVolatile(); Kuzzle* setVolatile(json_object* volatiles); diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 08631d34..1b75f273 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -93,6 +93,11 @@ typedef struct { kuzzle_offline_queue_loader loader; } kuzzle; +typedef struct { + void *instance; + kuzzle *kuzzle; +} auth; + //options passed to room constructor typedef struct { char *scope; diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 115d108e..efebac9f 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -36,6 +36,7 @@ #include "collection.cpp" #include "room.cpp" #include "document.cpp" +#include "auth.cpp" %} %include "exceptions.i" @@ -140,4 +141,5 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" %include "room.cpp" -%include "document.cpp" \ No newline at end of file +%include "document.cpp" +%include "auth.cpp" \ No newline at end of file diff --git a/kuzzle/check_token.go b/kuzzle/check_token.go deleted file mode 100644 index 413514e7..00000000 --- a/kuzzle/check_token.go +++ /dev/null @@ -1,43 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -type TokenValidity struct { - Valid bool `json:"valid"` - State string `json:"state"` - ExpiresAt int `json:"expiresAt"` -} - -// CheckToken checks the validity of a JSON Web Token. -func (k *Kuzzle) CheckToken(token string) (*TokenValidity, error) { - if token == "" { - return nil, types.NewError("Kuzzle.CheckToken: token required", 400) - } - - result := make(chan *types.KuzzleResponse) - - type body struct { - Token string `json:"token"` - } - - query := &types.KuzzleRequest{ - Controller: "auth", - Action: "checkToken", - Body: &body{token}, - } - go k.Query(query, nil, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - tokenValidity := &TokenValidity{} - json.Unmarshal(res.Result, tokenValidity) - - return tokenValidity, nil -} diff --git a/kuzzle/check_token_test.go b/kuzzle/check_token_test.go deleted file mode 100644 index 4eb6d6f2..00000000 --- a/kuzzle/check_token_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestCheckTokenTokenNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.CheckToken("") - assert.NotNil(t, err) -} - -func TestCheckTokenQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("error", 123)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.CheckToken("token") - assert.NotNil(t, err) - assert.Equal(t, 123, err.(*types.KuzzleError).Status) -} - -func TestCheckToken(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - tokenValidity := kuzzle.TokenValidity{Valid: true} - r, _ := json.Marshal(tokenValidity) - - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.CheckToken("token") - assert.Equal(t, true, res.Valid) -} - -func ExampleKuzzle_CheckToken() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - type credentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - myCredentials := credentials{"foo", "bar"} - - jwt, err := k.Login("local", myCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - res, err := k.CheckToken(jwt) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Valid, res.ExpiresAt, res.State) -} diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index 4d7891c1..7b1e6031 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -81,7 +81,7 @@ func (k *Kuzzle) Connect() error { if wasConnected { if k.jwt != "" { go func() { - res, err := k.CheckToken(k.jwt) + res, err := k.Auth.CheckToken(k.jwt) if err != nil { k.jwt = "" From 537d61cc3ff0231e4bfb35fdcbb9202ebd6fe80f Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 2 Mar 2018 10:28:00 +0100 Subject: [PATCH 017/363] auth.createMyCredentials --- .../createMyCredentials.go | 9 ++-- .../createMyCredentials_test.go | 13 ++--- internal/wrappers/cgo/kuzzle/auth.go | 48 +++++++++---------- internal/wrappers/cpp/auth.cpp | 9 ++++ internal/wrappers/cpp/kuzzle.cpp | 11 +---- internal/wrappers/headers/kuzzle.hpp | 1 - 6 files changed, 46 insertions(+), 45 deletions(-) rename kuzzle/create_my_credentials.go => auth/createMyCredentials.go (78%) rename kuzzle/create_my_credentials_test.go => auth/createMyCredentials_test.go (89%) diff --git a/kuzzle/create_my_credentials.go b/auth/createMyCredentials.go similarity index 78% rename from kuzzle/create_my_credentials.go rename to auth/createMyCredentials.go index 0aea7426..b85a5dad 100644 --- a/kuzzle/create_my_credentials.go +++ b/auth/createMyCredentials.go @@ -1,13 +1,14 @@ -package kuzzle +package auth import ( "encoding/json" - "github.com/kuzzleio/sdk-go/types" "reflect" + + "github.com/kuzzleio/sdk-go/types" ) // CreateMyCredentials create credentials of the specified strategy for the current user. -func (k *Kuzzle) CreateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (types.Credentials, error) { +func (a *Auth) CreateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (types.Credentials, error) { if strategy == "" { return nil, types.NewError("Kuzzle.CreateMyCredentials: strategy is required", 400) } @@ -19,7 +20,7 @@ func (k *Kuzzle) CreateMyCredentials(strategy string, credentials interface{}, o Body: credentials, Strategy: strategy, } - go k.Query(query, options, result) + go a.k.Query(query, options, result) res := <-result diff --git a/kuzzle/create_my_credentials_test.go b/auth/createMyCredentials_test.go similarity index 89% rename from kuzzle/create_my_credentials_test.go rename to auth/createMyCredentials_test.go index fc102fdf..65640b59 100644 --- a/kuzzle/create_my_credentials_test.go +++ b/auth/createMyCredentials_test.go @@ -1,14 +1,15 @@ -package kuzzle_test +package auth_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestCreateMyCredentialsQueryError(t *testing.T) { @@ -22,7 +23,7 @@ func TestCreateMyCredentialsQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.CreateMyCredentials("local", nil, nil) + _, err := k.Auth.CreateMyCredentials("local", nil, nil) assert.NotNil(t, err) } @@ -33,7 +34,7 @@ func TestCreateMyCredentialsEmptyStrategy(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.CreateMyCredentials("", nil, nil) + _, err := k.Auth.CreateMyCredentials("", nil, nil) assert.NotNil(t, err) } @@ -59,7 +60,7 @@ func TestCreateMyCredentials(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.CreateMyCredentials("local", myCredentials{"foo", "bar"}, nil) + res, _ := k.Auth.CreateMyCredentials("local", myCredentials{"foo", "bar"}, nil) assert.Equal(t, "foo", res["username"]) assert.Equal(t, "bar", res["password"]) @@ -83,7 +84,7 @@ func ExampleKuzzle_CreateMyCredentials() { } newCredentials := credentials{"new", "foo"} - res, err := k.CreateMyCredentials("other_strategy", newCredentials, nil) + res, err := k.Auth.CreateMyCredentials("other_strategy", newCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 283f0413..5754b503 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -47,28 +47,6 @@ func kuzzle_new_auth(a *C.auth, k *C.kuzzle) { registerAuth(a) } -//export kuzzle_login -func kuzzle_login(k *C.kuzzle, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { - var expire int - if expires_in != nil { - expire = int(*expires_in) - } - - res, err := (*kuzzle.Kuzzle)(k.instance).Login(C.GoString(strategy), JsonCConvert(credentials).(map[string]interface{}), &expire) - - return goToCStringResult(&res, err) -} - -//export kuzzle_logout -func kuzzle_logout(k *C.kuzzle) *C.char { - err := (*kuzzle.Kuzzle)(k.instance).Logout() - if err != nil { - return C.CString(err.Error()) - } - - return nil -} - //export kuzzle_check_token func kuzzle_check_token(a *C.auth, token *C.char) *C.token_validity { result := (*C.token_validity)(C.calloc(1, C.sizeof_token_validity)) @@ -87,8 +65,8 @@ func kuzzle_check_token(a *C.auth, token *C.char) *C.token_validity { } //export kuzzle_create_my_credentials -func kuzzle_create_my_credentials(k *C.kuzzle, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).CreateMyCredentials( +func kuzzle_create_my_credentials(a *C.auth, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.json_result { + res, err := (*auth.Auth)(a.instance).CreateMyCredentials( C.GoString(strategy), JsonCConvert(credentials).(map[string]interface{}), SetQueryOptions(options)) @@ -96,6 +74,28 @@ func kuzzle_create_my_credentials(k *C.kuzzle, strategy *C.char, credentials *C. return goToCJsonResult(res, err) } +//export kuzzle_login +func kuzzle_login(k *C.kuzzle, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { + var expire int + if expires_in != nil { + expire = int(*expires_in) + } + + res, err := (*kuzzle.Kuzzle)(k.instance).Login(C.GoString(strategy), JsonCConvert(credentials).(map[string]interface{}), &expire) + + return goToCStringResult(&res, err) +} + +//export kuzzle_logout +func kuzzle_logout(k *C.kuzzle) *C.char { + err := (*kuzzle.Kuzzle)(k.instance).Logout() + if err != nil { + return C.CString(err.Error()) + } + + return nil +} + //export kuzzle_delete_my_credentials func kuzzle_delete_my_credentials(k *C.kuzzle, strategy *C.char, options *C.query_options) *C.bool_result { res, err := (*kuzzle.Kuzzle)(k.instance).DeleteMyCredentials( diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index def9d346..311b4631 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -14,4 +14,13 @@ namespace kuzzleio { token_validity* Auth::checkToken(const std::string& token) { return kuzzle_check_token(_auth, const_cast(token.c_str())); } + + json_object* Auth::createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { + json_result* r = kuzzle_create_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); + if (r->error) + throwExceptionFromStatus(r); + json_object *ret = r->result; + delete(r); + return ret; + } } \ No newline at end of file diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 9c102895..a6b0a88c 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -37,15 +37,6 @@ namespace kuzzleio { return ret; } - json_object* Kuzzle::createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { - json_result* r = kuzzle_create_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); - if (r->error) - throwExceptionFromStatus(r); - json_object *ret = r->result; - delete(r); - return ret; - } - bool Kuzzle::deleteMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_delete_my_credentials(_kuzzle, const_cast(strategy.c_str()), options); if (r->error != NULL) @@ -233,7 +224,7 @@ namespace kuzzleio { delete(r); return ret; } - + Kuzzle* Kuzzle::flushQueue() { kuzzle_flush_queue(_kuzzle); return this; diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index ac2946be..91af1320 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -24,7 +24,6 @@ namespace kuzzleio { char* connect(); bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; bool deleteMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; json_object* getMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; From cbd64f9df83d9216d134ee22663405769d4b482f Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 2 Mar 2018 10:30:57 +0100 Subject: [PATCH 018/363] add auth to test.sh --- auth/checkToken_test.go | 3 ++- test.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go index e3cdcfcd..9121f276 100644 --- a/auth/checkToken_test.go +++ b/auth/checkToken_test.go @@ -5,6 +5,7 @@ import ( "fmt" "testing" + "github.com/kuzzleio/sdk-go/auth" "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" @@ -33,7 +34,7 @@ func TestCheckTokenQueryError(t *testing.T) { func TestCheckToken(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - tokenValidity := kuzzle.TokenValidity{Valid: true} + tokenValidity := auth.TokenValidity{Valid: true} r, _ := json.Marshal(tokenValidity) return &types.KuzzleResponse{Result: r} diff --git a/test.sh b/test.sh index e351d94a..6bbc5cf2 100755 --- a/test.sh +++ b/test.sh @@ -5,7 +5,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" workdir=$dir/.cover profile="$workdir/cover.out" mode=count -dirs=(kuzzle connection/websocket collection security ms) +dirs=(kuzzle connection/websocket collection security ms auth) timeout=${TIMEOUT:=1m} generate_cover_data() { From b607b7be9b31708dd01e7cc42da4ecc65227b843 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 2 Mar 2018 11:24:38 +0100 Subject: [PATCH 019/363] auth.crednetialsExist --- internal/wrappers/cgo/kuzzle/auth.go | 9 +++++++++ internal/wrappers/cpp/auth.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 5754b503..5eb6b94c 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -74,6 +74,15 @@ func kuzzle_create_my_credentials(a *C.auth, strategy *C.char, credentials *C.js return goToCJsonResult(res, err) } +//export kuzzle_credentials_exist +func kuzzle_credentials_exist(a *C.auth, strategy *C.char, options *C.query_options) *C.bool_result { + res, err := (*auth.Auth)(a.instance).CredentialsExist( + C.GoString(strategy), + SetQueryOptions(options)) + + return goToCBoolResult(res, err) +} + //export kuzzle_login func kuzzle_login(k *C.kuzzle, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { var expire int diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 311b4631..ff7ffa41 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -23,4 +23,13 @@ namespace kuzzleio { delete(r); return ret; } + + bool Auth::credentialsExist(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { + bool_result* r = kuzzle_credentials_exist(_auth, const_cast(strategy.c_str()), options); + if (r->error != NULL) + throwExceptionFromStatus(r); + bool ret = r->result; + delete(r); + return ret; + } } \ No newline at end of file From 360bcdac4c4c3198934b50dd79c9bcbe126372f9 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 2 Mar 2018 11:24:52 +0100 Subject: [PATCH 020/363] auth.crednetialsExist --- auth/credentialsExist.go | 33 ++++++++++++++++++ auth/credentialsExist_test.go | 63 +++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 auth/credentialsExist.go create mode 100644 auth/credentialsExist_test.go diff --git a/auth/credentialsExist.go b/auth/credentialsExist.go new file mode 100644 index 00000000..d7c8de62 --- /dev/null +++ b/auth/credentialsExist.go @@ -0,0 +1,33 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +//CredentialsExist check the existence of the specified 's credentials for the current user. +func (a *Auth) CredentialsExist(strategy string, options types.QueryOptions) (bool, error) { + if strategy == "" { + return false, types.NewError("Kuzzle.CredentialsExist: strategy is required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "credentialsExist", + Strategy: strategy, + } + go a.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return false, res.Error + } + + var exists bool + json.Unmarshal(res.Result, &exists) + + return exists, nil +} diff --git a/auth/credentialsExist_test.go b/auth/credentialsExist_test.go new file mode 100644 index 00000000..0a496d45 --- /dev/null +++ b/auth/credentialsExist_test.go @@ -0,0 +1,63 @@ +package auth_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCredentialsExistEmptyStrategy(t *testing.T) { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + _, err := k.Auth.CredentialsExist("", nil) + assert.NotNil(t, err) +} + +func TestCredentialsExistQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "credentialsExist", request.Action) + + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + _, err := k.Auth.CredentialsExist("local", nil) + assert.NotNil(t, err) +} + +func TestCredentialsExists(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "credentialsExist", request.Action) + + ret, _ := json.Marshal(true) + return &types.KuzzleResponse{Result: ret} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + res, _ := k.Auth.CredentialsExist("local", nil) + assert.Equal(t, true, res) +} + +func ExampleAdminExists() { + c := websocket.NewWebSocket("localhost", nil) + k, _ := kuzzle.NewKuzzle(c, nil) + k.Connect() + res, _ := k.Auth.CredentialsExist("local", nil) + println(res) +} From 579c69c5694d81d78988521eb6f5a135dac0c288 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 2 Mar 2018 13:26:21 +0100 Subject: [PATCH 021/363] auth.deleteMyCredentials --- auth/credentialsExist.go | 2 +- auth/deleteMyCredentials.go | 29 +++++++++++++ .../deleteMyCredentials_test.go | 15 ++++--- internal/wrappers/cgo/kuzzle/auth.go | 18 ++++---- internal/wrappers/cpp/auth.cpp | 7 ++++ internal/wrappers/cpp/kuzzle.cpp | 9 ---- internal/wrappers/headers/kuzzle.hpp | 1 - kuzzle/delete_my_credentials.go | 42 ------------------- 8 files changed, 53 insertions(+), 70 deletions(-) create mode 100644 auth/deleteMyCredentials.go rename kuzzle/delete_my_credentials_test.go => auth/deleteMyCredentials_test.go (90%) delete mode 100644 kuzzle/delete_my_credentials.go diff --git a/auth/credentialsExist.go b/auth/credentialsExist.go index d7c8de62..498c3862 100644 --- a/auth/credentialsExist.go +++ b/auth/credentialsExist.go @@ -9,7 +9,7 @@ import ( //CredentialsExist check the existence of the specified 's credentials for the current user. func (a *Auth) CredentialsExist(strategy string, options types.QueryOptions) (bool, error) { if strategy == "" { - return false, types.NewError("Kuzzle.CredentialsExist: strategy is required", 400) + return false, types.NewError("Auth.CredentialsExist: strategy is required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/auth/deleteMyCredentials.go b/auth/deleteMyCredentials.go new file mode 100644 index 00000000..49a05724 --- /dev/null +++ b/auth/deleteMyCredentials.go @@ -0,0 +1,29 @@ +package auth + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// DeleteMyCredentials delete credentials of the specified strategy for the current user. +func (a *Auth) DeleteMyCredentials(strategy string, options types.QueryOptions) error { + if strategy == "" { + return types.NewError("Auth.DeleteMyCredentials: strategy is required", 400) + } + + type body struct { + Strategy string `json:"strategy"` + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "deleteMyCredentials", + Strategy: strategy, + } + + go a.k.Query(query, options, result) + + res := <-result + + return res.Error +} diff --git a/kuzzle/delete_my_credentials_test.go b/auth/deleteMyCredentials_test.go similarity index 90% rename from kuzzle/delete_my_credentials_test.go rename to auth/deleteMyCredentials_test.go index 707836e7..c9ad175d 100644 --- a/kuzzle/delete_my_credentials_test.go +++ b/auth/deleteMyCredentials_test.go @@ -1,14 +1,15 @@ -package kuzzle_test +package auth_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestDeleteMyCredentialsQueryError(t *testing.T) { @@ -22,7 +23,7 @@ func TestDeleteMyCredentialsQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.DeleteMyCredentials("local", nil) + err := k.Auth.DeleteMyCredentials("local", nil) assert.NotNil(t, err) } @@ -33,7 +34,7 @@ func TestDeleteMyCredentialsEmptyStrategy(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.DeleteMyCredentials("", nil) + err := k.Auth.DeleteMyCredentials("", nil) assert.NotNil(t, err) } @@ -57,7 +58,7 @@ func TestDeleteMyCredentials(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.DeleteMyCredentials("local", nil) + err := k.Auth.DeleteMyCredentials("local", nil) assert.Nil(t, err) } @@ -78,11 +79,9 @@ func ExampleKuzzle_DeleteMyCredentials() { return } - res, err := k.DeleteMyCredentials("local", nil) + err = k.Auth.DeleteMyCredentials("local", nil) if err != nil { fmt.Println(err.Error()) return } - - fmt.Printf("%#v\n", res) } diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 5eb6b94c..2470b0cc 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -83,6 +83,15 @@ func kuzzle_credentials_exist(a *C.auth, strategy *C.char, options *C.query_opti return goToCBoolResult(res, err) } +//export kuzzle_delete_my_credentials +func kuzzle_delete_my_credentials(a *C.auth, strategy *C.char, options *C.query_options) *C.void_result { + err := (*auth.Auth)(a.instance).DeleteMyCredentials( + C.GoString(strategy), + SetQueryOptions(options)) + + return goToCVoidResult(err) +} + //export kuzzle_login func kuzzle_login(k *C.kuzzle, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { var expire int @@ -105,15 +114,6 @@ func kuzzle_logout(k *C.kuzzle) *C.char { return nil } -//export kuzzle_delete_my_credentials -func kuzzle_delete_my_credentials(k *C.kuzzle, strategy *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).DeleteMyCredentials( - C.GoString(strategy), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - //export kuzzle_get_my_credentials func kuzzle_get_my_credentials(k *C.kuzzle, strategy *C.char, options *C.query_options) *C.json_result { res, err := (*kuzzle.Kuzzle)(k.instance).GetMyCredentials( diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index ff7ffa41..0aa6437b 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -32,4 +32,11 @@ namespace kuzzleio { delete(r); return ret; } + + void Auth::deleteMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_delete_my_credentials(_auth, const_cast(strategy.c_str()), options); + if (r->error != NULL) + throwExceptionFromStatus(r); + delete(r); + } } \ No newline at end of file diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index a6b0a88c..695b4f91 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -37,15 +37,6 @@ namespace kuzzleio { return ret; } - bool Kuzzle::deleteMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_delete_my_credentials(_kuzzle, const_cast(strategy.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - json_object* Kuzzle::getMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { json_result *r = kuzzle_get_my_credentials(_kuzzle, const_cast(strategy.c_str()), options); if (r->error != NULL) diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 91af1320..5b515d10 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -25,7 +25,6 @@ namespace kuzzleio { char* connect(); bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - bool deleteMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; json_object* getMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; json_object* updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options=NULL) Kuz_Throw_KuzzleException; bool validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; diff --git a/kuzzle/delete_my_credentials.go b/kuzzle/delete_my_credentials.go deleted file mode 100644 index 09e22a88..00000000 --- a/kuzzle/delete_my_credentials.go +++ /dev/null @@ -1,42 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" -) - -// DeleteMyCredentials delete credentials of the specified strategy for the current user. -func (k *Kuzzle) DeleteMyCredentials(strategy string, options types.QueryOptions) (bool, error) { - if strategy == "" { - return false, types.NewError("Kuzzle.DeleteMyCredentials: strategy is required", 400) - } - - type body struct { - Strategy string `json:"strategy"` - } - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "auth", - Action: "deleteMyCredentials", - Strategy: strategy, - } - - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return false, res.Error - } - - ack := &struct { - Acknowledged bool `json:"acknowledged"` - }{} - err := json.Unmarshal(res.Result, ack) - if err != nil { - return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) - } - return ack.Acknowledged, nil -} From 89c14f8014b5cf1624d07e2b5e7ea96944a5dbfc Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Mon, 5 Mar 2018 08:45:45 +0100 Subject: [PATCH 022/363] One function missing --- collection/collection.go | 26 +- collection/collection_mapping.go | 112 --- collection/collection_mapping_test.go | 330 ------- collection/count.go | 45 - collection/create.go | 33 +- collection/create_document.go | 50 - collection/create_document_test.go | 128 --- collection/create_test.go | 27 +- collection/delete.go | 34 + collection/delete_document.go | 35 - collection/delete_document_test.go | 82 -- collection/{count_test.go => delete_test.go} | 52 +- collection/document.go | 276 ------ collection/document_exists.go | 34 - collection/document_exists_test.go | 80 -- collection/document_test.go | 466 --------- collection/exists.go | 45 + collection/exists_test.go | 67 ++ collection/fetch_document.go | 35 - collection/fetch_document_test.go | 80 -- collection/get_mapping.go | 41 +- collection/get_mapping_test.go | 104 +- collection/get_specifications.go | 37 + collection/get_specifications_test.go | 94 ++ collection/list.go | 38 + collection/list_test.go | 87 ++ collection/m_routes.go | 222 ----- collection/m_routes_test.go | 447 --------- collection/publish_message.go | 35 - collection/publish_message_test.go | 79 -- collection/replace_document.go | 36 - collection/replace_document_test.go | 89 -- collection/room.go | 161 ---- collection/room_count.go | 40 - collection/room_count_test.go | 62 -- collection/room_subscribe.go | 113 --- collection/room_subscribe_test.go | 130 --- collection/room_test.go | 294 ------ collection/room_unsubscribe.go | 41 - collection/room_unsubscribe_test.go | 40 - collection/scroll.go | 29 - collection/scroll_test.go | 81 -- collection/search.go | 38 - collection/search_result.go | 116 --- collection/search_result_test.go | 249 ----- collection/search_specifications.go | 42 + collection/search_specifications_test.go | 1 + collection/search_test.go | 117 --- collection/specifications.go | 297 ++---- collection/specifications_test.go | 963 ++++++++++--------- collection/subscribe.go | 16 - collection/subscribe_test.go | 57 -- collection/truncate.go | 29 +- collection/truncate_test.go | 31 +- collection/update_document.go | 36 - collection/update_document_test.go | 94 -- collection/update_mapping.go | 39 + collection/update_mapping_test.go | 74 ++ collection/validate_specifications.go | 29 + collection/validate_specifications_test.go | 65 ++ 60 files changed, 1408 insertions(+), 5222 deletions(-) delete mode 100644 collection/collection_mapping.go delete mode 100644 collection/collection_mapping_test.go delete mode 100644 collection/count.go delete mode 100644 collection/create_document.go delete mode 100644 collection/create_document_test.go create mode 100644 collection/delete.go delete mode 100644 collection/delete_document.go delete mode 100644 collection/delete_document_test.go rename collection/{count_test.go => delete_test.go} (51%) delete mode 100644 collection/document.go delete mode 100644 collection/document_exists.go delete mode 100644 collection/document_exists_test.go delete mode 100644 collection/document_test.go create mode 100644 collection/exists.go create mode 100644 collection/exists_test.go delete mode 100644 collection/fetch_document.go delete mode 100644 collection/fetch_document_test.go create mode 100644 collection/get_specifications.go create mode 100644 collection/get_specifications_test.go create mode 100644 collection/list.go create mode 100644 collection/list_test.go delete mode 100644 collection/m_routes.go delete mode 100644 collection/m_routes_test.go delete mode 100644 collection/publish_message.go delete mode 100644 collection/publish_message_test.go delete mode 100644 collection/replace_document.go delete mode 100644 collection/replace_document_test.go delete mode 100644 collection/room.go delete mode 100644 collection/room_count.go delete mode 100644 collection/room_count_test.go delete mode 100644 collection/room_subscribe.go delete mode 100644 collection/room_subscribe_test.go delete mode 100644 collection/room_test.go delete mode 100644 collection/room_unsubscribe.go delete mode 100644 collection/room_unsubscribe_test.go delete mode 100644 collection/scroll.go delete mode 100644 collection/scroll_test.go delete mode 100644 collection/search.go delete mode 100644 collection/search_result.go delete mode 100644 collection/search_result_test.go create mode 100644 collection/search_specifications.go create mode 100644 collection/search_specifications_test.go delete mode 100644 collection/search_test.go delete mode 100644 collection/subscribe.go delete mode 100644 collection/subscribe_test.go delete mode 100644 collection/update_document.go delete mode 100644 collection/update_document_test.go create mode 100644 collection/update_mapping.go create mode 100644 collection/update_mapping_test.go create mode 100644 collection/validate_specifications.go create mode 100644 collection/validate_specifications_test.go diff --git a/collection/collection.go b/collection/collection.go index ac345b3a..07b77424 100644 --- a/collection/collection.go +++ b/collection/collection.go @@ -5,24 +5,26 @@ import ( ) type Collection struct { - Kuzzle *kuzzle.Kuzzle - index, collection string - subscribeCallback interface{} + Kuzzle *kuzzle.Kuzzle } // NewCollection instanciates a new collection -func NewCollection(kuzzle *kuzzle.Kuzzle, collection, index string) *Collection { +func NewCollection(kuzzle *kuzzle.Kuzzle) *Collection { return &Collection{ - index: index, - collection: collection, - Kuzzle: kuzzle, + Kuzzle: kuzzle, } } -// Document instanciates a new Document -func (dc *Collection) Document() *Document { - return &Document{ - Content: []byte(`{}`), - collection: dc, +type ListOptions struct { + Type string + From int + Size int +} + +func NewListOptions(t string, from int, size int) *ListOptions { + return &ListOptions{ + Type: t, + From: from, + Size: size, } } diff --git a/collection/collection_mapping.go b/collection/collection_mapping.go deleted file mode 100644 index b2063fa6..00000000 --- a/collection/collection_mapping.go +++ /dev/null @@ -1,112 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -type IMapping interface { - Apply() - Refresh() - Set() -} - -type Mapping struct { - Mapping types.MappingFields - Collection *Collection -} - -func NewMapping(col *Collection) *Mapping { - fm := make(types.MappingFields) - return &Mapping{ - Collection: col, - Mapping: fm, - } -} - -// Apply applies the new mapping to the data collection. -func (cm *Mapping) Apply(options types.QueryOptions) (*Mapping, error) { - ch := make(chan *types.KuzzleResponse) - - type body struct { - Properties types.MappingFields `json:"properties"` - } - - query := &types.KuzzleRequest{ - Collection: cm.Collection.collection, - Index: cm.Collection.index, - Controller: "collection", - Action: "updateMapping", - Body: &body{Properties: cm.Mapping}, - } - - go cm.Collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return cm, res.Error - } - - return cm.Refresh(nil) -} - -// Refresh Replaces the current content with the mapping stored in Kuzzle. -// Calling this function will discard any uncommitted changes. You can commit changes by calling the “apply” function -func (cm *Mapping) Refresh(options types.QueryOptions) (*Mapping, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: cm.Collection.collection, - Index: cm.Collection.index, - Controller: "collection", - Action: "getMapping", - } - go cm.Collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return cm, res.Error - } - - type mappingResult map[string]struct { - Mappings map[string]struct { - Properties types.MappingFields `json:"properties"` - } `json:"mappings"` - } - - result := mappingResult{} - json.Unmarshal(res.Result, &result) - - if _, ok := result[cm.Collection.index]; ok { - indexMappings := result[cm.Collection.index].Mappings - - if _, ok := indexMappings[cm.Collection.collection]; ok { - cm.Mapping = indexMappings[cm.Collection.collection].Properties - - return cm, nil - } else { - return cm, types.NewError("No mapping found for collection "+cm.Collection.collection, 404) - } - } else { - return cm, types.NewError("No mapping found for index "+cm.Collection.index, 404) - } -} - -/* - Adds or updates a field mapping. - - Changes made by this function won’t be applied until you call the apply method -*/ -func (cm *Mapping) Set(mappings *types.MappingFields) *Mapping { - if cm.Mapping == nil { - return cm - } - - for field, mapping := range *mappings { - (cm.Mapping)[field] = mapping - } - - return cm -} diff --git a/collection/collection_mapping_test.go b/collection/collection_mapping_test.go deleted file mode 100644 index f7e8d5d3..00000000 --- a/collection/collection_mapping_test.go +++ /dev/null @@ -1,330 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestMappingApplyError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": { - Type: "text", - Index: true, - }, - }, - Collection: cl, - } - - _, err := cm.Apply(nil) - assert.NotNil(t, err) -} - -func TestMappingApply(t *testing.T) { - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - callCount++ - - if callCount == 1 { - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":256}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - } - if callCount == 2 { - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "updateMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":100}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - } - if callCount == 3 { - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":100}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - cm, _ := cl.GetMapping(nil) - - fieldMapping := &types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - } - - res, _ := cm.Set(fieldMapping).Apply(nil) - - assert.Equal(t, cm, res) -} - -func ExampleMapping_Apply() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - cm, _ := cl.GetMapping(nil) - qo := types.NewQueryOptions() - - fieldMapping := &types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - } - - res, err := cm.Set(fieldMapping).Apply(qo) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Collection, res.Mapping) -} - -func TestMappingRefreshError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - - _, err := cm.Refresh(nil) - assert.NotNil(t, err) -} - -func TestMappingRefreshUnknownIndex(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "wrong-index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":256}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "wrong-index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - - _, err := cm.Refresh(nil) - - assert.Equal(t, "No mapping found for index wrong-index", err.(*types.KuzzleError).Message) - assert.Equal(t, 404, err.(*types.KuzzleError).Status) -} - -func TestMappingRefreshUnknownCollection(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "wrong-collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":256}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "wrong-collection", "index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - - _, err := cm.Refresh(nil) - - assert.Equal(t, "No mapping found for collection wrong-collection", err.(*types.KuzzleError).Message) - assert.Equal(t, 404, err.(*types.KuzzleError).Status) -} - -func TestMappingRefresh(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":255}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - updatedCm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 255, - }, - }, - Collection: cl, - } - - cm.Refresh(nil) - assert.Equal(t, updatedCm.Mapping, cm.Mapping) -} - -func ExampleMapping_Refresh() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - qo := types.NewQueryOptions() - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - - res, err := cm.Refresh(qo) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Collection, res.Mapping) -} - -func TestMappingSet(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":256}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - cm, _ := cl.GetMapping(nil) - - fieldMapping := &types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - } - - cm.Set(fieldMapping) - - assert.Equal(t, 100, cm.Mapping["foo"].IgnoreAbove) -} - -func ExampleMapping_Set() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - cm, _ := cl.GetMapping(nil) - - fieldMapping := &types.MappingFields{ - "foo": { - Type: "text", - IgnoreAbove: 100, - }, - } - - res := cm.Set(fieldMapping) - - fmt.Println(res.Collection, res.Mapping) -} diff --git a/collection/count.go b/collection/count.go deleted file mode 100644 index e5ea7258..00000000 --- a/collection/count.go +++ /dev/null @@ -1,45 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/types" -) - -// Count returns the number of documents matching the provided set of filters. -// There is a small delay between documents creation and their existence in our advanced search layer, -// usually a couple of seconds. -// That means that a document that was just been created won’t be returned by this function -func (dc *Collection) Count(filters *types.SearchFilters, options types.QueryOptions) (int, error) { - type countResult struct { - Count int `json:"count"` - Status int - } - - searchfilters := &types.SearchFilters{} - - if filters != nil { - searchfilters = filters - } - - ch := make(chan *types.KuzzleResponse) - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "count", - Body: searchfilters, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return -1, res.Error - } - - result := &countResult{} - json.Unmarshal(res.Result, result) - - return result.Count, nil -} diff --git a/collection/create.go b/collection/create.go index c55f54ef..c7eb82b6 100644 --- a/collection/create.go +++ b/collection/create.go @@ -1,37 +1,34 @@ package collection import ( - "encoding/json" - - "fmt" "github.com/kuzzleio/sdk-go/types" ) -// Create creates a new empty data collection, with no associated mapping. -func (dc *Collection) Create(options types.QueryOptions) (bool, error) { +// Create creates a new empty data collection +func (dc *Collection) Create(index string, collection string) error { + if index == "" { + return types.NewError("Collection.Create: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.Create: collection required", 400) + } + ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, + Collection: collection, + Index: index, Controller: "collection", Action: "create", } - go dc.Kuzzle.Query(query, options, ch) + go dc.Kuzzle.Query(query, nil, ch) res := <-ch if res.Error != nil { - return false, res.Error - } - - ack := &struct { - Acknowledged bool `json:"acknowledged"` - }{} - err := json.Unmarshal(res.Result, ack) - if err != nil { - return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + return res.Error } - return ack.Acknowledged, nil + return nil } diff --git a/collection/create_document.go b/collection/create_document.go deleted file mode 100644 index cfb29125..00000000 --- a/collection/create_document.go +++ /dev/null @@ -1,50 +0,0 @@ -package collection - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" -) - -// Create a new document in Kuzzle. -// Takes an optional argument object with the following properties: -// - volatile (object, default: null): -// Additional information passed to notifications to other users -// - ifExist (string, allowed values: "error" (default), "replace"): -// If the same document already exists: -// - resolves with an error if set to "error". -// - replaces the existing document if set to "replace" -func (dc *Collection) CreateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - ch := make(chan *types.KuzzleResponse) - - action := "create" - - if options != nil { - if options.IfExist() == "replace" { - action = "createOrReplace" - } else if options.IfExist() != "error" { - return nil, types.NewError(fmt.Sprintf("Invalid value for the 'ifExist' option: '%s'", options.IfExist()), 400) - } - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: action, - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - documentResponse := &Document{collection: dc} - json.Unmarshal(res.Result, documentResponse) - - return documentResponse, nil -} diff --git a/collection/create_document_test.go b/collection/create_document_test.go deleted file mode 100644 index 00a9a52b..00000000 --- a/collection/create_document_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestCreateDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestCreateDocumentWrongOptionError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("unknown") - - _, err := newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, opts) - assert.Equal(t, "[400] Invalid value for the 'ifExist' option: 'unknown'", fmt.Sprint(err)) -} - -func TestCreateDocument(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "create", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - body := make(map[string]interface{}, 0) - body["title"] = "yolo" - - assert.Equal(t, body, parsedQuery.Body) - - res := collection.Document{Id: id, Content: []byte(`{"title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - assert.Equal(t, id, res.Id) -} - -func TestCreateDocumentReplace(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "createOrReplace", parsedQuery.Action) - - res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("replace") - newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) -} - -func TestCreateDocumentCreate(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "create", parsedQuery.Action) - - res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("error") - - newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) -} - -func ExampleCollection_CreateDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - id := "myId" - - res, err := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} diff --git a/collection/create_test.go b/collection/create_test.go index 99d5c737..679550c7 100644 --- a/collection/create_test.go +++ b/collection/create_test.go @@ -11,6 +11,20 @@ import ( "github.com/stretchr/testify/assert" ) +func TestCreateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Create("", "collection") + assert.NotNil(t, err) +} + +func TestCreateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Create("index", "") + assert.NotNil(t, err) +} + func TestCreateError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { @@ -19,7 +33,8 @@ func TestCreateError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := collection.NewCollection(k, "collection", "index").Create(nil) + nc := collection.NewCollection(k) + err := nc.Create("index", "collection") assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -34,20 +49,20 @@ func TestCreate(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := collection.NewCollection(k, "collection", "index").Create(nil) - assert.Equal(t, true, res) + nc := collection.NewCollection(k) + err := nc.Create("index", "collection") + assert.Nil(t, err) } func ExampleCollection_Create() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - res, err := collection.NewCollection(k, "collection", "index").Create(nil) + nc := collection.NewCollection(k) + err := nc.Create("index", "collection") if err != nil { fmt.Println(err.Error()) return } - - fmt.Printf("%#v\n", res) } diff --git a/collection/delete.go b/collection/delete.go new file mode 100644 index 00000000..1d8e495c --- /dev/null +++ b/collection/delete.go @@ -0,0 +1,34 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// Delete deletes a collection +func (dc *Collection) Delete(index string, collection string) error { + if index == "" { + return types.NewError("Collection.Delete: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.Delete: collection required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "delete", + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/collection/delete_document.go b/collection/delete_document.go deleted file mode 100644 index 198db81d..00000000 --- a/collection/delete_document.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// DeleteDocument deletes the Document using its provided unique id. -func (dc *Collection) DeleteDocument(id string, options types.QueryOptions) (string, error) { - if id == "" { - return "", types.NewError("Collection.DeleteDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "delete", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", res.Error - } - - document := &Document{collection: dc} - json.Unmarshal(res.Result, document) - - return document.Id, nil -} diff --git a/collection/delete_document_test.go b/collection/delete_document_test.go deleted file mode 100644 index 3fbb904f..00000000 --- a/collection/delete_document_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestDeleteDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("should have stopped before receiving a response")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("", nil) - assert.NotNil(t, err) - assert.Equal(t, "Collection.DeleteDocument: document id required", err.(*types.KuzzleError).Message) -} - -func TestDeleteDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("myId", nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestDeleteDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "delete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) - assert.Equal(t, id, res) -} - -func ExampleCollection_DeleteDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - id := "myId" - - res, err := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/count_test.go b/collection/delete_test.go similarity index 51% rename from collection/count_test.go rename to collection/delete_test.go index 1dc704ea..e0cebe6b 100644 --- a/collection/count_test.go +++ b/collection/delete_test.go @@ -1,17 +1,31 @@ package collection_test import ( - "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) -func TestCountError(t *testing.T) { +func TestDeleteIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Delete("", "collection") + assert.NotNil(t, err) +} + +func TestDeleteCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Delete("index", "") + assert.NotNil(t, err) +} + +func TestDeleteError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: types.NewError("Unit test error")} @@ -19,44 +33,36 @@ func TestCountError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - count, err := collection.NewCollection(k, "collection", "index").Count(nil, nil) + nc := collection.NewCollection(k) + err := nc.Delete("index", "collection") assert.NotNil(t, err) - assert.Equal(t, -1, count) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } -func TestCount(t *testing.T) { - type result struct { - Count int `json:"count"` - } - +func TestDelete(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - res := result{Count: 10} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} + return &types.KuzzleResponse{Result: []byte(`{ + "acknowledged":true + }`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := collection.NewCollection(k, "collection", "index").Count(nil, nil) - assert.Equal(t, 10, res) + nc := collection.NewCollection(k) + err := nc.Delete("index", "collection") + assert.Nil(t, err) } -func ExampleCollection_Count() { - type result struct { - Count int `json:"count"` - } - +func ExampleCollection_Delete() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - res, err := collection.NewCollection(k, "collection", "index").Count(nil, nil) + nc := collection.NewCollection(k) + err := nc.Delete("index", "collection") if err != nil { fmt.Println(err.Error()) return } - - fmt.Println(res) } diff --git a/collection/document.go b/collection/document.go deleted file mode 100644 index 38e7e174..00000000 --- a/collection/document.go +++ /dev/null @@ -1,276 +0,0 @@ -package collection - -import ( - "encoding/json" - "strconv" - - "github.com/kuzzleio/sdk-go/types" -) - -type IDocument interface { - Save() - Refresh() - SetContent() - Publish() - Exists() - Delete() -} - -type Document struct { - Id string `json:"_id"` - Index string `json:"_index"` - Meta *types.Meta `json:"_meta"` - Shards *types.Shards `json:"_shards"` - Content json.RawMessage `json:"_source"` - Version int `json:"_version"` - Result string `json:"result"` - Created bool `json:"created"` - Collection string `json:"_collection"` - collection *Collection `json:"-"` -} - -type DocumentContent map[string]interface{} - -/* - * Instanciate a new document - */ -func NewDocument(col *Collection, id string) *Document { - return &Document{ - collection: col, - Id: id, - Collection: col.collection, - Index: col.index, - } -} - -func (documentContent *DocumentContent) ToString() string { - s, _ := json.Marshal(documentContent) - - return string(s) -} - -func (d *Document) SourceToMap() DocumentContent { - sourceMap := DocumentContent{} - - json.Unmarshal(d.Content, &sourceMap) - - return sourceMap -} - -// Subscribe listens to events concerning this document. Has no effect if the document does not have an ID -// (i.e. if the document has not yet been created as a persisted document). -func (d *Document) Subscribe(options types.RoomOptions, ch chan<- types.KuzzleNotification) (*Room, error) { - if d.Id == "" { - return nil, types.NewError("Document.Subscribe: cannot subscribe to a document if no ID has been provided", 400) - } - - filters := map[string]map[string][]string{ - "ids": { - "values": []string{d.Id}, - }, - } - - return d.collection.Subscribe(filters, options, ch), nil -} - -/* - Saves the document into Kuzzle. - - If this is a new document, will create it in Kuzzle and the id property will be made available. - Otherwise, will replace the latest version of the document in Kuzzle by the current content of this object. -*/ -func (d *Document) Save(options types.QueryOptions) (*Document, error) { - if d.Id == "" { - return d, types.NewError("Document.Save: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "createOrReplace", - Id: d.Id, - Body: d.Content, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return d, res.Error - } - - return d, nil -} - -/* - Replaces the document with the latest version stored in Kuzzle. -*/ -func (d *Document) Refresh(options types.QueryOptions) (*Document, error) { - if d.Id == "" { - return d, types.NewError("Document.Refresh: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "get", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - if res.Error != nil { - return d, res.Error - } - - json.Unmarshal(res.Result, d) - - return d, nil -} - -/* - Sets the document id. -*/ -func (d *Document) SetDocumentId(id string) *Document { - if id != "" { - d.Id = id - } - - return d -} - -/* - Replaces the current document content with provided data. - Changes made by this function won’t be applied until the save method is called. - If replace is set to true, the entire content will be replaced, otherwise, only existing and new fields will be impacted. -*/ -func (d *Document) SetContent(content DocumentContent, replace bool) *Document { - if replace { - d.Content, _ = json.Marshal(content) - } else { - source := DocumentContent{} - json.Unmarshal(d.Content, &source) - - for attr, value := range content { - if source[attr] == nil { - source[attr] = value - } - } - - d.Content, _ = json.Marshal(source) - } - - return d -} - -/* - Sends the content of the document as a realtime message. -*/ -func (d *Document) Publish(options types.QueryOptions) (bool, error) { - ch := make(chan *types.KuzzleResponse) - - type message struct { - Id string `json:"_id,omitempty"` - Version int `json:"_version,omitempty"` - Body json.RawMessage `json:"body"` - Meta *types.Meta `json:"meta"` - } - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "realtime", - Action: "publish", - Body: message{ - Id: d.Id, - Version: d.Version, - Body: d.Content, - Meta: d.Meta, - }, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - response := types.RealtimeResponse{} - - json.Unmarshal(res.Result, &response) - - return response.Published, nil -} - -/* - Checks if the document exists in Kuzzle. -*/ -func (d *Document) Exists(options types.QueryOptions) (bool, error) { - if d.Id == "" { - return false, types.NewError("Document.Exists: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "exists", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - exists, _ := strconv.ParseBool(string(res.Result)) - - return exists, nil -} - -/* - Deletes the document in Kuzzle. -*/ -func (d *Document) Delete(options types.QueryOptions) (string, error) { - if d.Id == "" { - return "", types.NewError("Document.Delete: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "delete", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", res.Error - } - - document := Document{collection: d.collection} - json.Unmarshal(res.Result, &document) - - return document.Id, nil -} diff --git a/collection/document_exists.go b/collection/document_exists.go deleted file mode 100644 index 27c8e204..00000000 --- a/collection/document_exists.go +++ /dev/null @@ -1,34 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" - "strconv" -) - -// DocumentExists returns a boolean indicating whether or not a document with provided ID exists. -func (dc *Collection) DocumentExists(id string, options types.QueryOptions) (bool, error) { - if id == "" { - return false, types.NewError("Collection.DocumentExists: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "exists", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - exists, _ := strconv.ParseBool(string(res.Result)) - - return exists, nil -} diff --git a/collection/document_exists_test.go b/collection/document_exists_test.go deleted file mode 100644 index b41a98da..00000000 --- a/collection/document_exists_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestDocumentExistsEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.DocumentExists: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DocumentExists("", nil) - assert.NotNil(t, err) -} - -func TestDocumentExistsError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DocumentExists("myId", nil) - assert.NotNil(t, err) -} - -func TestDocumentExists(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "exists", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) - assert.Equal(t, true, res) -} - -func ExampleCollection_DocumentExists() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/document_test.go b/collection/document_test.go deleted file mode 100644 index 760845fc..00000000 --- a/collection/document_test.go +++ /dev/null @@ -1,466 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestDocumentSetContent(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) - - assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - }, - }, false) - - assert.Equal(t, string(json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`))), string(d.Content)) -} - -func ExampleDocument_SetContent() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - }, - }, false) - - fmt.Println(d.Content) -} - -func TestDocumentSetContentReplace(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) - - assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - "subsubfield": collection.DocumentContent{ - "hi": "there", - }, - }, - }, true) - - assert.Equal(t, string(json.RawMessage([]byte(`{"subfield":{"john":"cena","subsubfield":{"hi":"there"}}}`))), string(d.Content)) -} - -func TestDocumentSubscribeEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - cd := dc.Document() - - ch := make(chan types.KuzzleNotification) - _, err := cd.Subscribe(types.NewRoomOptions(), ch) - - assert.Equal(t, "[400] Document.Subscribe: cannot subscribe to a document if no ID has been provided", err.Error()) -} - -func TestDocumentSubscribe(t *testing.T) { - id := "docId" - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - // Fetch query - if parsedQuery.Controller == "document" { - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} - r, _ := json.Marshal(res) - - return &types.KuzzleResponse{Result: r} - } - - // Subscribe query - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "subscribe", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, map[string]interface{}(map[string]interface{}{"ids": map[string]interface{}{"values": []interface{}{"docId"}}}), parsedQuery.Body) - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - dc := collection.NewCollection(k, "collection", "index") - d := dc.Document() - d.Id = id - - ch := make(chan types.KuzzleNotification) - room, _ := d.Subscribe(types.NewRoomOptions(), ch) - r := <-room.ResponseChannel() - - assert.Nil(t, r.Error) - assert.NotNil(t, r.Room) - assert.Equal(t, "42", r.Room.RoomId()) -} - -func ExampleDocument_Subscribe() { - id := "docId" - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{} - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - dc := collection.NewCollection(k, "collection", "index") - d := dc.Document() - d.Id = id - - ch := make(chan types.KuzzleNotification) - room, _ := d.Subscribe(types.NewRoomOptions(), ch) - - notification := <-room.ResponseChannel() - - fmt.Println(notification.Room.RoomId(), notification.Error) -} - -func TestDocumentSaveEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Save(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Save: missing document id", fmt.Sprint(err)) -} - -func TestDocumentSaveError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Save(nil) - - assert.NotNil(t, err) -} - -func TestDocumentSave(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "createOrReplace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{"foo": "bar"} - - d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) - - assert.Equal(t, id, d.Id) - assert.Equal(t, documentContent.ToString(), string(d.Content)) -} - -func ExampleDocument_Save() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{"foo": "bar"} - - res, err := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} - -func TestDocumentRefreshEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Refresh(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Refresh: missing document id", fmt.Sprint(err)) -} - -func TestDocumentRefreshError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Refresh(nil) - - assert.NotNil(t, err) -} - -func TestDocumentRefresh(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"name":"Anakin","function":"Jedi"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{ - "name": "Anakin", - "function": "Padawan", - } - - d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Refresh(nil) - - result := collection.Document{} - json.Unmarshal(d.Content, &result.Content) - - ic := collection.DocumentContent{} - json.Unmarshal(result.Content, &ic) - - assert.Equal(t, id, d.Id) - assert.Equal(t, "Padawan", documentContent["function"]) - assert.Equal(t, "Jedi", ic["function"]) - assert.NotEqual(t, documentContent["function"], ic["function"]) -} - -func ExampleDocument_Refresh() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId(id).Refresh(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} - -func TestCollectionDocumentExistsEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Exists(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Exists: missing document id", fmt.Sprint(err)) -} - -func TestCollectionDocumentExistsError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Exists(nil) - - assert.NotNil(t, err) -} - -func TestCollectionDocumentExists(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "exists", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - exists, _ := dc.Document().SetDocumentId(id).Exists(nil) - - assert.Equal(t, true, exists) -} - -func ExampleDocument_Exists() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId(id).Exists(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestDocumentPublishError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "realtime", "publish") - _, err := dc.Document().SetDocumentId("myId").Publish(nil) - - assert.NotNil(t, err) -} - -func TestDocumentPublish(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "publish", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - r, _ := json.Marshal(types.RealtimeResponse{Published: true}) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, _ := dc.Document().SetDocumentId("myId").Publish(nil) - - assert.Equal(t, true, res) -} - -func ExampleDocument_Publish() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId("myId").Publish(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestDocumentDeleteEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Delete(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Delete: missing document id", fmt.Sprint(err)) -} - -func TestDocumentDeleteError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Delete(nil) - - assert.NotNil(t, err) -} - -func TestDocumentDelete(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "delete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(collection.Document{Id: id}) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, _ := dc.Document().SetDocumentId("myId").Delete(nil) - - assert.Equal(t, id, res) -} - -func ExampleDocument_Delete() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId("myId").Delete(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/exists.go b/collection/exists.go new file mode 100644 index 00000000..1f584089 --- /dev/null +++ b/collection/exists.go @@ -0,0 +1,45 @@ +package collection + +import ( + "encoding/json" + "fmt" + + "github.com/kuzzleio/sdk-go/types" +) + +// Exists check if a collection exists. +func (dc *Collection) Exists(index string, collection string) (bool, error) { + if index == "" { + return false, types.NewError("Collection.Exists: index required", 400) + } + + if collection == "" { + return false, types.NewError("Collection.Exists: collection required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "exists", + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return false, res.Error + } + + var exists bool + + err := json.Unmarshal(res.Result, &exists) + + if err != nil { + return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + } + + return true, nil +} diff --git a/collection/exists_test.go b/collection/exists_test.go new file mode 100644 index 00000000..60419dc6 --- /dev/null +++ b/collection/exists_test.go @@ -0,0 +1,67 @@ +package collection_test + +import ( + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestExistsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.Exists("", "collection") + assert.NotNil(t, err) +} + +func TestExistsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.Exists("index", "") + assert.NotNil(t, err) +} + +func TestExistsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.Exists("index", "collection") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestExists(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: []byte(`true`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + res, err := nc.Exists("index", "collection") + assert.Nil(t, err) + assert.Equal(t, true, res) +} + +func ExampleCollection_Exists() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.Exists("index", "collection") + + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/collection/fetch_document.go b/collection/fetch_document.go deleted file mode 100644 index 7f4fa8f7..00000000 --- a/collection/fetch_document.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// FetchDocument retrieves a Document using its provided unique id. -func (dc *Collection) FetchDocument(id string, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.FetchDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "get", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - document := &Document{collection: dc} - json.Unmarshal(res.Result, document) - - return document, nil -} diff --git a/collection/fetch_document_test.go b/collection/fetch_document_test.go deleted file mode 100644 index 73d71c51..00000000 --- a/collection/fetch_document_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestFetchDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.FetchDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").FetchDocument("", nil) - assert.NotNil(t, err) -} - -func TestFetchDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").FetchDocument("myId", nil) - assert.NotNil(t, err) -} - -func TestFetchDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo": "bar"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) - assert.Equal(t, id, res.Id) -} - -func ExampleCollection_FetchDocument() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} diff --git a/collection/get_mapping.go b/collection/get_mapping.go index 75e51d9c..0b215410 100644 --- a/collection/get_mapping.go +++ b/collection/get_mapping.go @@ -1,46 +1,37 @@ package collection import ( - "encoding/json" "github.com/kuzzleio/sdk-go/types" ) // GetMapping retrieves the current mapping of the collection. -func (dc *Collection) GetMapping(options types.QueryOptions) (*Mapping, error) { +func (dc *Collection) GetMapping(index string, collection string) (string, error) { + if index == "" { + return "", types.NewError("Collection.GetMapping: index required", 400) + } + + if collection == "" { + return "", types.NewError("Collection.GetMapping: collection required", 400) + } + ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, + Collection: collection, + Index: index, Controller: "collection", Action: "getMapping", } - go dc.Kuzzle.Query(query, options, ch) + go dc.Kuzzle.Query(query, nil, ch) res := <-ch if res.Error != nil { - return nil, res.Error + return "", res.Error } - type mappingResult map[string]struct { - Mappings map[string]struct { - Properties types.MappingFields `json:"properties"` - } `json:"mappings"` - } - - result := mappingResult{} - json.Unmarshal(res.Result, &result) + var mapping string + mapping = string(res.Result) - if _, ok := result[dc.index]; ok { - indexMappings := result[dc.index].Mappings - - if _, ok := indexMappings[dc.collection]; ok { - return &Mapping{Mapping: indexMappings[dc.collection].Properties, Collection: dc}, nil - } else { - return nil, types.NewError("No mapping found for collection "+dc.collection, 404) - } - } else { - return nil, types.NewError("No mapping found for index "+dc.index, 404) - } + return mapping, nil } diff --git a/collection/get_mapping_test.go b/collection/get_mapping_test.go index 67b68253..d2db05c8 100644 --- a/collection/get_mapping_test.go +++ b/collection/get_mapping_test.go @@ -3,73 +3,41 @@ package collection_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/collection" + "testing" + "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) -func TestGetMappingError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").GetMapping(nil) +func TestGetMappingIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.GetMapping("", "collection") assert.NotNil(t, err) } -func TestGetMappingUnknownIndex(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "wrong-index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","fields":{"type":"keyword","ignore_above":256}}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "wrong-index") - - _, err := cl.GetMapping(nil) +func TestGetMappingCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.GetMapping("index", "") assert.NotNil(t, err) - assert.Equal(t, "[404] No mapping found for index wrong-index", fmt.Sprint(err)) } -func TestGetMappingUnknownCollection(t *testing.T) { +func TestGetMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "wrong-collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":255}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} }, } k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "wrong-collection", "index") - _, err := cl.GetMapping(nil) + nc := collection.NewCollection(k) + _, err := nc.GetMapping("index", "collection") assert.NotNil(t, err) - assert.Equal(t, "[404] No mapping found for collection wrong-collection", fmt.Sprint(err)) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } func TestGetMapping(t *testing.T) { @@ -83,40 +51,46 @@ func TestGetMapping(t *testing.T) { assert.Equal(t, "index", parsedQuery.Index) assert.Equal(t, "collection", parsedQuery.Collection) - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":255}}}}}}`)} + res := types.KuzzleResponse{Result: []byte(` + { + "index":{ + "mappings":{ + "collection":{ + "properties":{ + "foo":{ + "type":"text", + "ignore_above":255 + } + } + } + } + } + }`), + } + r, _ := json.Marshal(res.Result) return &types.KuzzleResponse{Result: r} }, } k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - - res, _ := cl.GetMapping(nil) - - expected := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": { - Type: "text", - IgnoreAbove: 255, - }, - }, - Collection: cl, - } - assert.Equal(t, expected.Mapping, res.Mapping) + nc := collection.NewCollection(k) + res, err := nc.GetMapping("index", "collection") + assert.Nil(t, err) + assert.NotNil(t, res) } func ExampleCollection_GetMapping() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - res, err := cl.GetMapping(nil) + nc := collection.NewCollection(k) + res, err := nc.GetMapping("index", "collection") if err != nil { fmt.Println(err.Error()) return } - fmt.Println(res.Collection, res.Mapping) + fmt.Println(res) } diff --git a/collection/get_specifications.go b/collection/get_specifications.go new file mode 100644 index 00000000..f5f432a2 --- /dev/null +++ b/collection/get_specifications.go @@ -0,0 +1,37 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// GetSpecifications retrieves the current specifications of the collection. +func (dc *Collection) GetSpecifications(index string, collection string) (string, error) { + if index == "" { + return "", types.NewError("Collection.GetSpecifications: index required", 400) + } + + if collection == "" { + return "", types.NewError("Collection.GetSpecifications: collection required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "getSpecifications", + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var specifications string + specifications = string(res.Result) + + return specifications, nil +} diff --git a/collection/get_specifications_test.go b/collection/get_specifications_test.go new file mode 100644 index 00000000..afd2efb6 --- /dev/null +++ b/collection/get_specifications_test.go @@ -0,0 +1,94 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetSpecificationsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.GetSpecifications("", "collection") + assert.NotNil(t, err) +} + +func TestGetSpecificationsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.GetSpecifications("index", "") + assert.NotNil(t, err) +} + +func TestGetSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.GetSpecifications("index", "collection") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestGetSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "collection", parsedQuery.Controller) + assert.Equal(t, "getSpecifications", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + res := types.KuzzleResponse{Result: []byte(`{ + "collection": "collection", + "index": "index", + "validation": { + "fields": { + "myField": { + "defaultValue": 42, + "mandatory": true, + "type": "integer" + } + }, + "strict": true + }`), + } + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + res, err := nc.GetSpecifications("index", "collection") + assert.Nil(t, err) + assert.NotNil(t, res) +} + +func ExampleCollection_GetSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + res, err := nc.GetSpecifications("index", "collection") + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/collection/list.go b/collection/list.go new file mode 100644 index 00000000..33a305cb --- /dev/null +++ b/collection/list.go @@ -0,0 +1,38 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// ListCollections retrieves the list of known data collections contained in a specified index. +func (dc *Collection) List(index string, options *ListOptions) (string, error) { + if index == "" { + return "", types.NewError("Collection.List: index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "collection", + Action: "list", + Index: index, + Body: options.Type, + } + + queryOpts := types.NewQueryOptions() + queryOpts.SetFrom(options.From) + queryOpts.SetSize(options.Size) + + go dc.Kuzzle.Query(query, queryOpts, result) + + res := <-result + + if res.Error != nil { + return "", res.Error + } + + var collectionList string + collectionList = string(res.Result) + + return collectionList, nil +} diff --git a/collection/list_test.go b/collection/list_test.go new file mode 100644 index 00000000..5c99f4ff --- /dev/null +++ b/collection/list_test.go @@ -0,0 +1,87 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestListIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + lo := collection.NewListOptions("stored", 0, 1) + _, err := nc.List("", lo) + + assert.NotNil(t, err) +} + +func TestListError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + lo := collection.NewListOptions("stored", 0, 1) + _, err := nc.List("index", lo) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestList(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "collection", parsedQuery.Controller) + assert.Equal(t, "list", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + + res := types.KuzzleResponse{Result: []byte(` + { + "collections": [ + { + "name": "stored_n", "type": "stored" + } + ], + "type": "all" + }`), + } + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + lo := collection.NewListOptions("all", 0, 1) + res, err := nc.List("index", lo) + assert.Nil(t, err) + assert.NotNil(t, res) +} + +func ExampleCollection_List() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + lo := collection.NewListOptions("all", 0, 1) + res, err := nc.List("index", lo) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/collection/m_routes.go b/collection/m_routes.go deleted file mode 100644 index 571e952a..00000000 --- a/collection/m_routes.go +++ /dev/null @@ -1,222 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/types" -) - -type mActionResult struct { - Hits []json.RawMessage `json:"hits"` - Total int `json:"total"` -} - -/* - Creates the provided documents. -*/ -func (dc *Collection) MCreateDocument(documents []*Document, options types.QueryOptions) ([]*Document, error) { - return performMultipleCreate(dc, documents, "mCreate", options) -} - -/* - Creates or replaces the provided documents. -*/ -func (dc *Collection) MCreateOrReplaceDocument(documents []*Document, options types.QueryOptions) ([]*Document, error) { - return performMultipleCreate(dc, documents, "mCreateOrReplace", options) -} - -func (dc *Collection) parseMultiActionsResult(response *types.KuzzleResponse) ([]*Document, error) { - if response.Error != nil { - return nil, response.Error - } - - var rawResult mActionResult - json.Unmarshal(response.Result, &rawResult) - - result := make([]*Document, rawResult.Total) - - for i, d := range rawResult.Hits { - json.Unmarshal(d, &result[i]) - result[i].collection = dc - } - - return result, nil -} - -func performMultipleCreate(dc *Collection, documents []*Document, action string, options types.QueryOptions) ([]*Document, error) { - ch := make(chan *types.KuzzleResponse) - - type subDoc struct { - Document interface{} `json:document` - } - - type CreationDocument struct { - Id string `json:"_id"` - Body *subDoc `json:"body"` - } - - docs := []*CreationDocument{} - - type body struct { - Documents []*CreationDocument `json:"documents"` - } - - for _, doc := range documents { - docs = append(docs, &CreationDocument{ - Id: doc.Id, - Body: &subDoc{ - Document: doc.Content, - }, - }) - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: action, - Body: &body{docs}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - return dc.parseMultiActionsResult(res) -} - -// MReplaceDocument replaces multiple documents at once -func (dc *Collection) MReplaceDocument(documents []*Document, options types.QueryOptions) ([]*Document, error) { - if len(documents) == 0 { - return nil, types.NewError("Collection.MReplaceDocument: please provide at least one document to replace", 400) - } - - ch := make(chan *types.KuzzleResponse) - - type CreationDocument struct { - Id string `json:"_id"` - Body interface{} `json:"body"` - } - docs := []*CreationDocument{} - - type body struct { - Documents []*CreationDocument `json:"documents"` - } - - for _, doc := range documents { - docs = append(docs, &CreationDocument{ - Id: doc.Id, - Body: doc.Content, - }) - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "mReplace", - Body: &body{docs}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - return dc.parseMultiActionsResult(res) -} - -// MDeleteDocument deletes multiple documents at once -func (dc *Collection) MDeleteDocument(ids []string, options types.QueryOptions) ([]string, error) { - if len(ids) == 0 { - return nil, types.NewError("Collection.MDeleteDocument: please provide at least one id of document to delete", 400) - } - - ch := make(chan *types.KuzzleResponse) - - type body struct { - Ids []string `json:"ids"` - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "mDelete", - Body: &body{Ids: ids}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - result := []string{} - json.Unmarshal(res.Result, &result) - - return result, nil -} - -// MGetDocument fetches multiple documents at once -func (dc *Collection) MGetDocument(ids []string, options types.QueryOptions) ([]*Document, error) { - if len(ids) == 0 { - return nil, types.NewError("Collection.MGetDocument: please provide at least one id of document to retrieve", 400) - } - - ch := make(chan *types.KuzzleResponse) - - type body struct { - Ids []string `json:"ids"` - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "mGet", - Body: &body{Ids: ids}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - return dc.parseMultiActionsResult(res) -} - -// MUpdateDocument updates multiple documents at once -func (dc *Collection) MUpdateDocument(documents []*Document, options types.QueryOptions) ([]*Document, error) { - if len(documents) == 0 { - return nil, types.NewError("Collection.MUpdateDocument: please provide at least one document to update", 400) - } - - ch := make(chan *types.KuzzleResponse) - - type CreationDocument struct { - Id string `json:"_id"` - Body interface{} `json:"body"` - } - docs := []*CreationDocument{} - - type body struct { - Documents []*CreationDocument `json:"documents"` - } - - for _, doc := range documents { - docs = append(docs, &CreationDocument{ - Id: doc.Id, - Body: doc.Content, - }) - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "mUpdate", - Body: &body{docs}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - return dc.parseMultiActionsResult(res) -} diff --git a/collection/m_routes_test.go b/collection/m_routes_test.go deleted file mode 100644 index 2044a318..00000000 --- a/collection/m_routes_test.go +++ /dev/null @@ -1,447 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestMCreateDocumentError(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MCreateDocument(documents, nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestMCreateDocument(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mCreate", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := map[string]interface{}{"Total": 2, "Hits": documents} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MCreateDocument(documents, nil) - assert.Equal(t, 2, len(res)) - - for index, doc := range res { - assert.Equal(t, documents[index].Id, doc.Id) - assert.Equal(t, documents[index].Content, doc.Content) - } -} - -func ExampleCollection_MCreateDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MCreateDocument([]*collection.Document{ - {Content: []byte(`{"title":"yolo"}`)}, - {Content: []byte(`{"title":"oloy"}`)}, - }, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} - -func TestMCreateOrReplaceDocumentError(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MCreateOrReplaceDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMCreateOrReplaceDocument(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mCreateOrReplace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := map[string]interface{}{"Total": 2, "Hits": documents} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MCreateOrReplaceDocument(documents, nil) - assert.Equal(t, 2, len(res)) - - for index, doc := range res { - assert.Equal(t, documents[index].Id, doc.Id) - assert.Equal(t, documents[index].Content, doc.Content) - } -} - -func ExampleCollection_MCreateOrReplaceDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MCreateOrReplaceDocument([]*collection.Document{ - {Content: []byte(`{"title":"yolo"}`)}, - {Content: []byte(`{"title":"oloy"}`)}, - }, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} - -func TestMReplaceDocumentEmptyDocuments(t *testing.T) { - documents := []*collection.Document{} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.MReplaceDocument: please provide at least one document to replace"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MReplaceDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMReplaceDocumentError(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MReplaceDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMReplaceDocument(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mReplace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := map[string]interface{}{"Total": 2, "Hits": documents} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MReplaceDocument(documents, nil) - assert.Equal(t, 2, len(res)) - - for index, doc := range res { - assert.Equal(t, documents[index].Id, doc.Id) - assert.Equal(t, documents[index].Content, doc.Content) - } -} - -func ExampleCollection_MReplaceDocument() { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MReplaceDocument(documents, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} - -func TestMDeleteDocumentEmptyIds(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("should have failed before that line")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MDeleteDocument([]string{}, nil) - assert.NotNil(t, err) - assert.Equal(t, "Collection.MDeleteDocument: please provide at least one id of document to delete", err.(*types.KuzzleError).Message) -} - -func TestMDeleteDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MDeleteDocument([]string{"foo", "bar"}, nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestMDeleteDocument(t *testing.T) { - ids := []string{"foo", "bar"} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mDelete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, []interface{}{"foo", "bar"}, parsedQuery.Body.(map[string]interface{})["ids"]) - - return &types.KuzzleResponse{Result: []byte(`["foo","bar"]`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MDeleteDocument(ids, nil) - assert.Equal(t, []string{"foo", "bar"}, res) -} - -func ExampleCollection_MDeleteDocument() { - ids := []string{"foo", "bar"} - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MDeleteDocument(ids, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestMGetDocumentEmptyIds(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.MGetDocument: please provide at least one id of document to retrieve"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MGetDocument([]string{}, nil) - assert.NotNil(t, err) -} - -func TestMGetDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MGetDocument([]string{"foo", "bar"}, nil) - assert.NotNil(t, err) -} - -func TestMGetDocument(t *testing.T) { - hits := []*collection.Document{ - {Id: "foo", Content: json.RawMessage(`{"title":"foo"}`)}, - {Id: "bar", Content: json.RawMessage(`{"title":"bar"}`)}, - } - - ids := []string{"foo", "bar"} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mGet", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, []interface{}{"foo", "bar"}, parsedQuery.Body.(map[string]interface{})["ids"]) - - res := map[string]interface{}{"Total": 2, "Hits": hits} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MGetDocument(ids, nil) - assert.Equal(t, 2, len(res)) - - for i := range res { - assert.Equal(t, hits[i].Id, res[i].Id) - assert.Equal(t, hits[i].Content, res[i].Content) - } -} - -func ExampleCollection_MGetDocument() { - ids := []string{"foo", "bar"} - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MGetDocument(ids, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} - -func TestMUpdateDocumentEmptyDocuments(t *testing.T) { - documents := []*collection.Document{} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.MUpdateDocument: please provide at least one document to update"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MUpdateDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMUpdateDocumentError(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MUpdateDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMUpdateDocument(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mUpdate", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := map[string]interface{}{"Total": 2, "Hits": documents} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MUpdateDocument(documents, nil) - assert.Equal(t, 2, len(res)) - - for index, doc := range res { - assert.Equal(t, documents[index].Id, doc.Id) - assert.Equal(t, documents[index].Content, doc.Content) - } -} - -func ExampleCollection_MUpdateDocument() { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MUpdateDocument(documents, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} diff --git a/collection/publish_message.go b/collection/publish_message.go deleted file mode 100644 index d941f60e..00000000 --- a/collection/publish_message.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// PublishMessage publishes a realtime message -// Takes an optional argument object with the following properties: -// - volatile (object, default: null): -// Additional information passed to notifications to other users -func (dc *Collection) PublishMessage(message interface{}, options types.QueryOptions) (bool, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "realtime", - Action: "publish", - Body: message, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - response := types.RealtimeResponse{} - - json.Unmarshal(res.Result, &response) - - return response.Published, nil -} diff --git a/collection/publish_message_test.go b/collection/publish_message_test.go deleted file mode 100644 index c24f9d3c..00000000 --- a/collection/publish_message_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestPublishKuzzleError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - type TestMessageStruct struct { - Title string `json:"title"` - } - - _, err := collection.NewCollection(k, "collection", "index").PublishMessage(TestMessageStruct{"yolo"}, nil) - assert.NotNil(t, err) -} - -func TestPublishMessage(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "publish", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - assert.Equal(t, "yolo", parsedQuery.Body.(map[string]interface{})["title"]) - - res := types.KuzzleResponse{Result: []byte(`{"published":true}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - type TestMessageStruct struct { - Title string `json:"title"` - } - - coll := collection.NewCollection(k, "collection", "index") - res, _ := coll.PublishMessage(TestMessageStruct{"yolo"}, nil) - - assert.Equal(t, true, res) -} - -func ExampleCollection_PublishMessage() { - type Document struct { - Title string - } - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - type TestMessageStruct struct { - Title string `json:"title"` - } - res, err := collection.NewCollection(k, "collection", "index").PublishMessage(TestMessageStruct{"yolo"}, nil) - - if err != nil { - panic(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/replace_document.go b/collection/replace_document.go deleted file mode 100644 index 223a8848..00000000 --- a/collection/replace_document.go +++ /dev/null @@ -1,36 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// ReplaceDocument replaces a document in Kuzzle. -func (dc *Collection) ReplaceDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.ReplaceDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "replace", - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - d := &Document{collection: dc} - json.Unmarshal(res.Result, d) - - return d, nil -} diff --git a/collection/replace_document_test.go b/collection/replace_document_test.go deleted file mode 100644 index e221bef6..00000000 --- a/collection/replace_document_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestReplaceDocumentEmptyId(t *testing.T) { - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ReplaceDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestReplaceDocumentError(t *testing.T) { - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestReplaceDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "replace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) - - res := collection.Document{Id: id, Content: []byte(`{"title": "jonathan"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.Equal(t, id, res.Id) -} - -func ExampleCollection_ReplaceDocument() { - type Document struct { - Title string - } - - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} diff --git a/collection/room.go b/collection/room.go deleted file mode 100644 index db764131..00000000 --- a/collection/room.go +++ /dev/null @@ -1,161 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" - "github.com/satori/go.uuid" -) - -type roomState int - -const ( - inactive roomState = iota - subscribing - active -) - -type Room struct { - // object configuration - filters interface{} - channel string - roomId string - requestId string - scope string - state string - subscribeToSelf bool - users string - Volatile types.VolatileData - err error - autoResubscribe bool - - // internal properties - collection *Collection - id string - internalState roomState - isListening bool - subscribing bool - - // channels - realtimeNotificationChannel chan<- types.KuzzleNotification - subscribeResponseChan chan types.SubscribeResponse - onReconnect chan interface{} - onDisconnect chan interface{} - onTokenExpired chan interface{} -} - -// NewRoom instanciates a new Room; this type is the result of a subscription request, -// allowing to manipulate the subscription itself. -// In Kuzzle, you don't exactly subscribe to a room or a topic but, instead, you subscribe to documents. -// What it means is that, to subscribe, you provide to Kuzzle a set of matching filters. -// Once you have subscribed, if a pub/sub message is published matching your filters, or if a matching stored -// document change (because it is created, updated or deleted), then you'll receive a notification about it. -func NewRoom(c *Collection, filters interface{}, opts types.RoomOptions) *Room { - if opts == nil { - opts = types.NewRoomOptions() - } - - u, _ := uuid.NewV4() - r := &Room{ - scope: opts.Scope(), - state: opts.State(), - users: opts.Users(), - filters: filters, - id: u.String(), - collection: c, - subscribeToSelf: opts.SubscribeToSelf(), - Volatile: opts.Volatile(), - internalState: inactive, - isListening: false, - autoResubscribe: opts.AutoResubscribe(), - onReconnect: make(chan interface{}), - onDisconnect: make(chan interface{}), - onTokenExpired: make(chan interface{}), - } - return r -} - -// AddListener Adds a listener to a Kuzzle global event. When an event is fired, listeners are called in the order of their insertion. -func (room *Room) AddListener(event int, channel chan<- interface{}) { - room.collection.Kuzzle.AddListener(event, channel) -} - -// On is an alias to the AddListener function -func (room *Room) On(event int, channel chan<- interface{}) { - room.collection.Kuzzle.AddListener(event, channel) -} - -// Remove all listener by event type or all listener if event == -1 -func (room *Room) RemoveAllListeners(event int) { - room.collection.Kuzzle.RemoveAllListeners(event) -} - -// RemoveListener removes a listener -func (room *Room) RemoveListener(event int, channel chan<- interface{}) { - room.collection.Kuzzle.RemoveListener(event, channel) -} - -func (room *Room) Once(event int, channel chan<- interface{}) { - room.collection.Kuzzle.Once(event, channel) -} - -func (room *Room) ListenerCount(event int) int { - return room.collection.Kuzzle.ListenerCount(event) -} - -// RealtimeChannel returns the channel handling the notifications received by this room -func (room *Room) RealtimeChannel() chan<- types.KuzzleNotification { - return room.realtimeNotificationChannel -} - -// RoomId returns the kuzzle room unique identifier -func (room *Room) RoomId() string { - return room.roomId -} - -// Id returns the internal object identifier (internal use only) -func (room *Room) Id() string { - return room.id -} - -// Filters returns the room's filters -func (room *Room) Filters() interface{} { - return room.filters -} - -// ResponseChannel returns the channel handling the subscription request result -func (room *Room) ResponseChannel() chan types.SubscribeResponse { - return room.subscribeResponseChan -} - -// Channel is the getter for the channel's unique identifier -func (room *Room) Channel() string { - return room.channel -} - -func (room *Room) Scope() string { - return room.scope -} - -func (room *Room) State() string { - return room.state -} - -func (room *Room) Users() string { - return room.users -} - -//OnDone Calls the provided callback when the subscription finishes. -func (room *Room) OnDone(c chan types.SubscribeResponse) *Room { - if room.err != nil { - c <- types.SubscribeResponse{Error: room.err} - } else if room.internalState == active { - c <- types.SubscribeResponse{} - } else { - room.subscribeResponseChan = c - } - - return room -} - -func (room *Room) SubscribeToSelf() bool { - return room.subscribeToSelf -} diff --git a/collection/room_count.go b/collection/room_count.go deleted file mode 100644 index 4bf69c11..00000000 --- a/collection/room_count.go +++ /dev/null @@ -1,40 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/types" -) - -// Count returns the number of other subscriptions on that room. -func (room *Room) Count() (int, error) { - if room.internalState != active { - return -1, types.NewError("Cannot count subscriptions on a non-active room", 400) - } - - query := &types.KuzzleRequest{ - Controller: "realtime", - Action: "count", - Body: struct { - RoomId string `json:"roomId"` - }{room.roomId}, - } - - result := make(chan *types.KuzzleResponse) - - go room.collection.Kuzzle.Query(query, nil, result) - - res := <-result - - if res.Error != nil { - return -1, res.Error - } - - count := struct { - Count int `json:"count"` - }{} - - json.Unmarshal(res.Result, &count) - - return count.Count, nil -} diff --git a/collection/room_count_test.go b/collection/room_count_test.go deleted file mode 100644 index a43c41d2..00000000 --- a/collection/room_count_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package collection - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestRoomCountError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := NewRoom(NewCollection(k, "collection", "index"), nil, nil).Count() - assert.NotNil(t, err) -} - -func TestRoomCount(t *testing.T) { - type result struct { - Count int `json:"count"` - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - res := result{Count: 10} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.internalState = active - res, _ := r.Count() - assert.Equal(t, 10, res) -} - -func ExampleRoom_Count() { - type result struct { - Count int `json:"count"` - } - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := NewRoom(NewCollection(k, "collection", "index"), nil, nil).Count() - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/room_subscribe.go b/collection/room_subscribe.go deleted file mode 100644 index b9a71124..00000000 --- a/collection/room_subscribe.go +++ /dev/null @@ -1,113 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/event" - - "github.com/kuzzleio/sdk-go/types" -) - -// Renew the subscription. Force a resubscription using the same filters -// if no new ones are provided. -// Unsubscribes first if this Room was already listening to events. -func (room *Room) Subscribe(realtimeNotificationChannel chan<- types.KuzzleNotification) { - if room.internalState == active { - if room.subscribeResponseChan != nil { - room.subscribeResponseChan <- types.SubscribeResponse{Room: room} - } - return - } - - if room.internalState == subscribing { - return - } - - room.err = nil - room.internalState = subscribing - - go func() { - result := make(chan *types.KuzzleResponse) - - opts := types.NewQueryOptions() - opts.SetVolatile(room.Volatile) - - go room.collection.Kuzzle.Query(&types.KuzzleRequest{ - Controller: "realtime", - Action: "subscribe", - Index: room.collection.index, - Collection: room.collection.collection, - Scope: room.scope, - State: room.state, - Users: room.users, - Body: room.filters, - }, opts, result) - - res := <-result - room.subscribing = false - room.internalState = subscribing - - if res.Error != nil { - if res.Error.Message == "Not Connected" { - c := make(chan interface{}) - room.Once(event.Connected, c) - go func() { - <-c - room.internalState = inactive - room.err = nil - room.Subscribe(realtimeNotificationChannel) - }() - return - } - room.internalState = inactive - if room.subscribeResponseChan != nil { - room.subscribeResponseChan <- types.SubscribeResponse{Error: res.Error} - } - return - } - - type RoomResult struct { - RequestId string `json:"requestId"` - RoomId string `json:"roomId"` - Channel string `json:"channel"` - } - - var resRoom RoomResult - json.Unmarshal(res.Result, &resRoom) - - room.requestId = resRoom.RequestId - room.channel = resRoom.Channel - room.roomId = resRoom.RoomId - room.internalState = active - - room.realtimeNotificationChannel = realtimeNotificationChannel - room.collection.Kuzzle.RegisterRoom(room) - - if room.subscribeResponseChan != nil { - room.subscribeResponseChan <- types.SubscribeResponse{Room: room} - } - if room.isListening { - go func() { - <-room.onDisconnect - room.internalState = inactive - }() - go func() { - <-room.onTokenExpired - room.internalState = inactive - }() - go func() { - <-room.onReconnect - room.internalState = inactive - - if room.autoResubscribe { - room.Subscribe(realtimeNotificationChannel) - } - }() - - room.AddListener(event.Disconnected, room.onDisconnect) - room.AddListener(event.TokenExpired, room.onTokenExpired) - room.AddListener(event.Reconnected, room.onReconnect) - room.isListening = true - } - }() -} diff --git a/collection/room_subscribe_test.go b/collection/room_subscribe_test.go deleted file mode 100644 index db2f5ea8..00000000 --- a/collection/room_subscribe_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package collection - -import ( - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestSubscribeQueryError(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "ah!"}} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - subResChan := make(chan types.SubscribeResponse) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.OnDone(subResChan) - r.Subscribe(nil) - - res := <-subResChan - assert.Equal(t, "ah!", res.Error.Error()) -} - -func TestRenewWithSubscribeToSelf(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{RequestId: "ah!", Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - subResChan := make(chan types.SubscribeResponse) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.OnDone(subResChan) - r.Subscribe(nil) - - res := <-subResChan - assert.Equal(t, "42", res.Room.RoomId()) -} - -func TestRoomSubscribe(t *testing.T) { - var k *kuzzle.Kuzzle - - done := make(chan bool) - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - MockAddListener: func(e int, c chan<- interface{}) { - done <- true - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.isListening = true - r.Subscribe(nil) - <-done -} - -func TestRoomSubscribeAlreadyActive(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.internalState = active - r.subscribeResponseChan = make(chan types.SubscribeResponse) - done := make(chan bool) - - go func() { - <-r.subscribeResponseChan - done <- true - }() - r.Subscribe(nil) - - <-done -} - -func TestRoomSubscribeNotConnected(t *testing.T) { - var k *kuzzle.Kuzzle - - done := make(chan bool) - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Not Connected"}} - }, - MockOnce: func(e int, c chan<- interface{}) { - done <- true - }, - } - - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - r.Subscribe(nil) - <-done -} - -func ExampleRoom_Subscribe() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - NewRoom(NewCollection(k, "collection", "index"), nil, nil).Subscribe(nil) -} diff --git a/collection/room_test.go b/collection/room_test.go deleted file mode 100644 index 69bb634a..00000000 --- a/collection/room_test.go +++ /dev/null @@ -1,294 +0,0 @@ -package collection - -import ( - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestInitRoomWithoutOptions(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - assert.NotNil(t, r) -} - -func TestRoomFilters(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - - k, _ = kuzzle.NewKuzzle(c, nil) - cl := NewCollection(k, "collection", "index") - - type SubscribeFiltersValues struct { - Values []string `json:"values"` - } - type SubscribeFilters struct { - Ids SubscribeFiltersValues `json:"ids"` - } - var filters = SubscribeFilters{ - Ids: SubscribeFiltersValues{ - Values: []string{"1"}, - }, - } - - c.SetState(state.Connected) - rtc := make(chan types.KuzzleNotification) - res := cl.Subscribe(filters, types.NewRoomOptions(), rtc) - - assert.Equal(t, filters, res.Filters()) -} - -func ExampleRoom_Filters() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := NewCollection(k, "collection", "index") - - type SubscribeFiltersValues struct { - Values []string `json:"values"` - } - type SubscribeFilters struct { - Ids SubscribeFiltersValues `json:"ids"` - } - var filters = SubscribeFilters{ - Ids: SubscribeFiltersValues{ - Values: []string{"1"}, - }, - } - - c.SetState(state.Connected) - rtc := make(chan types.KuzzleNotification) - res := cl.Subscribe(filters, types.NewRoomOptions(), rtc) - - fmt.Println(res) -} - -func TestRoomRealtimeChannel(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - - k, _ = kuzzle.NewKuzzle(c, nil) - cl := NewCollection(k, "collection", "index") - - type SubscribeFiltersValues struct { - Values []string `json:"values"` - } - type SubscribeFilters struct { - Ids SubscribeFiltersValues `json:"ids"` - } - var filters = SubscribeFilters{ - Ids: SubscribeFiltersValues{ - Values: []string{"1"}, - }, - } - - c.SetState(state.Connected) - rtc := make(chan<- types.KuzzleNotification) - res := cl.Subscribe(filters, nil, rtc) - <-res.ResponseChannel() - - assert.Equal(t, rtc, res.RealtimeChannel()) -} - -func ExampleRoom_RealtimeChannel() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := NewCollection(k, "collection", "index") - - type SubscribeFiltersValues struct { - Values []string `json:"values"` - } - type SubscribeFilters struct { - Ids SubscribeFiltersValues `json:"ids"` - } - var filters = SubscribeFilters{ - Ids: SubscribeFiltersValues{ - Values: []string{"1"}, - }, - } - - c.SetState(state.Connected) - rtc := make(chan<- types.KuzzleNotification) - res := cl.Subscribe(filters, types.NewRoomOptions(), rtc) - rtChannel := res.RealtimeChannel() - - fmt.Println(rtChannel) -} - -func TestAddListener(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockAddListener: func(e int, c chan<- interface{}) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - ch := make(chan interface{}) - - r.AddListener(0, ch) - assert.Equal(t, true, called) -} - -func TestRemoveListener(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockRemoveListener: func(e int, c chan<- interface{}) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - ch := make(chan interface{}) - - r.RemoveListener(0, ch) - assert.Equal(t, true, called) -} -func TestRemoveAllListener(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockRemoveAllListeners: func(e int) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - r.RemoveAllListeners(0) - assert.Equal(t, true, called) -} - -func TestOnce(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockOnce: func(e int, c chan<- interface{}) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - ch := make(chan interface{}) - - r.Once(0, ch) - assert.Equal(t, true, called) -} - -func TestOn(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockAddListener: func(e int, c chan<- interface{}) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - ch := make(chan interface{}) - - r.On(0, ch) - assert.Equal(t, true, called) -} - -func TestListenerCount(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockListenerCount: func(e int) int { - called = true - return -1 - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - r.ListenerCount(0) - assert.Equal(t, true, called) -} -func TestOnDoneError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return nil - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - ch := make(chan types.SubscribeResponse) - done := make(chan bool) - - go func() { - <-ch - done <- true - }() - r.err = &types.KuzzleError{Message: "Room has an error"} - r.OnDone(ch) - - <-done -} - -func TestOnDoneAlreadyActive(t *testing.T) { - c := &internal.MockedConnection{} - - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - ch := make(chan types.SubscribeResponse) - done := make(chan bool) - - go func() { - <-ch - done <- true - }() - - r.internalState = active - r.OnDone(ch) - - <-done -} -func TestOnDone(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - ch := make(chan types.SubscribeResponse) - r.OnDone(ch) - - r.Subscribe(nil) - assert.Equal(t, ch, r.subscribeResponseChan) -} diff --git a/collection/room_unsubscribe.go b/collection/room_unsubscribe.go deleted file mode 100644 index 4371f801..00000000 --- a/collection/room_unsubscribe.go +++ /dev/null @@ -1,41 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/event" - "github.com/kuzzleio/sdk-go/types" -) - -// Unsubscribe from Kuzzle. Stop listening immediately. -// If there is no listener left on that Room, sends an unsubscribe request to Kuzzle, once -// pending subscriptions reaches 0, and only if there is still no listener on that Room. -// We wait for pending subscriptions to finish to avoid unsubscribing while another subscription on that Room is -// Unsubscribe from Kuzzle. Stop listening immediately. -func (room *Room) Unsubscribe() error { - if room.internalState == subscribing { - return types.NewError("Cannot unsubscribe a room while a subscription attempt is underway") - } - - if room.isListening { - room.collection.Kuzzle.RemoveListener(event.Disconnected, room.onDisconnect) - room.collection.Kuzzle.RemoveListener(event.TokenExpired, room.onTokenExpired) - room.collection.Kuzzle.RemoveListener(event.Reconnected, room.onReconnect) - room.isListening = false - } - - if room.internalState == active { - room.collection.Kuzzle.UnregisterRoom(room.id) - - type body struct { - RoomId string `json:"roomId"` - } - - query := &types.KuzzleRequest{ - Controller: "realtime", - Action: "unsubscribe", - Body: &body{room.roomId}, - } - - go room.collection.Kuzzle.Query(query, nil, nil) - } - return nil -} diff --git a/collection/room_unsubscribe_test.go b/collection/room_unsubscribe_test.go deleted file mode 100644 index a89b0bff..00000000 --- a/collection/room_unsubscribe_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package collection - -import ( - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/stretchr/testify/assert" -) - -func TestUnsubscribeSubscribing(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{} - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.internalState = subscribing - assert.NotNil(t, r.Unsubscribe()) -} - -func TestUnsubscribe(t *testing.T) { - var k *kuzzle.Kuzzle - var removedListener bool - c := &internal.MockedConnection{ - MockRemoveListener: func(e int, c chan<- interface{}) { - removedListener = true - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.isListening = true - r.internalState = active - r.Unsubscribe() - assert.Equal(t, true, removedListener) -} diff --git a/collection/scroll.go b/collection/scroll.go deleted file mode 100644 index 4950968d..00000000 --- a/collection/scroll.go +++ /dev/null @@ -1,29 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Scroll passes a "scroll" option to search queries, creating persistent paginated results. -func (dc *Collection) Scroll(scrollId string, options types.QueryOptions) (*SearchResult, error) { - if scrollId == "" { - return nil, types.NewError("Collection.Scroll: scroll id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "document", - Action: "scroll", - ScrollId: scrollId, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - return NewSearchResult(dc, nil, options, res), nil -} diff --git a/collection/scroll_test.go b/collection/scroll_test.go deleted file mode 100644 index 68b50e51..00000000 --- a/collection/scroll_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestScrollEmptyScrollId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.Scroll: scroll id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").Scroll("", nil) - assert.NotNil(t, err) -} - -func TestScrollError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").Scroll("f00b4r", nil) - assert.NotNil(t, err) -} - -func TestScroll(t *testing.T) { - hits := []*collection.Document{ - {Id: "doc42", Content: json.RawMessage(`{"foo":"bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "scroll", parsedQuery.Action) - - res := map[string]interface{}{"Total": 42, "Hits": hits} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").Scroll("f00b4r", nil) - assert.Equal(t, 42, res.Total) - assert.Equal(t, hits[0].Id, res.Documents[0].Id) - assert.Equal(t, hits[0].Content, res.Documents[0].Content) - assert.Equal(t, len(hits), len(res.Documents)) -} - -func ExampleCollection_Scroll(t *testing.T) { - hits := make([]*collection.Document, 1) - hits[0] = &collection.Document{Id: "doc42", Content: json.RawMessage(`{"foo":"bar"}`)} - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").Scroll("f00b4r", nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Documents[0].Id, res.Documents[0].Content) -} diff --git a/collection/search.go b/collection/search.go deleted file mode 100644 index 039ee4e0..00000000 --- a/collection/search.go +++ /dev/null @@ -1,38 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Search documents in the given Collection, using provided filters and option. -func (dc *Collection) Search(filters *types.SearchFilters, options types.QueryOptions) (*SearchResult, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "search", - Body: filters, - } - - if options != nil { - query.From = options.From() - query.Size = options.Size() - - scroll := options.Scroll() - if scroll != "" { - query.Scroll = scroll - } - } - - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - return NewSearchResult(dc, filters, options, res), nil -} diff --git a/collection/search_result.go b/collection/search_result.go deleted file mode 100644 index 2ce8dd6f..00000000 --- a/collection/search_result.go +++ /dev/null @@ -1,116 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -type SearchResult struct { - Collection *Collection - Documents []*Document - Total int - Fetched int - Aggregations map[string]interface{} - Options types.QueryOptions - Filters *types.SearchFilters -} - -func NewSearchResult(collection *Collection, filters *types.SearchFilters, options types.QueryOptions, raw *types.KuzzleResponse) *SearchResult { - type ParseSearchResult struct { - Documents []*Document `json:"hits"` - Total int `json:"total"` - ScrollId string `json:"_scroll_id"` - Aggregations map[string]interface{} `json:"aggregations"` - } - - var parsed ParseSearchResult - json.Unmarshal(raw.Result, &parsed) - - for _, d := range parsed.Documents { - d.collection = collection - } - - sr := &SearchResult{ - Collection: collection, - Filters: filters, - Documents: parsed.Documents, - Total: parsed.Total, - Fetched: len(parsed.Documents), - Aggregations: parsed.Aggregations, - Options: types.NewQueryOptions(), - } - - sr.Options.SetScrollId(parsed.ScrollId) - - if options != nil { - sr.Options.SetFrom(options.From()) - sr.Options.SetSize(options.Size()) - } else { - sr.Options.SetFrom(0) - sr.Options.SetSize(0) - } - - return sr -} - -// FetchNext returns a new SearchResult that corresponds to the next result page -func (ksr *SearchResult) FetchNext() (*SearchResult, error) { - if ksr.Fetched >= ksr.Total { - return nil, nil - } - - if ksr.Options.ScrollId() != "" { - res, err := ksr.Collection.Scroll(ksr.Options.ScrollId(), nil) - return ksr.afterFetch(res, err) - } - - if ksr.Options.Size() > 0 { - if ksr.Filters != nil && len(ksr.Filters.Sort) > 0 { - source := ksr.Documents[len(ksr.Documents)-1].SourceToMap() - - filters := &types.SearchFilters{ - Query: ksr.Filters.Query, - Sort: ksr.Filters.Sort, - Aggregations: ksr.Filters.Aggregations, - } - - for _, sortRules := range ksr.Filters.Sort { - switch t := sortRules.(type) { - case string: - filters.SearchAfter = append(filters.SearchAfter, source[t]) - case map[string]interface{}: - for field := range t { - filters.SearchAfter = append(filters.SearchAfter, source[field]) - } - } - } - - res, err := ksr.Collection.Search(filters, ksr.Options) - return ksr.afterFetch(res, err) - } else { - opts := types.NewQueryOptions() - opts.SetFrom(ksr.Options.From() + ksr.Options.Size()) - - if opts.From() >= ksr.Total { - return nil, nil - } - - opts.SetSize(ksr.Options.Size()) - - res, err := ksr.Collection.Search(ksr.Filters, opts) - return ksr.afterFetch(res, err) - } - } - - return nil, types.NewError("SearchResult.FetchNext: Unable to retrieve results: missing scrollId or from/size parameters", 400) -} - -func (ksr *SearchResult) afterFetch(nextResult *SearchResult, err error) (*SearchResult, error) { - if err != nil { - return nextResult, err - } - - nextResult.Fetched = len(nextResult.Documents) + ksr.Fetched - - return nextResult, nil -} diff --git a/collection/search_result_test.go b/collection/search_result_test.go deleted file mode 100644 index 709d63e1..00000000 --- a/collection/search_result_test.go +++ /dev/null @@ -1,249 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func searchResultSetup(c *internal.MockedConnection) *collection.SearchResult { - var _c *internal.MockedConnection - - if c == nil { - _c = &internal.MockedConnection{} - } else { - _c = c - } - - kuzzle, _ := kuzzle.NewKuzzle(_c, nil) - cl := collection.NewCollection(kuzzle, "collection", "index") - - filters := &types.SearchFilters{} - options := types.NewQueryOptions() - options.SetSize(0) - options.SetFrom(0) - response := &types.KuzzleResponse{} - - response.Result, _ = json.Marshal(map[string]interface{}{ - "total": 4, - "hits": []map[string]interface{}{ - { - "_id": "Bateman", - "_source": map[string]string{ - "firstname": "Patrick", - "killcount": "20", - }, - }, - { - "_id": "Morgan", - "_source": map[string]string{ - "firstname": "Dexter", - "killcount": "135?", - }, - }, - }, - "aggregations": map[string]interface{}{"foo": "bar"}, - }) - - return collection.NewSearchResult(cl, filters, options, response) -} - -func TestConstructor(t *testing.T) { - kuzzle, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - cl := collection.NewCollection(kuzzle, "collection", "index") - - filters := &types.SearchFilters{} - options := types.NewQueryOptions() - options.SetSize(42) - options.SetFrom(13) - response := &types.KuzzleResponse{} - - response.Result, _ = json.Marshal(map[string]interface{}{ - "total": 4, - "_scroll_id": "fooscrollid", - "hits": []map[string]string{ - {"_id": "foo", "_source": "bar"}, - {"_id": "Bateman", "_source": "Patrick"}, - }, - "aggregations": map[string]interface{}{"foo": "bar"}, - }) - - searchResult := collection.NewSearchResult(cl, filters, options, response) - - assert.Equal(t, filters, searchResult.Filters) - assert.Equal(t, cl, searchResult.Collection) - assert.Equal(t, "fooscrollid", searchResult.Options.ScrollId()) - assert.Equal(t, 13, searchResult.Options.From()) - assert.Equal(t, 42, searchResult.Options.Size()) - assert.Equal(t, 4, searchResult.Total) - assert.Equal(t, 2, searchResult.Fetched) - assert.Equal(t, "foo", searchResult.Documents[0].Id) - assert.Equal(t, "Bateman", searchResult.Documents[1].Id) - assert.Equal(t, "bar", searchResult.Aggregations["foo"]) -} - -func TestFetchNextNoResultLeft(t *testing.T) { - searchResult := searchResultSetup(nil) - - searchResult.Fetched = 4 - - res, err := searchResult.FetchNext() - - assert.Nil(t, res) - assert.Nil(t, err) -} - -func TestFetchNextBadOptions(t *testing.T) { - searchResult := searchResultSetup(nil) - - searchResult.Options.SetSize(0) - searchResult.Options.SetScrollId("") - - res, err := searchResult.FetchNext() - - assert.Nil(t, res) - assert.Equal(t, &types.KuzzleError{Message: "SearchResult.FetchNext: Unable to retrieve results: missing scrollId or from/size parameters", Stack: "", Status: 400}, err) -} - -func TestFetchNextWithScroll(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "scroll", parsedQuery.Action) - assert.Equal(t, "foobar", parsedQuery.ScrollId) - - fakeResult, _ := json.Marshal(map[string]interface{}{ - "total": 4, - "_scroll_id": "nextscrollid", - "hits": []map[string]string{ - {"_id": "foo2", "_source": "bar"}, - {"_id": "Bateman2", "_source": "Patrick"}, - }, - }) - - return &types.KuzzleResponse{Result: fakeResult} - }, - } - - searchResult := searchResultSetup(c) - - assert.Equal(t, 2, searchResult.Fetched) - - searchResult.Options.SetSize(0) - searchResult.Options.SetScrollId("foobar") - next, err := searchResult.FetchNext() - - assert.Nil(t, err) - assert.Equal(t, "nextscrollid", next.Options.ScrollId()) - assert.Equal(t, 4, next.Fetched) - assert.Equal(t, 4, next.Total) - assert.Equal(t, "foo2", next.Documents[0].Id) - assert.Equal(t, "Bateman2", next.Documents[1].Id) - assert.Nil(t, next.Aggregations) -} - -func TestFetchNextWithPage(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "search", parsedQuery.Action) - assert.Equal(t, 2, parsedQuery.From) - assert.Equal(t, 2, parsedQuery.Size) - - fakeResult, _ := json.Marshal(map[string]interface{}{ - "total": 4, - "hits": []map[string]string{ - {"_id": "foo2", "_source": "bar"}, - {"_id": "Bateman2", "_source": "Patrick"}, - }, - }) - - return &types.KuzzleResponse{Result: fakeResult} - }, - } - - searchResult := searchResultSetup(c) - - assert.Equal(t, 2, searchResult.Fetched) - - searchResult.Options.SetSize(2) - next, err := searchResult.FetchNext() - - assert.Nil(t, err) - assert.Equal(t, 4, next.Fetched) - assert.Equal(t, 4, next.Total) - assert.Equal(t, "foo2", next.Documents[0].Id) - assert.Equal(t, "Bateman2", next.Documents[1].Id) - assert.Nil(t, next.Aggregations) -} - -func TestFetchNextDoNotFetchAfterLastPage(t *testing.T) { - searchResult := searchResultSetup(nil) - - assert.Equal(t, 2, searchResult.Fetched) - - searchResult.Options.SetFrom(2) - searchResult.Options.SetSize(2) - next, err := searchResult.FetchNext() - - assert.Nil(t, err) - assert.Nil(t, next) -} - -func TestFetchNextWithSearchAfter(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "search", parsedQuery.Action) - - filters := &types.SearchFilters{} - rawBody, _ := json.Marshal(parsedQuery.Body) - json.Unmarshal(rawBody, filters) - - assert.Equal(t, "Dexter", filters.SearchAfter[0]) - assert.Equal(t, "135?", filters.SearchAfter[1]) - - fakeResult, _ := json.Marshal(map[string]interface{}{ - "total": 4, - "hits": []map[string]string{ - {"_id": "foo2", "_source": "bar"}, - {"_id": "Bateman2", "_source": "Patrick"}, - }, - }) - - return &types.KuzzleResponse{Result: fakeResult} - }, - } - - searchResult := searchResultSetup(c) - - assert.Equal(t, 2, searchResult.Fetched) - - searchResult.Filters.Sort = append(searchResult.Filters.Sort, "firstname") - searchResult.Filters.Sort = append(searchResult.Filters.Sort, map[string]interface{}{ - "killcount": map[string]string{"order": "asc"}, - }) - - searchResult.Options.SetSize(2) - next, err := searchResult.FetchNext() - - assert.Nil(t, err) - assert.Equal(t, 4, next.Fetched) - assert.Equal(t, 4, next.Total) - assert.Equal(t, "foo2", next.Documents[0].Id) - assert.Equal(t, "Bateman2", next.Documents[1].Id) - assert.Nil(t, next.Aggregations) -} diff --git a/collection/search_specifications.go b/collection/search_specifications.go new file mode 100644 index 00000000..eac74f32 --- /dev/null +++ b/collection/search_specifications.go @@ -0,0 +1,42 @@ +package collection + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// SearchSpecifications searches specifications across indexes/collections according to the provided filters. +func (dc *Collection) SearchSpecifications(options types.SpecificationSearchOptions) (*types.SpecificationSearchResult, error) { + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "collection", + Action: "searchSpecifications", + Body: struct { + Query interface{} `json:"query"` + }{Query: filters}, + } + + if options != nil { + query.From = options.From() + query.Size = options.Size() + scroll := options.Scroll() + if scroll != "" { + query.Scroll = scroll + } + } + + go dc.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + specifications := &types.SpecificationSearchResult{} + json.Unmarshal(res.Result, specifications) + + return specifications, nil +} diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go new file mode 100644 index 00000000..10c48eae --- /dev/null +++ b/collection/search_specifications_test.go @@ -0,0 +1 @@ +package collection_test diff --git a/collection/search_test.go b/collection/search_test.go deleted file mode 100644 index 227f224e..00000000 --- a/collection/search_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestSearchError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").Search(&types.SearchFilters{}, nil) - assert.NotNil(t, err) -} - -func TestSearch(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "search", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - rawresult, _ := json.Marshal(map[string]interface{}{ - "total": 42, - "hits": []map[string]interface{}{ - { - "_id": "doc42", - "_source": map[string]string{"foo": "bar"}, - }, - }, - }) - return &types.KuzzleResponse{Result: rawresult} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").Search(&types.SearchFilters{}, nil) - assert.Equal(t, 42, res.Total) - assert.Equal(t, 1, len(res.Documents)) - assert.Equal(t, res.Documents[0].Id, "doc42") - assert.Equal(t, res.Documents[0].SourceToMap(), collection.DocumentContent{"foo": "bar"}) -} - -func ExampleCollection_Search() { - hits := make([]*collection.Document, 1) - hits[0] = &collection.Document{Id: "doc42", Content: json.RawMessage(`{"foo":"bar"}`)} - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").Search(&types.SearchFilters{}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestSearchWithScroll(t *testing.T) { - hits := []*collection.Document{ - {Id: "doc42", Content: json.RawMessage(`{"foo":"bar"}`)}, - } - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "search", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, 2, parsedQuery.From) - assert.Equal(t, 4, parsedQuery.Size) - assert.Equal(t, "1m", parsedQuery.Scroll) - - rawresult, _ := json.Marshal(map[string]interface{}{ - "total": 42, - "hits": []map[string]interface{}{ - { - "_id": "doc42", - "_source": map[string]string{"foo": "bar"}, - }, - }, - "_scroll_id": "f00b4r", - }) - return &types.KuzzleResponse{Result: rawresult} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetFrom(2) - opts.SetSize(4) - opts.SetScroll("1m") - res, _ := collection.NewCollection(k, "collection", "index").Search(&types.SearchFilters{}, opts) - assert.Equal(t, 42, res.Total) - assert.Equal(t, len(hits), len(res.Documents)) - assert.Equal(t, "f00b4r", res.Options.ScrollId()) - assert.Equal(t, res.Documents[0].Id, hits[0].Id) - assert.Equal(t, res.Documents[0].Content, hits[0].Content) -} diff --git a/collection/specifications.go b/collection/specifications.go index ffa7ed13..2ece201d 100644 --- a/collection/specifications.go +++ b/collection/specifications.go @@ -1,197 +1,104 @@ package collection -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" -) - -// GetSpecifications retrieves the current specifications of the collection. -func (dc *Collection) GetSpecifications(options types.QueryOptions) (*types.SpecificationEntry, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "collection", - Action: "getSpecifications", - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - specifications := &types.SpecificationEntry{} - json.Unmarshal(res.Result, specifications) - - return specifications, nil -} - -// SearchSpecifications searches specifications across indexes/collections according to the provided filters. -func (dc *Collection) SearchSpecifications(filters interface{}, options types.QueryOptions) (*types.SpecificationSearchResult, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "collection", - Action: "searchSpecifications", - Body: struct { - Query interface{} `json:"query"` - }{Query: filters}, - } - - if options != nil { - query.From = options.From() - query.Size = options.Size() - scroll := options.Scroll() - if scroll != "" { - query.Scroll = scroll - } - } - - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - specifications := &types.SpecificationSearchResult{} - json.Unmarshal(res.Result, specifications) - - return specifications, nil -} - -// ScrollSpecifications retrieves next result of a specification search with scroll query. -func (dc *Collection) ScrollSpecifications(scrollId string, options types.QueryOptions) (*types.SpecificationSearchResult, error) { - if scrollId == "" { - return nil, types.NewError("Collection.ScrollSpecifications: scroll id required") - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "collection", - Action: "scrollSpecifications", - ScrollId: scrollId, - } - - if options != nil { - scroll := options.Scroll() - if scroll != "" { - query.Scroll = scroll - } - } - - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - specifications := &types.SpecificationSearchResult{} - json.Unmarshal(res.Result, specifications) - - return specifications, nil -} - -// ValidateSpecifications validates the provided specifications. -func (dc *Collection) ValidateSpecifications(specifications *types.Specification, options types.QueryOptions) (*types.ValidResponse, error) { - ch := make(chan *types.KuzzleResponse) - - type Specifications map[string]map[string]*types.Specification - - specificationsData := Specifications{ - dc.index: { - dc.collection: specifications, - }, - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "collection", - Action: "validateSpecifications", - Body: specificationsData, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - response := &types.ValidResponse{} - json.Unmarshal(res.Result, response) - - return response, nil -} - -// UpdateSpecifications updates the current specifications of this collection. -func (dc *Collection) UpdateSpecifications(specifications *types.Specification, options types.QueryOptions) (*types.Specification, error) { - ch := make(chan *types.KuzzleResponse) - - type Specifications map[string]map[string]*types.Specification - - specificationsData := &Specifications{ - dc.index: { - dc.collection: specifications, - }, - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "collection", - Action: "updateSpecifications", - Body: specificationsData, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - specification := &Specifications{} - json.Unmarshal(res.Result, specification) - - result := (*specification)[dc.index][dc.collection] - - return result, nil -} - -// DeleteSpecifications deletes the current specifications of this collection. -func (dc *Collection) DeleteSpecifications(options types.QueryOptions) (bool, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "collection", - Action: "deleteSpecifications", - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - ack := &struct { - Acknowledged bool `json:"acknowledged"` - }{} - err := json.Unmarshal(res.Result, ack) - if err != nil { - return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) - } - return ack.Acknowledged, nil -} +// +//import ( +// "encoding/json" +// "fmt" +// "github.com/kuzzleio/sdk-go/types" +//) +// +//// ScrollSpecifications retrieves next result of a specification search with scroll query. +//func (dc *Collection) ScrollSpecifications(scrollId string, options types.QueryOptions) (*types.SpecificationSearchResult, error) { +// if scrollId == "" { +// return nil, types.NewError("Collection.ScrollSpecifications: scroll id required") +// } +// +// ch := make(chan *types.KuzzleResponse) +// +// query := &types.KuzzleRequest{ +// Controller: "collection", +// Action: "scrollSpecifications", +// ScrollId: scrollId, +// } +// +// if options != nil { +// scroll := options.Scroll() +// if scroll != "" { +// query.Scroll = scroll +// } +// } +// +// go dc.Kuzzle.Query(query, options, ch) +// +// res := <-ch +// +// if res.Error != nil { +// return nil, res.Error +// } +// +// specifications := &types.SpecificationSearchResult{} +// json.Unmarshal(res.Result, specifications) +// +// return specifications, nil +//} +// +//// ValidateSpecifications validates the provided specifications. +//func (dc *Collection) ValidateSpecifications(specifications *types.Specification, options types.QueryOptions) (*types.ValidResponse, error) { +// ch := make(chan *types.KuzzleResponse) +// +// type Specifications map[string]map[string]*types.Specification +// +// specificationsData := Specifications{ +// dc.index: { +// dc.collection: specifications, +// }, +// } +// +// query := &types.KuzzleRequest{ +// Collection: dc.collection, +// Index: dc.index, +// Controller: "collection", +// Action: "validateSpecifications", +// Body: specificationsData, +// } +// go dc.Kuzzle.Query(query, options, ch) +// +// res := <-ch +// +// if res.Error != nil { +// return nil, res.Error +// } +// +// response := &types.ValidResponse{} +// json.Unmarshal(res.Result, response) +// +// return response, nil +//} +// +//// DeleteSpecifications deletes the current specifications of this collection. +//func (dc *Collection) DeleteSpecifications(options types.QueryOptions) (bool, error) { +// ch := make(chan *types.KuzzleResponse) +// +// query := &types.KuzzleRequest{ +// Collection: dc.collection, +// Index: dc.index, +// Controller: "collection", +// Action: "deleteSpecifications", +// } +// go dc.Kuzzle.Query(query, options, ch) +// +// res := <-ch +// +// if res.Error != nil { +// return false, res.Error +// } +// +// ack := &struct { +// Acknowledged bool `json:"acknowledged"` +// }{} +// err := json.Unmarshal(res.Result, ack) +// if err != nil { +// return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) +// } +// return ack.Acknowledged, nil +//} diff --git a/collection/specifications_test.go b/collection/specifications_test.go index a521d4aa..bd0a2efd 100644 --- a/collection/specifications_test.go +++ b/collection/specifications_test.go @@ -1,483 +1,484 @@ package collection_test -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestGetSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) - assert.NotNil(t, err) -} - -func TestGetSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getSpecifications", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - validation := types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: false, - Type: "bool", - DefaultValue: "Boring value", - }, - }, - } - - res := types.SpecificationEntry{ - Index: parsedQuery.Index, - Collection: parsedQuery.Collection, - Validation: &validation, - } - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) - assert.Equal(t, "index", res.Index) - assert.Equal(t, "collection", res.Collection) - assert.Equal(t, false, res.Validation.Strict) - assert.Equal(t, 1, len(res.Validation.Fields)) - assert.Equal(t, false, res.Validation.Fields["foo"].Mandatory) - assert.Equal(t, "bool", res.Validation.Fields["foo"].Type) - assert.Equal(t, "Boring value", res.Validation.Fields["foo"].DefaultValue) -} - -func ExampleCollection_GetSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Index, res.Collection, res.Validation) -} - -func TestSearchSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, nil) - assert.NotNil(t, err) -} - -func TestSearchSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "searchSpecifications", parsedQuery.Action) - - res := types.SpecificationSearchResult{ - ScrollId: "f00b4r", - Total: 1, - Hits: make([]types.SpecificationSearchResultHit, 1), - } - res.Hits[0] = types.SpecificationSearchResultHit{ - Source: types.SpecificationEntry{ - Index: "index", - Collection: "collection", - Validation: &types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": types.SpecificationField{ - Mandatory: true, - Type: "string", - DefaultValue: "Value found with search", - }, - }, - }, - }, - } - - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetFrom(2) - opts.SetSize(4) - opts.SetScroll("1m") - - res, _ := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) - assert.Equal(t, "f00b4r", res.ScrollId) - assert.Equal(t, 1, res.Total) - assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) -} - -func ExampleCollection_SearchSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetFrom(2) - opts.SetSize(4) - opts.SetScroll("1m") - - res, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) -} - -func TestScrollSpecificationsEmptyScrollId(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ScrollSpecifications: scroll id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("", nil) - assert.NotNil(t, err) -} - -func TestScrollSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", nil) - assert.NotNil(t, err) -} - -func TestScrollSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "scrollSpecifications", parsedQuery.Action) - - res := types.SpecificationSearchResult{ - ScrollId: "f00b4r", - Total: 1, - Hits: make([]types.SpecificationSearchResultHit, 1), - } - res.Hits[0] = types.SpecificationSearchResultHit{ - Source: types.SpecificationEntry{ - Index: "index", - Collection: "collection", - Validation: &types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": types.SpecificationField{ - Mandatory: true, - Type: "string", - DefaultValue: "Value found with search", - }, - }, - }, - }, - } - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetScroll("1m") - - res, _ := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) - assert.Equal(t, "f00b4r", res.ScrollId) - assert.Equal(t, 1, res.Total) - assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) -} - -func ExampleCollection_ScrollSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetScroll("1m") - - res, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) -} - -func TestValidateSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&types.Specification{}, nil) - assert.NotNil(t, err) -} - -func TestValidateSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "validateSpecifications", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.ValidResponse{Valid: true} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - specifications := types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - } - - res, _ := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) - assert.Equal(t, true, res.Valid) -} - -func ExampleCollection_ValidateSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - specifications := types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - } - - res, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Valid) -} -func TestUpdateSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&types.Specification{}, nil) - assert.NotNil(t, err) -} - -func TestUpdateSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - type Specifications map[string]map[string]*types.Specification - - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "updateSpecifications", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := Specifications{ - "index": { - "collection": &types.Specification{ - Strict: true, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - }, - }, - } - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - specifications := types.Specification{ - Strict: true, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - } - - specs, _ := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) - - fields := specs.Fields - - assert.Equal(t, true, specs.Strict) - assert.Equal(t, 1, len(fields)) - assert.Equal(t, true, fields["foo"].Mandatory) - assert.Equal(t, "string", fields["foo"].Type) - assert.Equal(t, "Exciting value", fields["foo"].DefaultValue) -} - -func ExampleCollection_UpdateSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - specifications := types.Specification{ - Strict: true, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - } - - res, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Strict, res.Fields) -} - -func TestDeleteSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) - assert.NotNil(t, err) -} - -func TestDeleteSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "deleteSpecifications", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - return &types.KuzzleResponse{Result: []byte(`{ - "acknowledged": true - }`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) - assert.Equal(t, true, res) -} - -func ExampleCollection_DeleteSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Printf("%#v\n", res) -} +// +//import ( +// "encoding/json" +// "fmt" +// "github.com/kuzzleio/sdk-go/collection" +// "github.com/kuzzleio/sdk-go/internal" +// "github.com/kuzzleio/sdk-go/kuzzle" +// "github.com/kuzzleio/sdk-go/types" +// "github.com/stretchr/testify/assert" +// "testing" +//) +// +//func TestGetSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) +// assert.NotNil(t, err) +//} +// +//func TestGetSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "getSpecifications", parsedQuery.Action) +// assert.Equal(t, "index", parsedQuery.Index) +// assert.Equal(t, "collection", parsedQuery.Collection) +// +// validation := types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: false, +// Type: "bool", +// DefaultValue: "Boring value", +// }, +// }, +// } +// +// res := types.SpecificationEntry{ +// Index: parsedQuery.Index, +// Collection: parsedQuery.Collection, +// Validation: &validation, +// } +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// res, _ := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) +// assert.Equal(t, "index", res.Index) +// assert.Equal(t, "collection", res.Collection) +// assert.Equal(t, false, res.Validation.Strict) +// assert.Equal(t, 1, len(res.Validation.Fields)) +// assert.Equal(t, false, res.Validation.Fields["foo"].Mandatory) +// assert.Equal(t, "bool", res.Validation.Fields["foo"].Type) +// assert.Equal(t, "Boring value", res.Validation.Fields["foo"].DefaultValue) +//} +// +//func ExampleCollection_GetSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// res, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Index, res.Collection, res.Validation) +//} +// +//func TestSearchSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, nil) +// assert.NotNil(t, err) +//} +// +//func TestSearchSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "searchSpecifications", parsedQuery.Action) +// +// res := types.SpecificationSearchResult{ +// ScrollId: "f00b4r", +// Total: 1, +// Hits: make([]types.SpecificationSearchResultHit, 1), +// } +// res.Hits[0] = types.SpecificationSearchResultHit{ +// Source: types.SpecificationEntry{ +// Index: "index", +// Collection: "collection", +// Validation: &types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": types.SpecificationField{ +// Mandatory: true, +// Type: "string", +// DefaultValue: "Value found with search", +// }, +// }, +// }, +// }, +// } +// +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// opts := types.NewQueryOptions() +// opts.SetFrom(2) +// opts.SetSize(4) +// opts.SetScroll("1m") +// +// res, _ := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) +// assert.Equal(t, "f00b4r", res.ScrollId) +// assert.Equal(t, 1, res.Total) +// assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) +//} +// +//func ExampleCollection_SearchSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// opts := types.NewQueryOptions() +// opts.SetFrom(2) +// opts.SetSize(4) +// opts.SetScroll("1m") +// +// res, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) +//} +// +//func TestScrollSpecificationsEmptyScrollId(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ScrollSpecifications: scroll id required"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("", nil) +// assert.NotNil(t, err) +//} +// +//func TestScrollSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", nil) +// assert.NotNil(t, err) +//} +// +//func TestScrollSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "scrollSpecifications", parsedQuery.Action) +// +// res := types.SpecificationSearchResult{ +// ScrollId: "f00b4r", +// Total: 1, +// Hits: make([]types.SpecificationSearchResultHit, 1), +// } +// res.Hits[0] = types.SpecificationSearchResultHit{ +// Source: types.SpecificationEntry{ +// Index: "index", +// Collection: "collection", +// Validation: &types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": types.SpecificationField{ +// Mandatory: true, +// Type: "string", +// DefaultValue: "Value found with search", +// }, +// }, +// }, +// }, +// } +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// opts := types.NewQueryOptions() +// opts.SetScroll("1m") +// +// res, _ := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) +// assert.Equal(t, "f00b4r", res.ScrollId) +// assert.Equal(t, 1, res.Total) +// assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) +//} +// +//func ExampleCollection_ScrollSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// opts := types.NewQueryOptions() +// opts.SetScroll("1m") +// +// res, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) +//} +// +//func TestValidateSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&types.Specification{}, nil) +// assert.NotNil(t, err) +//} +// +//func TestValidateSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "validateSpecifications", parsedQuery.Action) +// assert.Equal(t, "index", parsedQuery.Index) +// assert.Equal(t, "collection", parsedQuery.Collection) +// +// res := types.ValidResponse{Valid: true} +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// specifications := types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// } +// +// res, _ := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) +// assert.Equal(t, true, res.Valid) +//} +// +//func ExampleCollection_ValidateSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// specifications := types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// } +// +// res, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Valid) +//} +//func TestUpdateSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&types.Specification{}, nil) +// assert.NotNil(t, err) +//} +// +//func TestUpdateSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// type Specifications map[string]map[string]*types.Specification +// +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "updateSpecifications", parsedQuery.Action) +// assert.Equal(t, "index", parsedQuery.Index) +// assert.Equal(t, "collection", parsedQuery.Collection) +// +// res := Specifications{ +// "index": { +// "collection": &types.Specification{ +// Strict: true, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// }, +// }, +// } +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// specifications := types.Specification{ +// Strict: true, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// } +// +// specs, _ := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) +// +// fields := specs.Fields +// +// assert.Equal(t, true, specs.Strict) +// assert.Equal(t, 1, len(fields)) +// assert.Equal(t, true, fields["foo"].Mandatory) +// assert.Equal(t, "string", fields["foo"].Type) +// assert.Equal(t, "Exciting value", fields["foo"].DefaultValue) +//} +// +//func ExampleCollection_UpdateSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// specifications := types.Specification{ +// Strict: true, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// } +// +// res, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Strict, res.Fields) +//} +// +//func TestDeleteSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) +// assert.NotNil(t, err) +//} +// +//func TestDeleteSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "deleteSpecifications", parsedQuery.Action) +// assert.Equal(t, "index", parsedQuery.Index) +// assert.Equal(t, "collection", parsedQuery.Collection) +// +// return &types.KuzzleResponse{Result: []byte(`{ +// "acknowledged": true +// }`)} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// res, _ := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) +// assert.Equal(t, true, res) +//} +// +//func ExampleCollection_DeleteSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// res, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Printf("%#v\n", res) +//} diff --git a/collection/subscribe.go b/collection/subscribe.go deleted file mode 100644 index d6f483aa..00000000 --- a/collection/subscribe.go +++ /dev/null @@ -1,16 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Subscribe subscribes to this data collection with a set of Kuzzle DSL filters. -func (dc *Collection) Subscribe(filters interface{}, options types.RoomOptions, realtimeNotificationChannel chan<- types.KuzzleNotification) *Room { - r := NewRoom(dc, filters, options) - - res := make(chan types.SubscribeResponse) - r.OnDone(res) - r.Subscribe(realtimeNotificationChannel) - - return r -} diff --git a/collection/subscribe_test.go b/collection/subscribe_test.go deleted file mode 100644 index 3ff68b5a..00000000 --- a/collection/subscribe_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package collection - -import ( - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestSubscribeError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - room := NewCollection(k, "collection", "index").Subscribe(nil, nil, nil) - - r := <-room.ResponseChannel() - assert.Equal(t, "error", r.Error.Error()) -} - -func TestSubscribe(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - room := NewCollection(k, "collection", "index").Subscribe(nil, nil, nil) - - r := <-room.ResponseChannel() - assert.Equal(t, "42", r.Room.RoomId()) -} - -func ExampleCollection_Subscribe() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - room := NewCollection(k, "collection", "index").Subscribe(nil, nil, nil) - - r := <-room.ResponseChannel() - - fmt.Println(r.Room.RoomId) -} diff --git a/collection/truncate.go b/collection/truncate.go index c0715d1f..830c758c 100644 --- a/collection/truncate.go +++ b/collection/truncate.go @@ -1,35 +1,34 @@ package collection import ( - "encoding/json" - "fmt" "github.com/kuzzleio/sdk-go/types" ) // Truncate delete every Documents from the provided Collection. -func (dc *Collection) Truncate(options types.QueryOptions) (bool, error) { +func (dc *Collection) Truncate(index string, collection string) error { + if index == "" { + return types.NewError("Collection.Truncate: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.Truncate: collection required", 400) + } + ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, + Collection: collection, + Index: index, Controller: "collection", Action: "truncate", } - go dc.Kuzzle.Query(query, options, ch) + go dc.Kuzzle.Query(query, nil, ch) res := <-ch if res.Error != nil { - return false, res.Error + return res.Error } - ack := &struct { - Acknowledged bool `json:"acknowledged"` - }{} - err := json.Unmarshal(res.Result, ack) - if err != nil { - return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) - } - return ack.Acknowledged, nil + return nil } diff --git a/collection/truncate_test.go b/collection/truncate_test.go index 3eba1af6..28f20b22 100644 --- a/collection/truncate_test.go +++ b/collection/truncate_test.go @@ -2,15 +2,31 @@ package collection_test import ( "fmt" + "github.com/kuzzleio/sdk-go/collection" + "testing" + "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) +func TestTruncateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Truncate("", "collection") + assert.NotNil(t, err) +} + +func TestTruncateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Truncate("index", "") + assert.NotNil(t, err) +} + func TestTruncateError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { @@ -19,7 +35,8 @@ func TestTruncateError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := collection.NewCollection(k, "collection", "index").Truncate(nil) + nc := collection.NewCollection(k) + err := nc.Truncate("index", "collection") assert.NotNil(t, err) } @@ -33,20 +50,20 @@ func TestTruncate(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := collection.NewCollection(k, "collection", "index").Truncate(nil) - assert.Equal(t, true, res) + nc := collection.NewCollection(k) + err := nc.Truncate("index", "collection") + assert.Nil(t, err) } func ExampleCollection_Truncate() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - res, err := collection.NewCollection(k, "collection", "index").Truncate(nil) + nc := collection.NewCollection(k) + err := nc.Truncate("index", "collection") if err != nil { fmt.Println(err.Error()) return } - - fmt.Printf("%#v\n", res) } diff --git a/collection/update_document.go b/collection/update_document.go deleted file mode 100644 index 2fdc057e..00000000 --- a/collection/update_document.go +++ /dev/null @@ -1,36 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// UpdateDocument updates a document in Kuzzle. -func (dc *Collection) UpdateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.UpdateDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "update", - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - documentResponse := &Document{collection: dc} - json.Unmarshal(res.Result, documentResponse) - - return documentResponse, nil -} diff --git a/collection/update_document_test.go b/collection/update_document_test.go deleted file mode 100644 index 5a2be52b..00000000 --- a/collection/update_document_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestUpdateDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.UpdateDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestUpdateDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestUpdateDocument(t *testing.T) { - id := "myId" - - type Content struct { - Title string `json:"title"` - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "update", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, 10, options.RetryOnConflict()) - assert.Equal(t, id, parsedQuery.Id) - - assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) - - res := collection.Document{Id: id, Content: []byte(`{"title": "arthur"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - qo := types.NewQueryOptions() - qo.SetRetryOnConflict(10) - - res, _ := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) - - assert.Equal(t, id, res.Id) - - var result Content - - json.Unmarshal(res.Content, &result) - - assert.Equal(t, result.Title, "arthur") -} - -func ExampleCollection_UpdateDocument() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - qo := types.NewQueryOptions() - qo.SetRetryOnConflict(10) - - res, err := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} diff --git a/collection/update_mapping.go b/collection/update_mapping.go new file mode 100644 index 00000000..ae5124db --- /dev/null +++ b/collection/update_mapping.go @@ -0,0 +1,39 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// UpdateSpecifications updates the current specifications of this collection. +func (dc *Collection) UpdateSpecifications(index string, collection string, body string) error { + if index == "" { + return types.NewError("Collection.UpdateSpecifications: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.UpdateSpecifications: collection required", 400) + } + + if body == "" { + return types.NewError("Collection.UpdateSpecifications: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "updateSpecifications", + Body: body, + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go new file mode 100644 index 00000000..f29c5cd9 --- /dev/null +++ b/collection/update_mapping_test.go @@ -0,0 +1,74 @@ +package collection_test + +import ( + "fmt" + + "github.com/kuzzleio/sdk-go/collection" + + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateSpecificationsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("", "collection", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "collection", "") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "collection", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: []byte(`{}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "collection", "body") + assert.Nil(t, err) +} + +func ExampleCollection_UpdateSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "collection", "body") + + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go new file mode 100644 index 00000000..65044904 --- /dev/null +++ b/collection/validate_specifications.go @@ -0,0 +1,29 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// ValidateSpecifications validates the provided specifications. +func (dc *Collection) ValidateSpecifications(body string) error { + if body == "" { + return types.NewError("Collection.ValidateSpecifications: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "collection", + Action: "validateSpecifications", + Body: body, + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go new file mode 100644 index 00000000..104f9c6f --- /dev/null +++ b/collection/validate_specifications_test.go @@ -0,0 +1,65 @@ +package collection_test + +import ( + "fmt" + + "github.com/kuzzleio/sdk-go/collection" + + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestValidateSpecificationsBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.ValidateSpecifications("") + assert.NotNil(t, err) +} + +func TestValidateSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.ValidateSpecifications("body") + assert.NotNil(t, err) +} + +func TestValidateSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: []byte(`{ + "valid": true, + "details": [], + "description": "Some description text" + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.ValidateSpecifications("body") + assert.Nil(t, err) +} + +func ExampleCollection_ValidateSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.ValidateSpecifications("body") + + if err != nil { + fmt.Println(err.Error()) + return + } +} From 976a449830330be9c66aeaae06573d62ebfe5c93 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 5 Mar 2018 09:46:13 +0100 Subject: [PATCH 023/363] wip --- auth/getCurrentUser.go | 40 ++++++++++++++++++++++++++++++++++++++++ kuzzle/who_am_i.go | 10 ---------- 2 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 auth/getCurrentUser.go delete mode 100644 kuzzle/who_am_i.go diff --git a/auth/getCurrentUser.go b/auth/getCurrentUser.go new file mode 100644 index 00000000..9d1a04ec --- /dev/null +++ b/auth/getCurrentUser.go @@ -0,0 +1,40 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/security" + "github.com/kuzzleio/sdk-go/types" +) + +func (a *Auth) GetCurrentUser() (*security.User, error) { + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "getCurrentUser", + } + + go a.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + type jsonUser struct { + Id string `json:"_id"` + Source json.RawMessage `json:"_source"` + } + ju := &jsonUser{} + json.Unmarshal(res.Result, ju) + + var unmarsh map[string]interface{} + json.Unmarshal(ju.Source, &unmarsh) + u := &security.User{ + Id: ju.Id, + Content: unmarsh, + } + return u, nil +} diff --git a/kuzzle/who_am_i.go b/kuzzle/who_am_i.go deleted file mode 100644 index 52b581d9..00000000 --- a/kuzzle/who_am_i.go +++ /dev/null @@ -1,10 +0,0 @@ -package kuzzle - -import ( - "github.com/kuzzleio/sdk-go/security" -) - -// WhoAmI gets the rights array for the currently logged user. -func (k *Kuzzle) WhoAmI() (*security.User, error) { - return k.Security.WhoAmI() -} From 4c064e8990410f4ccde9d3e3eb956bfbc21d1c2f Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 5 Mar 2018 10:28:44 +0100 Subject: [PATCH 024/363] fix memleaks --- internal/wrappers/cpp/collection.cpp | 26 +++++++++-------- internal/wrappers/cpp/document.cpp | 10 +++---- internal/wrappers/cpp/kuzzle.cpp | 36 ++++++++++++------------ internal/wrappers/headers/exceptions.hpp | 3 ++ 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 066b1141..c614fa14 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -27,7 +27,7 @@ namespace kuzzleio { document_result *r = kuzzle_collection_create_document(_collection, const_cast(id.c_str()), document->_document, options); if (r->error != NULL) throwExceptionFromStatus(r); - delete(r); + kuzzle_free_document_result(r); return this; } @@ -36,7 +36,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; - delete(r); + kuzzle_free_string_result(r); return ret; } @@ -45,7 +45,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); + kuzzle_free_document_result(r); return ret; } @@ -67,7 +67,7 @@ namespace kuzzleio { for (int i = 0; i < r->result_length; i++) v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - delete(r); + kuzzle_free_document_array_result(r); return v; } @@ -88,7 +88,7 @@ namespace kuzzleio { for (int i = 0; i < r->result_length; i++) v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - delete(r); + kuzzle_free_document_array_result(r); return v; } @@ -109,7 +109,7 @@ namespace kuzzleio { for (int i = 0; i < r->result_length; i++) v.push_back(r->result[i]); - delete(r); + kuzzle_free_string_array_result(r); return v; } @@ -130,7 +130,7 @@ namespace kuzzleio { for (int i = 0; i < r->result_length; i++) v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - delete(r); + kuzzle_free_document_array_result(r); return v; } @@ -151,7 +151,7 @@ namespace kuzzleio { for (int i = 0; i < r->result_length; i++) v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - delete(r); + kuzzle_free_document_array_result(r); return v; } @@ -172,7 +172,7 @@ namespace kuzzleio { for (int i = 0; i < r->result_length; i++) v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - delete(r); + kuzzle_free_document_array_result(r); return v; } @@ -181,7 +181,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; - delete(r); + kuzzle_free_bool_result(r); return ret; } @@ -190,7 +190,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); + kuzzle_free_document_result(r); return ret; } @@ -198,6 +198,7 @@ namespace kuzzleio { search_result* r = kuzzle_collection_scroll(_collection, const_cast(id.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); + kuzzle_free_search_result(r); return r; } @@ -205,6 +206,7 @@ namespace kuzzleio { search_result* r = kuzzle_collection_search(_collection, filters, options); if (r->error != NULL) throwExceptionFromStatus(r); + kuzzle_free_search_result(r); return r; } @@ -232,7 +234,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); + kuzzle_free_document_result(r); return ret; } diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index dc34c667..34f7bf61 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -19,7 +19,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; - delete(r); + kuzzle_free_string_result(r); return ret; } @@ -28,7 +28,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; - delete(r); + kuzzle_free_bool_result(r); return ret; } @@ -37,7 +37,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; - delete(r); + kuzzle_free_bool_result(r); return ret; } @@ -46,7 +46,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); Document* ret = new Document(_collection, r->result->id, r->result->content); - delete(r); + kuzzle_free_document_result(r); return ret; } @@ -58,7 +58,7 @@ namespace kuzzleio { _document->id = r->result->id; _document->version = r->result->version; - delete(r); + kuzzle_free_document_result(r); return ret; } diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 53da4700..5c683148 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -37,7 +37,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; - delete(r); + kuzzle_free_bool_result(r); return ret; } @@ -46,7 +46,7 @@ namespace kuzzleio { if (r->error) throwExceptionFromStatus(r); json_object *ret = r->result; - delete(r); + kuzzle_free_json_result(r); return ret; } @@ -55,7 +55,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; - delete(r); + kuzzle_free_bool_result(r); return ret; } @@ -64,7 +64,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); json_object *ret = r->result; - delete(r); + kuzzle_free_json_result(r); return ret; } @@ -73,7 +73,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); json_object *ret = r->result; - delete(r); + kuzzle_free_json_result(r); return ret; } @@ -82,7 +82,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; - delete(r); + kuzzle_free_bool_result(r); return ret; } @@ -91,7 +91,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; - delete(r); + kuzzle_free_string_result(r); return ret; } std::string Kuzzle::login(const std::string& strategy, json_object* credentials, int expires_in) Kuz_Throw_KuzzleException { @@ -99,7 +99,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; - delete(r); + kuzzle_free_string_result(r); return ret; } @@ -108,7 +108,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); statistics *ret = r->result; - delete(r); + kuzzle_free_all_statistics_result(r); return ret; } @@ -117,7 +117,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); statistics *ret = r->result; - delete(r); + kuzzle_free_statistics_result(r); return ret; } @@ -126,7 +126,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; - delete(r); + kuzzle_free_bool_result(r); return ret; } @@ -139,7 +139,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); json_object *ret = r->result; - delete(r); + kuzzle_free_json_result(r); return ret; } @@ -148,7 +148,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); json_object *ret = r->result; - delete(r); + kuzzle_free_json_result(r); return ret; } @@ -157,7 +157,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); collection_entry *ret = r->result; - delete(r); + kuzzle_free_collection_entry_result(r); return ret; } @@ -170,7 +170,7 @@ namespace kuzzleio { for (int i = 0; r->result[i]; i++) v.push_back(r->result[i]); - delete(r); + kuzzle_free_string_array_result(r); return v; } @@ -194,7 +194,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); shards* ret = r->result; - delete(r); + kuzzle_free_shards_result(r); return ret; } @@ -248,7 +248,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); json_object* ret = r->result; - delete(r); + kuzzle_free_json_result(r); return ret; } @@ -257,7 +257,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); user *ret = r->user; - delete(r); + kuzzle_free_user_result(r); return ret; } diff --git a/internal/wrappers/headers/exceptions.hpp b/internal/wrappers/headers/exceptions.hpp index 896c01f6..3d06071e 100644 --- a/internal/wrappers/headers/exceptions.hpp +++ b/internal/wrappers/headers/exceptions.hpp @@ -95,6 +95,9 @@ namespace kuzzleio { void throwExceptionFromStatus(T *result) { const std::string error = std::string(result->error); delete(result->error); + if (result->stack) { + free(result->stack); + } switch(result->status) { case PARTIAL_EXCEPTION: From 5a04eeb521dcc1ea1cdf9d4df916f7d3e1b2b6e1 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 5 Mar 2018 15:00:40 +0100 Subject: [PATCH 025/363] auth.GetCurrentUser --- .../getCurrentUser_test.go | 23 ++++++++------- internal/wrappers/cgo/kuzzle/auth.go | 7 +++++ internal/wrappers/cpp/auth.cpp | 7 +++++ internal/wrappers/headers/auth.hpp | 1 + internal/wrappers/headers/kuzzlesdk.h | 2 +- security/who_am_i.go | 28 ------------------- 6 files changed, 29 insertions(+), 39 deletions(-) rename security/who_am_i_test.go => auth/getCurrentUser_test.go (77%) delete mode 100644 security/who_am_i.go diff --git a/security/who_am_i_test.go b/auth/getCurrentUser_test.go similarity index 77% rename from security/who_am_i_test.go rename to auth/getCurrentUser_test.go index 96156d8b..032ee5bb 100644 --- a/security/who_am_i_test.go +++ b/auth/getCurrentUser_test.go @@ -1,10 +1,11 @@ -package security_test +package auth_test import ( "encoding/json" "fmt" "testing" + "github.com/kuzzleio/sdk-go/auth" "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" @@ -12,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestWhoAmIQueryError(t *testing.T) { +func TestGetCurrentUserQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { request := types.KuzzleRequest{} @@ -23,11 +24,12 @@ func TestWhoAmIQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.WhoAmI() + auth := auth.NewAuth(k) + _, err := auth.GetCurrentUser() assert.NotNil(t, err) } -func TestWhoAmI(t *testing.T) { +func TestGetCurrentUser(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { request := types.KuzzleRequest{} @@ -41,14 +43,14 @@ func TestWhoAmI(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.WhoAmI() + auth := auth.NewAuth(k) + res, _ := auth.GetCurrentUser() assert.Equal(t, "id", res.Id) } -func ExampleKuzzle_WhoAmI() { - conn := websocket.NewWebSocket("localhost:7512", nil) +func ExampleKuzzle_GetCurrentUser() { + conn := websocket.NewWebSocket("localhost", nil) k, _ := kuzzle.NewKuzzle(conn, nil) type credentials struct { @@ -64,11 +66,12 @@ func ExampleKuzzle_WhoAmI() { return } - res, err := k.WhoAmI() + auth := auth.NewAuth(k) + res, _ := auth.GetCurrentUser() if err != nil { fmt.Println(err.Error()) return } - fmt.Printf("%#v\n", res) + fmt.Printf("%v\n", res) } diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 2470b0cc..ee7bd379 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -92,6 +92,13 @@ func kuzzle_delete_my_credentials(a *C.auth, strategy *C.char, options *C.query_ return goToCVoidResult(err) } +//export kuzzle_get_current_user +func kuzzle_get_current_user(a *C.auth) *C.user_result { + u, err := (*auth.Auth)(a.instance).GetCurrentUser() + + return goToCUserResult(a.kuzzle, u, err) +} + //export kuzzle_login func kuzzle_login(k *C.kuzzle, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { var expire int diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 0aa6437b..88ee68de 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -39,4 +39,11 @@ namespace kuzzleio { throwExceptionFromStatus(r); delete(r); } + + user* Auth::getCurrentUser() Kuz_Throw_KuzzleException { + user_result *r = kuzzle_get_current_user(_auth); + if (r->error != NULL) + throwExceptionFromStatus(r); + kuzzle_free_user_result(r); + } } \ No newline at end of file diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index 349f7b62..d5a00284 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -16,6 +16,7 @@ namespace kuzzleio { json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; bool credentialsExist(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; void deleteMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; + user* getCurrentUser() Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index a2802ee5..4202541b 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -99,7 +99,7 @@ typedef struct { } auth; typedef struct { - void *instance + void *instance; kuzzle *kuzzle; } server; diff --git a/security/who_am_i.go b/security/who_am_i.go deleted file mode 100644 index 91010fa0..00000000 --- a/security/who_am_i.go +++ /dev/null @@ -1,28 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) WhoAmI() (*User, error) { - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "auth", - Action: "getCurrentUser", - } - - go s.Kuzzle.Query(query, nil, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - jsonUser := &jsonUser{} - json.Unmarshal(res.Result, jsonUser) - - return s.jsonUserToUser(jsonUser), nil -} From fceaabe41e425c265c4e84ea9ff871ddbeb84e5b Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 6 Mar 2018 10:37:43 +0100 Subject: [PATCH 026/363] json.RawMessage response --- auth/createMyCredentials.go | 8 +- auth/createMyCredentials_test.go | 6 +- internal/wrappers/cgo/kuzzle/auth.go | 66 +++++++------- internal/wrappers/cgo/kuzzle/destructors.go | 6 +- internal/wrappers/cgo/kuzzle/go_to_c.go | 4 +- internal/wrappers/cpp/auth.cpp | 25 +++++- internal/wrappers/cpp/kuzzle.cpp | 20 +---- internal/wrappers/headers/auth.hpp | 4 +- internal/wrappers/headers/kuzzle.hpp | 2 - internal/wrappers/headers/kuzzlesdk.h | 2 +- kuzzle/get_my_credentials.go | 30 ------- kuzzle/get_my_credentials_test.go | 98 -------------------- kuzzle/get_my_rights.go | 33 ------- kuzzle/get_my_rights_test.go | 99 --------------------- security/user_test.go | 2 +- types/kuzzle_response.go | 10 +-- 16 files changed, 73 insertions(+), 342 deletions(-) delete mode 100644 kuzzle/get_my_credentials.go delete mode 100644 kuzzle/get_my_credentials_test.go delete mode 100644 kuzzle/get_my_rights.go delete mode 100644 kuzzle/get_my_rights_test.go diff --git a/auth/createMyCredentials.go b/auth/createMyCredentials.go index b85a5dad..73b1865c 100644 --- a/auth/createMyCredentials.go +++ b/auth/createMyCredentials.go @@ -1,9 +1,6 @@ package auth import ( - "encoding/json" - "reflect" - "github.com/kuzzleio/sdk-go/types" ) @@ -28,8 +25,5 @@ func (a *Auth) CreateMyCredentials(strategy string, credentials interface{}, opt return nil, res.Error } - ref := reflect.New(reflect.TypeOf(credentials)).Elem().Interface() - json.Unmarshal(res.Result, &ref) - - return ref.(map[string]interface{}), nil + return res.Result, nil } diff --git a/auth/createMyCredentials_test.go b/auth/createMyCredentials_test.go index 65640b59..9ceb861a 100644 --- a/auth/createMyCredentials_test.go +++ b/auth/createMyCredentials_test.go @@ -61,9 +61,11 @@ func TestCreateMyCredentials(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) res, _ := k.Auth.CreateMyCredentials("local", myCredentials{"foo", "bar"}, nil) + r := myCredentials{} + json.Unmarshal(res, &r) - assert.Equal(t, "foo", res["username"]) - assert.Equal(t, "bar", res["password"]) + assert.Equal(t, "foo", r.Username) + assert.Equal(t, "bar", r.Password) } func ExampleKuzzle_CreateMyCredentials() { diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index ee7bd379..ccc86f0f 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -65,13 +65,14 @@ func kuzzle_check_token(a *C.auth, token *C.char) *C.token_validity { } //export kuzzle_create_my_credentials -func kuzzle_create_my_credentials(a *C.auth, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.json_result { +func kuzzle_create_my_credentials(a *C.auth, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.string_result { res, err := (*auth.Auth)(a.instance).CreateMyCredentials( C.GoString(strategy), JsonCConvert(credentials).(map[string]interface{}), SetQueryOptions(options)) - return goToCJsonResult(res, err) + str := string(res) + return goToCStringResult(&str, err) } //export kuzzle_credentials_exist @@ -99,6 +100,37 @@ func kuzzle_get_current_user(a *C.auth) *C.user_result { return goToCUserResult(a.kuzzle, u, err) } +//export kuzzle_get_my_credentials +func kuzzle_get_my_credentials(a *C.auth, strategy *C.char, options *C.query_options) *C.string_result { + res, err := (*auth.Auth)(a.instance).GetMyCredentials( + C.GoString(strategy), + SetQueryOptions(options)) + + str := string(res) + return goToCStringResult(&str, err) +} + +//export kuzzle_get_my_rights +func kuzzle_get_my_rights(a *C.auth, options *C.query_options) *C.user_rights_result { + res, err := (*auth.Auth)(a.instance).GetMyRights(SetQueryOptions(options)) + + return goToCUserRightsResult(res, err) +} + +//export kuzzle_update_self +func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options) *C.json_result { + userData, err := cToGoUserData(data) + if err != nil { + return goToCJsonResult(nil, err) + } + + res, err := (*kuzzle.Kuzzle)(k.instance).UpdateSelf( + userData, + SetQueryOptions(options)) + + return goToCJsonResult(res, err) +} + //export kuzzle_login func kuzzle_login(k *C.kuzzle, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { var expire int @@ -121,15 +153,6 @@ func kuzzle_logout(k *C.kuzzle) *C.char { return nil } -//export kuzzle_get_my_credentials -func kuzzle_get_my_credentials(k *C.kuzzle, strategy *C.char, options *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).GetMyCredentials( - C.GoString(strategy), - SetQueryOptions(options)) - - return goToCJsonResult(res, err) -} - //export kuzzle_update_my_credentials func kuzzle_update_my_credentials(k *C.kuzzle, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.json_result { res, err := (*kuzzle.Kuzzle)(k.instance).UpdateMyCredentials( @@ -149,24 +172,3 @@ func kuzzle_validate_my_credentials(k *C.kuzzle, strategy *C.char, credentials * return goToCBoolResult(res, err) } - -//export kuzzle_get_my_rights -func kuzzle_get_my_rights(k *C.kuzzle, options *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).GetMyRights(SetQueryOptions(options)) - - return goToCJsonResult(res, err) -} - -//export kuzzle_update_self -func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options) *C.json_result { - userData, err := cToGoUserData(data) - if err != nil { - return goToCJsonResult(nil, err) - } - - res, err := (*kuzzle.Kuzzle)(k.instance).UpdateSelf( - userData, - SetQueryOptions(options)) - - return goToCJsonResult(res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 333bb7a7..4d8779c8 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -367,14 +367,14 @@ func kuzzle_free_user_right(st *C.user_right) { //export kuzzle_free_user_rights_result func kuzzle_free_user_rights_result(st *C.user_rights_result) { if st != nil { - if st.user_rights != nil { - rights := (*[1<<30 - 1]C.user_right)(unsafe.Pointer(st.user_rights))[:int(st.user_rights_length):int(st.user_rights_length)] + if st.result != nil { + rights := (*[1<<30 - 1]C.user_right)(unsafe.Pointer(st.result))[:int(st.user_rights_length):int(st.user_rights_length)] for _, right := range rights { _free_user_right(&right) } - C.free(unsafe.Pointer(st.user_rights)) + C.free(unsafe.Pointer(st.result)) } C.free(unsafe.Pointer(st.error)) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 295df2e8..1cad648e 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -789,8 +789,8 @@ func goToCUserRightsResult(rights []*types.UserRights, err error) *C.user_rights result.user_rights_length = C.size_t(len(rights)) if rights != nil { - result.user_rights = (*C.user_right)(C.calloc(C.size_t(len(rights)), C.sizeof_user_right)) - carray := (*[1<<30 - 1]C.user_right)(unsafe.Pointer(result.user_rights))[:len(rights):len(rights)] + result.result = (*C.user_right)(C.calloc(C.size_t(len(rights)), C.sizeof_user_right)) + carray := (*[1<<30 - 1]C.user_right)(unsafe.Pointer(result.result))[:len(rights):len(rights)] for i, right := range rights { goToCUserRight(right, &carray[i]) diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 88ee68de..8648063b 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -15,11 +15,11 @@ namespace kuzzleio { return kuzzle_check_token(_auth, const_cast(token.c_str())); } - json_object* Auth::createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { - json_result* r = kuzzle_create_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); + std::string Auth::createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_create_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); if (r->error) throwExceptionFromStatus(r); - json_object *ret = r->result; + std::string ret = r->result; delete(r); return ret; } @@ -46,4 +46,23 @@ namespace kuzzleio { throwExceptionFromStatus(r); kuzzle_free_user_result(r); } + + std::string Auth::getMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_get_my_credentials(_auth, const_cast(strategy.c_str()), options); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + user_right* Auth::getMyRights(query_options* options) Kuz_Throw_KuzzleException { + user_rights_result *r = kuzzle_get_my_rights(_auth, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + user_right *ret = r->result; + kuzzle_free_user_rights_result(r); + return ret; + } + } \ No newline at end of file diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 1b66be8c..3546f5a9 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -37,15 +37,6 @@ namespace kuzzleio { return ret; } - json_object* Kuzzle::getMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { - json_result *r = kuzzle_get_my_credentials(_kuzzle, const_cast(strategy.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - json_object *ret = r->result; - delete(r); - return ret; - } - json_object* Kuzzle::updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options) Kuz_Throw_KuzzleException { json_result *r = kuzzle_update_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); if (r->error != NULL) @@ -89,16 +80,7 @@ namespace kuzzleio { delete(r); return ret; } - - json_object* Kuzzle::getMyRights(query_options* options) Kuz_Throw_KuzzleException { - json_result *r = kuzzle_get_my_rights(_kuzzle, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - json_object *ret = r->result; - delete(r); - return ret; - } - + collection_entry* Kuzzle::listCollections(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { collection_entry_result *r = kuzzle_list_collections(_kuzzle, const_cast(index.c_str()), options); if (r->error != NULL) diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index d5a00284..d9d10453 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -13,10 +13,12 @@ namespace kuzzleio { Auth(Kuzzle *kuzzle); virtual ~Auth(); token_validity* checkToken(const std::string& token); - json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; bool credentialsExist(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; void deleteMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; user* getCurrentUser() Kuz_Throw_KuzzleException; + std::string getMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; + user_right* getMyRights(query_options* options=NULL) Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 68662587..c3e66046 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -25,7 +25,6 @@ namespace kuzzleio { char* connect(); bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - json_object* getMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; json_object* updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options=NULL) Kuz_Throw_KuzzleException; bool validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; std::string login(const std::string& strategy, json_object* credentials, int expiresIn) Kuz_Throw_KuzzleException; @@ -34,7 +33,6 @@ namespace kuzzleio { statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; bool getAutoRefresh(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - json_object* getMyRights(query_options* options=NULL) Kuz_Throw_KuzzleException; collection_entry* listCollections(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; std::vector listIndexes(query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 4202541b..12edf3e5 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -314,7 +314,7 @@ typedef struct { } user_right; typedef struct user_rights_result { - user_right *user_rights; + user_right *result; size_t user_rights_length; int status; char *error; diff --git a/kuzzle/get_my_credentials.go b/kuzzle/get_my_credentials.go deleted file mode 100644 index 83e2ae72..00000000 --- a/kuzzle/get_my_credentials.go +++ /dev/null @@ -1,30 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// GetMyCredentials get credential information of the specified strategy for the current user. -func (k *Kuzzle) GetMyCredentials(strategy string, options types.QueryOptions) (json.RawMessage, error) { - if strategy == "" { - return nil, types.NewError("Kuzzle.GetMyCredentials: strategy is required", 400) - } - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "auth", - Action: "getMyCredentials", - Strategy: strategy, - } - - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - return res.Result, nil -} diff --git a/kuzzle/get_my_credentials_test.go b/kuzzle/get_my_credentials_test.go deleted file mode 100644 index 08ec036c..00000000 --- a/kuzzle/get_my_credentials_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestGetMyCredentialsQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "getMyCredentials", request.Action) - assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.GetMyCredentials("local", nil) - assert.NotNil(t, err) -} - -func TestGetMyCredentialsEmptyStrategy(t *testing.T) { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.GetMyCredentials("", nil) - assert.Equal(t, "[400] Kuzzle.GetMyCredentials: strategy is required", fmt.Sprint(err)) -} - -func TestGetMyCredentials(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "getMyCredentials", request.Action) - assert.Equal(t, "local", request.Strategy) - - type myCredentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - myCred := myCredentials{"admin", "test"} - marsh, _ := json.Marshal(myCred) - - return &types.KuzzleResponse{Result: marsh} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.GetMyCredentials("local", nil) - assert.Nil(t, err) - - type myCredentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - cred := myCredentials{} - json.Unmarshal(res, &cred) - - assert.Equal(t, "admin", cred.Username) - assert.Equal(t, "test", cred.Password) -} - -func ExampleKuzzle_GetMyCredentials() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - type credentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - myCredentials := credentials{"foo", "bar"} - - _, err := k.Login("local", myCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - res, err := k.GetMyCredentials("local", nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/kuzzle/get_my_rights.go b/kuzzle/get_my_rights.go deleted file mode 100644 index 69f81567..00000000 --- a/kuzzle/get_my_rights.go +++ /dev/null @@ -1,33 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// GetMyRights gets the rights array for the currently logged user. -func (k *Kuzzle) GetMyRights(options types.QueryOptions) ([]*types.Rights, error) { - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "auth", - Action: "getMyRights", - } - - type rights struct { - Hits []*types.Rights `json:"hits"` - } - - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - r := rights{} - json.Unmarshal(res.Result, &r) - - return r.Hits, nil -} diff --git a/kuzzle/get_my_rights_test.go b/kuzzle/get_my_rights_test.go deleted file mode 100644 index ac70f769..00000000 --- a/kuzzle/get_my_rights_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "log" - "testing" -) - -func TestGetMyRightsQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "getMyRights", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.GetMyRights(nil) - assert.NotNil(t, err) -} - -func TestGetMyRights(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "getMyRights", request.Action) - - type hits struct { - Hits []*types.Rights `json:"hits"` - } - - m := make(map[string]int) - m["websocket"] = 42 - - rights := types.Rights{ - Controller: "controller", - Action: "action", - Index: "index", - Collection: "collection", - Value: "allowed", - } - - hitsArray := []*types.Rights{&rights} - toMarshal := hits{hitsArray} - - h, err := json.Marshal(toMarshal) - if err != nil { - log.Fatal(err) - } - - return &types.KuzzleResponse{Result: h} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.GetMyRights(nil) - - assert.Equal(t, "controller", res[0].Controller) - assert.Equal(t, "action", res[0].Action) - assert.Equal(t, "index", res[0].Index) - assert.Equal(t, "collection", res[0].Collection) - assert.Equal(t, "allowed", res[0].Value) -} - -func ExampleKuzzle_GetMyRights() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - type credentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - myCredentials := credentials{"foo", "bar"} - - _, err := k.Login("local", myCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - res, err := k.GetMyRights(nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/security/user_test.go b/security/user_test.go index bcdc7e0e..7b9f771b 100644 --- a/security/user_test.go +++ b/security/user_test.go @@ -294,7 +294,7 @@ func TestUser_CreateWithCredentials(t *testing.T) { Content: map[string]interface{}{"function": "Jedi"}, ProfileIds: []string{"profile1", "profile2"}, }) - _, err = user.CreateWithCredentials(types.Credentials{"strategy": "myCredentials"}, nil) + _, err = user.CreateWithCredentials(types.Credentials("{\"strategy\": \"myCredentials\"}"), nil) assert.Nil(t, err) } diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index ff52fe05..5a6b9cf5 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -188,14 +188,6 @@ type ( Timestamp int `json:"timestamp"` } - Rights struct { - Controller string `json:"controller"` - Action string `json:"action"` - Index string `json:"index"` - Collection string `json:"collection"` - Value string `json:"value"` - } - LoginAttempt struct { Success bool `json:"success"` Error error `json:"error"` @@ -223,7 +215,7 @@ type ( CredentialStrategyFields []string CredentialFields map[string]CredentialStrategyFields - Credentials map[string]interface{} + Credentials = json.RawMessage UserRights struct { Controller string `json:"controller"` From c6cead26039a83356ae4676d4fd60ac9afa83c24 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 6 Mar 2018 10:38:25 +0100 Subject: [PATCH 027/363] auth.getMyCredentials && auth.getMyRights --- auth/getMyCredentials.go | 29 ++++++++++ auth/getMyCredentials_test.go | 99 +++++++++++++++++++++++++++++++++ auth/getMyRights.go | 34 ++++++++++++ auth/getMyRights_test.go | 100 ++++++++++++++++++++++++++++++++++ 4 files changed, 262 insertions(+) create mode 100644 auth/getMyCredentials.go create mode 100644 auth/getMyCredentials_test.go create mode 100644 auth/getMyRights.go create mode 100644 auth/getMyRights_test.go diff --git a/auth/getMyCredentials.go b/auth/getMyCredentials.go new file mode 100644 index 00000000..59d73980 --- /dev/null +++ b/auth/getMyCredentials.go @@ -0,0 +1,29 @@ +package auth + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// GetMyCredentials get credential information of the specified strategy for the current user. +func (a *Auth) GetMyCredentials(strategy string, options types.QueryOptions) (types.Credentials, error) { + if strategy == "" { + return nil, types.NewError("Kuzzle.GetMyCredentials: strategy is required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "getMyCredentials", + Strategy: strategy, + } + + go a.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/auth/getMyCredentials_test.go b/auth/getMyCredentials_test.go new file mode 100644 index 00000000..f45dd818 --- /dev/null +++ b/auth/getMyCredentials_test.go @@ -0,0 +1,99 @@ +package auth_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetMyCredentialsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "getMyCredentials", request.Action) + assert.Equal(t, "local", request.Strategy) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Auth.GetMyCredentials("local", nil) + assert.NotNil(t, err) +} + +func TestGetMyCredentialsEmptyStrategy(t *testing.T) { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Auth.GetMyCredentials("", nil) + assert.Equal(t, "[400] Kuzzle.GetMyCredentials: strategy is required", fmt.Sprint(err)) +} + +func TestGetMyCredentials(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "getMyCredentials", request.Action) + assert.Equal(t, "local", request.Strategy) + + type myCredentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + myCred := myCredentials{"admin", "test"} + marsh, _ := json.Marshal(myCred) + + return &types.KuzzleResponse{Result: marsh} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Auth.GetMyCredentials("local", nil) + assert.Nil(t, err) + + type myCredentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + var cred myCredentials + json.Unmarshal(res, &cred) + + assert.Equal(t, "admin", cred.Username) + assert.Equal(t, "test", cred.Password) +} + +func ExampleKuzzle_GetMyCredentials() { + conn := websocket.NewWebSocket("localhost", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + type credentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + myCredentials := credentials{"foo", "bar"} + + _, err := k.Login("local", myCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + res, err := k.Auth.GetMyCredentials("local", nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/auth/getMyRights.go b/auth/getMyRights.go new file mode 100644 index 00000000..f6c9f899 --- /dev/null +++ b/auth/getMyRights.go @@ -0,0 +1,34 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// GetMyRights gets the rights array for the currently logged user. +func (a *Auth) GetMyRights(options types.QueryOptions) ([]*types.UserRights, error) { + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "getMyRights", + } + + type rights struct { + Hits []*types.UserRights `json:"hits"` + } + + go a.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + r := rights{} + json.Unmarshal(res.Result, &r) + + return r.Hits, nil +} diff --git a/auth/getMyRights_test.go b/auth/getMyRights_test.go new file mode 100644 index 00000000..63ee5ba2 --- /dev/null +++ b/auth/getMyRights_test.go @@ -0,0 +1,100 @@ +package auth_test + +import ( + "encoding/json" + "fmt" + "log" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetMyRightsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "getMyRights", request.Action) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Auth.GetMyRights(nil) + assert.NotNil(t, err) +} + +func TestGetMyRights(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "getMyRights", request.Action) + + type hits struct { + Hits []*types.UserRights `json:"hits"` + } + + m := make(map[string]int) + m["websocket"] = 42 + + rights := types.UserRights{ + Controller: "controller", + Action: "action", + Index: "index", + Collection: "collection", + Value: "allowed", + } + + hitsArray := []*types.UserRights{&rights} + toMarshal := hits{hitsArray} + + h, err := json.Marshal(toMarshal) + if err != nil { + log.Fatal(err) + } + + return &types.KuzzleResponse{Result: h} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := k.Auth.GetMyRights(nil) + + assert.Equal(t, "controller", res[0].Controller) + assert.Equal(t, "action", res[0].Action) + assert.Equal(t, "index", res[0].Index) + assert.Equal(t, "collection", res[0].Collection) + assert.Equal(t, "allowed", res[0].Value) +} + +func ExampleKuzzle_GetMyRights() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + type credentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + myCredentials := credentials{"foo", "bar"} + + _, err := k.Login("local", myCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + res, err := k.Auth.GetMyRights(nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} From e085c03bed8b443190b595294588aee6cb400f56 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 6 Mar 2018 11:42:52 +0100 Subject: [PATCH 028/363] auth.GetStrategies --- auth/getStrategies.go | 29 +++++++++++++ auth/getStrategies_test.go | 62 ++++++++++++++++++++++++++++ internal/wrappers/cgo/kuzzle/auth.go | 7 ++++ internal/wrappers/cpp/auth.cpp | 14 +++++++ internal/wrappers/headers/auth.hpp | 3 +- 5 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 auth/getStrategies.go create mode 100644 auth/getStrategies_test.go diff --git a/auth/getStrategies.go b/auth/getStrategies.go new file mode 100644 index 00000000..6452f4b6 --- /dev/null +++ b/auth/getStrategies.go @@ -0,0 +1,29 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// GetStrategies retrieve a list of accepted fields per authentication strategy. +func (a *Auth) GetStrategies(options types.QueryOptions) ([]string, error) { + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "getStrategies", + } + go a.k.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + strategies := []string{} + json.Unmarshal(res.Result, &strategies) + + return strategies, nil +} diff --git a/auth/getStrategies_test.go b/auth/getStrategies_test.go new file mode 100644 index 00000000..bb14f59b --- /dev/null +++ b/auth/getStrategies_test.go @@ -0,0 +1,62 @@ +package auth_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetStrategiesError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "getStrategies", request.Action) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Auth.GetStrategies(nil) + assert.NotNil(t, err) +} + +func TestGetStrategies(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "getStrategies", request.Action) + + marsh, _ := json.Marshal([]string{"local", "facebook"}) + + return &types.KuzzleResponse{Result: marsh} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Auth.GetStrategies(nil) + assert.Nil(t, err) + + assert.Equal(t, "local", res[0]) + assert.Equal(t, "facebook", res[1]) +} + +func ExampleSecurity_GetStrategies() { + c := websocket.NewWebSocket("localhost", nil) + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Auth.GetStrategies(nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index ccc86f0f..c456c70a 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -117,6 +117,13 @@ func kuzzle_get_my_rights(a *C.auth, options *C.query_options) *C.user_rights_re return goToCUserRightsResult(res, err) } +//export kuzzle_get_strategies +func kuzzle_get_strategies(a *C.auth, options *C.query_options) *C.string_array_result { + res, err := (*auth.Auth)(a.instance).GetStrategies(SetQueryOptions(options)) + + return goToCStringArrayResult(res, err) +} + //export kuzzle_update_self func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options) *C.json_result { userData, err := cToGoUserData(data) diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 8648063b..172fbbf8 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -65,4 +65,18 @@ namespace kuzzleio { return ret; } + std::vector Auth::getStrategies(query_options *options) Kuz_Throw_KuzzleException { + string_array_result *r = kuzzle_get_strategies(_auth, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::vector v; + for (int i = 0; r->result[i]; i++) + v.push_back(r->result[i]); + + kuzzle_free_string_array_result(r); + return v; + } + + } \ No newline at end of file diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index d9d10453..11a427a6 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -18,7 +18,8 @@ namespace kuzzleio { void deleteMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; user* getCurrentUser() Kuz_Throw_KuzzleException; std::string getMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; - user_right* getMyRights(query_options* options=NULL) Kuz_Throw_KuzzleException; + user_right* getMyRights(query_options *options=NULL) Kuz_Throw_KuzzleException; + std::vector getStrategies(query_options *options=NULL) Kuz_Throw_KuzzleException; }; } From 32464d7b53f5b8095cebfe721864ecdd0d01bf75 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 12:00:31 +0100 Subject: [PATCH 029/363] Final commit (#97) --- collection/delete.go | 34 --- collection/delete_specifications.go | 32 +++ ..._test.go => delete_specifications_test.go} | 20 +- collection/search_specifications.go | 18 +- collection/search_specifications_test.go | 87 ++++++ collection/specifications.go | 33 --- collection/update_mapping.go | 12 +- collection/update_mapping_test.go | 24 +- collection/update_specifications.go | 42 +++ collection/update_specifications_test.go | 74 +++++ internal/wrappers/cgo/kuzzle/c_to_go.go | 91 +++--- internal/wrappers/cgo/kuzzle/collection.go | 91 +++--- .../cgo/kuzzle/collection_document.go | 100 ------- .../wrappers/cgo/kuzzle/collection_mapping.go | 54 ---- .../cgo/kuzzle/collection_specification.go | 44 --- internal/wrappers/cgo/kuzzle/destructors.go | 15 +- internal/wrappers/cgo/kuzzle/document.go | 124 -------- internal/wrappers/cgo/kuzzle/go_to_c.go | 136 +-------- internal/wrappers/cgo/kuzzle/room.go | 79 ----- internal/wrappers/cgo/kuzzle/search_result.go | 10 +- internal/wrappers/cpp/collection.cpp | 272 +++++------------- internal/wrappers/cpp/document.cpp | 92 ------ internal/wrappers/cpp/kuzzle.cpp | 11 +- internal/wrappers/cpp/room.cpp | 64 ----- internal/wrappers/headers/collection.hpp | 40 ++- internal/wrappers/headers/document.hpp | 36 --- internal/wrappers/headers/kuzzle.hpp | 3 +- internal/wrappers/headers/kuzzlesdk.h | 24 +- internal/wrappers/headers/room.hpp | 32 --- .../wrappers/headers/sdk_wrappers_internal.h | 1 - internal/wrappers/kcore.i | 6 +- internal/wrappers/templates/java/core.i | 5 - kuzzle/kuzzle_test.go | 4 +- test.sh | 4 +- types/consts.go | 7 + types/search_options.go | 37 +++ types/search_result.go | 111 +++++++ 37 files changed, 652 insertions(+), 1217 deletions(-) delete mode 100644 collection/delete.go create mode 100644 collection/delete_specifications.go rename collection/{delete_test.go => delete_specifications_test.go} (71%) create mode 100644 collection/update_specifications.go create mode 100644 collection/update_specifications_test.go delete mode 100644 internal/wrappers/cgo/kuzzle/collection_document.go delete mode 100644 internal/wrappers/cgo/kuzzle/collection_mapping.go delete mode 100644 internal/wrappers/cgo/kuzzle/collection_specification.go delete mode 100644 internal/wrappers/cgo/kuzzle/document.go delete mode 100644 internal/wrappers/cgo/kuzzle/room.go delete mode 100644 internal/wrappers/cpp/document.cpp delete mode 100644 internal/wrappers/cpp/room.cpp delete mode 100644 internal/wrappers/headers/document.hpp delete mode 100644 internal/wrappers/headers/room.hpp create mode 100644 types/search_options.go create mode 100644 types/search_result.go diff --git a/collection/delete.go b/collection/delete.go deleted file mode 100644 index 1d8e495c..00000000 --- a/collection/delete.go +++ /dev/null @@ -1,34 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Delete deletes a collection -func (dc *Collection) Delete(index string, collection string) error { - if index == "" { - return types.NewError("Collection.Delete: index required", 400) - } - - if collection == "" { - return types.NewError("Collection.Delete: collection required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: collection, - Index: index, - Controller: "collection", - Action: "delete", - } - go dc.Kuzzle.Query(query, nil, ch) - - res := <-ch - - if res.Error != nil { - return res.Error - } - - return nil -} diff --git a/collection/delete_specifications.go b/collection/delete_specifications.go new file mode 100644 index 00000000..78cb5304 --- /dev/null +++ b/collection/delete_specifications.go @@ -0,0 +1,32 @@ +package collection + +import "github.com/kuzzleio/sdk-go/types" + +// DeleteSpecifications deletes the current specifications of this collection. +func (dc *Collection) DeleteSpecifications(index string, collection string) error { + if index == "" { + return types.NewError("Collection.DeleteSpecifications: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.DeleteSpecifications: collection required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "deleteSpecifications", + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/collection/delete_test.go b/collection/delete_specifications_test.go similarity index 71% rename from collection/delete_test.go rename to collection/delete_specifications_test.go index e0cebe6b..3a26d9a5 100644 --- a/collection/delete_test.go +++ b/collection/delete_specifications_test.go @@ -11,21 +11,21 @@ import ( "github.com/stretchr/testify/assert" ) -func TestDeleteIndexNull(t *testing.T) { +func TestDeleteSpecificationsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.Delete("", "collection") + err := nc.DeleteSpecifications("", "collection") assert.NotNil(t, err) } -func TestDeleteCollectionNull(t *testing.T) { +func TestDeleteSpecificationsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.Delete("index", "") + err := nc.DeleteSpecifications("index", "") assert.NotNil(t, err) } -func TestDeleteError(t *testing.T) { +func TestDeleteSpecificationsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: types.NewError("Unit test error")} @@ -34,12 +34,12 @@ func TestDeleteError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Delete("index", "collection") + err := nc.DeleteSpecifications("index", "collection") assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } -func TestDelete(t *testing.T) { +func TestDeleteSpecifications(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Result: []byte(`{ @@ -50,16 +50,16 @@ func TestDelete(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Delete("index", "collection") + err := nc.DeleteSpecifications("index", "collection") assert.Nil(t, err) } -func ExampleCollection_Delete() { +func ExampleCollection_DeleteSpecifications() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Delete("index", "collection") + err := nc.DeleteSpecifications("index", "collection") if err != nil { fmt.Println(err.Error()) diff --git a/collection/search_specifications.go b/collection/search_specifications.go index eac74f32..efe35b66 100644 --- a/collection/search_specifications.go +++ b/collection/search_specifications.go @@ -7,27 +7,25 @@ import ( ) // SearchSpecifications searches specifications across indexes/collections according to the provided filters. -func (dc *Collection) SearchSpecifications(options types.SpecificationSearchOptions) (*types.SpecificationSearchResult, error) { +func (dc *Collection) SearchSpecifications(options *types.SearchOptions) (*types.SearchResult, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ Controller: "collection", Action: "searchSpecifications", - Body: struct { - Query interface{} `json:"query"` - }{Query: filters}, + Body: options.Type, } if options != nil { - query.From = options.From() - query.Size = options.Size() - scroll := options.Scroll() + query.From = options.From + query.Size = options.Size + scroll := options.Scroll if scroll != "" { query.Scroll = scroll } } - go dc.Kuzzle.Query(query, options, ch) + go dc.Kuzzle.Query(query, nil, ch) res := <-ch @@ -35,8 +33,8 @@ func (dc *Collection) SearchSpecifications(options types.SpecificationSearchOpti return nil, res.Error } - specifications := &types.SpecificationSearchResult{} - json.Unmarshal(res.Result, specifications) + specifications := &types.SearchResult{} + json.Unmarshal(res.Result, &specifications) return specifications, nil } diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go index 10c48eae..8cf9cc9a 100644 --- a/collection/search_specifications_test.go +++ b/collection/search_specifications_test.go @@ -1 +1,88 @@ package collection_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestSearchSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + so := types.NewSearchOptions("all", 2, 4, "1m") + _, err := nc.SearchSpecifications(so) + assert.NotNil(t, err) +} + +func TestSearchSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "collection", parsedQuery.Controller) + assert.Equal(t, "searchSpecifications", parsedQuery.Action) + + res := types.SpecificationSearchResult{ + ScrollId: "f00b4r", + Total: 1, + Hits: make([]types.SpecificationSearchResultHit, 1), + } + res.Hits[0] = types.SpecificationSearchResultHit{ + Source: types.SpecificationEntry{ + Index: "index", + Collection: "collection", + Validation: &types.Specification{ + Strict: false, + Fields: types.SpecificationFields{ + "foo": types.SpecificationField{ + Mandatory: true, + Type: "string", + DefaultValue: "Value found with search", + }, + }, + }, + }, + } + + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + so := types.NewSearchOptions("all", 2, 4, "1m") + res, err := nc.SearchSpecifications(so) + assert.Equal(t, 1, res.Total) + assert.Nil(t, err) +} + +func ExampleCollection_SearchSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + so := types.NewSearchOptions("all", 2, 4, "1m") + + res, err := nc.SearchSpecifications(so) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/collection/specifications.go b/collection/specifications.go index 2ece201d..8ce10072 100644 --- a/collection/specifications.go +++ b/collection/specifications.go @@ -42,39 +42,6 @@ package collection // return specifications, nil //} // -//// ValidateSpecifications validates the provided specifications. -//func (dc *Collection) ValidateSpecifications(specifications *types.Specification, options types.QueryOptions) (*types.ValidResponse, error) { -// ch := make(chan *types.KuzzleResponse) -// -// type Specifications map[string]map[string]*types.Specification -// -// specificationsData := Specifications{ -// dc.index: { -// dc.collection: specifications, -// }, -// } -// -// query := &types.KuzzleRequest{ -// Collection: dc.collection, -// Index: dc.index, -// Controller: "collection", -// Action: "validateSpecifications", -// Body: specificationsData, -// } -// go dc.Kuzzle.Query(query, options, ch) -// -// res := <-ch -// -// if res.Error != nil { -// return nil, res.Error -// } -// -// response := &types.ValidResponse{} -// json.Unmarshal(res.Result, response) -// -// return response, nil -//} -// //// DeleteSpecifications deletes the current specifications of this collection. //func (dc *Collection) DeleteSpecifications(options types.QueryOptions) (bool, error) { // ch := make(chan *types.KuzzleResponse) diff --git a/collection/update_mapping.go b/collection/update_mapping.go index ae5124db..8bb72eb4 100644 --- a/collection/update_mapping.go +++ b/collection/update_mapping.go @@ -4,18 +4,18 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// UpdateSpecifications updates the current specifications of this collection. -func (dc *Collection) UpdateSpecifications(index string, collection string, body string) error { +// UpdateMapping updates the current mapping of this collection. +func (dc *Collection) UpdateMapping(index string, collection string, body string) error { if index == "" { - return types.NewError("Collection.UpdateSpecifications: index required", 400) + return types.NewError("Collection.UpdateMapping: index required", 400) } if collection == "" { - return types.NewError("Collection.UpdateSpecifications: collection required", 400) + return types.NewError("Collection.UpdateMapping: collection required", 400) } if body == "" { - return types.NewError("Collection.UpdateSpecifications: body required", 400) + return types.NewError("Collection.UpdateMapping: body required", 400) } ch := make(chan *types.KuzzleResponse) @@ -24,7 +24,7 @@ func (dc *Collection) UpdateSpecifications(index string, collection string, body Collection: collection, Index: index, Controller: "collection", - Action: "updateSpecifications", + Action: "updateMapping", Body: body, } go dc.Kuzzle.Query(query, nil, ch) diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index f29c5cd9..0658033c 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -13,28 +13,28 @@ import ( "github.com/stretchr/testify/assert" ) -func TestUpdateSpecificationsIndexNull(t *testing.T) { +func TestUpdateMappingIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("", "collection", "body") + err := nc.UpdateMapping("", "collection", "body") assert.NotNil(t, err) } -func TestUpdateSpecificationsCollectionNull(t *testing.T) { +func TestUpdateMappingCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "", "body") + err := nc.UpdateMapping("index", "", "body") assert.NotNil(t, err) } -func TestUpdateSpecificationsBodyNull(t *testing.T) { +func TestUpdateMappingBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "collection", "") + err := nc.UpdateMapping("index", "collection", "") assert.NotNil(t, err) } -func TestUpdateSpecificationsError(t *testing.T) { +func TestUpdateMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} @@ -43,11 +43,11 @@ func TestUpdateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", "body") assert.NotNil(t, err) } -func TestUpdateSpecifications(t *testing.T) { +func TestUpdateMapping(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Result: []byte(`{}`)} @@ -56,16 +56,16 @@ func TestUpdateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", "body") assert.Nil(t, err) } -func ExampleCollection_UpdateSpecifications() { +func ExampleCollection_UpdateMapping() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", "body") if err != nil { fmt.Println(err.Error()) diff --git a/collection/update_specifications.go b/collection/update_specifications.go new file mode 100644 index 00000000..151b105d --- /dev/null +++ b/collection/update_specifications.go @@ -0,0 +1,42 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// UpdateSpecifications updates the current specifications of this collection. +func (dc *Collection) UpdateSpecifications(index string, collection string, body string) (string, error) { + if index == "" { + return "", types.NewError("Collection.UpdateSpecifications: index required", 400) + } + + if collection == "" { + return "", types.NewError("Collection.UpdateSpecifications: collection required", 400) + } + + if body == "" { + return "", types.NewError("Collection.UpdateSpecifications: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "updateSpecifications", + Body: body, + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var result string + result = string(res.Result) + + return result, nil +} diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go new file mode 100644 index 00000000..83cd4a4a --- /dev/null +++ b/collection/update_specifications_test.go @@ -0,0 +1,74 @@ +package collection_test + +import ( + "fmt" + + "github.com/kuzzleio/sdk-go/collection" + + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateSpecificationsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("", "collection", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "collection", "") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "collection", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: []byte(`{}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "collection", "body") + assert.Nil(t, err) +} + +func ExampleCollection_UpdateSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "collection", "body") + + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 15141d53..c99f37e9 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -102,19 +102,6 @@ func cToGoStrings(arr **C.char, len C.size_t) []string { return goStrings } -// Helper to convert a C document** to a go array of document pointers -func cToGoDocuments(col *C.collection, docs **C.document, length C.uint) []*collection.Document { - if length == 0 { - return nil - } - tmpslice := (*[1 << 30]*C.document)(unsafe.Pointer(docs))[:length:length] - godocuments := make([]*collection.Document, length) - for i, doc := range tmpslice { - godocuments[i] = cToGoDocument(col, doc) - } - return godocuments -} - func cToGoShards(cShards *C.shards) *types.Shards { return &types.Shards{ Total: int(cShards.total), @@ -135,28 +122,7 @@ func cToGoKuzzleMeta(cMeta *C.meta) *types.Meta { } func cToGoCollection(c *C.collection) *collection.Collection { - return collection.NewCollection((*kuzzle.Kuzzle)(c.kuzzle.instance), C.GoString(c.collection), C.GoString(c.index)) -} - -func cToGoMapping(cMapping *C.mapping) *collection.Mapping { - mapping := collection.NewMapping(cToGoCollection(cMapping.collection)) - json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(cMapping.mapping))), &mapping.Mapping) - - return mapping -} - -func cToGoSpecification(cSpec *C.specification) *types.Specification { - spec := types.Specification{} - spec.Strict = bool(cSpec.strict) - json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(cSpec.fields))), &spec.Fields) - json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(cSpec.validators))), &spec.Validators) - - return &spec -} - -func cToGoDocument(c *C.collection, cDoc *C.document) *collection.Document { - gDoc := ((*collection.Document)(cDoc.instance)) - return gDoc + return collection.NewCollection((*kuzzle.Kuzzle)(c.kuzzle.instance)) } func cToGoPolicyRestriction(r *C.policy_restriction) *types.PolicyRestriction { @@ -257,31 +223,54 @@ func cToGoUserRigh(r *C.user_right) *types.UserRights { return right } -func cToGoSearchResult(s *C.search_result) *collection.SearchResult { - var godocuments []*collection.Document - - if s.documents_length > 0 { - tmpslice := (*[1 << 30]C.document)(unsafe.Pointer(s.documents))[:s.documents_length:s.documents_length] - - godocuments = make([]*collection.Document, s.documents_length) - - for i, doc := range tmpslice { - godocuments[i] = cToGoDocument(s.collection, &doc) - } - } - +func cToGoSearchResult(s *C.search_result) *types.SearchResult { opts := types.NewQueryOptions() opts.SetSize(int(s.options.size)) opts.SetFrom(int(s.options.from)) opts.SetScrollId(C.GoString(s.options.scroll_id)) - return &collection.SearchResult{ - Collection: cToGoCollection(s.collection), - Documents: godocuments, + var collections json.RawMessage + c, _ := json.Marshal(s.collection) + collections = c + + var documents json.RawMessage + d, _ := json.Marshal(s.documents) + documents = d + + return &types.SearchResult{ + Collection: collections, + Documents: documents, Total: int(s.total), Fetched: int(s.fetched), Options: opts, Filters: cToGoSearchFilters(s.filters), } } + +func cToGoSearchOptions(s *C.search_options) *types.SearchOptions { + return &types.SearchOptions{ + Type: C.GoString(s.type_), + From: int(s.from), + Size: int(s.size), + Scroll: C.GoString(s.scroll), + } +} + +func cToGoCollectionListOptions(clo *C.collection_list_options) *collection.ListOptions { + var t string + + if clo.type_ == C.ALL { + t = "all" + } else if clo.type_ == C.STORED { + t = "stored" + } else if clo.type_ == C.REALTIME { + t = "realtime" + } + + return &collection.ListOptions{ + Type: t, + From: int(clo.type_), + Size: int(clo.size), + } +} diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 5e2bd640..109fb1ee 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -11,7 +11,6 @@ import ( "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" ) // map which stores instances to keep references in case the gc passes @@ -30,58 +29,86 @@ func unregisterCollection(d *C.collection) { // Allocates memory //export kuzzle_new_collection -func kuzzle_new_collection(c *C.collection, k *C.kuzzle, colName *C.char, index *C.char) { +func kuzzle_new_collection(c *C.collection, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) - col := collection.NewCollection(kuz, C.GoString(colName), C.GoString(index)) + col := collection.NewCollection(kuz) - if documentInstances == nil { + if collectionInstances == nil { collectionInstances = make(map[interface{}]bool) } c.instance = unsafe.Pointer(col) - c.index = index - c.collection = colName c.kuzzle = k registerCollection(c) } //export kuzzle_collection_create -func kuzzle_collection_create(c *C.collection, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).Create(SetQueryOptions(options)) - return goToCBoolResult(res, err) +func kuzzle_collection_create(c *C.collection, index *C.char, col *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).Create(C.GoString(index), C.GoString(col)) + return goToCVoidResult(err) } -//export kuzzle_collection_publish_message -func kuzzle_collection_publish_message(c *C.collection, message *C.json_object, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).PublishMessage(JsonCConvert(message).(map[string]interface{}), SetQueryOptions(options)) - return goToCBoolResult(res, err) +//export kuzzle_collection_truncate +func kuzzle_collection_truncate(c *C.collection, index *C.char, col *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).Truncate(C.GoString(index), C.GoString(col)) + return goToCVoidResult(err) } -//export kuzzle_collection_truncate -func kuzzle_collection_truncate(c *C.collection, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).Truncate(SetQueryOptions(options)) +//export kuzzle_collection_exists +func kuzzle_collection_exists(c *C.collection, index *C.char, col *C.char) *C.bool_result { + res, err := (*collection.Collection)(c.instance).Exists(C.GoString(index), C.GoString(col)) return goToCBoolResult(res, err) } -//export kuzzle_collection_subscribe -// TODO loop and close on Unsubscribe -func kuzzle_collection_subscribe(col *C.collection, filters *C.search_filters, options *C.room_options, cb C.kuzzle_notification_listener, data unsafe.Pointer) *C.room_result { - c := make(chan types.KuzzleNotification) - goRoom := cToGoCollection(col).Subscribe(cToGoSearchFilters(filters), SetRoomOptions(options), c) +//export kuzzle_collection_list +func kuzzle_collection_list(c *C.collection, index *C.char, clo *C.collection_list_options) *C.string_result { + res, err := (*collection.Collection)(c.instance).List(C.GoString(index), cToGoCollectionListOptions(clo)) + return goToCStringResult(&res, err) +} + +// Mapping + +//export kuzzle_collection_get_mapping +func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char) *C.string_result { + res, err := (*collection.Collection)(c.instance).GetMapping(C.GoString(index), C.GoString(col)) + return goToCStringResult(&res, err) +} + +//export kuzzle_collection_update_mapping +func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), C.GoString(body)) + return goToCVoidResult(err) +} + +// Specifications + +//export kuzzle_collection_delete_specifications +func kuzzle_collection_delete_specifications(c *C.collection, index *C.char, col *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).DeleteSpecifications(C.GoString(index), C.GoString(col)) + return goToCVoidResult(err) +} - go func() { - res := <-c - C.kuzzle_notify(cb, goToCNotificationResult(&res), data) - }() +//export kuzzle_collection_get_specifications +func kuzzle_collection_get_specifications(c *C.collection, index *C.char, col *C.char) *C.string_result { + res, err := (*collection.Collection)(c.instance).GetSpecifications(C.GoString(index), C.GoString(col)) + return goToCStringResult(&res, err) +} - <-goRoom.ResponseChannel() +//export kuzzle_collection_search_specifications +func kuzzle_collection_search_specifications(c *C.collection, searchOptions *C.search_options) *C.search_result { + res, err := (*collection.Collection)(c.instance).SearchSpecifications(cToGoSearchOptions(searchOptions)) + return goToCSearchResult(res, err) +} - room := (*C.room)(C.calloc(1, C.sizeof_room)) - room.instance = unsafe.Pointer(goRoom) - registerRoom(room) - result := (*C.room_result)(C.calloc(1, C.sizeof_room_result)) +//export kuzzle_collection_update_specifications +func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col *C.char, body *C.char) *C.string_result { + res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), C.GoString(body)) + return goToCStringResult(&res, err) +} - result.result = room - return result +//export kuzzle_collection_validate_specifications +func kuzzle_collection_validate_specifications(c *C.collection, body *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).ValidateSpecifications(C.GoString(body)) + return goToCVoidResult(err) } diff --git a/internal/wrappers/cgo/kuzzle/collection_document.go b/internal/wrappers/cgo/kuzzle/collection_document.go deleted file mode 100644 index 28446425..00000000 --- a/internal/wrappers/cgo/kuzzle/collection_document.go +++ /dev/null @@ -1,100 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" -*/ -import "C" -import ( - "github.com/kuzzleio/sdk-go/collection" -) - -//export kuzzle_collection_count -func kuzzle_collection_count(c *C.collection, searchFilters *C.search_filters, options *C.query_options) *C.int_result { - res, err := (*collection.Collection)(c.instance).Count(cToGoSearchFilters(searchFilters), SetQueryOptions(options)) - return goToCIntResult(res, err) -} - -//export kuzzle_collection_create_document -func kuzzle_collection_create_document(c *C.collection, id *C.char, document *C.document, options *C.query_options) *C.document_result { - res, err := (*collection.Collection)(c.instance).CreateDocument(C.GoString(id), cToGoDocument(c, document), SetQueryOptions(options)) - return goToCDocumentResult(c, res, err) -} - -//export kuzzle_collection_delete_document -func kuzzle_collection_delete_document(c *C.collection, id *C.char, options *C.query_options) *C.string_result { - res, err := (*collection.Collection)(c.instance).DeleteDocument(C.GoString(id), SetQueryOptions(options)) - return goToCStringResult(&res, err) -} - -//export kuzzle_collection_document_exists -func kuzzle_collection_document_exists(c *C.collection, id *C.char, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).DocumentExists(C.GoString(id), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_collection_fetch_document -func kuzzle_collection_fetch_document(c *C.collection, id *C.char, options *C.query_options) *C.document_result { - res, err := (*collection.Collection)(c.instance).FetchDocument(C.GoString(id), SetQueryOptions(options)) - return goToCDocumentResult(c, res, err) -} - -//export kuzzle_collection_replace_document -func kuzzle_collection_replace_document(c *C.collection, id *C.char, document *C.document, options *C.query_options) *C.document_result { - res, err := (*collection.Collection)(c.instance).ReplaceDocument(C.GoString(id), cToGoDocument(c, document), SetQueryOptions(options)) - return goToCDocumentResult(c, res, err) -} - -//export kuzzle_collection_update_document -func kuzzle_collection_update_document(c *C.collection, id *C.char, document *C.document, options *C.query_options) *C.document_result { - res, err := (*collection.Collection)(c.instance).UpdateDocument(C.GoString(id), cToGoDocument(c, document), SetQueryOptions(options)) - return goToCDocumentResult(c, res, err) -} - -//export kuzzle_collection_scroll -func kuzzle_collection_scroll(c *C.collection, scrollId *C.char, options *C.query_options) *C.search_result { - res, err := (*collection.Collection)(c.instance).Scroll(C.GoString(scrollId), SetQueryOptions(options)) - return goToCSearchResult(c, res, err) -} - -//export kuzzle_collection_search -func kuzzle_collection_search(c *C.collection, searchFilters *C.search_filters, options *C.query_options) *C.search_result { - res, err := (*collection.Collection)(c.instance).Search(cToGoSearchFilters(searchFilters), SetQueryOptions(options)) - return goToCSearchResult(c, res, err) -} - -//export kuzzle_collection_m_create_document -func kuzzle_collection_m_create_document(c *C.collection, documents **C.document, docCount C.uint, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MCreateDocument(cToGoDocuments(c, documents, docCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} - -//export kuzzle_collection_m_create_or_replace_document -func kuzzle_collection_m_create_or_replace_document(c *C.collection, documents **C.document, docCount C.uint, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MCreateOrReplaceDocument(cToGoDocuments(c, documents, docCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} - -//export kuzzle_collection_m_delete_document -func kuzzle_collection_m_delete_document(c *C.collection, ids **C.char, idsCount C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*collection.Collection)(c.instance).MDeleteDocument(cToGoStrings(ids, idsCount), SetQueryOptions(options)) - return goToCStringArrayResult(res, err) -} - -//export kuzzle_collection_m_get_document -func kuzzle_collection_m_get_document(c *C.collection, ids **C.char, idsCount C.size_t, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MGetDocument(cToGoStrings(ids, idsCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} - -//export kuzzle_collection_m_replace_document -func kuzzle_collection_m_replace_document(c *C.collection, documents **C.document, docCount C.uint, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MReplaceDocument(cToGoDocuments(c, documents, docCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} - -//export kuzzle_collection_m_update_document -func kuzzle_collection_m_update_document(c *C.collection, documents **C.document, docCount C.uint, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MUpdateDocument(cToGoDocuments(c, documents, docCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/collection_mapping.go b/internal/wrappers/cgo/kuzzle/collection_mapping.go deleted file mode 100644 index bde6662c..00000000 --- a/internal/wrappers/cgo/kuzzle/collection_mapping.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" -*/ -import "C" -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/types" -) - -//export kuzzle_new_mapping -func kuzzle_new_mapping(c *C.collection) *C.mapping { - cm := (*C.mapping)(C.calloc(1, C.sizeof_mapping)) - cm.mapping = C.json_object_new_object() - cm.collection = c - - return cm -} - -//export kuzzle_collection_get_mapping -func kuzzle_collection_get_mapping(c *C.collection, options *C.query_options) *C.mapping_result { - res, err := (*collection.Collection)(c.instance).GetMapping(SetQueryOptions(options)) - return goToCMappingResult(c, res, err) -} - -//export kuzzle_mapping_apply -func kuzzle_mapping_apply(cm *C.mapping, options *C.query_options) *C.bool_result { - _, err := cToGoMapping(cm).Apply(SetQueryOptions(options)) - return goToCBoolResult(true, err) -} - -//export kuzzle_mapping_refresh -func kuzzle_mapping_refresh(cm *C.mapping, options *C.query_options) *C.bool_result { - _, err := cToGoMapping(cm).Refresh(SetQueryOptions(options)) - return goToCBoolResult(true, err) -} - -//export kuzzle_mapping_set -func kuzzle_mapping_set(cm *C.mapping, jMap *C.json_object) { - var mappings types.MappingFields - - if JsonCType(jMap) == C.json_type_object { - jsonString := []byte(C.GoString(C.json_object_to_json_string(jMap))) - json.Unmarshal(jsonString, &mappings) - } - - cToGoMapping(cm).Set(&mappings) - - return -} diff --git a/internal/wrappers/cgo/kuzzle/collection_specification.go b/internal/wrappers/cgo/kuzzle/collection_specification.go deleted file mode 100644 index 78189193..00000000 --- a/internal/wrappers/cgo/kuzzle/collection_specification.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" -*/ -import "C" -import "github.com/kuzzleio/sdk-go/collection" - -//export kuzzle_collection_delete_specifications -func kuzzle_collection_delete_specifications(c *C.collection, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).DeleteSpecifications(SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_collection_get_specifications -func kuzzle_collection_get_specifications(c *C.collection, options *C.query_options) *C.specification_result { - res, err := (*collection.Collection)(c.instance).GetSpecifications(SetQueryOptions(options)) - return goToCSpecificationResult(res.Validation, err) -} - -//export kuzzle_collection_scroll_specifications -func kuzzle_collection_scroll_specifications(c *C.collection, scrollId *C.char, options *C.query_options) *C.specification_search_result { - res, err := (*collection.Collection)(c.instance).ScrollSpecifications(C.GoString(scrollId), SetQueryOptions(options)) - return goToCSpecificationSearchResult(res, err) -} - -//export kuzzle_collection_search_specifications -func kuzzle_collection_search_specifications(c *C.collection, searchFilters *C.search_filters, options *C.query_options) *C.specification_search_result { - res, err := (*collection.Collection)(c.instance).SearchSpecifications(cToGoSearchFilters(searchFilters), SetQueryOptions(options)) - return goToCSpecificationSearchResult(res, err) -} - -//export kuzzle_collection_update_specifications -func kuzzle_collection_update_specifications(c *C.collection, specification *C.specification, options *C.query_options) *C.specification_result { - res, err := (*collection.Collection)(c.instance).UpdateSpecifications(cToGoSpecification(specification), SetQueryOptions(options)) - return goToCSpecificationResult(res, err) -} - -//export kuzzle_collection_validate_specifications -func kuzzle_collection_validate_specifications(c *C.collection, specification *C.specification, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).ValidateSpecifications(cToGoSpecification(specification), SetQueryOptions(options)) - return goToCBoolResult(res.Valid, err) -} diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 333bb7a7..2331c8ed 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -234,8 +234,8 @@ func kuzzle_free_user_data(st *C.user_data) { //export kuzzle_free_collection func kuzzle_free_collection(st *C.collection) { if st != nil { - C.free(unsafe.Pointer(st.index)) - C.free(unsafe.Pointer(st.collection)) + C.free(unsafe.Pointer(st.instance)) + C.free(unsafe.Pointer(st.kuzzle)) C.free(unsafe.Pointer(st)) } } @@ -671,17 +671,6 @@ func kuzzle_free_search_result(st *C.search_result) { kuzzle_free_query_options(st.options) kuzzle_free_json_object(st.aggregations) kuzzle_free_search_filters(st.filters) - kuzzle_free_collection(st.collection) - - if st.documents != nil { - documents := (*[1<<30 - 1]C.document)(unsafe.Pointer(st.documents))[:int(st.documents_length):int(st.documents_length)] - - for _, document := range documents { - _free_document(&document) - } - - C.free(unsafe.Pointer(st.documents)) - } C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go deleted file mode 100644 index 14acdfdc..00000000 --- a/internal/wrappers/cgo/kuzzle/document.go +++ /dev/null @@ -1,124 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "unsafe" - - col "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/types" -) - -// map which stores instances to keep references in case the gc passes -var documentInstances map[interface{}]bool - -// register new instance to the instances map -func registerDocument(instance interface{}) { - documentInstances[instance] = true -} - -// unregister an instance from the instances map -//export unregisterDocument -func unregisterDocument(d *C.document) { - delete(documentInstances, (*col.Document)(d.instance)) -} - -//export kuzzle_new_document -func kuzzle_new_document(d *C.document, c *C.collection, id *C.char, content *C.json_object) { - doc := col.NewDocument((*col.Collection)(c.instance), C.GoString(id)) - - if content != nil { - doc.SetContent(JsonCConvert(content).(map[string]interface{}), true) - } - if documentInstances == nil { - documentInstances = make(map[interface{}]bool) - } - - registerDocument(doc) - d._collection = c - d.instance = unsafe.Pointer(doc) -} - -//export kuzzle_document_subscribe -// TODO close on Unsubscribe -func kuzzle_document_subscribe(d *C.document, options *C.room_options, cb C.kuzzle_notification_listener, data unsafe.Pointer) *C.room_result { - c := make(chan types.KuzzleNotification) - goroom, _ := cToGoDocument(d._collection, d).Subscribe(SetRoomOptions(options), c) - - go func() { - for { - res := <-c - C.kuzzle_notify(cb, goToCNotificationResult(&res), data) - } - }() - <-goroom.ResponseChannel() - - room := (*C.room)(C.calloc(1, C.sizeof_room)) - room.instance = unsafe.Pointer(goroom) - registerRoom(room) - result := (*C.room_result)(C.calloc(1, C.sizeof_room_result)) - - result.result = room - return result -} - -// Does not re-allocate the document -//export kuzzle_document_save -func kuzzle_document_save(d *C.document, options *C.query_options) *C.document_result { - _, err := cToGoDocument(d._collection, d).Save(SetQueryOptions(options)) - return currentDocumentResult(d, err) -} - -//export kuzzle_document_refresh -func kuzzle_document_refresh(d *C.document, options *C.query_options) *C.document_result { - res, err := cToGoDocument(d._collection, d).Refresh(SetQueryOptions(options)) - return goToCDocumentResult(d._collection, res, err) -} - -//export kuzzle_document_publish -func kuzzle_document_publish(d *C.document, options *C.query_options) *C.bool_result { - //res, err := cToGoDocument(d._collection, d).Publish(SetQueryOptions(options)) - - res, err := (*col.Document)(d.instance).Publish(SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_document_exists -func kuzzle_document_exists(d *C.document, options *C.query_options) *C.bool_result { - res, err := cToGoDocument(d._collection, d).Exists(SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_document_delete -func kuzzle_document_delete(d *C.document, options *C.query_options) *C.string_result { - res, err := (*col.Document)(d.instance).Delete(SetQueryOptions(options)) - return goToCStringResult(&res, err) -} - -//export kuzzle_document_set_content -func kuzzle_document_set_content(d *C.document, content *C.json_object, replace C.bool) { - (*col.Document)(d.instance).SetContent(JsonCConvert(content).(map[string]interface{}), bool(replace)) -} - -//export kuzzle_document_get_content -func kuzzle_document_get_content(d *C.document) *C.json_object { - r, _ := goToCJson((*col.Document)(d.instance).Content) - return r -} - -// Allocates memory for result, not document -func currentDocumentResult(d *C.document, err error) *C.document_result { - result := (*C.document_result)(C.calloc(1, C.sizeof_document_result)) - - if err != nil { - Set_document_error(result, err) - } - - result.result = d - - return result -} diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 295df2e8..51bb9f2a 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -12,7 +12,6 @@ import ( "encoding/json" "unsafe" - "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" ) @@ -20,14 +19,6 @@ import ( func duplicateCollection(ptr *C.collection) *C.collection { dest := (*C.collection)(C.calloc(1, C.sizeof_collection)) - if ptr.index != nil { - dest.index = C.CString(C.GoString(ptr.index)) - } - - if ptr.collection != nil { - dest.collection = C.CString(C.GoString(ptr.collection)) - } - dest.kuzzle = ptr.kuzzle return dest @@ -64,37 +55,6 @@ func goToCShards(gShards *types.Shards) *C.shards { return result } -// Allocates memory -func goToCDocument(col *C.collection, gDoc *collection.Document, dest *C.document) *C.document { - var result *C.document - if dest == nil { - result = (*C.document)(C.calloc(1, C.sizeof_document)) - } else { - result = dest - } - - result.id = C.CString(gDoc.Id) - result.index = C.CString(gDoc.Index) - result.result = C.CString(gDoc.Result) - result.collection = C.CString(gDoc.Collection) - result.meta = goToCMeta(gDoc.Meta) - result.shards = goToCShards(gDoc.Shards) - result._collection = duplicateCollection(col) - - if string(gDoc.Content) != "" { - buffer := C.CString(string(gDoc.Content)) - result.content = C.json_tokener_parse(buffer) - C.free(unsafe.Pointer(buffer)) - } else { - result.content = C.json_object_new_object() - } - - result.version = C.int(gDoc.Version) - result.created = C.bool(gDoc.Created) - - return result -} - // Allocates memory func goToCNotificationContent(gNotifContent *types.NotificationResult) *C.notification_content { result := (*C.notification_content)(C.calloc(1, C.sizeof_notification_content)) @@ -160,42 +120,6 @@ func goToCKuzzleResponse(gRes *types.KuzzleResponse) *C.kuzzle_response { return result } -// Allocates memory -func goToCDocumentResult(col *C.collection, goRes *collection.Document, err error) *C.document_result { - result := (*C.document_result)(C.calloc(1, C.sizeof_document_result)) - - if err != nil { - Set_document_error(result, err) - return result - } - - result.result = goToCDocument(col, goRes, nil) - - return result -} - -func goToCDocumentArrayResult(col *C.collection, goRes []*collection.Document, err error) *C.document_array_result { - result := (*C.document_array_result)(C.calloc(1, C.sizeof_document_array_result)) - - if err != nil { - Set_document_array_result_error(result, err) - return result - } - - if goRes != nil { - result.result_length = C.size_t(len(goRes)) - result.result = (*C.document)(C.calloc(result.result_length, C.sizeof_document)) - - cArray := (*[1<<30 - 1]C.document)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] - - for i, doc := range goRes { - goToCDocument(col, doc, &cArray[i]) - } - } - - return result -} - func goToCPolicyRestriction(restriction *types.PolicyRestriction, dest *C.policy_restriction) *C.policy_restriction { var crestriction *C.policy_restriction if dest == nil { @@ -430,28 +354,14 @@ func goToCSearchFilters(filters *types.SearchFilters) *C.search_filters { } // Allocates memory -func goToCSearchResult(col *C.collection, goRes *collection.SearchResult, err error) *C.search_result { +func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { result := (*C.search_result)(C.calloc(1, C.sizeof_search_result)) - result.collection = duplicateCollection(col) + result.collection, _ = goToCJson(goRes.Collection) + result.documents, _ = goToCJson(goRes.Documents) - if err != nil { - Set_search_result_error(result, err) - return result - } - - result.documents_length = C.size_t(len(goRes.Documents)) result.fetched = C.uint(goRes.Fetched) result.total = C.uint(goRes.Total) - if len(goRes.Documents) > 0 { - result.documents = (*C.document)(C.calloc(result.documents_length, C.sizeof_document)) - cArray := (*[1<<30 - 1]C.document)(unsafe.Pointer(result.documents))[:len(goRes.Documents):len(goRes.Documents)] - - for i, doc := range goRes.Documents { - goToCDocument(col, doc, &cArray[i]) - } - } - if goRes.Filters != nil { result.filters = goToCSearchFilters(goRes.Filters) } @@ -471,30 +381,6 @@ func goToCSearchResult(col *C.collection, goRes *collection.SearchResult, err er return result } -// Allocates memory -func goToCMapping(c *C.collection, goMapping *collection.Mapping) *C.mapping { - result := (*C.mapping)(C.calloc(1, C.sizeof_mapping)) - - result.collection = duplicateCollection(c) - result.mapping, _ = goToCJson(goMapping.Mapping) - - return result -} - -// Allocates memory -func goToCMappingResult(c *C.collection, goRes *collection.Mapping, err error) *C.mapping_result { - result := (*C.mapping_result)(C.calloc(1, C.sizeof_mapping_result)) - - if err != nil { - Set_mapping_result_error(result, err) - return result - } - - result.result = goToCMapping(c, goRes) - - return result -} - func goToCRole(k *C.kuzzle, role *security.Role, dest *C.role) *C.role { var crole *C.role if dest == nil { @@ -890,19 +776,3 @@ func goToCDateResult(goRes int, err error) *C.date_result { return result } - -// Allocates memory -func goToCRoomResult(err error) *C.room_result { - result := (*C.room_result)(C.calloc(1, C.sizeof_room_result)) - - if err != nil { - Set_room_result_error(result, err) - return result - } - - room := (*C.room)(C.calloc(1, C.sizeof_room)) - room.instance = unsafe.Pointer(room) - registerRoom(room) - result.result = room - return result -} diff --git a/internal/wrappers/cgo/kuzzle/room.go b/internal/wrappers/cgo/kuzzle/room.go deleted file mode 100644 index 23910d24..00000000 --- a/internal/wrappers/cgo/kuzzle/room.go +++ /dev/null @@ -1,79 +0,0 @@ -package main - -import ( - "unsafe" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/types" -) - -/* - #cgo CFLAGS: -I../../headers - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" - -// map which stores instances to keep references in case the gc passes -var roomInstances map[interface{}]bool - -// register new instance to the instances map -func registerRoom(instance interface{}) { - if roomInstances == nil { - roomInstances = make(map[interface{}]bool) - } - roomInstances[instance] = true -} - -// unregister an instance from the instances map -//export unregisterRoom -func unregisterRoom(r *C.room) { - delete(roomInstances, (*collection.Room)(r.instance)) -} - -//export room_new_room -func room_new_room(room *C.room, col *C.collection, filters *C.json_object, options *C.room_options) { - opts := SetRoomOptions(options) - - r := collection.NewRoom((*collection.Collection)(col.instance), JsonCConvert(filters), opts) - - registerRoom(room) - room.instance = unsafe.Pointer(r) - room.filters = filters - room.options = options -} - -//export room_count -func room_count(room *C.room) *C.int_result { - res, err := (*collection.Room)(room.instance).Count() - return goToCIntResult(res, err) -} - -//export room_on_done -func room_on_done(room *C.room, cb C.kuzzle_subscribe_listener, data unsafe.Pointer) { - c := make(chan types.SubscribeResponse) - - (*collection.Room)(room.instance).OnDone(c) - go func() { - res := <-c - C.room_on_subscribe(cb, goToCRoomResult(res.Error), data) - }() -} - -//export room_subscribe -func room_subscribe(room *C.room, cb C.kuzzle_notification_listener, data unsafe.Pointer) { - c := make(chan types.KuzzleNotification) - - (*collection.Room)(room.instance).Subscribe(c) - go func() { - res := <-c - C.kuzzle_notify(cb, goToCNotificationResult(&res), data) - }() -} - -//export room_unsubscribe -func room_unsubscribe(room *C.room) *C.void_result { - err := (*collection.Room)(room.instance).Unsubscribe() - return goToCVoidResult(err) -} diff --git a/internal/wrappers/cgo/kuzzle/search_result.go b/internal/wrappers/cgo/kuzzle/search_result.go index 64f1a16a..91e62a6a 100644 --- a/internal/wrappers/cgo/kuzzle/search_result.go +++ b/internal/wrappers/cgo/kuzzle/search_result.go @@ -6,8 +6,8 @@ package main */ import "C" -//export kuzzle_search_result_fetch_next -func kuzzle_search_result_fetch_next(sr *C.search_result) *C.search_result { - res, err := cToGoSearchResult(sr).FetchNext() - return goToCSearchResult(sr.collection, res, err) -} +////export kuzzle_search_result_fetch_next +//func kuzzle_search_result_fetch_next(sr *C.search_result) *C.search_result { +// res, err := cToGoSearchResult(sr).FetchNext() +// return goToCSearchResult(sr.collection, res, err) +//} diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 066b1141..3d1fe552 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -1,239 +1,117 @@ #include "kuzzle.hpp" #include "collection.hpp" -#include "document.hpp" -#include "room.hpp" namespace kuzzleio { - Collection::Collection(Kuzzle* kuzzle, const std::string& col, const std::string& index) { + Collection::Collection(Kuzzle* kuzzle) { _collection = new collection(); - kuzzle_new_collection(_collection, kuzzle->_kuzzle, const_cast(col.c_str()), const_cast(index.c_str())); + kuzzle_new_collection(_collection, kuzzle->_kuzzle); } Collection::~Collection() { unregisterCollection(_collection); - delete(_collection); + kuzzle_free_collection(_collection); } - int Collection::count(search_filters* filters, query_options* options) Kuz_Throw_KuzzleException { - int_result *r = kuzzle_collection_count(_collection, filters, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - int ret = r->result; - delete(r); - return ret; + void Collection::create(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_create(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + kuzzle_free_void_result(r); } - Collection* Collection::createDocument(Document* document, const std::string& id, query_options* options) Kuz_Throw_KuzzleException { - document_result *r = kuzzle_collection_create_document(_collection, const_cast(id.c_str()), document->_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - delete(r); - return this; - } + bool Collection::exists(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_collection_exists(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - std::string Collection::deleteDocument(const std::string& id, query_options* options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_collection_delete_document(_collection, const_cast(id.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; + bool ret = r->result; + kuzzle_free_bool_result(r); + return ret; } - Document* Collection::fetchDocument(const std::string& id, query_options* options) Kuz_Throw_KuzzleException { - document_result *r = kuzzle_collection_fetch_document(_collection, const_cast(id.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); - return ret; + std::string Collection::list(const std::string& index, collection_list_options *collectionListOptions) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_list(_collection, const_cast(index.c_str()), collectionListOptions); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; } - std::vector Collection::mCreateDocument(std::vector& documents, query_options* options) Kuz_Throw_KuzzleException { - document **docs = new document *[documents.size()]; - int i = 0; - for(auto const& doc: documents) { - docs[i] = doc->_document; - i++; - } - document_array_result *r = kuzzle_collection_m_create_document(_collection, docs, documents.size(), options); + void Collection::truncate(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - delete[] docs; + kuzzle_free_void_result(r); + } - if (r->error != NULL) - throwExceptionFromStatus(r); + std::string Collection::getMapping(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_get_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); + std::string ret = r->result; + kuzzle_free_string_result(r); - delete(r); - return v; + return ret; } - std::vector Collection::mCreateOrReplaceDocument(std::vector& documents, query_options* options) Kuz_Throw_KuzzleException { - document **docs = new document *[documents.size()]; - int i = 0; - for (auto const& doc : documents) { - docs[i] = doc->_document; - i++; - } - document_array_result *r = kuzzle_collection_m_create_or_replace_document(_collection, docs, documents.size(), options); - - delete[] docs; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - - delete(r); - return v; - } + void Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - std::vector Collection::mDeleteDocument(std::vector& ids, query_options* options) Kuz_Throw_KuzzleException { - char **docsIds = new char *[ids.size()]; - int i = 0; - for (auto const& id : ids) { - docsIds[i] = const_cast(id.c_str()); - i++; - } - string_array_result *r = kuzzle_collection_m_delete_document(_collection, docsIds, ids.size(), options); - - delete[] docsIds; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(r->result[i]); - - delete(r); - return v; + kuzzle_free_void_result(r); } - std::vector Collection::mGetDocument(std::vector& ids, query_options* options) Kuz_Throw_KuzzleException { - char **docsIds = new char *[ids.size()]; - int i = 0; - for (auto const& id : ids) { - docsIds[i] = const_cast(id.c_str()); - i++; - } - document_array_result *r = kuzzle_collection_m_get_document(_collection, docsIds, ids.size(), options); - - delete[] docsIds; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - - delete(r); - return v; - } + std::string Collection::getSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_get_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - std::vector Collection::mReplaceDocument(std::vector& documents, query_options* options) Kuz_Throw_KuzzleException { - document **docs = new document *[documents.size()]; - int i = 0; - for (auto const& doc : documents) { - docs[i] = doc->_document; - i++; - } - document_array_result *r = kuzzle_collection_m_replace_document(_collection, docs, documents.size(), options); - - delete[] docs; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - - delete(r); - return v; - } + std::string ret = r->result; + kuzzle_free_string_result(r); - std::vector Collection::mUpdateDocument(std::vector& documents, query_options* options) Kuz_Throw_KuzzleException { - document **docs = new document *[documents.size()]; - int i = 0; - for (auto const& doc : documents) { - docs[i] = doc->_document; - i++; - } - document_array_result *r = kuzzle_collection_m_update_document(_collection, docs, documents.size(), options); - - delete[] docs; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - - delete(r); - return v; + return ret; } - bool Collection::publishMessage(json_object* content, query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_collection_publish_message(_collection, content, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } + search_result* Collection::searchSpecifications(search_options *searchOptions) Kuz_Throw_KuzzleException { + search_result *r = kuzzle_collection_search_specifications(_collection, searchOptions); + if (r->error != NULL) + throwExceptionFromStatus(r); - Document* Collection::replaceDocument(const std::string& id, Document* document, query_options* options) Kuz_Throw_KuzzleException { - document_result* r = kuzzle_collection_update_document(_collection, const_cast(id.c_str()), document->_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); - return ret; - } + search_result *ret = r; + kuzzle_free_search_result(r); - search_result* Collection::scroll(const std::string& id, query_options* options) Kuz_Throw_KuzzleException { - search_result* r = kuzzle_collection_scroll(_collection, const_cast(id.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - return r; + return ret; } - search_result* Collection::search(search_filters* filters, query_options* options) Kuz_Throw_KuzzleException { - search_result* r = kuzzle_collection_search(_collection, filters, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - return r; - } + std::string Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_update_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - void call_collection_cb(notification_result* res, void* data) { - ((Collection*)data)->getListener()->onMessage(res); - } + std::string ret = r->result; + kuzzle_free_string_result(r); - NotificationListener* Collection::getListener() { - return _listener_instance; + return ret; } - Room* Collection::subscribe(search_filters* filters, NotificationListener *listener, room_options* options) Kuz_Throw_KuzzleException { - room_result* r = kuzzle_collection_subscribe(_collection, filters, options, &call_collection_cb, this); - if (r->error != NULL) - throwExceptionFromStatus(r); - _listener_instance = listener; - - Room* ret = new Room(r->result, NULL, listener); - free(r); - return ret; - } + void Collection::validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - Document* Collection::updateDocument(const std::string& id, Document* document, query_options* options) Kuz_Throw_KuzzleException { - document_result* r = kuzzle_collection_update_document(_collection, const_cast(id.c_str()), document->_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); - return ret; + kuzzle_free_void_result(r); } -} \ No newline at end of file + void Collection::deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + + kuzzle_free_void_result(r); + } +} diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp deleted file mode 100644 index dc34c667..00000000 --- a/internal/wrappers/cpp/document.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "document.hpp" -#include "collection.hpp" - -namespace kuzzleio { - - Document::Document(Collection *collection, const std::string& id, json_object* content) Kuz_Throw_KuzzleException { - _document = new document(); - _collection = collection; - kuzzle_new_document(_document, collection->_collection, const_cast(id.c_str()), content); - } - - Document::~Document() { - unregisterDocument(_document); - delete(_document); - } - - std::string Document::delete_(query_options* options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_delete(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - - bool Document::exists(query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_document_exists(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - - bool Document::publish(query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_document_publish(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - - Document* Document::refresh(query_options* options) Kuz_Throw_KuzzleException { - document_result *r = kuzzle_document_refresh(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(_collection, r->result->id, r->result->content); - delete(r); - return ret; - } - - Document* Document::save(query_options* options) Kuz_Throw_KuzzleException { - document_result *r = kuzzle_document_save(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(_collection, r->result->id, r->result->content); - - _document->id = r->result->id; - _document->version = r->result->version; - delete(r); - return ret; - } - - Document* Document::setContent(json_object* content, bool replace) { - kuzzle_document_set_content(_document, content, replace); - return this; - } - - json_object* Document::getContent() { - return kuzzle_document_get_content(_document); - } - - void call_cb(notification_result* res, void* data) { - ((Document*)data)->getListener()->onMessage(res); - } - - Room* Document::subscribe(NotificationListener* listener, room_options* options) { - room_result* r = kuzzle_document_subscribe(_document, options, &call_cb, this); - if (r->error != NULL) - throwExceptionFromStatus(r); - _listener_instance = listener; - - Room* ret = new Room(r->result, NULL, listener); - free(r); - return ret; - } - - NotificationListener* Document::getListener() { - return _listener_instance; - } -} diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 53da4700..db16a222 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -152,15 +152,6 @@ namespace kuzzleio { return ret; } - collection_entry* Kuzzle::listCollections(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { - collection_entry_result *r = kuzzle_list_collections(_kuzzle, const_cast(index.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - collection_entry *ret = r->result; - delete(r); - return ret; - } - std::vector Kuzzle::listIndexes(query_options* options) Kuz_Throw_KuzzleException { string_array_result *r = kuzzle_list_indexes(_kuzzle, options); if (r->error != NULL) @@ -310,5 +301,5 @@ namespace kuzzleio { int Kuzzle::listenerCount(Event event) { return kuzzle_listener_count(_kuzzle, event); } - + } diff --git a/internal/wrappers/cpp/room.cpp b/internal/wrappers/cpp/room.cpp deleted file mode 100644 index b975ab63..00000000 --- a/internal/wrappers/cpp/room.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "room.hpp" -#include "collection.hpp" - -namespace kuzzleio { - Room::Room(room* r, SubscribeListener* subscribe_listener, NotificationListener* notification_listener) { - this->_room = r; - this->_listener_instance = subscribe_listener; - this->_notification_listener_instance = notification_listener; - } - - Room::Room(Collection *collection, json_object *filters, room_options* options) { - this->_room = new room(); - room_new_room(this->_room, collection->_collection, filters, options); - } - - Room::~Room() { - unregisterRoom(this->_room); - delete(this->_room); - } - - int Room::count() Kuz_Throw_KuzzleException { - int_result *r = room_count(_room); - if (r->error != NULL) - throwExceptionFromStatus(r); - int ret = r->result; - delete(r); - return ret; - } - - void call_cb(room_result* res, void* data) { - ((Room*)data)->getSubscribeListener()->onSubscribe(res); - } - - void notify(notification_result* res, void* data) { - ((Room*)data)->getNotificationListener()->onMessage(res); - } - - SubscribeListener* Room::getSubscribeListener() { - return _listener_instance; - } - - NotificationListener* Room::getNotificationListener() { - return _notification_listener_instance; - } - - Room* Room::onDone(SubscribeListener *listener) { - _listener_instance = listener; - room_on_done(_room, &call_cb, this); - } - - Room* Room::subscribe(NotificationListener* listener) { - _notification_listener_instance = listener; - room_subscribe(_room, ¬ify, this); - } - - void Room::unsubscribe() Kuz_Throw_KuzzleException { - void_result *r = room_unsubscribe(_room); - if (r && r->error != NULL) - throwExceptionFromStatus(r); - _notification_listener_instance = NULL; - _listener_instance = NULL; - delete(r); - } -} \ No newline at end of file diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index b42ad65f..0c59b7ef 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -6,34 +6,26 @@ #include "core.hpp" namespace kuzzleio { - class Document; - class Room; class Collection { - public: - collection* _collection; - NotificationListener* _listener_instance; + collection* _collection; + Collection(); - Collection(Kuzzle* kuzzle, const std::string& collection, const std::string& index); + public: + Collection(Kuzzle* kuzzle); virtual ~Collection(); - int count(search_filters* filters, query_options* options=NULL) Kuz_Throw_KuzzleException; - Collection* createDocument(Document* document, const std::string& id="", query_options* options=NULL) Kuz_Throw_KuzzleException; - std::string deleteDocument(const std::string& id, query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* fetchDocument(const std::string& id, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mCreateDocument(std::vector& documents, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mCreateOrReplaceDocument(std::vector& documents, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mDeleteDocument(std::vector& ids, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mGetDocument(std::vector& ids, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mReplaceDocument(std::vector& documents, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mUpdateDocument(std::vector& documents, query_options* options=NULL) Kuz_Throw_KuzzleException; - bool publishMessage(json_object* content, query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* replaceDocument(const std::string& id, Document* document, query_options* options=NULL) Kuz_Throw_KuzzleException; - search_result* scroll(const std::string& id, query_options* options=NULL) Kuz_Throw_KuzzleException; - search_result* search(search_filters* filters, query_options* options=NULL) Kuz_Throw_KuzzleException; - Room* subscribe(search_filters* filters, NotificationListener* listener, room_options* options=NULL) Kuz_Throw_KuzzleException; - NotificationListener* getListener(); - Document* updateDocument(const std::string& id, Document* document, query_options* options=NULL) Kuz_Throw_KuzzleException; + void create(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + std::string list(const std::string& index, collection_list_options *collectionListOptions) Kuz_Throw_KuzzleException; + void truncate(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + std::string getMapping(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + void updateMapping(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; + std::string getSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + search_result* searchSpecifications(search_options *searchOptions) Kuz_Throw_KuzzleException; + std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; + void validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException; + void deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; }; } -#endif \ No newline at end of file +#endif diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp deleted file mode 100644 index 5e4e121c..00000000 --- a/internal/wrappers/headers/document.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _DOCUMENT_HPP_ -#define _DOCUMENT_HPP_ - -#include "listeners.hpp" -#include "exceptions.hpp" -#include "core.hpp" -#include "room.hpp" - -#include -#include - -namespace kuzzleio { - class Collection; - - class Document { - Document(){}; - Collection *_collection; - NotificationListener* _listener_instance; - - public: - document *_document; - Document(Collection *collection, const std::string& id="", json_object* content=NULL) Kuz_Throw_KuzzleException; - virtual ~Document(); - std::string delete_(query_options* options=NULL) Kuz_Throw_KuzzleException; - bool exists(query_options* options=NULL) Kuz_Throw_KuzzleException; - bool publish(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* refresh(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* save(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* setContent(json_object* content, bool replace=false); - json_object* getContent(); - Room* subscribe(NotificationListener* listener, room_options* options=NULL); - NotificationListener* getListener(); - }; -} - -#endif \ No newline at end of file diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index cb3b09c5..c5607b34 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -39,7 +39,6 @@ namespace kuzzleio { std::string getJwt(); json_object* getMyRights(query_options* options=NULL) Kuz_Throw_KuzzleException; json_object* getServerInfo(query_options* options=NULL) Kuz_Throw_KuzzleException; - collection_entry* listCollections(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; std::vector listIndexes(query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); void logout(); @@ -69,4 +68,4 @@ namespace kuzzleio { }; } -#endif \ No newline at end of file +#endif diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 08631d34..2302edbd 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -93,6 +93,23 @@ typedef struct { kuzzle_offline_queue_loader loader; } kuzzle; +typedef struct { + enum { + ALL, + STORED, + REALTIME + } type_; + int from; + int size; +} collection_list_options; + +typedef struct { + char *type_; + int from; + int size; + char *scroll; +} search_options; + //options passed to room constructor typedef struct { char *scope; @@ -212,8 +229,6 @@ typedef struct { typedef struct { void *instance; - char *index; - char *collection; kuzzle *kuzzle; } collection; @@ -529,14 +544,13 @@ typedef struct specification_result { } specification_result; typedef struct search_result { - document *documents; - size_t documents_length; + json_object *documents; unsigned fetched; unsigned total; json_object *aggregations; search_filters *filters; query_options *options; - collection *collection; + json_object *collection; int status; char *error; char *stack; diff --git a/internal/wrappers/headers/room.hpp b/internal/wrappers/headers/room.hpp deleted file mode 100644 index 1640e54c..00000000 --- a/internal/wrappers/headers/room.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _ROOM_HPP_ -#define _ROOM_HPP_ - -#include "listeners.hpp" -#include "exceptions.hpp" -#include "core.hpp" -#include "room.hpp" - -namespace kuzzleio { - class Collection; - - class Room { - room *_room; - SubscribeListener *_listener_instance; - NotificationListener *_notification_listener_instance; - - Room(){} - - public: - Room(Collection *collection, json_object *filters=NULL, room_options* options=NULL); - Room(room* r, SubscribeListener* subscribe_listener, NotificationListener* notification_listener); - virtual ~Room(); - int count() Kuz_Throw_KuzzleException; - SubscribeListener *getSubscribeListener(); - NotificationListener *getNotificationListener(); - Room* onDone(SubscribeListener* listener); - Room* subscribe(NotificationListener* listener); - void unsubscribe() Kuz_Throw_KuzzleException; - }; -} - -#endif \ No newline at end of file diff --git a/internal/wrappers/headers/sdk_wrappers_internal.h b/internal/wrappers/headers/sdk_wrappers_internal.h index 05927566..0a492139 100644 --- a/internal/wrappers/headers/sdk_wrappers_internal.h +++ b/internal/wrappers/headers/sdk_wrappers_internal.h @@ -2,7 +2,6 @@ #define __SDK_WRAPPERS_INTERNAL typedef char *char_ptr; -typedef document *document_ptr; typedef policy *policy_ptr; typedef policy_restriction *policy_restriction_ptr; typedef json_object *json_object_ptr; diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index c1c717c7..a444972d 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -2,13 +2,11 @@ %module(directors="1") kcore %{ -#include "listeners.hpp" +#include "listeners.hpp" #include "exceptions.hpp" #include "event_emitter.hpp" #include "kuzzle.hpp" #include "collection.hpp" -#include "room.hpp" -#include "document.hpp" #include #include %} @@ -23,5 +21,3 @@ %include "event_emitter.hpp" %include "kuzzle.hpp" %include "collection.hpp" -%include "room.hpp" -%include "document.hpp" diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 115d108e..c8b1a6bf 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -34,8 +34,6 @@ %{ #include "kuzzle.cpp" #include "collection.cpp" -#include "room.cpp" -#include "document.cpp" %} %include "exceptions.i" @@ -50,7 +48,6 @@ %include "std_vector.i" %template(StringVector) std::vector; -%template(DocumentVector) std::vector; %typemap(out) const StringVector& %{ return $1; @@ -139,5 +136,3 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" -%include "room.cpp" -%include "document.cpp" \ No newline at end of file diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index 8578096d..a55141e6 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -3,12 +3,13 @@ package kuzzle_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func ExampleKuzzle_Connect() { @@ -25,7 +26,6 @@ func ExampleKuzzle_Connect() { return } - fmt.Println(k.State) } func ExampleKuzzle_Jwt() { diff --git a/test.sh b/test.sh index e351d94a..08899e0f 100755 --- a/test.sh +++ b/test.sh @@ -36,7 +36,7 @@ linter_check() { make_wrappers() { cd "${dir}/internal/wrappers" - make all + make all } cd "$dir" @@ -53,4 +53,4 @@ case "$1" in show_cover_report html ;; *) echo >&2 "error: invalid option: $1"; exit 1 ;; -esac \ No newline at end of file +esac diff --git a/types/consts.go b/types/consts.go index eed0bb84..87c7611b 100644 --- a/types/consts.go +++ b/types/consts.go @@ -23,3 +23,10 @@ const ( USERS_OUT = "out" USERS_NONE = "none" ) + +// user notifications constants +const ( + TYPE_ALL = "all" + TYPE_STORED = "stored" + TYPE_REALTIME = "realtime" +) diff --git a/types/search_options.go b/types/search_options.go new file mode 100644 index 00000000..481a6e7a --- /dev/null +++ b/types/search_options.go @@ -0,0 +1,37 @@ +package types + +type SearchOptions struct { + Type string + From int + Size int + Scroll string +} + +func NewSearchOptions(t string, from int, size int, scroll string) *SearchOptions { + return &SearchOptions{ + Type: t, + From: from, + Size: size, + Scroll: scroll, + } +} + +func (so *SearchOptions) SetType(nt string) *SearchOptions { + so.Type = nt + return so +} + +func (so *SearchOptions) SetFrom(nf int) *SearchOptions { + so.From = nf + return so +} + +func (so *SearchOptions) SetSize(ns int) *SearchOptions { + so.Size = ns + return so +} + +func (so *SearchOptions) SetScroll(ns string) *SearchOptions { + so.Scroll = ns + return so +} diff --git a/types/search_result.go b/types/search_result.go new file mode 100644 index 00000000..8fee1d19 --- /dev/null +++ b/types/search_result.go @@ -0,0 +1,111 @@ +package types + +import ( + "encoding/json" +) + +type SearchResult struct { + Collection json.RawMessage + Documents json.RawMessage + Total int + Fetched int + Aggregations json.RawMessage + Options QueryOptions + Filters *SearchFilters +} + +func NewSearchResult(collection json.RawMessage, filters *SearchFilters, options QueryOptions, raw *KuzzleResponse) *SearchResult { + type ParseSearchResult struct { + Documents json.RawMessage `json:"hits"` + Total int `json:"total"` + ScrollId string `json:"_scroll_id"` + Aggregations json.RawMessage `json:"aggregations"` + } + + var parsed ParseSearchResult + json.Unmarshal(raw.Result, &parsed) + + sr := &SearchResult{ + Collection: collection, + Filters: filters, + Documents: parsed.Documents, + Total: parsed.Total, + Fetched: len(parsed.Documents), + Aggregations: parsed.Aggregations, + Options: NewQueryOptions(), + } + + sr.Options.SetScrollId(parsed.ScrollId) + + if options != nil { + sr.Options.SetFrom(options.From()) + sr.Options.SetSize(options.Size()) + } else { + sr.Options.SetFrom(0) + sr.Options.SetSize(0) + } + + return sr +} + +//// FetchNext returns a new SearchResult that corresponds to the next result page +//func (ksr *SearchResult) FetchNext() (*SearchResult, error) { +// if ksr.Fetched >= ksr.Total { +// return nil, nil +// } +// +// if ksr.Options.ScrollId() != "" { +// res, err := ksr.Scroll(ksr.Options.ScrollId(), nil) +// return ksr.afterFetch(res, err) +// } +// +// if ksr.Options.Size() > 0 { +// if ksr.Filters != nil && len(ksr.Filters.Sort) > 0 { +// source := ksr.Documents[len(ksr.Documents)-1].SourceToMap() +// +// filters := &SearchFilters{ +// Query: ksr.Filters.Query, +// Sort: ksr.Filters.Sort, +// Aggregations: ksr.Filters.Aggregations, +// } +// +// for _, sortRules := range ksr.Filters.Sort { +// switch t := sortRules.(type) { +// case string: +// filters.SearchAfter = append(filters.SearchAfter, source[t]) +// case map[string]interface{}: +// for field := range t { +// filters.SearchAfter = append(filters.SearchAfter, source[field]) +// } +// } +// } +// +// res, err := ksr.Collection.Search(filters, ksr.Options) +// return ksr.afterFetch(res, err) +// } else { +// opts := NewQueryOptions() +// opts.SetFrom(ksr.Options.From() + ksr.Options.Size()) +// +// if opts.From() >= ksr.Total { +// return nil, nil +// } +// +// opts.SetSize(ksr.Options.Size()) +// +// res, err := ksr.Collection.Search(ksr.Filters, opts) +// return ksr.afterFetch(res, err) +// } +// } +// +// return nil, NewError("SearchResult.FetchNext: Unable to retrieve results: missing scrollId or from/size parameters", 400) +//} +// +//func (ksr *SearchResult) afterFetch(nextResult *SearchResult, err error) (*SearchResult, error) { +// if err != nil { +// return nextResult, err +// } +// +// nextResult.Fetched = len(nextResult.Documents) + ksr.Fetched +// +// return nextResult, nil +//} From f035abda03c16c5406752f37d88446561bda328f Mon Sep 17 00:00:00 2001 From: Ballinette Date: Wed, 28 Feb 2018 19:19:18 +0100 Subject: [PATCH 030/363] remove link to obsolete kuzzle-sdk repository --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index 69bc368b..9c63d986 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ A backend software, self-hostable and ready to use to power modern apps. You can access the Kuzzle repository on [Github](https://github.com/kuzzleio/kuzzle) * [SDK Documentation](https://godoc.org/github.com/kuzzleio/sdk-go) -* [Report an issue](#report-an-issue) * [Installation](#installation) * [Basic usage](#basic-usage) * [Running tests](#tests) @@ -20,12 +19,6 @@ You can access the Kuzzle repository on [Github](https://github.com/kuzzleio/kuz The complete SDK documentation is available [here](http://docs.kuzzle.io/sdk-reference/) -## Report an issue - -Use following meta repository to report issues on SDK: - -https://github.com/kuzzleio/kuzzle-sdk/issues - ## Installation ````sh From 936d3b51143e89b98af8260a87a7e6e9fb32d720 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Mon, 5 Mar 2018 08:45:45 +0100 Subject: [PATCH 031/363] One function missing --- collection/collection.go | 26 +- collection/collection_mapping.go | 112 --- collection/collection_mapping_test.go | 330 ------- collection/count.go | 45 - collection/create.go | 33 +- collection/create_document.go | 50 - collection/create_document_test.go | 128 --- collection/create_test.go | 27 +- collection/delete.go | 34 + collection/delete_document.go | 35 - collection/delete_document_test.go | 82 -- collection/{count_test.go => delete_test.go} | 52 +- collection/document.go | 276 ------ collection/document_exists.go | 34 - collection/document_exists_test.go | 80 -- collection/document_test.go | 466 --------- collection/exists.go | 45 + collection/exists_test.go | 67 ++ collection/fetch_document.go | 35 - collection/fetch_document_test.go | 80 -- collection/get_mapping.go | 41 +- collection/get_mapping_test.go | 104 +- collection/get_specifications.go | 37 + collection/get_specifications_test.go | 94 ++ collection/list.go | 38 + collection/list_test.go | 87 ++ collection/m_routes.go | 222 ----- collection/m_routes_test.go | 447 --------- collection/publish_message.go | 35 - collection/publish_message_test.go | 79 -- collection/replace_document.go | 36 - collection/replace_document_test.go | 89 -- collection/room.go | 161 ---- collection/room_count.go | 40 - collection/room_count_test.go | 62 -- collection/room_subscribe.go | 113 --- collection/room_subscribe_test.go | 130 --- collection/room_test.go | 294 ------ collection/room_unsubscribe.go | 41 - collection/room_unsubscribe_test.go | 40 - collection/scroll.go | 29 - collection/scroll_test.go | 81 -- collection/search.go | 38 - collection/search_result.go | 116 --- collection/search_result_test.go | 249 ----- collection/search_specifications.go | 42 + collection/search_specifications_test.go | 1 + collection/search_test.go | 117 --- collection/specifications.go | 297 ++---- collection/specifications_test.go | 963 ++++++++++--------- collection/subscribe.go | 16 - collection/subscribe_test.go | 57 -- collection/truncate.go | 29 +- collection/truncate_test.go | 31 +- collection/update_document.go | 36 - collection/update_document_test.go | 94 -- collection/update_mapping.go | 39 + collection/update_mapping_test.go | 74 ++ collection/validate_specifications.go | 29 + collection/validate_specifications_test.go | 65 ++ 60 files changed, 1408 insertions(+), 5222 deletions(-) delete mode 100644 collection/collection_mapping.go delete mode 100644 collection/collection_mapping_test.go delete mode 100644 collection/count.go delete mode 100644 collection/create_document.go delete mode 100644 collection/create_document_test.go create mode 100644 collection/delete.go delete mode 100644 collection/delete_document.go delete mode 100644 collection/delete_document_test.go rename collection/{count_test.go => delete_test.go} (51%) delete mode 100644 collection/document.go delete mode 100644 collection/document_exists.go delete mode 100644 collection/document_exists_test.go delete mode 100644 collection/document_test.go create mode 100644 collection/exists.go create mode 100644 collection/exists_test.go delete mode 100644 collection/fetch_document.go delete mode 100644 collection/fetch_document_test.go create mode 100644 collection/get_specifications.go create mode 100644 collection/get_specifications_test.go create mode 100644 collection/list.go create mode 100644 collection/list_test.go delete mode 100644 collection/m_routes.go delete mode 100644 collection/m_routes_test.go delete mode 100644 collection/publish_message.go delete mode 100644 collection/publish_message_test.go delete mode 100644 collection/replace_document.go delete mode 100644 collection/replace_document_test.go delete mode 100644 collection/room.go delete mode 100644 collection/room_count.go delete mode 100644 collection/room_count_test.go delete mode 100644 collection/room_subscribe.go delete mode 100644 collection/room_subscribe_test.go delete mode 100644 collection/room_test.go delete mode 100644 collection/room_unsubscribe.go delete mode 100644 collection/room_unsubscribe_test.go delete mode 100644 collection/scroll.go delete mode 100644 collection/scroll_test.go delete mode 100644 collection/search.go delete mode 100644 collection/search_result.go delete mode 100644 collection/search_result_test.go create mode 100644 collection/search_specifications.go create mode 100644 collection/search_specifications_test.go delete mode 100644 collection/search_test.go delete mode 100644 collection/subscribe.go delete mode 100644 collection/subscribe_test.go delete mode 100644 collection/update_document.go delete mode 100644 collection/update_document_test.go create mode 100644 collection/update_mapping.go create mode 100644 collection/update_mapping_test.go create mode 100644 collection/validate_specifications.go create mode 100644 collection/validate_specifications_test.go diff --git a/collection/collection.go b/collection/collection.go index ac345b3a..07b77424 100644 --- a/collection/collection.go +++ b/collection/collection.go @@ -5,24 +5,26 @@ import ( ) type Collection struct { - Kuzzle *kuzzle.Kuzzle - index, collection string - subscribeCallback interface{} + Kuzzle *kuzzle.Kuzzle } // NewCollection instanciates a new collection -func NewCollection(kuzzle *kuzzle.Kuzzle, collection, index string) *Collection { +func NewCollection(kuzzle *kuzzle.Kuzzle) *Collection { return &Collection{ - index: index, - collection: collection, - Kuzzle: kuzzle, + Kuzzle: kuzzle, } } -// Document instanciates a new Document -func (dc *Collection) Document() *Document { - return &Document{ - Content: []byte(`{}`), - collection: dc, +type ListOptions struct { + Type string + From int + Size int +} + +func NewListOptions(t string, from int, size int) *ListOptions { + return &ListOptions{ + Type: t, + From: from, + Size: size, } } diff --git a/collection/collection_mapping.go b/collection/collection_mapping.go deleted file mode 100644 index b2063fa6..00000000 --- a/collection/collection_mapping.go +++ /dev/null @@ -1,112 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -type IMapping interface { - Apply() - Refresh() - Set() -} - -type Mapping struct { - Mapping types.MappingFields - Collection *Collection -} - -func NewMapping(col *Collection) *Mapping { - fm := make(types.MappingFields) - return &Mapping{ - Collection: col, - Mapping: fm, - } -} - -// Apply applies the new mapping to the data collection. -func (cm *Mapping) Apply(options types.QueryOptions) (*Mapping, error) { - ch := make(chan *types.KuzzleResponse) - - type body struct { - Properties types.MappingFields `json:"properties"` - } - - query := &types.KuzzleRequest{ - Collection: cm.Collection.collection, - Index: cm.Collection.index, - Controller: "collection", - Action: "updateMapping", - Body: &body{Properties: cm.Mapping}, - } - - go cm.Collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return cm, res.Error - } - - return cm.Refresh(nil) -} - -// Refresh Replaces the current content with the mapping stored in Kuzzle. -// Calling this function will discard any uncommitted changes. You can commit changes by calling the “apply” function -func (cm *Mapping) Refresh(options types.QueryOptions) (*Mapping, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: cm.Collection.collection, - Index: cm.Collection.index, - Controller: "collection", - Action: "getMapping", - } - go cm.Collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return cm, res.Error - } - - type mappingResult map[string]struct { - Mappings map[string]struct { - Properties types.MappingFields `json:"properties"` - } `json:"mappings"` - } - - result := mappingResult{} - json.Unmarshal(res.Result, &result) - - if _, ok := result[cm.Collection.index]; ok { - indexMappings := result[cm.Collection.index].Mappings - - if _, ok := indexMappings[cm.Collection.collection]; ok { - cm.Mapping = indexMappings[cm.Collection.collection].Properties - - return cm, nil - } else { - return cm, types.NewError("No mapping found for collection "+cm.Collection.collection, 404) - } - } else { - return cm, types.NewError("No mapping found for index "+cm.Collection.index, 404) - } -} - -/* - Adds or updates a field mapping. - - Changes made by this function won’t be applied until you call the apply method -*/ -func (cm *Mapping) Set(mappings *types.MappingFields) *Mapping { - if cm.Mapping == nil { - return cm - } - - for field, mapping := range *mappings { - (cm.Mapping)[field] = mapping - } - - return cm -} diff --git a/collection/collection_mapping_test.go b/collection/collection_mapping_test.go deleted file mode 100644 index f7e8d5d3..00000000 --- a/collection/collection_mapping_test.go +++ /dev/null @@ -1,330 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestMappingApplyError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": { - Type: "text", - Index: true, - }, - }, - Collection: cl, - } - - _, err := cm.Apply(nil) - assert.NotNil(t, err) -} - -func TestMappingApply(t *testing.T) { - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - callCount++ - - if callCount == 1 { - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":256}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - } - if callCount == 2 { - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "updateMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":100}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - } - if callCount == 3 { - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":100}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - cm, _ := cl.GetMapping(nil) - - fieldMapping := &types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - } - - res, _ := cm.Set(fieldMapping).Apply(nil) - - assert.Equal(t, cm, res) -} - -func ExampleMapping_Apply() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - cm, _ := cl.GetMapping(nil) - qo := types.NewQueryOptions() - - fieldMapping := &types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - } - - res, err := cm.Set(fieldMapping).Apply(qo) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Collection, res.Mapping) -} - -func TestMappingRefreshError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - - _, err := cm.Refresh(nil) - assert.NotNil(t, err) -} - -func TestMappingRefreshUnknownIndex(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "wrong-index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":256}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "wrong-index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - - _, err := cm.Refresh(nil) - - assert.Equal(t, "No mapping found for index wrong-index", err.(*types.KuzzleError).Message) - assert.Equal(t, 404, err.(*types.KuzzleError).Status) -} - -func TestMappingRefreshUnknownCollection(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "wrong-collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":256}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "wrong-collection", "index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - - _, err := cm.Refresh(nil) - - assert.Equal(t, "No mapping found for collection wrong-collection", err.(*types.KuzzleError).Message) - assert.Equal(t, 404, err.(*types.KuzzleError).Status) -} - -func TestMappingRefresh(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":255}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - updatedCm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 255, - }, - }, - Collection: cl, - } - - cm.Refresh(nil) - assert.Equal(t, updatedCm.Mapping, cm.Mapping) -} - -func ExampleMapping_Refresh() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - qo := types.NewQueryOptions() - - cm := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - }, - Collection: cl, - } - - res, err := cm.Refresh(qo) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Collection, res.Mapping) -} - -func TestMappingSet(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":256}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - cm, _ := cl.GetMapping(nil) - - fieldMapping := &types.MappingFields{ - "foo": types.MappingField{ - Type: "text", - IgnoreAbove: 100, - }, - } - - cm.Set(fieldMapping) - - assert.Equal(t, 100, cm.Mapping["foo"].IgnoreAbove) -} - -func ExampleMapping_Set() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - cm, _ := cl.GetMapping(nil) - - fieldMapping := &types.MappingFields{ - "foo": { - Type: "text", - IgnoreAbove: 100, - }, - } - - res := cm.Set(fieldMapping) - - fmt.Println(res.Collection, res.Mapping) -} diff --git a/collection/count.go b/collection/count.go deleted file mode 100644 index e5ea7258..00000000 --- a/collection/count.go +++ /dev/null @@ -1,45 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/types" -) - -// Count returns the number of documents matching the provided set of filters. -// There is a small delay between documents creation and their existence in our advanced search layer, -// usually a couple of seconds. -// That means that a document that was just been created won’t be returned by this function -func (dc *Collection) Count(filters *types.SearchFilters, options types.QueryOptions) (int, error) { - type countResult struct { - Count int `json:"count"` - Status int - } - - searchfilters := &types.SearchFilters{} - - if filters != nil { - searchfilters = filters - } - - ch := make(chan *types.KuzzleResponse) - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "count", - Body: searchfilters, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return -1, res.Error - } - - result := &countResult{} - json.Unmarshal(res.Result, result) - - return result.Count, nil -} diff --git a/collection/create.go b/collection/create.go index c55f54ef..c7eb82b6 100644 --- a/collection/create.go +++ b/collection/create.go @@ -1,37 +1,34 @@ package collection import ( - "encoding/json" - - "fmt" "github.com/kuzzleio/sdk-go/types" ) -// Create creates a new empty data collection, with no associated mapping. -func (dc *Collection) Create(options types.QueryOptions) (bool, error) { +// Create creates a new empty data collection +func (dc *Collection) Create(index string, collection string) error { + if index == "" { + return types.NewError("Collection.Create: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.Create: collection required", 400) + } + ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, + Collection: collection, + Index: index, Controller: "collection", Action: "create", } - go dc.Kuzzle.Query(query, options, ch) + go dc.Kuzzle.Query(query, nil, ch) res := <-ch if res.Error != nil { - return false, res.Error - } - - ack := &struct { - Acknowledged bool `json:"acknowledged"` - }{} - err := json.Unmarshal(res.Result, ack) - if err != nil { - return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + return res.Error } - return ack.Acknowledged, nil + return nil } diff --git a/collection/create_document.go b/collection/create_document.go deleted file mode 100644 index cfb29125..00000000 --- a/collection/create_document.go +++ /dev/null @@ -1,50 +0,0 @@ -package collection - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" -) - -// Create a new document in Kuzzle. -// Takes an optional argument object with the following properties: -// - volatile (object, default: null): -// Additional information passed to notifications to other users -// - ifExist (string, allowed values: "error" (default), "replace"): -// If the same document already exists: -// - resolves with an error if set to "error". -// - replaces the existing document if set to "replace" -func (dc *Collection) CreateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - ch := make(chan *types.KuzzleResponse) - - action := "create" - - if options != nil { - if options.IfExist() == "replace" { - action = "createOrReplace" - } else if options.IfExist() != "error" { - return nil, types.NewError(fmt.Sprintf("Invalid value for the 'ifExist' option: '%s'", options.IfExist()), 400) - } - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: action, - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - documentResponse := &Document{collection: dc} - json.Unmarshal(res.Result, documentResponse) - - return documentResponse, nil -} diff --git a/collection/create_document_test.go b/collection/create_document_test.go deleted file mode 100644 index 00a9a52b..00000000 --- a/collection/create_document_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestCreateDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestCreateDocumentWrongOptionError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("unknown") - - _, err := newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, opts) - assert.Equal(t, "[400] Invalid value for the 'ifExist' option: 'unknown'", fmt.Sprint(err)) -} - -func TestCreateDocument(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "create", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - body := make(map[string]interface{}, 0) - body["title"] = "yolo" - - assert.Equal(t, body, parsedQuery.Body) - - res := collection.Document{Id: id, Content: []byte(`{"title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - assert.Equal(t, id, res.Id) -} - -func TestCreateDocumentReplace(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "createOrReplace", parsedQuery.Action) - - res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("replace") - newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) -} - -func TestCreateDocumentCreate(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "create", parsedQuery.Action) - - res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("error") - - newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) -} - -func ExampleCollection_CreateDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - id := "myId" - - res, err := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} diff --git a/collection/create_test.go b/collection/create_test.go index 99d5c737..679550c7 100644 --- a/collection/create_test.go +++ b/collection/create_test.go @@ -11,6 +11,20 @@ import ( "github.com/stretchr/testify/assert" ) +func TestCreateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Create("", "collection") + assert.NotNil(t, err) +} + +func TestCreateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Create("index", "") + assert.NotNil(t, err) +} + func TestCreateError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { @@ -19,7 +33,8 @@ func TestCreateError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := collection.NewCollection(k, "collection", "index").Create(nil) + nc := collection.NewCollection(k) + err := nc.Create("index", "collection") assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -34,20 +49,20 @@ func TestCreate(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := collection.NewCollection(k, "collection", "index").Create(nil) - assert.Equal(t, true, res) + nc := collection.NewCollection(k) + err := nc.Create("index", "collection") + assert.Nil(t, err) } func ExampleCollection_Create() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - res, err := collection.NewCollection(k, "collection", "index").Create(nil) + nc := collection.NewCollection(k) + err := nc.Create("index", "collection") if err != nil { fmt.Println(err.Error()) return } - - fmt.Printf("%#v\n", res) } diff --git a/collection/delete.go b/collection/delete.go new file mode 100644 index 00000000..1d8e495c --- /dev/null +++ b/collection/delete.go @@ -0,0 +1,34 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// Delete deletes a collection +func (dc *Collection) Delete(index string, collection string) error { + if index == "" { + return types.NewError("Collection.Delete: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.Delete: collection required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "delete", + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/collection/delete_document.go b/collection/delete_document.go deleted file mode 100644 index 198db81d..00000000 --- a/collection/delete_document.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// DeleteDocument deletes the Document using its provided unique id. -func (dc *Collection) DeleteDocument(id string, options types.QueryOptions) (string, error) { - if id == "" { - return "", types.NewError("Collection.DeleteDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "delete", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", res.Error - } - - document := &Document{collection: dc} - json.Unmarshal(res.Result, document) - - return document.Id, nil -} diff --git a/collection/delete_document_test.go b/collection/delete_document_test.go deleted file mode 100644 index 3fbb904f..00000000 --- a/collection/delete_document_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestDeleteDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("should have stopped before receiving a response")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("", nil) - assert.NotNil(t, err) - assert.Equal(t, "Collection.DeleteDocument: document id required", err.(*types.KuzzleError).Message) -} - -func TestDeleteDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("myId", nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestDeleteDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "delete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) - assert.Equal(t, id, res) -} - -func ExampleCollection_DeleteDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - id := "myId" - - res, err := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/count_test.go b/collection/delete_test.go similarity index 51% rename from collection/count_test.go rename to collection/delete_test.go index 1dc704ea..e0cebe6b 100644 --- a/collection/count_test.go +++ b/collection/delete_test.go @@ -1,17 +1,31 @@ package collection_test import ( - "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) -func TestCountError(t *testing.T) { +func TestDeleteIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Delete("", "collection") + assert.NotNil(t, err) +} + +func TestDeleteCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Delete("index", "") + assert.NotNil(t, err) +} + +func TestDeleteError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: types.NewError("Unit test error")} @@ -19,44 +33,36 @@ func TestCountError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - count, err := collection.NewCollection(k, "collection", "index").Count(nil, nil) + nc := collection.NewCollection(k) + err := nc.Delete("index", "collection") assert.NotNil(t, err) - assert.Equal(t, -1, count) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } -func TestCount(t *testing.T) { - type result struct { - Count int `json:"count"` - } - +func TestDelete(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - res := result{Count: 10} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} + return &types.KuzzleResponse{Result: []byte(`{ + "acknowledged":true + }`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := collection.NewCollection(k, "collection", "index").Count(nil, nil) - assert.Equal(t, 10, res) + nc := collection.NewCollection(k) + err := nc.Delete("index", "collection") + assert.Nil(t, err) } -func ExampleCollection_Count() { - type result struct { - Count int `json:"count"` - } - +func ExampleCollection_Delete() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - res, err := collection.NewCollection(k, "collection", "index").Count(nil, nil) + nc := collection.NewCollection(k) + err := nc.Delete("index", "collection") if err != nil { fmt.Println(err.Error()) return } - - fmt.Println(res) } diff --git a/collection/document.go b/collection/document.go deleted file mode 100644 index 38e7e174..00000000 --- a/collection/document.go +++ /dev/null @@ -1,276 +0,0 @@ -package collection - -import ( - "encoding/json" - "strconv" - - "github.com/kuzzleio/sdk-go/types" -) - -type IDocument interface { - Save() - Refresh() - SetContent() - Publish() - Exists() - Delete() -} - -type Document struct { - Id string `json:"_id"` - Index string `json:"_index"` - Meta *types.Meta `json:"_meta"` - Shards *types.Shards `json:"_shards"` - Content json.RawMessage `json:"_source"` - Version int `json:"_version"` - Result string `json:"result"` - Created bool `json:"created"` - Collection string `json:"_collection"` - collection *Collection `json:"-"` -} - -type DocumentContent map[string]interface{} - -/* - * Instanciate a new document - */ -func NewDocument(col *Collection, id string) *Document { - return &Document{ - collection: col, - Id: id, - Collection: col.collection, - Index: col.index, - } -} - -func (documentContent *DocumentContent) ToString() string { - s, _ := json.Marshal(documentContent) - - return string(s) -} - -func (d *Document) SourceToMap() DocumentContent { - sourceMap := DocumentContent{} - - json.Unmarshal(d.Content, &sourceMap) - - return sourceMap -} - -// Subscribe listens to events concerning this document. Has no effect if the document does not have an ID -// (i.e. if the document has not yet been created as a persisted document). -func (d *Document) Subscribe(options types.RoomOptions, ch chan<- types.KuzzleNotification) (*Room, error) { - if d.Id == "" { - return nil, types.NewError("Document.Subscribe: cannot subscribe to a document if no ID has been provided", 400) - } - - filters := map[string]map[string][]string{ - "ids": { - "values": []string{d.Id}, - }, - } - - return d.collection.Subscribe(filters, options, ch), nil -} - -/* - Saves the document into Kuzzle. - - If this is a new document, will create it in Kuzzle and the id property will be made available. - Otherwise, will replace the latest version of the document in Kuzzle by the current content of this object. -*/ -func (d *Document) Save(options types.QueryOptions) (*Document, error) { - if d.Id == "" { - return d, types.NewError("Document.Save: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "createOrReplace", - Id: d.Id, - Body: d.Content, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return d, res.Error - } - - return d, nil -} - -/* - Replaces the document with the latest version stored in Kuzzle. -*/ -func (d *Document) Refresh(options types.QueryOptions) (*Document, error) { - if d.Id == "" { - return d, types.NewError("Document.Refresh: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "get", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - if res.Error != nil { - return d, res.Error - } - - json.Unmarshal(res.Result, d) - - return d, nil -} - -/* - Sets the document id. -*/ -func (d *Document) SetDocumentId(id string) *Document { - if id != "" { - d.Id = id - } - - return d -} - -/* - Replaces the current document content with provided data. - Changes made by this function won’t be applied until the save method is called. - If replace is set to true, the entire content will be replaced, otherwise, only existing and new fields will be impacted. -*/ -func (d *Document) SetContent(content DocumentContent, replace bool) *Document { - if replace { - d.Content, _ = json.Marshal(content) - } else { - source := DocumentContent{} - json.Unmarshal(d.Content, &source) - - for attr, value := range content { - if source[attr] == nil { - source[attr] = value - } - } - - d.Content, _ = json.Marshal(source) - } - - return d -} - -/* - Sends the content of the document as a realtime message. -*/ -func (d *Document) Publish(options types.QueryOptions) (bool, error) { - ch := make(chan *types.KuzzleResponse) - - type message struct { - Id string `json:"_id,omitempty"` - Version int `json:"_version,omitempty"` - Body json.RawMessage `json:"body"` - Meta *types.Meta `json:"meta"` - } - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "realtime", - Action: "publish", - Body: message{ - Id: d.Id, - Version: d.Version, - Body: d.Content, - Meta: d.Meta, - }, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - response := types.RealtimeResponse{} - - json.Unmarshal(res.Result, &response) - - return response.Published, nil -} - -/* - Checks if the document exists in Kuzzle. -*/ -func (d *Document) Exists(options types.QueryOptions) (bool, error) { - if d.Id == "" { - return false, types.NewError("Document.Exists: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "exists", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - exists, _ := strconv.ParseBool(string(res.Result)) - - return exists, nil -} - -/* - Deletes the document in Kuzzle. -*/ -func (d *Document) Delete(options types.QueryOptions) (string, error) { - if d.Id == "" { - return "", types.NewError("Document.Delete: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "delete", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", res.Error - } - - document := Document{collection: d.collection} - json.Unmarshal(res.Result, &document) - - return document.Id, nil -} diff --git a/collection/document_exists.go b/collection/document_exists.go deleted file mode 100644 index 27c8e204..00000000 --- a/collection/document_exists.go +++ /dev/null @@ -1,34 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" - "strconv" -) - -// DocumentExists returns a boolean indicating whether or not a document with provided ID exists. -func (dc *Collection) DocumentExists(id string, options types.QueryOptions) (bool, error) { - if id == "" { - return false, types.NewError("Collection.DocumentExists: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "exists", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - exists, _ := strconv.ParseBool(string(res.Result)) - - return exists, nil -} diff --git a/collection/document_exists_test.go b/collection/document_exists_test.go deleted file mode 100644 index b41a98da..00000000 --- a/collection/document_exists_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestDocumentExistsEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.DocumentExists: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DocumentExists("", nil) - assert.NotNil(t, err) -} - -func TestDocumentExistsError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DocumentExists("myId", nil) - assert.NotNil(t, err) -} - -func TestDocumentExists(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "exists", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) - assert.Equal(t, true, res) -} - -func ExampleCollection_DocumentExists() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/document_test.go b/collection/document_test.go deleted file mode 100644 index 760845fc..00000000 --- a/collection/document_test.go +++ /dev/null @@ -1,466 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestDocumentSetContent(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) - - assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - }, - }, false) - - assert.Equal(t, string(json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`))), string(d.Content)) -} - -func ExampleDocument_SetContent() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - }, - }, false) - - fmt.Println(d.Content) -} - -func TestDocumentSetContentReplace(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) - - assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - "subsubfield": collection.DocumentContent{ - "hi": "there", - }, - }, - }, true) - - assert.Equal(t, string(json.RawMessage([]byte(`{"subfield":{"john":"cena","subsubfield":{"hi":"there"}}}`))), string(d.Content)) -} - -func TestDocumentSubscribeEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - cd := dc.Document() - - ch := make(chan types.KuzzleNotification) - _, err := cd.Subscribe(types.NewRoomOptions(), ch) - - assert.Equal(t, "[400] Document.Subscribe: cannot subscribe to a document if no ID has been provided", err.Error()) -} - -func TestDocumentSubscribe(t *testing.T) { - id := "docId" - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - // Fetch query - if parsedQuery.Controller == "document" { - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} - r, _ := json.Marshal(res) - - return &types.KuzzleResponse{Result: r} - } - - // Subscribe query - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "subscribe", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, map[string]interface{}(map[string]interface{}{"ids": map[string]interface{}{"values": []interface{}{"docId"}}}), parsedQuery.Body) - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - dc := collection.NewCollection(k, "collection", "index") - d := dc.Document() - d.Id = id - - ch := make(chan types.KuzzleNotification) - room, _ := d.Subscribe(types.NewRoomOptions(), ch) - r := <-room.ResponseChannel() - - assert.Nil(t, r.Error) - assert.NotNil(t, r.Room) - assert.Equal(t, "42", r.Room.RoomId()) -} - -func ExampleDocument_Subscribe() { - id := "docId" - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{} - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - dc := collection.NewCollection(k, "collection", "index") - d := dc.Document() - d.Id = id - - ch := make(chan types.KuzzleNotification) - room, _ := d.Subscribe(types.NewRoomOptions(), ch) - - notification := <-room.ResponseChannel() - - fmt.Println(notification.Room.RoomId(), notification.Error) -} - -func TestDocumentSaveEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Save(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Save: missing document id", fmt.Sprint(err)) -} - -func TestDocumentSaveError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Save(nil) - - assert.NotNil(t, err) -} - -func TestDocumentSave(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "createOrReplace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{"foo": "bar"} - - d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) - - assert.Equal(t, id, d.Id) - assert.Equal(t, documentContent.ToString(), string(d.Content)) -} - -func ExampleDocument_Save() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{"foo": "bar"} - - res, err := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} - -func TestDocumentRefreshEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Refresh(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Refresh: missing document id", fmt.Sprint(err)) -} - -func TestDocumentRefreshError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Refresh(nil) - - assert.NotNil(t, err) -} - -func TestDocumentRefresh(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"name":"Anakin","function":"Jedi"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{ - "name": "Anakin", - "function": "Padawan", - } - - d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Refresh(nil) - - result := collection.Document{} - json.Unmarshal(d.Content, &result.Content) - - ic := collection.DocumentContent{} - json.Unmarshal(result.Content, &ic) - - assert.Equal(t, id, d.Id) - assert.Equal(t, "Padawan", documentContent["function"]) - assert.Equal(t, "Jedi", ic["function"]) - assert.NotEqual(t, documentContent["function"], ic["function"]) -} - -func ExampleDocument_Refresh() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId(id).Refresh(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} - -func TestCollectionDocumentExistsEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Exists(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Exists: missing document id", fmt.Sprint(err)) -} - -func TestCollectionDocumentExistsError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Exists(nil) - - assert.NotNil(t, err) -} - -func TestCollectionDocumentExists(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "exists", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - exists, _ := dc.Document().SetDocumentId(id).Exists(nil) - - assert.Equal(t, true, exists) -} - -func ExampleDocument_Exists() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId(id).Exists(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestDocumentPublishError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "realtime", "publish") - _, err := dc.Document().SetDocumentId("myId").Publish(nil) - - assert.NotNil(t, err) -} - -func TestDocumentPublish(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "publish", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - r, _ := json.Marshal(types.RealtimeResponse{Published: true}) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, _ := dc.Document().SetDocumentId("myId").Publish(nil) - - assert.Equal(t, true, res) -} - -func ExampleDocument_Publish() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId("myId").Publish(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestDocumentDeleteEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Delete(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Delete: missing document id", fmt.Sprint(err)) -} - -func TestDocumentDeleteError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Delete(nil) - - assert.NotNil(t, err) -} - -func TestDocumentDelete(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "delete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(collection.Document{Id: id}) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, _ := dc.Document().SetDocumentId("myId").Delete(nil) - - assert.Equal(t, id, res) -} - -func ExampleDocument_Delete() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId("myId").Delete(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/exists.go b/collection/exists.go new file mode 100644 index 00000000..1f584089 --- /dev/null +++ b/collection/exists.go @@ -0,0 +1,45 @@ +package collection + +import ( + "encoding/json" + "fmt" + + "github.com/kuzzleio/sdk-go/types" +) + +// Exists check if a collection exists. +func (dc *Collection) Exists(index string, collection string) (bool, error) { + if index == "" { + return false, types.NewError("Collection.Exists: index required", 400) + } + + if collection == "" { + return false, types.NewError("Collection.Exists: collection required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "exists", + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return false, res.Error + } + + var exists bool + + err := json.Unmarshal(res.Result, &exists) + + if err != nil { + return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + } + + return true, nil +} diff --git a/collection/exists_test.go b/collection/exists_test.go new file mode 100644 index 00000000..60419dc6 --- /dev/null +++ b/collection/exists_test.go @@ -0,0 +1,67 @@ +package collection_test + +import ( + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestExistsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.Exists("", "collection") + assert.NotNil(t, err) +} + +func TestExistsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.Exists("index", "") + assert.NotNil(t, err) +} + +func TestExistsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.Exists("index", "collection") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestExists(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: []byte(`true`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + res, err := nc.Exists("index", "collection") + assert.Nil(t, err) + assert.Equal(t, true, res) +} + +func ExampleCollection_Exists() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.Exists("index", "collection") + + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/collection/fetch_document.go b/collection/fetch_document.go deleted file mode 100644 index 7f4fa8f7..00000000 --- a/collection/fetch_document.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// FetchDocument retrieves a Document using its provided unique id. -func (dc *Collection) FetchDocument(id string, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.FetchDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "get", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - document := &Document{collection: dc} - json.Unmarshal(res.Result, document) - - return document, nil -} diff --git a/collection/fetch_document_test.go b/collection/fetch_document_test.go deleted file mode 100644 index 73d71c51..00000000 --- a/collection/fetch_document_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestFetchDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.FetchDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").FetchDocument("", nil) - assert.NotNil(t, err) -} - -func TestFetchDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").FetchDocument("myId", nil) - assert.NotNil(t, err) -} - -func TestFetchDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo": "bar"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) - assert.Equal(t, id, res.Id) -} - -func ExampleCollection_FetchDocument() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} diff --git a/collection/get_mapping.go b/collection/get_mapping.go index 75e51d9c..0b215410 100644 --- a/collection/get_mapping.go +++ b/collection/get_mapping.go @@ -1,46 +1,37 @@ package collection import ( - "encoding/json" "github.com/kuzzleio/sdk-go/types" ) // GetMapping retrieves the current mapping of the collection. -func (dc *Collection) GetMapping(options types.QueryOptions) (*Mapping, error) { +func (dc *Collection) GetMapping(index string, collection string) (string, error) { + if index == "" { + return "", types.NewError("Collection.GetMapping: index required", 400) + } + + if collection == "" { + return "", types.NewError("Collection.GetMapping: collection required", 400) + } + ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, + Collection: collection, + Index: index, Controller: "collection", Action: "getMapping", } - go dc.Kuzzle.Query(query, options, ch) + go dc.Kuzzle.Query(query, nil, ch) res := <-ch if res.Error != nil { - return nil, res.Error + return "", res.Error } - type mappingResult map[string]struct { - Mappings map[string]struct { - Properties types.MappingFields `json:"properties"` - } `json:"mappings"` - } - - result := mappingResult{} - json.Unmarshal(res.Result, &result) + var mapping string + mapping = string(res.Result) - if _, ok := result[dc.index]; ok { - indexMappings := result[dc.index].Mappings - - if _, ok := indexMappings[dc.collection]; ok { - return &Mapping{Mapping: indexMappings[dc.collection].Properties, Collection: dc}, nil - } else { - return nil, types.NewError("No mapping found for collection "+dc.collection, 404) - } - } else { - return nil, types.NewError("No mapping found for index "+dc.index, 404) - } + return mapping, nil } diff --git a/collection/get_mapping_test.go b/collection/get_mapping_test.go index 67b68253..d2db05c8 100644 --- a/collection/get_mapping_test.go +++ b/collection/get_mapping_test.go @@ -3,73 +3,41 @@ package collection_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/collection" + "testing" + "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) -func TestGetMappingError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").GetMapping(nil) +func TestGetMappingIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.GetMapping("", "collection") assert.NotNil(t, err) } -func TestGetMappingUnknownIndex(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "wrong-index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","fields":{"type":"keyword","ignore_above":256}}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "wrong-index") - - _, err := cl.GetMapping(nil) +func TestGetMappingCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.GetMapping("index", "") assert.NotNil(t, err) - assert.Equal(t, "[404] No mapping found for index wrong-index", fmt.Sprint(err)) } -func TestGetMappingUnknownCollection(t *testing.T) { +func TestGetMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getMapping", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "wrong-collection", parsedQuery.Collection) - - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":255}}}}}}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} }, } k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "wrong-collection", "index") - _, err := cl.GetMapping(nil) + nc := collection.NewCollection(k) + _, err := nc.GetMapping("index", "collection") assert.NotNil(t, err) - assert.Equal(t, "[404] No mapping found for collection wrong-collection", fmt.Sprint(err)) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } func TestGetMapping(t *testing.T) { @@ -83,40 +51,46 @@ func TestGetMapping(t *testing.T) { assert.Equal(t, "index", parsedQuery.Index) assert.Equal(t, "collection", parsedQuery.Collection) - res := types.KuzzleResponse{Result: []byte(`{"index":{"mappings":{"collection":{"properties":{"foo":{"type":"text","ignore_above":255}}}}}}`)} + res := types.KuzzleResponse{Result: []byte(` + { + "index":{ + "mappings":{ + "collection":{ + "properties":{ + "foo":{ + "type":"text", + "ignore_above":255 + } + } + } + } + } + }`), + } + r, _ := json.Marshal(res.Result) return &types.KuzzleResponse{Result: r} }, } k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - - res, _ := cl.GetMapping(nil) - - expected := collection.Mapping{ - Mapping: types.MappingFields{ - "foo": { - Type: "text", - IgnoreAbove: 255, - }, - }, - Collection: cl, - } - assert.Equal(t, expected.Mapping, res.Mapping) + nc := collection.NewCollection(k) + res, err := nc.GetMapping("index", "collection") + assert.Nil(t, err) + assert.NotNil(t, res) } func ExampleCollection_GetMapping() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - cl := collection.NewCollection(k, "collection", "index") - res, err := cl.GetMapping(nil) + nc := collection.NewCollection(k) + res, err := nc.GetMapping("index", "collection") if err != nil { fmt.Println(err.Error()) return } - fmt.Println(res.Collection, res.Mapping) + fmt.Println(res) } diff --git a/collection/get_specifications.go b/collection/get_specifications.go new file mode 100644 index 00000000..f5f432a2 --- /dev/null +++ b/collection/get_specifications.go @@ -0,0 +1,37 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// GetSpecifications retrieves the current specifications of the collection. +func (dc *Collection) GetSpecifications(index string, collection string) (string, error) { + if index == "" { + return "", types.NewError("Collection.GetSpecifications: index required", 400) + } + + if collection == "" { + return "", types.NewError("Collection.GetSpecifications: collection required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "getSpecifications", + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var specifications string + specifications = string(res.Result) + + return specifications, nil +} diff --git a/collection/get_specifications_test.go b/collection/get_specifications_test.go new file mode 100644 index 00000000..afd2efb6 --- /dev/null +++ b/collection/get_specifications_test.go @@ -0,0 +1,94 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetSpecificationsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.GetSpecifications("", "collection") + assert.NotNil(t, err) +} + +func TestGetSpecificationsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.GetSpecifications("index", "") + assert.NotNil(t, err) +} + +func TestGetSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.GetSpecifications("index", "collection") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestGetSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "collection", parsedQuery.Controller) + assert.Equal(t, "getSpecifications", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + res := types.KuzzleResponse{Result: []byte(`{ + "collection": "collection", + "index": "index", + "validation": { + "fields": { + "myField": { + "defaultValue": 42, + "mandatory": true, + "type": "integer" + } + }, + "strict": true + }`), + } + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + res, err := nc.GetSpecifications("index", "collection") + assert.Nil(t, err) + assert.NotNil(t, res) +} + +func ExampleCollection_GetSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + res, err := nc.GetSpecifications("index", "collection") + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/collection/list.go b/collection/list.go new file mode 100644 index 00000000..33a305cb --- /dev/null +++ b/collection/list.go @@ -0,0 +1,38 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// ListCollections retrieves the list of known data collections contained in a specified index. +func (dc *Collection) List(index string, options *ListOptions) (string, error) { + if index == "" { + return "", types.NewError("Collection.List: index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "collection", + Action: "list", + Index: index, + Body: options.Type, + } + + queryOpts := types.NewQueryOptions() + queryOpts.SetFrom(options.From) + queryOpts.SetSize(options.Size) + + go dc.Kuzzle.Query(query, queryOpts, result) + + res := <-result + + if res.Error != nil { + return "", res.Error + } + + var collectionList string + collectionList = string(res.Result) + + return collectionList, nil +} diff --git a/collection/list_test.go b/collection/list_test.go new file mode 100644 index 00000000..5c99f4ff --- /dev/null +++ b/collection/list_test.go @@ -0,0 +1,87 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestListIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + lo := collection.NewListOptions("stored", 0, 1) + _, err := nc.List("", lo) + + assert.NotNil(t, err) +} + +func TestListError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + lo := collection.NewListOptions("stored", 0, 1) + _, err := nc.List("index", lo) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestList(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "collection", parsedQuery.Controller) + assert.Equal(t, "list", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + + res := types.KuzzleResponse{Result: []byte(` + { + "collections": [ + { + "name": "stored_n", "type": "stored" + } + ], + "type": "all" + }`), + } + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + lo := collection.NewListOptions("all", 0, 1) + res, err := nc.List("index", lo) + assert.Nil(t, err) + assert.NotNil(t, res) +} + +func ExampleCollection_List() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + lo := collection.NewListOptions("all", 0, 1) + res, err := nc.List("index", lo) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/collection/m_routes.go b/collection/m_routes.go deleted file mode 100644 index 571e952a..00000000 --- a/collection/m_routes.go +++ /dev/null @@ -1,222 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/types" -) - -type mActionResult struct { - Hits []json.RawMessage `json:"hits"` - Total int `json:"total"` -} - -/* - Creates the provided documents. -*/ -func (dc *Collection) MCreateDocument(documents []*Document, options types.QueryOptions) ([]*Document, error) { - return performMultipleCreate(dc, documents, "mCreate", options) -} - -/* - Creates or replaces the provided documents. -*/ -func (dc *Collection) MCreateOrReplaceDocument(documents []*Document, options types.QueryOptions) ([]*Document, error) { - return performMultipleCreate(dc, documents, "mCreateOrReplace", options) -} - -func (dc *Collection) parseMultiActionsResult(response *types.KuzzleResponse) ([]*Document, error) { - if response.Error != nil { - return nil, response.Error - } - - var rawResult mActionResult - json.Unmarshal(response.Result, &rawResult) - - result := make([]*Document, rawResult.Total) - - for i, d := range rawResult.Hits { - json.Unmarshal(d, &result[i]) - result[i].collection = dc - } - - return result, nil -} - -func performMultipleCreate(dc *Collection, documents []*Document, action string, options types.QueryOptions) ([]*Document, error) { - ch := make(chan *types.KuzzleResponse) - - type subDoc struct { - Document interface{} `json:document` - } - - type CreationDocument struct { - Id string `json:"_id"` - Body *subDoc `json:"body"` - } - - docs := []*CreationDocument{} - - type body struct { - Documents []*CreationDocument `json:"documents"` - } - - for _, doc := range documents { - docs = append(docs, &CreationDocument{ - Id: doc.Id, - Body: &subDoc{ - Document: doc.Content, - }, - }) - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: action, - Body: &body{docs}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - return dc.parseMultiActionsResult(res) -} - -// MReplaceDocument replaces multiple documents at once -func (dc *Collection) MReplaceDocument(documents []*Document, options types.QueryOptions) ([]*Document, error) { - if len(documents) == 0 { - return nil, types.NewError("Collection.MReplaceDocument: please provide at least one document to replace", 400) - } - - ch := make(chan *types.KuzzleResponse) - - type CreationDocument struct { - Id string `json:"_id"` - Body interface{} `json:"body"` - } - docs := []*CreationDocument{} - - type body struct { - Documents []*CreationDocument `json:"documents"` - } - - for _, doc := range documents { - docs = append(docs, &CreationDocument{ - Id: doc.Id, - Body: doc.Content, - }) - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "mReplace", - Body: &body{docs}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - return dc.parseMultiActionsResult(res) -} - -// MDeleteDocument deletes multiple documents at once -func (dc *Collection) MDeleteDocument(ids []string, options types.QueryOptions) ([]string, error) { - if len(ids) == 0 { - return nil, types.NewError("Collection.MDeleteDocument: please provide at least one id of document to delete", 400) - } - - ch := make(chan *types.KuzzleResponse) - - type body struct { - Ids []string `json:"ids"` - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "mDelete", - Body: &body{Ids: ids}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - result := []string{} - json.Unmarshal(res.Result, &result) - - return result, nil -} - -// MGetDocument fetches multiple documents at once -func (dc *Collection) MGetDocument(ids []string, options types.QueryOptions) ([]*Document, error) { - if len(ids) == 0 { - return nil, types.NewError("Collection.MGetDocument: please provide at least one id of document to retrieve", 400) - } - - ch := make(chan *types.KuzzleResponse) - - type body struct { - Ids []string `json:"ids"` - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "mGet", - Body: &body{Ids: ids}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - return dc.parseMultiActionsResult(res) -} - -// MUpdateDocument updates multiple documents at once -func (dc *Collection) MUpdateDocument(documents []*Document, options types.QueryOptions) ([]*Document, error) { - if len(documents) == 0 { - return nil, types.NewError("Collection.MUpdateDocument: please provide at least one document to update", 400) - } - - ch := make(chan *types.KuzzleResponse) - - type CreationDocument struct { - Id string `json:"_id"` - Body interface{} `json:"body"` - } - docs := []*CreationDocument{} - - type body struct { - Documents []*CreationDocument `json:"documents"` - } - - for _, doc := range documents { - docs = append(docs, &CreationDocument{ - Id: doc.Id, - Body: doc.Content, - }) - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "mUpdate", - Body: &body{docs}, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - return dc.parseMultiActionsResult(res) -} diff --git a/collection/m_routes_test.go b/collection/m_routes_test.go deleted file mode 100644 index 2044a318..00000000 --- a/collection/m_routes_test.go +++ /dev/null @@ -1,447 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestMCreateDocumentError(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MCreateDocument(documents, nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestMCreateDocument(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mCreate", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := map[string]interface{}{"Total": 2, "Hits": documents} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MCreateDocument(documents, nil) - assert.Equal(t, 2, len(res)) - - for index, doc := range res { - assert.Equal(t, documents[index].Id, doc.Id) - assert.Equal(t, documents[index].Content, doc.Content) - } -} - -func ExampleCollection_MCreateDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MCreateDocument([]*collection.Document{ - {Content: []byte(`{"title":"yolo"}`)}, - {Content: []byte(`{"title":"oloy"}`)}, - }, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} - -func TestMCreateOrReplaceDocumentError(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MCreateOrReplaceDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMCreateOrReplaceDocument(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mCreateOrReplace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := map[string]interface{}{"Total": 2, "Hits": documents} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MCreateOrReplaceDocument(documents, nil) - assert.Equal(t, 2, len(res)) - - for index, doc := range res { - assert.Equal(t, documents[index].Id, doc.Id) - assert.Equal(t, documents[index].Content, doc.Content) - } -} - -func ExampleCollection_MCreateOrReplaceDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MCreateOrReplaceDocument([]*collection.Document{ - {Content: []byte(`{"title":"yolo"}`)}, - {Content: []byte(`{"title":"oloy"}`)}, - }, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} - -func TestMReplaceDocumentEmptyDocuments(t *testing.T) { - documents := []*collection.Document{} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.MReplaceDocument: please provide at least one document to replace"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MReplaceDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMReplaceDocumentError(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MReplaceDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMReplaceDocument(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mReplace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := map[string]interface{}{"Total": 2, "Hits": documents} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MReplaceDocument(documents, nil) - assert.Equal(t, 2, len(res)) - - for index, doc := range res { - assert.Equal(t, documents[index].Id, doc.Id) - assert.Equal(t, documents[index].Content, doc.Content) - } -} - -func ExampleCollection_MReplaceDocument() { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MReplaceDocument(documents, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} - -func TestMDeleteDocumentEmptyIds(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("should have failed before that line")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MDeleteDocument([]string{}, nil) - assert.NotNil(t, err) - assert.Equal(t, "Collection.MDeleteDocument: please provide at least one id of document to delete", err.(*types.KuzzleError).Message) -} - -func TestMDeleteDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MDeleteDocument([]string{"foo", "bar"}, nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestMDeleteDocument(t *testing.T) { - ids := []string{"foo", "bar"} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mDelete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, []interface{}{"foo", "bar"}, parsedQuery.Body.(map[string]interface{})["ids"]) - - return &types.KuzzleResponse{Result: []byte(`["foo","bar"]`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MDeleteDocument(ids, nil) - assert.Equal(t, []string{"foo", "bar"}, res) -} - -func ExampleCollection_MDeleteDocument() { - ids := []string{"foo", "bar"} - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MDeleteDocument(ids, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestMGetDocumentEmptyIds(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.MGetDocument: please provide at least one id of document to retrieve"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MGetDocument([]string{}, nil) - assert.NotNil(t, err) -} - -func TestMGetDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MGetDocument([]string{"foo", "bar"}, nil) - assert.NotNil(t, err) -} - -func TestMGetDocument(t *testing.T) { - hits := []*collection.Document{ - {Id: "foo", Content: json.RawMessage(`{"title":"foo"}`)}, - {Id: "bar", Content: json.RawMessage(`{"title":"bar"}`)}, - } - - ids := []string{"foo", "bar"} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mGet", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, []interface{}{"foo", "bar"}, parsedQuery.Body.(map[string]interface{})["ids"]) - - res := map[string]interface{}{"Total": 2, "Hits": hits} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MGetDocument(ids, nil) - assert.Equal(t, 2, len(res)) - - for i := range res { - assert.Equal(t, hits[i].Id, res[i].Id) - assert.Equal(t, hits[i].Content, res[i].Content) - } -} - -func ExampleCollection_MGetDocument() { - ids := []string{"foo", "bar"} - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MGetDocument(ids, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} - -func TestMUpdateDocumentEmptyDocuments(t *testing.T) { - documents := []*collection.Document{} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.MUpdateDocument: please provide at least one document to update"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MUpdateDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMUpdateDocumentError(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").MUpdateDocument(documents, nil) - assert.NotNil(t, err) -} - -func TestMUpdateDocument(t *testing.T) { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "mUpdate", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := map[string]interface{}{"Total": 2, "Hits": documents} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").MUpdateDocument(documents, nil) - assert.Equal(t, 2, len(res)) - - for index, doc := range res { - assert.Equal(t, documents[index].Id, doc.Id) - assert.Equal(t, documents[index].Content, doc.Content) - } -} - -func ExampleCollection_MUpdateDocument() { - documents := []*collection.Document{ - {Id: "foo", Content: []byte(`{"title":"Foo"}`)}, - {Id: "bar", Content: []byte(`{"title":"Bar"}`)}, - } - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").MUpdateDocument(documents, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Content) -} diff --git a/collection/publish_message.go b/collection/publish_message.go deleted file mode 100644 index d941f60e..00000000 --- a/collection/publish_message.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// PublishMessage publishes a realtime message -// Takes an optional argument object with the following properties: -// - volatile (object, default: null): -// Additional information passed to notifications to other users -func (dc *Collection) PublishMessage(message interface{}, options types.QueryOptions) (bool, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "realtime", - Action: "publish", - Body: message, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - response := types.RealtimeResponse{} - - json.Unmarshal(res.Result, &response) - - return response.Published, nil -} diff --git a/collection/publish_message_test.go b/collection/publish_message_test.go deleted file mode 100644 index c24f9d3c..00000000 --- a/collection/publish_message_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestPublishKuzzleError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - type TestMessageStruct struct { - Title string `json:"title"` - } - - _, err := collection.NewCollection(k, "collection", "index").PublishMessage(TestMessageStruct{"yolo"}, nil) - assert.NotNil(t, err) -} - -func TestPublishMessage(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "publish", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - assert.Equal(t, "yolo", parsedQuery.Body.(map[string]interface{})["title"]) - - res := types.KuzzleResponse{Result: []byte(`{"published":true}`)} - r, _ := json.Marshal(res.Result) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - type TestMessageStruct struct { - Title string `json:"title"` - } - - coll := collection.NewCollection(k, "collection", "index") - res, _ := coll.PublishMessage(TestMessageStruct{"yolo"}, nil) - - assert.Equal(t, true, res) -} - -func ExampleCollection_PublishMessage() { - type Document struct { - Title string - } - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - type TestMessageStruct struct { - Title string `json:"title"` - } - res, err := collection.NewCollection(k, "collection", "index").PublishMessage(TestMessageStruct{"yolo"}, nil) - - if err != nil { - panic(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/replace_document.go b/collection/replace_document.go deleted file mode 100644 index 223a8848..00000000 --- a/collection/replace_document.go +++ /dev/null @@ -1,36 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// ReplaceDocument replaces a document in Kuzzle. -func (dc *Collection) ReplaceDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.ReplaceDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "replace", - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - d := &Document{collection: dc} - json.Unmarshal(res.Result, d) - - return d, nil -} diff --git a/collection/replace_document_test.go b/collection/replace_document_test.go deleted file mode 100644 index e221bef6..00000000 --- a/collection/replace_document_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestReplaceDocumentEmptyId(t *testing.T) { - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ReplaceDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestReplaceDocumentError(t *testing.T) { - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestReplaceDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "replace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) - - res := collection.Document{Id: id, Content: []byte(`{"title": "jonathan"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.Equal(t, id, res.Id) -} - -func ExampleCollection_ReplaceDocument() { - type Document struct { - Title string - } - - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} diff --git a/collection/room.go b/collection/room.go deleted file mode 100644 index db764131..00000000 --- a/collection/room.go +++ /dev/null @@ -1,161 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" - "github.com/satori/go.uuid" -) - -type roomState int - -const ( - inactive roomState = iota - subscribing - active -) - -type Room struct { - // object configuration - filters interface{} - channel string - roomId string - requestId string - scope string - state string - subscribeToSelf bool - users string - Volatile types.VolatileData - err error - autoResubscribe bool - - // internal properties - collection *Collection - id string - internalState roomState - isListening bool - subscribing bool - - // channels - realtimeNotificationChannel chan<- types.KuzzleNotification - subscribeResponseChan chan types.SubscribeResponse - onReconnect chan interface{} - onDisconnect chan interface{} - onTokenExpired chan interface{} -} - -// NewRoom instanciates a new Room; this type is the result of a subscription request, -// allowing to manipulate the subscription itself. -// In Kuzzle, you don't exactly subscribe to a room or a topic but, instead, you subscribe to documents. -// What it means is that, to subscribe, you provide to Kuzzle a set of matching filters. -// Once you have subscribed, if a pub/sub message is published matching your filters, or if a matching stored -// document change (because it is created, updated or deleted), then you'll receive a notification about it. -func NewRoom(c *Collection, filters interface{}, opts types.RoomOptions) *Room { - if opts == nil { - opts = types.NewRoomOptions() - } - - u, _ := uuid.NewV4() - r := &Room{ - scope: opts.Scope(), - state: opts.State(), - users: opts.Users(), - filters: filters, - id: u.String(), - collection: c, - subscribeToSelf: opts.SubscribeToSelf(), - Volatile: opts.Volatile(), - internalState: inactive, - isListening: false, - autoResubscribe: opts.AutoResubscribe(), - onReconnect: make(chan interface{}), - onDisconnect: make(chan interface{}), - onTokenExpired: make(chan interface{}), - } - return r -} - -// AddListener Adds a listener to a Kuzzle global event. When an event is fired, listeners are called in the order of their insertion. -func (room *Room) AddListener(event int, channel chan<- interface{}) { - room.collection.Kuzzle.AddListener(event, channel) -} - -// On is an alias to the AddListener function -func (room *Room) On(event int, channel chan<- interface{}) { - room.collection.Kuzzle.AddListener(event, channel) -} - -// Remove all listener by event type or all listener if event == -1 -func (room *Room) RemoveAllListeners(event int) { - room.collection.Kuzzle.RemoveAllListeners(event) -} - -// RemoveListener removes a listener -func (room *Room) RemoveListener(event int, channel chan<- interface{}) { - room.collection.Kuzzle.RemoveListener(event, channel) -} - -func (room *Room) Once(event int, channel chan<- interface{}) { - room.collection.Kuzzle.Once(event, channel) -} - -func (room *Room) ListenerCount(event int) int { - return room.collection.Kuzzle.ListenerCount(event) -} - -// RealtimeChannel returns the channel handling the notifications received by this room -func (room *Room) RealtimeChannel() chan<- types.KuzzleNotification { - return room.realtimeNotificationChannel -} - -// RoomId returns the kuzzle room unique identifier -func (room *Room) RoomId() string { - return room.roomId -} - -// Id returns the internal object identifier (internal use only) -func (room *Room) Id() string { - return room.id -} - -// Filters returns the room's filters -func (room *Room) Filters() interface{} { - return room.filters -} - -// ResponseChannel returns the channel handling the subscription request result -func (room *Room) ResponseChannel() chan types.SubscribeResponse { - return room.subscribeResponseChan -} - -// Channel is the getter for the channel's unique identifier -func (room *Room) Channel() string { - return room.channel -} - -func (room *Room) Scope() string { - return room.scope -} - -func (room *Room) State() string { - return room.state -} - -func (room *Room) Users() string { - return room.users -} - -//OnDone Calls the provided callback when the subscription finishes. -func (room *Room) OnDone(c chan types.SubscribeResponse) *Room { - if room.err != nil { - c <- types.SubscribeResponse{Error: room.err} - } else if room.internalState == active { - c <- types.SubscribeResponse{} - } else { - room.subscribeResponseChan = c - } - - return room -} - -func (room *Room) SubscribeToSelf() bool { - return room.subscribeToSelf -} diff --git a/collection/room_count.go b/collection/room_count.go deleted file mode 100644 index 4bf69c11..00000000 --- a/collection/room_count.go +++ /dev/null @@ -1,40 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/types" -) - -// Count returns the number of other subscriptions on that room. -func (room *Room) Count() (int, error) { - if room.internalState != active { - return -1, types.NewError("Cannot count subscriptions on a non-active room", 400) - } - - query := &types.KuzzleRequest{ - Controller: "realtime", - Action: "count", - Body: struct { - RoomId string `json:"roomId"` - }{room.roomId}, - } - - result := make(chan *types.KuzzleResponse) - - go room.collection.Kuzzle.Query(query, nil, result) - - res := <-result - - if res.Error != nil { - return -1, res.Error - } - - count := struct { - Count int `json:"count"` - }{} - - json.Unmarshal(res.Result, &count) - - return count.Count, nil -} diff --git a/collection/room_count_test.go b/collection/room_count_test.go deleted file mode 100644 index a43c41d2..00000000 --- a/collection/room_count_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package collection - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestRoomCountError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := NewRoom(NewCollection(k, "collection", "index"), nil, nil).Count() - assert.NotNil(t, err) -} - -func TestRoomCount(t *testing.T) { - type result struct { - Count int `json:"count"` - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - res := result{Count: 10} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.internalState = active - res, _ := r.Count() - assert.Equal(t, 10, res) -} - -func ExampleRoom_Count() { - type result struct { - Count int `json:"count"` - } - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := NewRoom(NewCollection(k, "collection", "index"), nil, nil).Count() - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/room_subscribe.go b/collection/room_subscribe.go deleted file mode 100644 index b9a71124..00000000 --- a/collection/room_subscribe.go +++ /dev/null @@ -1,113 +0,0 @@ -package collection - -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/event" - - "github.com/kuzzleio/sdk-go/types" -) - -// Renew the subscription. Force a resubscription using the same filters -// if no new ones are provided. -// Unsubscribes first if this Room was already listening to events. -func (room *Room) Subscribe(realtimeNotificationChannel chan<- types.KuzzleNotification) { - if room.internalState == active { - if room.subscribeResponseChan != nil { - room.subscribeResponseChan <- types.SubscribeResponse{Room: room} - } - return - } - - if room.internalState == subscribing { - return - } - - room.err = nil - room.internalState = subscribing - - go func() { - result := make(chan *types.KuzzleResponse) - - opts := types.NewQueryOptions() - opts.SetVolatile(room.Volatile) - - go room.collection.Kuzzle.Query(&types.KuzzleRequest{ - Controller: "realtime", - Action: "subscribe", - Index: room.collection.index, - Collection: room.collection.collection, - Scope: room.scope, - State: room.state, - Users: room.users, - Body: room.filters, - }, opts, result) - - res := <-result - room.subscribing = false - room.internalState = subscribing - - if res.Error != nil { - if res.Error.Message == "Not Connected" { - c := make(chan interface{}) - room.Once(event.Connected, c) - go func() { - <-c - room.internalState = inactive - room.err = nil - room.Subscribe(realtimeNotificationChannel) - }() - return - } - room.internalState = inactive - if room.subscribeResponseChan != nil { - room.subscribeResponseChan <- types.SubscribeResponse{Error: res.Error} - } - return - } - - type RoomResult struct { - RequestId string `json:"requestId"` - RoomId string `json:"roomId"` - Channel string `json:"channel"` - } - - var resRoom RoomResult - json.Unmarshal(res.Result, &resRoom) - - room.requestId = resRoom.RequestId - room.channel = resRoom.Channel - room.roomId = resRoom.RoomId - room.internalState = active - - room.realtimeNotificationChannel = realtimeNotificationChannel - room.collection.Kuzzle.RegisterRoom(room) - - if room.subscribeResponseChan != nil { - room.subscribeResponseChan <- types.SubscribeResponse{Room: room} - } - if room.isListening { - go func() { - <-room.onDisconnect - room.internalState = inactive - }() - go func() { - <-room.onTokenExpired - room.internalState = inactive - }() - go func() { - <-room.onReconnect - room.internalState = inactive - - if room.autoResubscribe { - room.Subscribe(realtimeNotificationChannel) - } - }() - - room.AddListener(event.Disconnected, room.onDisconnect) - room.AddListener(event.TokenExpired, room.onTokenExpired) - room.AddListener(event.Reconnected, room.onReconnect) - room.isListening = true - } - }() -} diff --git a/collection/room_subscribe_test.go b/collection/room_subscribe_test.go deleted file mode 100644 index db2f5ea8..00000000 --- a/collection/room_subscribe_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package collection - -import ( - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestSubscribeQueryError(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "ah!"}} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - subResChan := make(chan types.SubscribeResponse) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.OnDone(subResChan) - r.Subscribe(nil) - - res := <-subResChan - assert.Equal(t, "ah!", res.Error.Error()) -} - -func TestRenewWithSubscribeToSelf(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{RequestId: "ah!", Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - subResChan := make(chan types.SubscribeResponse) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.OnDone(subResChan) - r.Subscribe(nil) - - res := <-subResChan - assert.Equal(t, "42", res.Room.RoomId()) -} - -func TestRoomSubscribe(t *testing.T) { - var k *kuzzle.Kuzzle - - done := make(chan bool) - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - MockAddListener: func(e int, c chan<- interface{}) { - done <- true - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.isListening = true - r.Subscribe(nil) - <-done -} - -func TestRoomSubscribeAlreadyActive(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.internalState = active - r.subscribeResponseChan = make(chan types.SubscribeResponse) - done := make(chan bool) - - go func() { - <-r.subscribeResponseChan - done <- true - }() - r.Subscribe(nil) - - <-done -} - -func TestRoomSubscribeNotConnected(t *testing.T) { - var k *kuzzle.Kuzzle - - done := make(chan bool) - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Not Connected"}} - }, - MockOnce: func(e int, c chan<- interface{}) { - done <- true - }, - } - - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - r.Subscribe(nil) - <-done -} - -func ExampleRoom_Subscribe() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - NewRoom(NewCollection(k, "collection", "index"), nil, nil).Subscribe(nil) -} diff --git a/collection/room_test.go b/collection/room_test.go deleted file mode 100644 index 69bb634a..00000000 --- a/collection/room_test.go +++ /dev/null @@ -1,294 +0,0 @@ -package collection - -import ( - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestInitRoomWithoutOptions(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - assert.NotNil(t, r) -} - -func TestRoomFilters(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - - k, _ = kuzzle.NewKuzzle(c, nil) - cl := NewCollection(k, "collection", "index") - - type SubscribeFiltersValues struct { - Values []string `json:"values"` - } - type SubscribeFilters struct { - Ids SubscribeFiltersValues `json:"ids"` - } - var filters = SubscribeFilters{ - Ids: SubscribeFiltersValues{ - Values: []string{"1"}, - }, - } - - c.SetState(state.Connected) - rtc := make(chan types.KuzzleNotification) - res := cl.Subscribe(filters, types.NewRoomOptions(), rtc) - - assert.Equal(t, filters, res.Filters()) -} - -func ExampleRoom_Filters() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := NewCollection(k, "collection", "index") - - type SubscribeFiltersValues struct { - Values []string `json:"values"` - } - type SubscribeFilters struct { - Ids SubscribeFiltersValues `json:"ids"` - } - var filters = SubscribeFilters{ - Ids: SubscribeFiltersValues{ - Values: []string{"1"}, - }, - } - - c.SetState(state.Connected) - rtc := make(chan types.KuzzleNotification) - res := cl.Subscribe(filters, types.NewRoomOptions(), rtc) - - fmt.Println(res) -} - -func TestRoomRealtimeChannel(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - - k, _ = kuzzle.NewKuzzle(c, nil) - cl := NewCollection(k, "collection", "index") - - type SubscribeFiltersValues struct { - Values []string `json:"values"` - } - type SubscribeFilters struct { - Ids SubscribeFiltersValues `json:"ids"` - } - var filters = SubscribeFilters{ - Ids: SubscribeFiltersValues{ - Values: []string{"1"}, - }, - } - - c.SetState(state.Connected) - rtc := make(chan<- types.KuzzleNotification) - res := cl.Subscribe(filters, nil, rtc) - <-res.ResponseChannel() - - assert.Equal(t, rtc, res.RealtimeChannel()) -} - -func ExampleRoom_RealtimeChannel() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - cl := NewCollection(k, "collection", "index") - - type SubscribeFiltersValues struct { - Values []string `json:"values"` - } - type SubscribeFilters struct { - Ids SubscribeFiltersValues `json:"ids"` - } - var filters = SubscribeFilters{ - Ids: SubscribeFiltersValues{ - Values: []string{"1"}, - }, - } - - c.SetState(state.Connected) - rtc := make(chan<- types.KuzzleNotification) - res := cl.Subscribe(filters, types.NewRoomOptions(), rtc) - rtChannel := res.RealtimeChannel() - - fmt.Println(rtChannel) -} - -func TestAddListener(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockAddListener: func(e int, c chan<- interface{}) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - ch := make(chan interface{}) - - r.AddListener(0, ch) - assert.Equal(t, true, called) -} - -func TestRemoveListener(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockRemoveListener: func(e int, c chan<- interface{}) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - ch := make(chan interface{}) - - r.RemoveListener(0, ch) - assert.Equal(t, true, called) -} -func TestRemoveAllListener(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockRemoveAllListeners: func(e int) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - r.RemoveAllListeners(0) - assert.Equal(t, true, called) -} - -func TestOnce(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockOnce: func(e int, c chan<- interface{}) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - ch := make(chan interface{}) - - r.Once(0, ch) - assert.Equal(t, true, called) -} - -func TestOn(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockAddListener: func(e int, c chan<- interface{}) { - called = true - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - ch := make(chan interface{}) - - r.On(0, ch) - assert.Equal(t, true, called) -} - -func TestListenerCount(t *testing.T) { - called := false - - c := &internal.MockedConnection{ - MockListenerCount: func(e int) int { - called = true - return -1 - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - - r.ListenerCount(0) - assert.Equal(t, true, called) -} -func TestOnDoneError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return nil - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - ch := make(chan types.SubscribeResponse) - done := make(chan bool) - - go func() { - <-ch - done <- true - }() - r.err = &types.KuzzleError{Message: "Room has an error"} - r.OnDone(ch) - - <-done -} - -func TestOnDoneAlreadyActive(t *testing.T) { - c := &internal.MockedConnection{} - - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - ch := make(chan types.SubscribeResponse) - done := make(chan bool) - - go func() { - <-ch - done <- true - }() - - r.internalState = active - r.OnDone(ch) - - <-done -} -func TestOnDone(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - ch := make(chan types.SubscribeResponse) - r.OnDone(ch) - - r.Subscribe(nil) - assert.Equal(t, ch, r.subscribeResponseChan) -} diff --git a/collection/room_unsubscribe.go b/collection/room_unsubscribe.go deleted file mode 100644 index 4371f801..00000000 --- a/collection/room_unsubscribe.go +++ /dev/null @@ -1,41 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/event" - "github.com/kuzzleio/sdk-go/types" -) - -// Unsubscribe from Kuzzle. Stop listening immediately. -// If there is no listener left on that Room, sends an unsubscribe request to Kuzzle, once -// pending subscriptions reaches 0, and only if there is still no listener on that Room. -// We wait for pending subscriptions to finish to avoid unsubscribing while another subscription on that Room is -// Unsubscribe from Kuzzle. Stop listening immediately. -func (room *Room) Unsubscribe() error { - if room.internalState == subscribing { - return types.NewError("Cannot unsubscribe a room while a subscription attempt is underway") - } - - if room.isListening { - room.collection.Kuzzle.RemoveListener(event.Disconnected, room.onDisconnect) - room.collection.Kuzzle.RemoveListener(event.TokenExpired, room.onTokenExpired) - room.collection.Kuzzle.RemoveListener(event.Reconnected, room.onReconnect) - room.isListening = false - } - - if room.internalState == active { - room.collection.Kuzzle.UnregisterRoom(room.id) - - type body struct { - RoomId string `json:"roomId"` - } - - query := &types.KuzzleRequest{ - Controller: "realtime", - Action: "unsubscribe", - Body: &body{room.roomId}, - } - - go room.collection.Kuzzle.Query(query, nil, nil) - } - return nil -} diff --git a/collection/room_unsubscribe_test.go b/collection/room_unsubscribe_test.go deleted file mode 100644 index a89b0bff..00000000 --- a/collection/room_unsubscribe_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package collection - -import ( - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/stretchr/testify/assert" -) - -func TestUnsubscribeSubscribing(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{} - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.internalState = subscribing - assert.NotNil(t, r.Unsubscribe()) -} - -func TestUnsubscribe(t *testing.T) { - var k *kuzzle.Kuzzle - var removedListener bool - c := &internal.MockedConnection{ - MockRemoveListener: func(e int, c chan<- interface{}) { - removedListener = true - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - r := NewRoom(NewCollection(k, "collection", "index"), nil, nil) - r.isListening = true - r.internalState = active - r.Unsubscribe() - assert.Equal(t, true, removedListener) -} diff --git a/collection/scroll.go b/collection/scroll.go deleted file mode 100644 index 4950968d..00000000 --- a/collection/scroll.go +++ /dev/null @@ -1,29 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Scroll passes a "scroll" option to search queries, creating persistent paginated results. -func (dc *Collection) Scroll(scrollId string, options types.QueryOptions) (*SearchResult, error) { - if scrollId == "" { - return nil, types.NewError("Collection.Scroll: scroll id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "document", - Action: "scroll", - ScrollId: scrollId, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - return NewSearchResult(dc, nil, options, res), nil -} diff --git a/collection/scroll_test.go b/collection/scroll_test.go deleted file mode 100644 index 68b50e51..00000000 --- a/collection/scroll_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestScrollEmptyScrollId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.Scroll: scroll id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").Scroll("", nil) - assert.NotNil(t, err) -} - -func TestScrollError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").Scroll("f00b4r", nil) - assert.NotNil(t, err) -} - -func TestScroll(t *testing.T) { - hits := []*collection.Document{ - {Id: "doc42", Content: json.RawMessage(`{"foo":"bar"}`)}, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "scroll", parsedQuery.Action) - - res := map[string]interface{}{"Total": 42, "Hits": hits} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").Scroll("f00b4r", nil) - assert.Equal(t, 42, res.Total) - assert.Equal(t, hits[0].Id, res.Documents[0].Id) - assert.Equal(t, hits[0].Content, res.Documents[0].Content) - assert.Equal(t, len(hits), len(res.Documents)) -} - -func ExampleCollection_Scroll(t *testing.T) { - hits := make([]*collection.Document, 1) - hits[0] = &collection.Document{Id: "doc42", Content: json.RawMessage(`{"foo":"bar"}`)} - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").Scroll("f00b4r", nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Documents[0].Id, res.Documents[0].Content) -} diff --git a/collection/search.go b/collection/search.go deleted file mode 100644 index 039ee4e0..00000000 --- a/collection/search.go +++ /dev/null @@ -1,38 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Search documents in the given Collection, using provided filters and option. -func (dc *Collection) Search(filters *types.SearchFilters, options types.QueryOptions) (*SearchResult, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "search", - Body: filters, - } - - if options != nil { - query.From = options.From() - query.Size = options.Size() - - scroll := options.Scroll() - if scroll != "" { - query.Scroll = scroll - } - } - - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - return NewSearchResult(dc, filters, options, res), nil -} diff --git a/collection/search_result.go b/collection/search_result.go deleted file mode 100644 index 2ce8dd6f..00000000 --- a/collection/search_result.go +++ /dev/null @@ -1,116 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -type SearchResult struct { - Collection *Collection - Documents []*Document - Total int - Fetched int - Aggregations map[string]interface{} - Options types.QueryOptions - Filters *types.SearchFilters -} - -func NewSearchResult(collection *Collection, filters *types.SearchFilters, options types.QueryOptions, raw *types.KuzzleResponse) *SearchResult { - type ParseSearchResult struct { - Documents []*Document `json:"hits"` - Total int `json:"total"` - ScrollId string `json:"_scroll_id"` - Aggregations map[string]interface{} `json:"aggregations"` - } - - var parsed ParseSearchResult - json.Unmarshal(raw.Result, &parsed) - - for _, d := range parsed.Documents { - d.collection = collection - } - - sr := &SearchResult{ - Collection: collection, - Filters: filters, - Documents: parsed.Documents, - Total: parsed.Total, - Fetched: len(parsed.Documents), - Aggregations: parsed.Aggregations, - Options: types.NewQueryOptions(), - } - - sr.Options.SetScrollId(parsed.ScrollId) - - if options != nil { - sr.Options.SetFrom(options.From()) - sr.Options.SetSize(options.Size()) - } else { - sr.Options.SetFrom(0) - sr.Options.SetSize(0) - } - - return sr -} - -// FetchNext returns a new SearchResult that corresponds to the next result page -func (ksr *SearchResult) FetchNext() (*SearchResult, error) { - if ksr.Fetched >= ksr.Total { - return nil, nil - } - - if ksr.Options.ScrollId() != "" { - res, err := ksr.Collection.Scroll(ksr.Options.ScrollId(), nil) - return ksr.afterFetch(res, err) - } - - if ksr.Options.Size() > 0 { - if ksr.Filters != nil && len(ksr.Filters.Sort) > 0 { - source := ksr.Documents[len(ksr.Documents)-1].SourceToMap() - - filters := &types.SearchFilters{ - Query: ksr.Filters.Query, - Sort: ksr.Filters.Sort, - Aggregations: ksr.Filters.Aggregations, - } - - for _, sortRules := range ksr.Filters.Sort { - switch t := sortRules.(type) { - case string: - filters.SearchAfter = append(filters.SearchAfter, source[t]) - case map[string]interface{}: - for field := range t { - filters.SearchAfter = append(filters.SearchAfter, source[field]) - } - } - } - - res, err := ksr.Collection.Search(filters, ksr.Options) - return ksr.afterFetch(res, err) - } else { - opts := types.NewQueryOptions() - opts.SetFrom(ksr.Options.From() + ksr.Options.Size()) - - if opts.From() >= ksr.Total { - return nil, nil - } - - opts.SetSize(ksr.Options.Size()) - - res, err := ksr.Collection.Search(ksr.Filters, opts) - return ksr.afterFetch(res, err) - } - } - - return nil, types.NewError("SearchResult.FetchNext: Unable to retrieve results: missing scrollId or from/size parameters", 400) -} - -func (ksr *SearchResult) afterFetch(nextResult *SearchResult, err error) (*SearchResult, error) { - if err != nil { - return nextResult, err - } - - nextResult.Fetched = len(nextResult.Documents) + ksr.Fetched - - return nextResult, nil -} diff --git a/collection/search_result_test.go b/collection/search_result_test.go deleted file mode 100644 index 709d63e1..00000000 --- a/collection/search_result_test.go +++ /dev/null @@ -1,249 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func searchResultSetup(c *internal.MockedConnection) *collection.SearchResult { - var _c *internal.MockedConnection - - if c == nil { - _c = &internal.MockedConnection{} - } else { - _c = c - } - - kuzzle, _ := kuzzle.NewKuzzle(_c, nil) - cl := collection.NewCollection(kuzzle, "collection", "index") - - filters := &types.SearchFilters{} - options := types.NewQueryOptions() - options.SetSize(0) - options.SetFrom(0) - response := &types.KuzzleResponse{} - - response.Result, _ = json.Marshal(map[string]interface{}{ - "total": 4, - "hits": []map[string]interface{}{ - { - "_id": "Bateman", - "_source": map[string]string{ - "firstname": "Patrick", - "killcount": "20", - }, - }, - { - "_id": "Morgan", - "_source": map[string]string{ - "firstname": "Dexter", - "killcount": "135?", - }, - }, - }, - "aggregations": map[string]interface{}{"foo": "bar"}, - }) - - return collection.NewSearchResult(cl, filters, options, response) -} - -func TestConstructor(t *testing.T) { - kuzzle, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - cl := collection.NewCollection(kuzzle, "collection", "index") - - filters := &types.SearchFilters{} - options := types.NewQueryOptions() - options.SetSize(42) - options.SetFrom(13) - response := &types.KuzzleResponse{} - - response.Result, _ = json.Marshal(map[string]interface{}{ - "total": 4, - "_scroll_id": "fooscrollid", - "hits": []map[string]string{ - {"_id": "foo", "_source": "bar"}, - {"_id": "Bateman", "_source": "Patrick"}, - }, - "aggregations": map[string]interface{}{"foo": "bar"}, - }) - - searchResult := collection.NewSearchResult(cl, filters, options, response) - - assert.Equal(t, filters, searchResult.Filters) - assert.Equal(t, cl, searchResult.Collection) - assert.Equal(t, "fooscrollid", searchResult.Options.ScrollId()) - assert.Equal(t, 13, searchResult.Options.From()) - assert.Equal(t, 42, searchResult.Options.Size()) - assert.Equal(t, 4, searchResult.Total) - assert.Equal(t, 2, searchResult.Fetched) - assert.Equal(t, "foo", searchResult.Documents[0].Id) - assert.Equal(t, "Bateman", searchResult.Documents[1].Id) - assert.Equal(t, "bar", searchResult.Aggregations["foo"]) -} - -func TestFetchNextNoResultLeft(t *testing.T) { - searchResult := searchResultSetup(nil) - - searchResult.Fetched = 4 - - res, err := searchResult.FetchNext() - - assert.Nil(t, res) - assert.Nil(t, err) -} - -func TestFetchNextBadOptions(t *testing.T) { - searchResult := searchResultSetup(nil) - - searchResult.Options.SetSize(0) - searchResult.Options.SetScrollId("") - - res, err := searchResult.FetchNext() - - assert.Nil(t, res) - assert.Equal(t, &types.KuzzleError{Message: "SearchResult.FetchNext: Unable to retrieve results: missing scrollId or from/size parameters", Stack: "", Status: 400}, err) -} - -func TestFetchNextWithScroll(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "scroll", parsedQuery.Action) - assert.Equal(t, "foobar", parsedQuery.ScrollId) - - fakeResult, _ := json.Marshal(map[string]interface{}{ - "total": 4, - "_scroll_id": "nextscrollid", - "hits": []map[string]string{ - {"_id": "foo2", "_source": "bar"}, - {"_id": "Bateman2", "_source": "Patrick"}, - }, - }) - - return &types.KuzzleResponse{Result: fakeResult} - }, - } - - searchResult := searchResultSetup(c) - - assert.Equal(t, 2, searchResult.Fetched) - - searchResult.Options.SetSize(0) - searchResult.Options.SetScrollId("foobar") - next, err := searchResult.FetchNext() - - assert.Nil(t, err) - assert.Equal(t, "nextscrollid", next.Options.ScrollId()) - assert.Equal(t, 4, next.Fetched) - assert.Equal(t, 4, next.Total) - assert.Equal(t, "foo2", next.Documents[0].Id) - assert.Equal(t, "Bateman2", next.Documents[1].Id) - assert.Nil(t, next.Aggregations) -} - -func TestFetchNextWithPage(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "search", parsedQuery.Action) - assert.Equal(t, 2, parsedQuery.From) - assert.Equal(t, 2, parsedQuery.Size) - - fakeResult, _ := json.Marshal(map[string]interface{}{ - "total": 4, - "hits": []map[string]string{ - {"_id": "foo2", "_source": "bar"}, - {"_id": "Bateman2", "_source": "Patrick"}, - }, - }) - - return &types.KuzzleResponse{Result: fakeResult} - }, - } - - searchResult := searchResultSetup(c) - - assert.Equal(t, 2, searchResult.Fetched) - - searchResult.Options.SetSize(2) - next, err := searchResult.FetchNext() - - assert.Nil(t, err) - assert.Equal(t, 4, next.Fetched) - assert.Equal(t, 4, next.Total) - assert.Equal(t, "foo2", next.Documents[0].Id) - assert.Equal(t, "Bateman2", next.Documents[1].Id) - assert.Nil(t, next.Aggregations) -} - -func TestFetchNextDoNotFetchAfterLastPage(t *testing.T) { - searchResult := searchResultSetup(nil) - - assert.Equal(t, 2, searchResult.Fetched) - - searchResult.Options.SetFrom(2) - searchResult.Options.SetSize(2) - next, err := searchResult.FetchNext() - - assert.Nil(t, err) - assert.Nil(t, next) -} - -func TestFetchNextWithSearchAfter(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "search", parsedQuery.Action) - - filters := &types.SearchFilters{} - rawBody, _ := json.Marshal(parsedQuery.Body) - json.Unmarshal(rawBody, filters) - - assert.Equal(t, "Dexter", filters.SearchAfter[0]) - assert.Equal(t, "135?", filters.SearchAfter[1]) - - fakeResult, _ := json.Marshal(map[string]interface{}{ - "total": 4, - "hits": []map[string]string{ - {"_id": "foo2", "_source": "bar"}, - {"_id": "Bateman2", "_source": "Patrick"}, - }, - }) - - return &types.KuzzleResponse{Result: fakeResult} - }, - } - - searchResult := searchResultSetup(c) - - assert.Equal(t, 2, searchResult.Fetched) - - searchResult.Filters.Sort = append(searchResult.Filters.Sort, "firstname") - searchResult.Filters.Sort = append(searchResult.Filters.Sort, map[string]interface{}{ - "killcount": map[string]string{"order": "asc"}, - }) - - searchResult.Options.SetSize(2) - next, err := searchResult.FetchNext() - - assert.Nil(t, err) - assert.Equal(t, 4, next.Fetched) - assert.Equal(t, 4, next.Total) - assert.Equal(t, "foo2", next.Documents[0].Id) - assert.Equal(t, "Bateman2", next.Documents[1].Id) - assert.Nil(t, next.Aggregations) -} diff --git a/collection/search_specifications.go b/collection/search_specifications.go new file mode 100644 index 00000000..eac74f32 --- /dev/null +++ b/collection/search_specifications.go @@ -0,0 +1,42 @@ +package collection + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// SearchSpecifications searches specifications across indexes/collections according to the provided filters. +func (dc *Collection) SearchSpecifications(options types.SpecificationSearchOptions) (*types.SpecificationSearchResult, error) { + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "collection", + Action: "searchSpecifications", + Body: struct { + Query interface{} `json:"query"` + }{Query: filters}, + } + + if options != nil { + query.From = options.From() + query.Size = options.Size() + scroll := options.Scroll() + if scroll != "" { + query.Scroll = scroll + } + } + + go dc.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + specifications := &types.SpecificationSearchResult{} + json.Unmarshal(res.Result, specifications) + + return specifications, nil +} diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go new file mode 100644 index 00000000..10c48eae --- /dev/null +++ b/collection/search_specifications_test.go @@ -0,0 +1 @@ +package collection_test diff --git a/collection/search_test.go b/collection/search_test.go deleted file mode 100644 index 227f224e..00000000 --- a/collection/search_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestSearchError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").Search(&types.SearchFilters{}, nil) - assert.NotNil(t, err) -} - -func TestSearch(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "search", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - rawresult, _ := json.Marshal(map[string]interface{}{ - "total": 42, - "hits": []map[string]interface{}{ - { - "_id": "doc42", - "_source": map[string]string{"foo": "bar"}, - }, - }, - }) - return &types.KuzzleResponse{Result: rawresult} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").Search(&types.SearchFilters{}, nil) - assert.Equal(t, 42, res.Total) - assert.Equal(t, 1, len(res.Documents)) - assert.Equal(t, res.Documents[0].Id, "doc42") - assert.Equal(t, res.Documents[0].SourceToMap(), collection.DocumentContent{"foo": "bar"}) -} - -func ExampleCollection_Search() { - hits := make([]*collection.Document, 1) - hits[0] = &collection.Document{Id: "doc42", Content: json.RawMessage(`{"foo":"bar"}`)} - - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").Search(&types.SearchFilters{}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestSearchWithScroll(t *testing.T) { - hits := []*collection.Document{ - {Id: "doc42", Content: json.RawMessage(`{"foo":"bar"}`)}, - } - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "search", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, 2, parsedQuery.From) - assert.Equal(t, 4, parsedQuery.Size) - assert.Equal(t, "1m", parsedQuery.Scroll) - - rawresult, _ := json.Marshal(map[string]interface{}{ - "total": 42, - "hits": []map[string]interface{}{ - { - "_id": "doc42", - "_source": map[string]string{"foo": "bar"}, - }, - }, - "_scroll_id": "f00b4r", - }) - return &types.KuzzleResponse{Result: rawresult} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetFrom(2) - opts.SetSize(4) - opts.SetScroll("1m") - res, _ := collection.NewCollection(k, "collection", "index").Search(&types.SearchFilters{}, opts) - assert.Equal(t, 42, res.Total) - assert.Equal(t, len(hits), len(res.Documents)) - assert.Equal(t, "f00b4r", res.Options.ScrollId()) - assert.Equal(t, res.Documents[0].Id, hits[0].Id) - assert.Equal(t, res.Documents[0].Content, hits[0].Content) -} diff --git a/collection/specifications.go b/collection/specifications.go index ffa7ed13..2ece201d 100644 --- a/collection/specifications.go +++ b/collection/specifications.go @@ -1,197 +1,104 @@ package collection -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" -) - -// GetSpecifications retrieves the current specifications of the collection. -func (dc *Collection) GetSpecifications(options types.QueryOptions) (*types.SpecificationEntry, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "collection", - Action: "getSpecifications", - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - specifications := &types.SpecificationEntry{} - json.Unmarshal(res.Result, specifications) - - return specifications, nil -} - -// SearchSpecifications searches specifications across indexes/collections according to the provided filters. -func (dc *Collection) SearchSpecifications(filters interface{}, options types.QueryOptions) (*types.SpecificationSearchResult, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "collection", - Action: "searchSpecifications", - Body: struct { - Query interface{} `json:"query"` - }{Query: filters}, - } - - if options != nil { - query.From = options.From() - query.Size = options.Size() - scroll := options.Scroll() - if scroll != "" { - query.Scroll = scroll - } - } - - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - specifications := &types.SpecificationSearchResult{} - json.Unmarshal(res.Result, specifications) - - return specifications, nil -} - -// ScrollSpecifications retrieves next result of a specification search with scroll query. -func (dc *Collection) ScrollSpecifications(scrollId string, options types.QueryOptions) (*types.SpecificationSearchResult, error) { - if scrollId == "" { - return nil, types.NewError("Collection.ScrollSpecifications: scroll id required") - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "collection", - Action: "scrollSpecifications", - ScrollId: scrollId, - } - - if options != nil { - scroll := options.Scroll() - if scroll != "" { - query.Scroll = scroll - } - } - - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - specifications := &types.SpecificationSearchResult{} - json.Unmarshal(res.Result, specifications) - - return specifications, nil -} - -// ValidateSpecifications validates the provided specifications. -func (dc *Collection) ValidateSpecifications(specifications *types.Specification, options types.QueryOptions) (*types.ValidResponse, error) { - ch := make(chan *types.KuzzleResponse) - - type Specifications map[string]map[string]*types.Specification - - specificationsData := Specifications{ - dc.index: { - dc.collection: specifications, - }, - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "collection", - Action: "validateSpecifications", - Body: specificationsData, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - response := &types.ValidResponse{} - json.Unmarshal(res.Result, response) - - return response, nil -} - -// UpdateSpecifications updates the current specifications of this collection. -func (dc *Collection) UpdateSpecifications(specifications *types.Specification, options types.QueryOptions) (*types.Specification, error) { - ch := make(chan *types.KuzzleResponse) - - type Specifications map[string]map[string]*types.Specification - - specificationsData := &Specifications{ - dc.index: { - dc.collection: specifications, - }, - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "collection", - Action: "updateSpecifications", - Body: specificationsData, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - specification := &Specifications{} - json.Unmarshal(res.Result, specification) - - result := (*specification)[dc.index][dc.collection] - - return result, nil -} - -// DeleteSpecifications deletes the current specifications of this collection. -func (dc *Collection) DeleteSpecifications(options types.QueryOptions) (bool, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "collection", - Action: "deleteSpecifications", - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - ack := &struct { - Acknowledged bool `json:"acknowledged"` - }{} - err := json.Unmarshal(res.Result, ack) - if err != nil { - return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) - } - return ack.Acknowledged, nil -} +// +//import ( +// "encoding/json" +// "fmt" +// "github.com/kuzzleio/sdk-go/types" +//) +// +//// ScrollSpecifications retrieves next result of a specification search with scroll query. +//func (dc *Collection) ScrollSpecifications(scrollId string, options types.QueryOptions) (*types.SpecificationSearchResult, error) { +// if scrollId == "" { +// return nil, types.NewError("Collection.ScrollSpecifications: scroll id required") +// } +// +// ch := make(chan *types.KuzzleResponse) +// +// query := &types.KuzzleRequest{ +// Controller: "collection", +// Action: "scrollSpecifications", +// ScrollId: scrollId, +// } +// +// if options != nil { +// scroll := options.Scroll() +// if scroll != "" { +// query.Scroll = scroll +// } +// } +// +// go dc.Kuzzle.Query(query, options, ch) +// +// res := <-ch +// +// if res.Error != nil { +// return nil, res.Error +// } +// +// specifications := &types.SpecificationSearchResult{} +// json.Unmarshal(res.Result, specifications) +// +// return specifications, nil +//} +// +//// ValidateSpecifications validates the provided specifications. +//func (dc *Collection) ValidateSpecifications(specifications *types.Specification, options types.QueryOptions) (*types.ValidResponse, error) { +// ch := make(chan *types.KuzzleResponse) +// +// type Specifications map[string]map[string]*types.Specification +// +// specificationsData := Specifications{ +// dc.index: { +// dc.collection: specifications, +// }, +// } +// +// query := &types.KuzzleRequest{ +// Collection: dc.collection, +// Index: dc.index, +// Controller: "collection", +// Action: "validateSpecifications", +// Body: specificationsData, +// } +// go dc.Kuzzle.Query(query, options, ch) +// +// res := <-ch +// +// if res.Error != nil { +// return nil, res.Error +// } +// +// response := &types.ValidResponse{} +// json.Unmarshal(res.Result, response) +// +// return response, nil +//} +// +//// DeleteSpecifications deletes the current specifications of this collection. +//func (dc *Collection) DeleteSpecifications(options types.QueryOptions) (bool, error) { +// ch := make(chan *types.KuzzleResponse) +// +// query := &types.KuzzleRequest{ +// Collection: dc.collection, +// Index: dc.index, +// Controller: "collection", +// Action: "deleteSpecifications", +// } +// go dc.Kuzzle.Query(query, options, ch) +// +// res := <-ch +// +// if res.Error != nil { +// return false, res.Error +// } +// +// ack := &struct { +// Acknowledged bool `json:"acknowledged"` +// }{} +// err := json.Unmarshal(res.Result, ack) +// if err != nil { +// return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) +// } +// return ack.Acknowledged, nil +//} diff --git a/collection/specifications_test.go b/collection/specifications_test.go index a521d4aa..bd0a2efd 100644 --- a/collection/specifications_test.go +++ b/collection/specifications_test.go @@ -1,483 +1,484 @@ package collection_test -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestGetSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) - assert.NotNil(t, err) -} - -func TestGetSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "getSpecifications", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - validation := types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: false, - Type: "bool", - DefaultValue: "Boring value", - }, - }, - } - - res := types.SpecificationEntry{ - Index: parsedQuery.Index, - Collection: parsedQuery.Collection, - Validation: &validation, - } - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) - assert.Equal(t, "index", res.Index) - assert.Equal(t, "collection", res.Collection) - assert.Equal(t, false, res.Validation.Strict) - assert.Equal(t, 1, len(res.Validation.Fields)) - assert.Equal(t, false, res.Validation.Fields["foo"].Mandatory) - assert.Equal(t, "bool", res.Validation.Fields["foo"].Type) - assert.Equal(t, "Boring value", res.Validation.Fields["foo"].DefaultValue) -} - -func ExampleCollection_GetSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Index, res.Collection, res.Validation) -} - -func TestSearchSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, nil) - assert.NotNil(t, err) -} - -func TestSearchSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "searchSpecifications", parsedQuery.Action) - - res := types.SpecificationSearchResult{ - ScrollId: "f00b4r", - Total: 1, - Hits: make([]types.SpecificationSearchResultHit, 1), - } - res.Hits[0] = types.SpecificationSearchResultHit{ - Source: types.SpecificationEntry{ - Index: "index", - Collection: "collection", - Validation: &types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": types.SpecificationField{ - Mandatory: true, - Type: "string", - DefaultValue: "Value found with search", - }, - }, - }, - }, - } - - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetFrom(2) - opts.SetSize(4) - opts.SetScroll("1m") - - res, _ := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) - assert.Equal(t, "f00b4r", res.ScrollId) - assert.Equal(t, 1, res.Total) - assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) -} - -func ExampleCollection_SearchSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetFrom(2) - opts.SetSize(4) - opts.SetScroll("1m") - - res, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) -} - -func TestScrollSpecificationsEmptyScrollId(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ScrollSpecifications: scroll id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("", nil) - assert.NotNil(t, err) -} - -func TestScrollSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", nil) - assert.NotNil(t, err) -} - -func TestScrollSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "scrollSpecifications", parsedQuery.Action) - - res := types.SpecificationSearchResult{ - ScrollId: "f00b4r", - Total: 1, - Hits: make([]types.SpecificationSearchResultHit, 1), - } - res.Hits[0] = types.SpecificationSearchResultHit{ - Source: types.SpecificationEntry{ - Index: "index", - Collection: "collection", - Validation: &types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": types.SpecificationField{ - Mandatory: true, - Type: "string", - DefaultValue: "Value found with search", - }, - }, - }, - }, - } - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetScroll("1m") - - res, _ := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) - assert.Equal(t, "f00b4r", res.ScrollId) - assert.Equal(t, 1, res.Total) - assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) -} - -func ExampleCollection_ScrollSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetScroll("1m") - - res, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) -} - -func TestValidateSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&types.Specification{}, nil) - assert.NotNil(t, err) -} - -func TestValidateSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "validateSpecifications", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := types.ValidResponse{Valid: true} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - specifications := types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - } - - res, _ := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) - assert.Equal(t, true, res.Valid) -} - -func ExampleCollection_ValidateSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - specifications := types.Specification{ - Strict: false, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - } - - res, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Valid) -} -func TestUpdateSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&types.Specification{}, nil) - assert.NotNil(t, err) -} - -func TestUpdateSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - type Specifications map[string]map[string]*types.Specification - - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "updateSpecifications", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - res := Specifications{ - "index": { - "collection": &types.Specification{ - Strict: true, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - }, - }, - } - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - specifications := types.Specification{ - Strict: true, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - } - - specs, _ := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) - - fields := specs.Fields - - assert.Equal(t, true, specs.Strict) - assert.Equal(t, 1, len(fields)) - assert.Equal(t, true, fields["foo"].Mandatory) - assert.Equal(t, "string", fields["foo"].Type) - assert.Equal(t, "Exciting value", fields["foo"].DefaultValue) -} - -func ExampleCollection_UpdateSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - specifications := types.Specification{ - Strict: true, - Fields: types.SpecificationFields{ - "foo": { - Mandatory: true, - Type: "string", - DefaultValue: "Exciting value", - }, - }, - } - - res, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Strict, res.Fields) -} - -func TestDeleteSpecificationsError(t *testing.T) { - type Document struct { - Title string - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) - assert.NotNil(t, err) -} - -func TestDeleteSpecifications(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "collection", parsedQuery.Controller) - assert.Equal(t, "deleteSpecifications", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - return &types.KuzzleResponse{Result: []byte(`{ - "acknowledged": true - }`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) - assert.Equal(t, true, res) -} - -func ExampleCollection_DeleteSpecifications() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Printf("%#v\n", res) -} +// +//import ( +// "encoding/json" +// "fmt" +// "github.com/kuzzleio/sdk-go/collection" +// "github.com/kuzzleio/sdk-go/internal" +// "github.com/kuzzleio/sdk-go/kuzzle" +// "github.com/kuzzleio/sdk-go/types" +// "github.com/stretchr/testify/assert" +// "testing" +//) +// +//func TestGetSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) +// assert.NotNil(t, err) +//} +// +//func TestGetSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "getSpecifications", parsedQuery.Action) +// assert.Equal(t, "index", parsedQuery.Index) +// assert.Equal(t, "collection", parsedQuery.Collection) +// +// validation := types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: false, +// Type: "bool", +// DefaultValue: "Boring value", +// }, +// }, +// } +// +// res := types.SpecificationEntry{ +// Index: parsedQuery.Index, +// Collection: parsedQuery.Collection, +// Validation: &validation, +// } +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// res, _ := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) +// assert.Equal(t, "index", res.Index) +// assert.Equal(t, "collection", res.Collection) +// assert.Equal(t, false, res.Validation.Strict) +// assert.Equal(t, 1, len(res.Validation.Fields)) +// assert.Equal(t, false, res.Validation.Fields["foo"].Mandatory) +// assert.Equal(t, "bool", res.Validation.Fields["foo"].Type) +// assert.Equal(t, "Boring value", res.Validation.Fields["foo"].DefaultValue) +//} +// +//func ExampleCollection_GetSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// res, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Index, res.Collection, res.Validation) +//} +// +//func TestSearchSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, nil) +// assert.NotNil(t, err) +//} +// +//func TestSearchSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "searchSpecifications", parsedQuery.Action) +// +// res := types.SpecificationSearchResult{ +// ScrollId: "f00b4r", +// Total: 1, +// Hits: make([]types.SpecificationSearchResultHit, 1), +// } +// res.Hits[0] = types.SpecificationSearchResultHit{ +// Source: types.SpecificationEntry{ +// Index: "index", +// Collection: "collection", +// Validation: &types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": types.SpecificationField{ +// Mandatory: true, +// Type: "string", +// DefaultValue: "Value found with search", +// }, +// }, +// }, +// }, +// } +// +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// opts := types.NewQueryOptions() +// opts.SetFrom(2) +// opts.SetSize(4) +// opts.SetScroll("1m") +// +// res, _ := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) +// assert.Equal(t, "f00b4r", res.ScrollId) +// assert.Equal(t, 1, res.Total) +// assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) +//} +// +//func ExampleCollection_SearchSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// opts := types.NewQueryOptions() +// opts.SetFrom(2) +// opts.SetSize(4) +// opts.SetScroll("1m") +// +// res, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) +//} +// +//func TestScrollSpecificationsEmptyScrollId(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ScrollSpecifications: scroll id required"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("", nil) +// assert.NotNil(t, err) +//} +// +//func TestScrollSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", nil) +// assert.NotNil(t, err) +//} +// +//func TestScrollSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "scrollSpecifications", parsedQuery.Action) +// +// res := types.SpecificationSearchResult{ +// ScrollId: "f00b4r", +// Total: 1, +// Hits: make([]types.SpecificationSearchResultHit, 1), +// } +// res.Hits[0] = types.SpecificationSearchResultHit{ +// Source: types.SpecificationEntry{ +// Index: "index", +// Collection: "collection", +// Validation: &types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": types.SpecificationField{ +// Mandatory: true, +// Type: "string", +// DefaultValue: "Value found with search", +// }, +// }, +// }, +// }, +// } +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// opts := types.NewQueryOptions() +// opts.SetScroll("1m") +// +// res, _ := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) +// assert.Equal(t, "f00b4r", res.ScrollId) +// assert.Equal(t, 1, res.Total) +// assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) +//} +// +//func ExampleCollection_ScrollSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// opts := types.NewQueryOptions() +// opts.SetScroll("1m") +// +// res, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) +//} +// +//func TestValidateSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&types.Specification{}, nil) +// assert.NotNil(t, err) +//} +// +//func TestValidateSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "validateSpecifications", parsedQuery.Action) +// assert.Equal(t, "index", parsedQuery.Index) +// assert.Equal(t, "collection", parsedQuery.Collection) +// +// res := types.ValidResponse{Valid: true} +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// specifications := types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// } +// +// res, _ := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) +// assert.Equal(t, true, res.Valid) +//} +// +//func ExampleCollection_ValidateSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// specifications := types.Specification{ +// Strict: false, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// } +// +// res, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Valid) +//} +//func TestUpdateSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&types.Specification{}, nil) +// assert.NotNil(t, err) +//} +// +//func TestUpdateSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// type Specifications map[string]map[string]*types.Specification +// +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "updateSpecifications", parsedQuery.Action) +// assert.Equal(t, "index", parsedQuery.Index) +// assert.Equal(t, "collection", parsedQuery.Collection) +// +// res := Specifications{ +// "index": { +// "collection": &types.Specification{ +// Strict: true, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// }, +// }, +// } +// r, _ := json.Marshal(res) +// return &types.KuzzleResponse{Result: r} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// specifications := types.Specification{ +// Strict: true, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// } +// +// specs, _ := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) +// +// fields := specs.Fields +// +// assert.Equal(t, true, specs.Strict) +// assert.Equal(t, 1, len(fields)) +// assert.Equal(t, true, fields["foo"].Mandatory) +// assert.Equal(t, "string", fields["foo"].Type) +// assert.Equal(t, "Exciting value", fields["foo"].DefaultValue) +//} +// +//func ExampleCollection_UpdateSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// specifications := types.Specification{ +// Strict: true, +// Fields: types.SpecificationFields{ +// "foo": { +// Mandatory: true, +// Type: "string", +// DefaultValue: "Exciting value", +// }, +// }, +// } +// +// res, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Println(res.Strict, res.Fields) +//} +// +//func TestDeleteSpecificationsError(t *testing.T) { +// type Document struct { +// Title string +// } +// +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// _, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) +// assert.NotNil(t, err) +//} +// +//func TestDeleteSpecifications(t *testing.T) { +// c := &internal.MockedConnection{ +// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { +// parsedQuery := &types.KuzzleRequest{} +// json.Unmarshal(query, parsedQuery) +// +// assert.Equal(t, "collection", parsedQuery.Controller) +// assert.Equal(t, "deleteSpecifications", parsedQuery.Action) +// assert.Equal(t, "index", parsedQuery.Index) +// assert.Equal(t, "collection", parsedQuery.Collection) +// +// return &types.KuzzleResponse{Result: []byte(`{ +// "acknowledged": true +// }`)} +// }, +// } +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// res, _ := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) +// assert.Equal(t, true, res) +//} +// +//func ExampleCollection_DeleteSpecifications() { +// c := &internal.MockedConnection{} +// k, _ := kuzzle.NewKuzzle(c, nil) +// +// res, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) +// +// if err != nil { +// fmt.Println(err.Error()) +// return +// } +// +// fmt.Printf("%#v\n", res) +//} diff --git a/collection/subscribe.go b/collection/subscribe.go deleted file mode 100644 index d6f483aa..00000000 --- a/collection/subscribe.go +++ /dev/null @@ -1,16 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Subscribe subscribes to this data collection with a set of Kuzzle DSL filters. -func (dc *Collection) Subscribe(filters interface{}, options types.RoomOptions, realtimeNotificationChannel chan<- types.KuzzleNotification) *Room { - r := NewRoom(dc, filters, options) - - res := make(chan types.SubscribeResponse) - r.OnDone(res) - r.Subscribe(realtimeNotificationChannel) - - return r -} diff --git a/collection/subscribe_test.go b/collection/subscribe_test.go deleted file mode 100644 index 325524f3..00000000 --- a/collection/subscribe_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package collection - -import ( - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestSubscribeError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - room := NewCollection(k, "collection", "index").Subscribe(nil, nil, nil) - - r := <-room.ResponseChannel() - assert.Equal(t, "error", r.Error.Error()) -} - -func TestSubscribe(t *testing.T) { - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - room := NewCollection(k, "collection", "index").Subscribe(nil, nil, nil) - - r := <-room.ResponseChannel() - assert.Equal(t, "42", r.Room.RoomId()) -} - -func ExampleCollection_Subscribe() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - - room := NewCollection(k, "collection", "index").Subscribe(nil, nil, nil) - - r := <-room.ResponseChannel() - - fmt.Println(r.Room.RoomId()) -} diff --git a/collection/truncate.go b/collection/truncate.go index c0715d1f..830c758c 100644 --- a/collection/truncate.go +++ b/collection/truncate.go @@ -1,35 +1,34 @@ package collection import ( - "encoding/json" - "fmt" "github.com/kuzzleio/sdk-go/types" ) // Truncate delete every Documents from the provided Collection. -func (dc *Collection) Truncate(options types.QueryOptions) (bool, error) { +func (dc *Collection) Truncate(index string, collection string) error { + if index == "" { + return types.NewError("Collection.Truncate: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.Truncate: collection required", 400) + } + ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, + Collection: collection, + Index: index, Controller: "collection", Action: "truncate", } - go dc.Kuzzle.Query(query, options, ch) + go dc.Kuzzle.Query(query, nil, ch) res := <-ch if res.Error != nil { - return false, res.Error + return res.Error } - ack := &struct { - Acknowledged bool `json:"acknowledged"` - }{} - err := json.Unmarshal(res.Result, ack) - if err != nil { - return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) - } - return ack.Acknowledged, nil + return nil } diff --git a/collection/truncate_test.go b/collection/truncate_test.go index 3eba1af6..28f20b22 100644 --- a/collection/truncate_test.go +++ b/collection/truncate_test.go @@ -2,15 +2,31 @@ package collection_test import ( "fmt" + "github.com/kuzzleio/sdk-go/collection" + "testing" + "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) +func TestTruncateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Truncate("", "collection") + assert.NotNil(t, err) +} + +func TestTruncateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.Truncate("index", "") + assert.NotNil(t, err) +} + func TestTruncateError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { @@ -19,7 +35,8 @@ func TestTruncateError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := collection.NewCollection(k, "collection", "index").Truncate(nil) + nc := collection.NewCollection(k) + err := nc.Truncate("index", "collection") assert.NotNil(t, err) } @@ -33,20 +50,20 @@ func TestTruncate(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := collection.NewCollection(k, "collection", "index").Truncate(nil) - assert.Equal(t, true, res) + nc := collection.NewCollection(k) + err := nc.Truncate("index", "collection") + assert.Nil(t, err) } func ExampleCollection_Truncate() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - res, err := collection.NewCollection(k, "collection", "index").Truncate(nil) + nc := collection.NewCollection(k) + err := nc.Truncate("index", "collection") if err != nil { fmt.Println(err.Error()) return } - - fmt.Printf("%#v\n", res) } diff --git a/collection/update_document.go b/collection/update_document.go deleted file mode 100644 index 2fdc057e..00000000 --- a/collection/update_document.go +++ /dev/null @@ -1,36 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// UpdateDocument updates a document in Kuzzle. -func (dc *Collection) UpdateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.UpdateDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "update", - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - documentResponse := &Document{collection: dc} - json.Unmarshal(res.Result, documentResponse) - - return documentResponse, nil -} diff --git a/collection/update_document_test.go b/collection/update_document_test.go deleted file mode 100644 index 5a2be52b..00000000 --- a/collection/update_document_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestUpdateDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.UpdateDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestUpdateDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestUpdateDocument(t *testing.T) { - id := "myId" - - type Content struct { - Title string `json:"title"` - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "update", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, 10, options.RetryOnConflict()) - assert.Equal(t, id, parsedQuery.Id) - - assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) - - res := collection.Document{Id: id, Content: []byte(`{"title": "arthur"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - qo := types.NewQueryOptions() - qo.SetRetryOnConflict(10) - - res, _ := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) - - assert.Equal(t, id, res.Id) - - var result Content - - json.Unmarshal(res.Content, &result) - - assert.Equal(t, result.Title, "arthur") -} - -func ExampleCollection_UpdateDocument() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - qo := types.NewQueryOptions() - qo.SetRetryOnConflict(10) - - res, err := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} diff --git a/collection/update_mapping.go b/collection/update_mapping.go new file mode 100644 index 00000000..ae5124db --- /dev/null +++ b/collection/update_mapping.go @@ -0,0 +1,39 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// UpdateSpecifications updates the current specifications of this collection. +func (dc *Collection) UpdateSpecifications(index string, collection string, body string) error { + if index == "" { + return types.NewError("Collection.UpdateSpecifications: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.UpdateSpecifications: collection required", 400) + } + + if body == "" { + return types.NewError("Collection.UpdateSpecifications: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "updateSpecifications", + Body: body, + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go new file mode 100644 index 00000000..f29c5cd9 --- /dev/null +++ b/collection/update_mapping_test.go @@ -0,0 +1,74 @@ +package collection_test + +import ( + "fmt" + + "github.com/kuzzleio/sdk-go/collection" + + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateSpecificationsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("", "collection", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "collection", "") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "collection", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: []byte(`{}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "collection", "body") + assert.Nil(t, err) +} + +func ExampleCollection_UpdateSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.UpdateSpecifications("index", "collection", "body") + + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go new file mode 100644 index 00000000..65044904 --- /dev/null +++ b/collection/validate_specifications.go @@ -0,0 +1,29 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// ValidateSpecifications validates the provided specifications. +func (dc *Collection) ValidateSpecifications(body string) error { + if body == "" { + return types.NewError("Collection.ValidateSpecifications: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "collection", + Action: "validateSpecifications", + Body: body, + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go new file mode 100644 index 00000000..104f9c6f --- /dev/null +++ b/collection/validate_specifications_test.go @@ -0,0 +1,65 @@ +package collection_test + +import ( + "fmt" + + "github.com/kuzzleio/sdk-go/collection" + + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestValidateSpecificationsBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + err := nc.ValidateSpecifications("") + assert.NotNil(t, err) +} + +func TestValidateSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.ValidateSpecifications("body") + assert.NotNil(t, err) +} + +func TestValidateSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: []byte(`{ + "valid": true, + "details": [], + "description": "Some description text" + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.ValidateSpecifications("body") + assert.Nil(t, err) +} + +func ExampleCollection_ValidateSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + err := nc.ValidateSpecifications("body") + + if err != nil { + fmt.Println(err.Error()) + return + } +} From fb381e2eacc91c2b31a91128ce2131d13b718f16 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 12:00:31 +0100 Subject: [PATCH 032/363] Final commit (#97) --- collection/delete.go | 34 --- collection/delete_specifications.go | 32 +++ ..._test.go => delete_specifications_test.go} | 20 +- collection/search_specifications.go | 18 +- collection/search_specifications_test.go | 87 ++++++ collection/specifications.go | 33 --- collection/update_mapping.go | 12 +- collection/update_mapping_test.go | 24 +- collection/update_specifications.go | 42 +++ collection/update_specifications_test.go | 74 +++++ internal/wrappers/cgo/kuzzle/c_to_go.go | 91 +++--- internal/wrappers/cgo/kuzzle/collection.go | 91 +++--- .../cgo/kuzzle/collection_document.go | 100 ------- .../wrappers/cgo/kuzzle/collection_mapping.go | 54 ---- .../cgo/kuzzle/collection_specification.go | 44 --- internal/wrappers/cgo/kuzzle/destructors.go | 15 +- internal/wrappers/cgo/kuzzle/document.go | 124 -------- internal/wrappers/cgo/kuzzle/go_to_c.go | 136 +-------- internal/wrappers/cgo/kuzzle/room.go | 79 ----- internal/wrappers/cgo/kuzzle/search_result.go | 10 +- internal/wrappers/cpp/collection.cpp | 272 +++++------------- internal/wrappers/cpp/document.cpp | 92 ------ internal/wrappers/cpp/kuzzle.cpp | 11 +- internal/wrappers/cpp/room.cpp | 64 ----- internal/wrappers/headers/collection.hpp | 40 ++- internal/wrappers/headers/document.hpp | 36 --- internal/wrappers/headers/kuzzle.hpp | 3 +- internal/wrappers/headers/kuzzlesdk.h | 24 +- internal/wrappers/headers/room.hpp | 32 --- .../wrappers/headers/sdk_wrappers_internal.h | 1 - internal/wrappers/kcore.i | 6 +- internal/wrappers/templates/java/core.i | 5 - kuzzle/kuzzle_test.go | 1 - test.sh | 4 +- types/consts.go | 7 + types/search_options.go | 37 +++ types/search_result.go | 111 +++++++ 37 files changed, 650 insertions(+), 1216 deletions(-) delete mode 100644 collection/delete.go create mode 100644 collection/delete_specifications.go rename collection/{delete_test.go => delete_specifications_test.go} (71%) create mode 100644 collection/update_specifications.go create mode 100644 collection/update_specifications_test.go delete mode 100644 internal/wrappers/cgo/kuzzle/collection_document.go delete mode 100644 internal/wrappers/cgo/kuzzle/collection_mapping.go delete mode 100644 internal/wrappers/cgo/kuzzle/collection_specification.go delete mode 100644 internal/wrappers/cgo/kuzzle/document.go delete mode 100644 internal/wrappers/cgo/kuzzle/room.go delete mode 100644 internal/wrappers/cpp/document.cpp delete mode 100644 internal/wrappers/cpp/room.cpp delete mode 100644 internal/wrappers/headers/document.hpp delete mode 100644 internal/wrappers/headers/room.hpp create mode 100644 types/search_options.go create mode 100644 types/search_result.go diff --git a/collection/delete.go b/collection/delete.go deleted file mode 100644 index 1d8e495c..00000000 --- a/collection/delete.go +++ /dev/null @@ -1,34 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Delete deletes a collection -func (dc *Collection) Delete(index string, collection string) error { - if index == "" { - return types.NewError("Collection.Delete: index required", 400) - } - - if collection == "" { - return types.NewError("Collection.Delete: collection required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: collection, - Index: index, - Controller: "collection", - Action: "delete", - } - go dc.Kuzzle.Query(query, nil, ch) - - res := <-ch - - if res.Error != nil { - return res.Error - } - - return nil -} diff --git a/collection/delete_specifications.go b/collection/delete_specifications.go new file mode 100644 index 00000000..78cb5304 --- /dev/null +++ b/collection/delete_specifications.go @@ -0,0 +1,32 @@ +package collection + +import "github.com/kuzzleio/sdk-go/types" + +// DeleteSpecifications deletes the current specifications of this collection. +func (dc *Collection) DeleteSpecifications(index string, collection string) error { + if index == "" { + return types.NewError("Collection.DeleteSpecifications: index required", 400) + } + + if collection == "" { + return types.NewError("Collection.DeleteSpecifications: collection required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "deleteSpecifications", + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/collection/delete_test.go b/collection/delete_specifications_test.go similarity index 71% rename from collection/delete_test.go rename to collection/delete_specifications_test.go index e0cebe6b..3a26d9a5 100644 --- a/collection/delete_test.go +++ b/collection/delete_specifications_test.go @@ -11,21 +11,21 @@ import ( "github.com/stretchr/testify/assert" ) -func TestDeleteIndexNull(t *testing.T) { +func TestDeleteSpecificationsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.Delete("", "collection") + err := nc.DeleteSpecifications("", "collection") assert.NotNil(t, err) } -func TestDeleteCollectionNull(t *testing.T) { +func TestDeleteSpecificationsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.Delete("index", "") + err := nc.DeleteSpecifications("index", "") assert.NotNil(t, err) } -func TestDeleteError(t *testing.T) { +func TestDeleteSpecificationsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: types.NewError("Unit test error")} @@ -34,12 +34,12 @@ func TestDeleteError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Delete("index", "collection") + err := nc.DeleteSpecifications("index", "collection") assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } -func TestDelete(t *testing.T) { +func TestDeleteSpecifications(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Result: []byte(`{ @@ -50,16 +50,16 @@ func TestDelete(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Delete("index", "collection") + err := nc.DeleteSpecifications("index", "collection") assert.Nil(t, err) } -func ExampleCollection_Delete() { +func ExampleCollection_DeleteSpecifications() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Delete("index", "collection") + err := nc.DeleteSpecifications("index", "collection") if err != nil { fmt.Println(err.Error()) diff --git a/collection/search_specifications.go b/collection/search_specifications.go index eac74f32..efe35b66 100644 --- a/collection/search_specifications.go +++ b/collection/search_specifications.go @@ -7,27 +7,25 @@ import ( ) // SearchSpecifications searches specifications across indexes/collections according to the provided filters. -func (dc *Collection) SearchSpecifications(options types.SpecificationSearchOptions) (*types.SpecificationSearchResult, error) { +func (dc *Collection) SearchSpecifications(options *types.SearchOptions) (*types.SearchResult, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ Controller: "collection", Action: "searchSpecifications", - Body: struct { - Query interface{} `json:"query"` - }{Query: filters}, + Body: options.Type, } if options != nil { - query.From = options.From() - query.Size = options.Size() - scroll := options.Scroll() + query.From = options.From + query.Size = options.Size + scroll := options.Scroll if scroll != "" { query.Scroll = scroll } } - go dc.Kuzzle.Query(query, options, ch) + go dc.Kuzzle.Query(query, nil, ch) res := <-ch @@ -35,8 +33,8 @@ func (dc *Collection) SearchSpecifications(options types.SpecificationSearchOpti return nil, res.Error } - specifications := &types.SpecificationSearchResult{} - json.Unmarshal(res.Result, specifications) + specifications := &types.SearchResult{} + json.Unmarshal(res.Result, &specifications) return specifications, nil } diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go index 10c48eae..8cf9cc9a 100644 --- a/collection/search_specifications_test.go +++ b/collection/search_specifications_test.go @@ -1 +1,88 @@ package collection_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestSearchSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + so := types.NewSearchOptions("all", 2, 4, "1m") + _, err := nc.SearchSpecifications(so) + assert.NotNil(t, err) +} + +func TestSearchSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "collection", parsedQuery.Controller) + assert.Equal(t, "searchSpecifications", parsedQuery.Action) + + res := types.SpecificationSearchResult{ + ScrollId: "f00b4r", + Total: 1, + Hits: make([]types.SpecificationSearchResultHit, 1), + } + res.Hits[0] = types.SpecificationSearchResultHit{ + Source: types.SpecificationEntry{ + Index: "index", + Collection: "collection", + Validation: &types.Specification{ + Strict: false, + Fields: types.SpecificationFields{ + "foo": types.SpecificationField{ + Mandatory: true, + Type: "string", + DefaultValue: "Value found with search", + }, + }, + }, + }, + } + + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + so := types.NewSearchOptions("all", 2, 4, "1m") + res, err := nc.SearchSpecifications(so) + assert.Equal(t, 1, res.Total) + assert.Nil(t, err) +} + +func ExampleCollection_SearchSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + so := types.NewSearchOptions("all", 2, 4, "1m") + + res, err := nc.SearchSpecifications(so) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/collection/specifications.go b/collection/specifications.go index 2ece201d..8ce10072 100644 --- a/collection/specifications.go +++ b/collection/specifications.go @@ -42,39 +42,6 @@ package collection // return specifications, nil //} // -//// ValidateSpecifications validates the provided specifications. -//func (dc *Collection) ValidateSpecifications(specifications *types.Specification, options types.QueryOptions) (*types.ValidResponse, error) { -// ch := make(chan *types.KuzzleResponse) -// -// type Specifications map[string]map[string]*types.Specification -// -// specificationsData := Specifications{ -// dc.index: { -// dc.collection: specifications, -// }, -// } -// -// query := &types.KuzzleRequest{ -// Collection: dc.collection, -// Index: dc.index, -// Controller: "collection", -// Action: "validateSpecifications", -// Body: specificationsData, -// } -// go dc.Kuzzle.Query(query, options, ch) -// -// res := <-ch -// -// if res.Error != nil { -// return nil, res.Error -// } -// -// response := &types.ValidResponse{} -// json.Unmarshal(res.Result, response) -// -// return response, nil -//} -// //// DeleteSpecifications deletes the current specifications of this collection. //func (dc *Collection) DeleteSpecifications(options types.QueryOptions) (bool, error) { // ch := make(chan *types.KuzzleResponse) diff --git a/collection/update_mapping.go b/collection/update_mapping.go index ae5124db..8bb72eb4 100644 --- a/collection/update_mapping.go +++ b/collection/update_mapping.go @@ -4,18 +4,18 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// UpdateSpecifications updates the current specifications of this collection. -func (dc *Collection) UpdateSpecifications(index string, collection string, body string) error { +// UpdateMapping updates the current mapping of this collection. +func (dc *Collection) UpdateMapping(index string, collection string, body string) error { if index == "" { - return types.NewError("Collection.UpdateSpecifications: index required", 400) + return types.NewError("Collection.UpdateMapping: index required", 400) } if collection == "" { - return types.NewError("Collection.UpdateSpecifications: collection required", 400) + return types.NewError("Collection.UpdateMapping: collection required", 400) } if body == "" { - return types.NewError("Collection.UpdateSpecifications: body required", 400) + return types.NewError("Collection.UpdateMapping: body required", 400) } ch := make(chan *types.KuzzleResponse) @@ -24,7 +24,7 @@ func (dc *Collection) UpdateSpecifications(index string, collection string, body Collection: collection, Index: index, Controller: "collection", - Action: "updateSpecifications", + Action: "updateMapping", Body: body, } go dc.Kuzzle.Query(query, nil, ch) diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index f29c5cd9..0658033c 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -13,28 +13,28 @@ import ( "github.com/stretchr/testify/assert" ) -func TestUpdateSpecificationsIndexNull(t *testing.T) { +func TestUpdateMappingIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("", "collection", "body") + err := nc.UpdateMapping("", "collection", "body") assert.NotNil(t, err) } -func TestUpdateSpecificationsCollectionNull(t *testing.T) { +func TestUpdateMappingCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "", "body") + err := nc.UpdateMapping("index", "", "body") assert.NotNil(t, err) } -func TestUpdateSpecificationsBodyNull(t *testing.T) { +func TestUpdateMappingBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "collection", "") + err := nc.UpdateMapping("index", "collection", "") assert.NotNil(t, err) } -func TestUpdateSpecificationsError(t *testing.T) { +func TestUpdateMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} @@ -43,11 +43,11 @@ func TestUpdateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", "body") assert.NotNil(t, err) } -func TestUpdateSpecifications(t *testing.T) { +func TestUpdateMapping(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Result: []byte(`{}`)} @@ -56,16 +56,16 @@ func TestUpdateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", "body") assert.Nil(t, err) } -func ExampleCollection_UpdateSpecifications() { +func ExampleCollection_UpdateMapping() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateSpecifications("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", "body") if err != nil { fmt.Println(err.Error()) diff --git a/collection/update_specifications.go b/collection/update_specifications.go new file mode 100644 index 00000000..151b105d --- /dev/null +++ b/collection/update_specifications.go @@ -0,0 +1,42 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// UpdateSpecifications updates the current specifications of this collection. +func (dc *Collection) UpdateSpecifications(index string, collection string, body string) (string, error) { + if index == "" { + return "", types.NewError("Collection.UpdateSpecifications: index required", 400) + } + + if collection == "" { + return "", types.NewError("Collection.UpdateSpecifications: collection required", 400) + } + + if body == "" { + return "", types.NewError("Collection.UpdateSpecifications: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "collection", + Action: "updateSpecifications", + Body: body, + } + go dc.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var result string + result = string(res.Result) + + return result, nil +} diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go new file mode 100644 index 00000000..83cd4a4a --- /dev/null +++ b/collection/update_specifications_test.go @@ -0,0 +1,74 @@ +package collection_test + +import ( + "fmt" + + "github.com/kuzzleio/sdk-go/collection" + + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateSpecificationsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("", "collection", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "collection", "") + assert.NotNil(t, err) +} + +func TestUpdateSpecificationsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "collection", "body") + assert.NotNil(t, err) +} + +func TestUpdateSpecifications(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: []byte(`{}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "collection", "body") + assert.Nil(t, err) +} + +func ExampleCollection_UpdateSpecifications() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + nc := collection.NewCollection(k) + _, err := nc.UpdateSpecifications("index", "collection", "body") + + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 15141d53..c99f37e9 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -102,19 +102,6 @@ func cToGoStrings(arr **C.char, len C.size_t) []string { return goStrings } -// Helper to convert a C document** to a go array of document pointers -func cToGoDocuments(col *C.collection, docs **C.document, length C.uint) []*collection.Document { - if length == 0 { - return nil - } - tmpslice := (*[1 << 30]*C.document)(unsafe.Pointer(docs))[:length:length] - godocuments := make([]*collection.Document, length) - for i, doc := range tmpslice { - godocuments[i] = cToGoDocument(col, doc) - } - return godocuments -} - func cToGoShards(cShards *C.shards) *types.Shards { return &types.Shards{ Total: int(cShards.total), @@ -135,28 +122,7 @@ func cToGoKuzzleMeta(cMeta *C.meta) *types.Meta { } func cToGoCollection(c *C.collection) *collection.Collection { - return collection.NewCollection((*kuzzle.Kuzzle)(c.kuzzle.instance), C.GoString(c.collection), C.GoString(c.index)) -} - -func cToGoMapping(cMapping *C.mapping) *collection.Mapping { - mapping := collection.NewMapping(cToGoCollection(cMapping.collection)) - json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(cMapping.mapping))), &mapping.Mapping) - - return mapping -} - -func cToGoSpecification(cSpec *C.specification) *types.Specification { - spec := types.Specification{} - spec.Strict = bool(cSpec.strict) - json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(cSpec.fields))), &spec.Fields) - json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(cSpec.validators))), &spec.Validators) - - return &spec -} - -func cToGoDocument(c *C.collection, cDoc *C.document) *collection.Document { - gDoc := ((*collection.Document)(cDoc.instance)) - return gDoc + return collection.NewCollection((*kuzzle.Kuzzle)(c.kuzzle.instance)) } func cToGoPolicyRestriction(r *C.policy_restriction) *types.PolicyRestriction { @@ -257,31 +223,54 @@ func cToGoUserRigh(r *C.user_right) *types.UserRights { return right } -func cToGoSearchResult(s *C.search_result) *collection.SearchResult { - var godocuments []*collection.Document - - if s.documents_length > 0 { - tmpslice := (*[1 << 30]C.document)(unsafe.Pointer(s.documents))[:s.documents_length:s.documents_length] - - godocuments = make([]*collection.Document, s.documents_length) - - for i, doc := range tmpslice { - godocuments[i] = cToGoDocument(s.collection, &doc) - } - } - +func cToGoSearchResult(s *C.search_result) *types.SearchResult { opts := types.NewQueryOptions() opts.SetSize(int(s.options.size)) opts.SetFrom(int(s.options.from)) opts.SetScrollId(C.GoString(s.options.scroll_id)) - return &collection.SearchResult{ - Collection: cToGoCollection(s.collection), - Documents: godocuments, + var collections json.RawMessage + c, _ := json.Marshal(s.collection) + collections = c + + var documents json.RawMessage + d, _ := json.Marshal(s.documents) + documents = d + + return &types.SearchResult{ + Collection: collections, + Documents: documents, Total: int(s.total), Fetched: int(s.fetched), Options: opts, Filters: cToGoSearchFilters(s.filters), } } + +func cToGoSearchOptions(s *C.search_options) *types.SearchOptions { + return &types.SearchOptions{ + Type: C.GoString(s.type_), + From: int(s.from), + Size: int(s.size), + Scroll: C.GoString(s.scroll), + } +} + +func cToGoCollectionListOptions(clo *C.collection_list_options) *collection.ListOptions { + var t string + + if clo.type_ == C.ALL { + t = "all" + } else if clo.type_ == C.STORED { + t = "stored" + } else if clo.type_ == C.REALTIME { + t = "realtime" + } + + return &collection.ListOptions{ + Type: t, + From: int(clo.type_), + Size: int(clo.size), + } +} diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 5e2bd640..109fb1ee 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -11,7 +11,6 @@ import ( "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" ) // map which stores instances to keep references in case the gc passes @@ -30,58 +29,86 @@ func unregisterCollection(d *C.collection) { // Allocates memory //export kuzzle_new_collection -func kuzzle_new_collection(c *C.collection, k *C.kuzzle, colName *C.char, index *C.char) { +func kuzzle_new_collection(c *C.collection, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) - col := collection.NewCollection(kuz, C.GoString(colName), C.GoString(index)) + col := collection.NewCollection(kuz) - if documentInstances == nil { + if collectionInstances == nil { collectionInstances = make(map[interface{}]bool) } c.instance = unsafe.Pointer(col) - c.index = index - c.collection = colName c.kuzzle = k registerCollection(c) } //export kuzzle_collection_create -func kuzzle_collection_create(c *C.collection, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).Create(SetQueryOptions(options)) - return goToCBoolResult(res, err) +func kuzzle_collection_create(c *C.collection, index *C.char, col *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).Create(C.GoString(index), C.GoString(col)) + return goToCVoidResult(err) } -//export kuzzle_collection_publish_message -func kuzzle_collection_publish_message(c *C.collection, message *C.json_object, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).PublishMessage(JsonCConvert(message).(map[string]interface{}), SetQueryOptions(options)) - return goToCBoolResult(res, err) +//export kuzzle_collection_truncate +func kuzzle_collection_truncate(c *C.collection, index *C.char, col *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).Truncate(C.GoString(index), C.GoString(col)) + return goToCVoidResult(err) } -//export kuzzle_collection_truncate -func kuzzle_collection_truncate(c *C.collection, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).Truncate(SetQueryOptions(options)) +//export kuzzle_collection_exists +func kuzzle_collection_exists(c *C.collection, index *C.char, col *C.char) *C.bool_result { + res, err := (*collection.Collection)(c.instance).Exists(C.GoString(index), C.GoString(col)) return goToCBoolResult(res, err) } -//export kuzzle_collection_subscribe -// TODO loop and close on Unsubscribe -func kuzzle_collection_subscribe(col *C.collection, filters *C.search_filters, options *C.room_options, cb C.kuzzle_notification_listener, data unsafe.Pointer) *C.room_result { - c := make(chan types.KuzzleNotification) - goRoom := cToGoCollection(col).Subscribe(cToGoSearchFilters(filters), SetRoomOptions(options), c) +//export kuzzle_collection_list +func kuzzle_collection_list(c *C.collection, index *C.char, clo *C.collection_list_options) *C.string_result { + res, err := (*collection.Collection)(c.instance).List(C.GoString(index), cToGoCollectionListOptions(clo)) + return goToCStringResult(&res, err) +} + +// Mapping + +//export kuzzle_collection_get_mapping +func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char) *C.string_result { + res, err := (*collection.Collection)(c.instance).GetMapping(C.GoString(index), C.GoString(col)) + return goToCStringResult(&res, err) +} + +//export kuzzle_collection_update_mapping +func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), C.GoString(body)) + return goToCVoidResult(err) +} + +// Specifications + +//export kuzzle_collection_delete_specifications +func kuzzle_collection_delete_specifications(c *C.collection, index *C.char, col *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).DeleteSpecifications(C.GoString(index), C.GoString(col)) + return goToCVoidResult(err) +} - go func() { - res := <-c - C.kuzzle_notify(cb, goToCNotificationResult(&res), data) - }() +//export kuzzle_collection_get_specifications +func kuzzle_collection_get_specifications(c *C.collection, index *C.char, col *C.char) *C.string_result { + res, err := (*collection.Collection)(c.instance).GetSpecifications(C.GoString(index), C.GoString(col)) + return goToCStringResult(&res, err) +} - <-goRoom.ResponseChannel() +//export kuzzle_collection_search_specifications +func kuzzle_collection_search_specifications(c *C.collection, searchOptions *C.search_options) *C.search_result { + res, err := (*collection.Collection)(c.instance).SearchSpecifications(cToGoSearchOptions(searchOptions)) + return goToCSearchResult(res, err) +} - room := (*C.room)(C.calloc(1, C.sizeof_room)) - room.instance = unsafe.Pointer(goRoom) - registerRoom(room) - result := (*C.room_result)(C.calloc(1, C.sizeof_room_result)) +//export kuzzle_collection_update_specifications +func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col *C.char, body *C.char) *C.string_result { + res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), C.GoString(body)) + return goToCStringResult(&res, err) +} - result.result = room - return result +//export kuzzle_collection_validate_specifications +func kuzzle_collection_validate_specifications(c *C.collection, body *C.char) *C.void_result { + err := (*collection.Collection)(c.instance).ValidateSpecifications(C.GoString(body)) + return goToCVoidResult(err) } diff --git a/internal/wrappers/cgo/kuzzle/collection_document.go b/internal/wrappers/cgo/kuzzle/collection_document.go deleted file mode 100644 index 28446425..00000000 --- a/internal/wrappers/cgo/kuzzle/collection_document.go +++ /dev/null @@ -1,100 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" -*/ -import "C" -import ( - "github.com/kuzzleio/sdk-go/collection" -) - -//export kuzzle_collection_count -func kuzzle_collection_count(c *C.collection, searchFilters *C.search_filters, options *C.query_options) *C.int_result { - res, err := (*collection.Collection)(c.instance).Count(cToGoSearchFilters(searchFilters), SetQueryOptions(options)) - return goToCIntResult(res, err) -} - -//export kuzzle_collection_create_document -func kuzzle_collection_create_document(c *C.collection, id *C.char, document *C.document, options *C.query_options) *C.document_result { - res, err := (*collection.Collection)(c.instance).CreateDocument(C.GoString(id), cToGoDocument(c, document), SetQueryOptions(options)) - return goToCDocumentResult(c, res, err) -} - -//export kuzzle_collection_delete_document -func kuzzle_collection_delete_document(c *C.collection, id *C.char, options *C.query_options) *C.string_result { - res, err := (*collection.Collection)(c.instance).DeleteDocument(C.GoString(id), SetQueryOptions(options)) - return goToCStringResult(&res, err) -} - -//export kuzzle_collection_document_exists -func kuzzle_collection_document_exists(c *C.collection, id *C.char, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).DocumentExists(C.GoString(id), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_collection_fetch_document -func kuzzle_collection_fetch_document(c *C.collection, id *C.char, options *C.query_options) *C.document_result { - res, err := (*collection.Collection)(c.instance).FetchDocument(C.GoString(id), SetQueryOptions(options)) - return goToCDocumentResult(c, res, err) -} - -//export kuzzle_collection_replace_document -func kuzzle_collection_replace_document(c *C.collection, id *C.char, document *C.document, options *C.query_options) *C.document_result { - res, err := (*collection.Collection)(c.instance).ReplaceDocument(C.GoString(id), cToGoDocument(c, document), SetQueryOptions(options)) - return goToCDocumentResult(c, res, err) -} - -//export kuzzle_collection_update_document -func kuzzle_collection_update_document(c *C.collection, id *C.char, document *C.document, options *C.query_options) *C.document_result { - res, err := (*collection.Collection)(c.instance).UpdateDocument(C.GoString(id), cToGoDocument(c, document), SetQueryOptions(options)) - return goToCDocumentResult(c, res, err) -} - -//export kuzzle_collection_scroll -func kuzzle_collection_scroll(c *C.collection, scrollId *C.char, options *C.query_options) *C.search_result { - res, err := (*collection.Collection)(c.instance).Scroll(C.GoString(scrollId), SetQueryOptions(options)) - return goToCSearchResult(c, res, err) -} - -//export kuzzle_collection_search -func kuzzle_collection_search(c *C.collection, searchFilters *C.search_filters, options *C.query_options) *C.search_result { - res, err := (*collection.Collection)(c.instance).Search(cToGoSearchFilters(searchFilters), SetQueryOptions(options)) - return goToCSearchResult(c, res, err) -} - -//export kuzzle_collection_m_create_document -func kuzzle_collection_m_create_document(c *C.collection, documents **C.document, docCount C.uint, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MCreateDocument(cToGoDocuments(c, documents, docCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} - -//export kuzzle_collection_m_create_or_replace_document -func kuzzle_collection_m_create_or_replace_document(c *C.collection, documents **C.document, docCount C.uint, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MCreateOrReplaceDocument(cToGoDocuments(c, documents, docCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} - -//export kuzzle_collection_m_delete_document -func kuzzle_collection_m_delete_document(c *C.collection, ids **C.char, idsCount C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*collection.Collection)(c.instance).MDeleteDocument(cToGoStrings(ids, idsCount), SetQueryOptions(options)) - return goToCStringArrayResult(res, err) -} - -//export kuzzle_collection_m_get_document -func kuzzle_collection_m_get_document(c *C.collection, ids **C.char, idsCount C.size_t, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MGetDocument(cToGoStrings(ids, idsCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} - -//export kuzzle_collection_m_replace_document -func kuzzle_collection_m_replace_document(c *C.collection, documents **C.document, docCount C.uint, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MReplaceDocument(cToGoDocuments(c, documents, docCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} - -//export kuzzle_collection_m_update_document -func kuzzle_collection_m_update_document(c *C.collection, documents **C.document, docCount C.uint, options *C.query_options) *C.document_array_result { - res, err := (*collection.Collection)(c.instance).MUpdateDocument(cToGoDocuments(c, documents, docCount), SetQueryOptions(options)) - return goToCDocumentArrayResult(c, res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/collection_mapping.go b/internal/wrappers/cgo/kuzzle/collection_mapping.go deleted file mode 100644 index bde6662c..00000000 --- a/internal/wrappers/cgo/kuzzle/collection_mapping.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" -*/ -import "C" -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/types" -) - -//export kuzzle_new_mapping -func kuzzle_new_mapping(c *C.collection) *C.mapping { - cm := (*C.mapping)(C.calloc(1, C.sizeof_mapping)) - cm.mapping = C.json_object_new_object() - cm.collection = c - - return cm -} - -//export kuzzle_collection_get_mapping -func kuzzle_collection_get_mapping(c *C.collection, options *C.query_options) *C.mapping_result { - res, err := (*collection.Collection)(c.instance).GetMapping(SetQueryOptions(options)) - return goToCMappingResult(c, res, err) -} - -//export kuzzle_mapping_apply -func kuzzle_mapping_apply(cm *C.mapping, options *C.query_options) *C.bool_result { - _, err := cToGoMapping(cm).Apply(SetQueryOptions(options)) - return goToCBoolResult(true, err) -} - -//export kuzzle_mapping_refresh -func kuzzle_mapping_refresh(cm *C.mapping, options *C.query_options) *C.bool_result { - _, err := cToGoMapping(cm).Refresh(SetQueryOptions(options)) - return goToCBoolResult(true, err) -} - -//export kuzzle_mapping_set -func kuzzle_mapping_set(cm *C.mapping, jMap *C.json_object) { - var mappings types.MappingFields - - if JsonCType(jMap) == C.json_type_object { - jsonString := []byte(C.GoString(C.json_object_to_json_string(jMap))) - json.Unmarshal(jsonString, &mappings) - } - - cToGoMapping(cm).Set(&mappings) - - return -} diff --git a/internal/wrappers/cgo/kuzzle/collection_specification.go b/internal/wrappers/cgo/kuzzle/collection_specification.go deleted file mode 100644 index 78189193..00000000 --- a/internal/wrappers/cgo/kuzzle/collection_specification.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" -*/ -import "C" -import "github.com/kuzzleio/sdk-go/collection" - -//export kuzzle_collection_delete_specifications -func kuzzle_collection_delete_specifications(c *C.collection, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).DeleteSpecifications(SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_collection_get_specifications -func kuzzle_collection_get_specifications(c *C.collection, options *C.query_options) *C.specification_result { - res, err := (*collection.Collection)(c.instance).GetSpecifications(SetQueryOptions(options)) - return goToCSpecificationResult(res.Validation, err) -} - -//export kuzzle_collection_scroll_specifications -func kuzzle_collection_scroll_specifications(c *C.collection, scrollId *C.char, options *C.query_options) *C.specification_search_result { - res, err := (*collection.Collection)(c.instance).ScrollSpecifications(C.GoString(scrollId), SetQueryOptions(options)) - return goToCSpecificationSearchResult(res, err) -} - -//export kuzzle_collection_search_specifications -func kuzzle_collection_search_specifications(c *C.collection, searchFilters *C.search_filters, options *C.query_options) *C.specification_search_result { - res, err := (*collection.Collection)(c.instance).SearchSpecifications(cToGoSearchFilters(searchFilters), SetQueryOptions(options)) - return goToCSpecificationSearchResult(res, err) -} - -//export kuzzle_collection_update_specifications -func kuzzle_collection_update_specifications(c *C.collection, specification *C.specification, options *C.query_options) *C.specification_result { - res, err := (*collection.Collection)(c.instance).UpdateSpecifications(cToGoSpecification(specification), SetQueryOptions(options)) - return goToCSpecificationResult(res, err) -} - -//export kuzzle_collection_validate_specifications -func kuzzle_collection_validate_specifications(c *C.collection, specification *C.specification, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).ValidateSpecifications(cToGoSpecification(specification), SetQueryOptions(options)) - return goToCBoolResult(res.Valid, err) -} diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 333bb7a7..2331c8ed 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -234,8 +234,8 @@ func kuzzle_free_user_data(st *C.user_data) { //export kuzzle_free_collection func kuzzle_free_collection(st *C.collection) { if st != nil { - C.free(unsafe.Pointer(st.index)) - C.free(unsafe.Pointer(st.collection)) + C.free(unsafe.Pointer(st.instance)) + C.free(unsafe.Pointer(st.kuzzle)) C.free(unsafe.Pointer(st)) } } @@ -671,17 +671,6 @@ func kuzzle_free_search_result(st *C.search_result) { kuzzle_free_query_options(st.options) kuzzle_free_json_object(st.aggregations) kuzzle_free_search_filters(st.filters) - kuzzle_free_collection(st.collection) - - if st.documents != nil { - documents := (*[1<<30 - 1]C.document)(unsafe.Pointer(st.documents))[:int(st.documents_length):int(st.documents_length)] - - for _, document := range documents { - _free_document(&document) - } - - C.free(unsafe.Pointer(st.documents)) - } C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go deleted file mode 100644 index 14acdfdc..00000000 --- a/internal/wrappers/cgo/kuzzle/document.go +++ /dev/null @@ -1,124 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "unsafe" - - col "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/types" -) - -// map which stores instances to keep references in case the gc passes -var documentInstances map[interface{}]bool - -// register new instance to the instances map -func registerDocument(instance interface{}) { - documentInstances[instance] = true -} - -// unregister an instance from the instances map -//export unregisterDocument -func unregisterDocument(d *C.document) { - delete(documentInstances, (*col.Document)(d.instance)) -} - -//export kuzzle_new_document -func kuzzle_new_document(d *C.document, c *C.collection, id *C.char, content *C.json_object) { - doc := col.NewDocument((*col.Collection)(c.instance), C.GoString(id)) - - if content != nil { - doc.SetContent(JsonCConvert(content).(map[string]interface{}), true) - } - if documentInstances == nil { - documentInstances = make(map[interface{}]bool) - } - - registerDocument(doc) - d._collection = c - d.instance = unsafe.Pointer(doc) -} - -//export kuzzle_document_subscribe -// TODO close on Unsubscribe -func kuzzle_document_subscribe(d *C.document, options *C.room_options, cb C.kuzzle_notification_listener, data unsafe.Pointer) *C.room_result { - c := make(chan types.KuzzleNotification) - goroom, _ := cToGoDocument(d._collection, d).Subscribe(SetRoomOptions(options), c) - - go func() { - for { - res := <-c - C.kuzzle_notify(cb, goToCNotificationResult(&res), data) - } - }() - <-goroom.ResponseChannel() - - room := (*C.room)(C.calloc(1, C.sizeof_room)) - room.instance = unsafe.Pointer(goroom) - registerRoom(room) - result := (*C.room_result)(C.calloc(1, C.sizeof_room_result)) - - result.result = room - return result -} - -// Does not re-allocate the document -//export kuzzle_document_save -func kuzzle_document_save(d *C.document, options *C.query_options) *C.document_result { - _, err := cToGoDocument(d._collection, d).Save(SetQueryOptions(options)) - return currentDocumentResult(d, err) -} - -//export kuzzle_document_refresh -func kuzzle_document_refresh(d *C.document, options *C.query_options) *C.document_result { - res, err := cToGoDocument(d._collection, d).Refresh(SetQueryOptions(options)) - return goToCDocumentResult(d._collection, res, err) -} - -//export kuzzle_document_publish -func kuzzle_document_publish(d *C.document, options *C.query_options) *C.bool_result { - //res, err := cToGoDocument(d._collection, d).Publish(SetQueryOptions(options)) - - res, err := (*col.Document)(d.instance).Publish(SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_document_exists -func kuzzle_document_exists(d *C.document, options *C.query_options) *C.bool_result { - res, err := cToGoDocument(d._collection, d).Exists(SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_document_delete -func kuzzle_document_delete(d *C.document, options *C.query_options) *C.string_result { - res, err := (*col.Document)(d.instance).Delete(SetQueryOptions(options)) - return goToCStringResult(&res, err) -} - -//export kuzzle_document_set_content -func kuzzle_document_set_content(d *C.document, content *C.json_object, replace C.bool) { - (*col.Document)(d.instance).SetContent(JsonCConvert(content).(map[string]interface{}), bool(replace)) -} - -//export kuzzle_document_get_content -func kuzzle_document_get_content(d *C.document) *C.json_object { - r, _ := goToCJson((*col.Document)(d.instance).Content) - return r -} - -// Allocates memory for result, not document -func currentDocumentResult(d *C.document, err error) *C.document_result { - result := (*C.document_result)(C.calloc(1, C.sizeof_document_result)) - - if err != nil { - Set_document_error(result, err) - } - - result.result = d - - return result -} diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 295df2e8..51bb9f2a 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -12,7 +12,6 @@ import ( "encoding/json" "unsafe" - "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" ) @@ -20,14 +19,6 @@ import ( func duplicateCollection(ptr *C.collection) *C.collection { dest := (*C.collection)(C.calloc(1, C.sizeof_collection)) - if ptr.index != nil { - dest.index = C.CString(C.GoString(ptr.index)) - } - - if ptr.collection != nil { - dest.collection = C.CString(C.GoString(ptr.collection)) - } - dest.kuzzle = ptr.kuzzle return dest @@ -64,37 +55,6 @@ func goToCShards(gShards *types.Shards) *C.shards { return result } -// Allocates memory -func goToCDocument(col *C.collection, gDoc *collection.Document, dest *C.document) *C.document { - var result *C.document - if dest == nil { - result = (*C.document)(C.calloc(1, C.sizeof_document)) - } else { - result = dest - } - - result.id = C.CString(gDoc.Id) - result.index = C.CString(gDoc.Index) - result.result = C.CString(gDoc.Result) - result.collection = C.CString(gDoc.Collection) - result.meta = goToCMeta(gDoc.Meta) - result.shards = goToCShards(gDoc.Shards) - result._collection = duplicateCollection(col) - - if string(gDoc.Content) != "" { - buffer := C.CString(string(gDoc.Content)) - result.content = C.json_tokener_parse(buffer) - C.free(unsafe.Pointer(buffer)) - } else { - result.content = C.json_object_new_object() - } - - result.version = C.int(gDoc.Version) - result.created = C.bool(gDoc.Created) - - return result -} - // Allocates memory func goToCNotificationContent(gNotifContent *types.NotificationResult) *C.notification_content { result := (*C.notification_content)(C.calloc(1, C.sizeof_notification_content)) @@ -160,42 +120,6 @@ func goToCKuzzleResponse(gRes *types.KuzzleResponse) *C.kuzzle_response { return result } -// Allocates memory -func goToCDocumentResult(col *C.collection, goRes *collection.Document, err error) *C.document_result { - result := (*C.document_result)(C.calloc(1, C.sizeof_document_result)) - - if err != nil { - Set_document_error(result, err) - return result - } - - result.result = goToCDocument(col, goRes, nil) - - return result -} - -func goToCDocumentArrayResult(col *C.collection, goRes []*collection.Document, err error) *C.document_array_result { - result := (*C.document_array_result)(C.calloc(1, C.sizeof_document_array_result)) - - if err != nil { - Set_document_array_result_error(result, err) - return result - } - - if goRes != nil { - result.result_length = C.size_t(len(goRes)) - result.result = (*C.document)(C.calloc(result.result_length, C.sizeof_document)) - - cArray := (*[1<<30 - 1]C.document)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] - - for i, doc := range goRes { - goToCDocument(col, doc, &cArray[i]) - } - } - - return result -} - func goToCPolicyRestriction(restriction *types.PolicyRestriction, dest *C.policy_restriction) *C.policy_restriction { var crestriction *C.policy_restriction if dest == nil { @@ -430,28 +354,14 @@ func goToCSearchFilters(filters *types.SearchFilters) *C.search_filters { } // Allocates memory -func goToCSearchResult(col *C.collection, goRes *collection.SearchResult, err error) *C.search_result { +func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { result := (*C.search_result)(C.calloc(1, C.sizeof_search_result)) - result.collection = duplicateCollection(col) + result.collection, _ = goToCJson(goRes.Collection) + result.documents, _ = goToCJson(goRes.Documents) - if err != nil { - Set_search_result_error(result, err) - return result - } - - result.documents_length = C.size_t(len(goRes.Documents)) result.fetched = C.uint(goRes.Fetched) result.total = C.uint(goRes.Total) - if len(goRes.Documents) > 0 { - result.documents = (*C.document)(C.calloc(result.documents_length, C.sizeof_document)) - cArray := (*[1<<30 - 1]C.document)(unsafe.Pointer(result.documents))[:len(goRes.Documents):len(goRes.Documents)] - - for i, doc := range goRes.Documents { - goToCDocument(col, doc, &cArray[i]) - } - } - if goRes.Filters != nil { result.filters = goToCSearchFilters(goRes.Filters) } @@ -471,30 +381,6 @@ func goToCSearchResult(col *C.collection, goRes *collection.SearchResult, err er return result } -// Allocates memory -func goToCMapping(c *C.collection, goMapping *collection.Mapping) *C.mapping { - result := (*C.mapping)(C.calloc(1, C.sizeof_mapping)) - - result.collection = duplicateCollection(c) - result.mapping, _ = goToCJson(goMapping.Mapping) - - return result -} - -// Allocates memory -func goToCMappingResult(c *C.collection, goRes *collection.Mapping, err error) *C.mapping_result { - result := (*C.mapping_result)(C.calloc(1, C.sizeof_mapping_result)) - - if err != nil { - Set_mapping_result_error(result, err) - return result - } - - result.result = goToCMapping(c, goRes) - - return result -} - func goToCRole(k *C.kuzzle, role *security.Role, dest *C.role) *C.role { var crole *C.role if dest == nil { @@ -890,19 +776,3 @@ func goToCDateResult(goRes int, err error) *C.date_result { return result } - -// Allocates memory -func goToCRoomResult(err error) *C.room_result { - result := (*C.room_result)(C.calloc(1, C.sizeof_room_result)) - - if err != nil { - Set_room_result_error(result, err) - return result - } - - room := (*C.room)(C.calloc(1, C.sizeof_room)) - room.instance = unsafe.Pointer(room) - registerRoom(room) - result.result = room - return result -} diff --git a/internal/wrappers/cgo/kuzzle/room.go b/internal/wrappers/cgo/kuzzle/room.go deleted file mode 100644 index 23910d24..00000000 --- a/internal/wrappers/cgo/kuzzle/room.go +++ /dev/null @@ -1,79 +0,0 @@ -package main - -import ( - "unsafe" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/types" -) - -/* - #cgo CFLAGS: -I../../headers - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" - -// map which stores instances to keep references in case the gc passes -var roomInstances map[interface{}]bool - -// register new instance to the instances map -func registerRoom(instance interface{}) { - if roomInstances == nil { - roomInstances = make(map[interface{}]bool) - } - roomInstances[instance] = true -} - -// unregister an instance from the instances map -//export unregisterRoom -func unregisterRoom(r *C.room) { - delete(roomInstances, (*collection.Room)(r.instance)) -} - -//export room_new_room -func room_new_room(room *C.room, col *C.collection, filters *C.json_object, options *C.room_options) { - opts := SetRoomOptions(options) - - r := collection.NewRoom((*collection.Collection)(col.instance), JsonCConvert(filters), opts) - - registerRoom(room) - room.instance = unsafe.Pointer(r) - room.filters = filters - room.options = options -} - -//export room_count -func room_count(room *C.room) *C.int_result { - res, err := (*collection.Room)(room.instance).Count() - return goToCIntResult(res, err) -} - -//export room_on_done -func room_on_done(room *C.room, cb C.kuzzle_subscribe_listener, data unsafe.Pointer) { - c := make(chan types.SubscribeResponse) - - (*collection.Room)(room.instance).OnDone(c) - go func() { - res := <-c - C.room_on_subscribe(cb, goToCRoomResult(res.Error), data) - }() -} - -//export room_subscribe -func room_subscribe(room *C.room, cb C.kuzzle_notification_listener, data unsafe.Pointer) { - c := make(chan types.KuzzleNotification) - - (*collection.Room)(room.instance).Subscribe(c) - go func() { - res := <-c - C.kuzzle_notify(cb, goToCNotificationResult(&res), data) - }() -} - -//export room_unsubscribe -func room_unsubscribe(room *C.room) *C.void_result { - err := (*collection.Room)(room.instance).Unsubscribe() - return goToCVoidResult(err) -} diff --git a/internal/wrappers/cgo/kuzzle/search_result.go b/internal/wrappers/cgo/kuzzle/search_result.go index 64f1a16a..91e62a6a 100644 --- a/internal/wrappers/cgo/kuzzle/search_result.go +++ b/internal/wrappers/cgo/kuzzle/search_result.go @@ -6,8 +6,8 @@ package main */ import "C" -//export kuzzle_search_result_fetch_next -func kuzzle_search_result_fetch_next(sr *C.search_result) *C.search_result { - res, err := cToGoSearchResult(sr).FetchNext() - return goToCSearchResult(sr.collection, res, err) -} +////export kuzzle_search_result_fetch_next +//func kuzzle_search_result_fetch_next(sr *C.search_result) *C.search_result { +// res, err := cToGoSearchResult(sr).FetchNext() +// return goToCSearchResult(sr.collection, res, err) +//} diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 066b1141..3d1fe552 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -1,239 +1,117 @@ #include "kuzzle.hpp" #include "collection.hpp" -#include "document.hpp" -#include "room.hpp" namespace kuzzleio { - Collection::Collection(Kuzzle* kuzzle, const std::string& col, const std::string& index) { + Collection::Collection(Kuzzle* kuzzle) { _collection = new collection(); - kuzzle_new_collection(_collection, kuzzle->_kuzzle, const_cast(col.c_str()), const_cast(index.c_str())); + kuzzle_new_collection(_collection, kuzzle->_kuzzle); } Collection::~Collection() { unregisterCollection(_collection); - delete(_collection); + kuzzle_free_collection(_collection); } - int Collection::count(search_filters* filters, query_options* options) Kuz_Throw_KuzzleException { - int_result *r = kuzzle_collection_count(_collection, filters, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - int ret = r->result; - delete(r); - return ret; + void Collection::create(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_create(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + kuzzle_free_void_result(r); } - Collection* Collection::createDocument(Document* document, const std::string& id, query_options* options) Kuz_Throw_KuzzleException { - document_result *r = kuzzle_collection_create_document(_collection, const_cast(id.c_str()), document->_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - delete(r); - return this; - } + bool Collection::exists(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_collection_exists(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - std::string Collection::deleteDocument(const std::string& id, query_options* options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_collection_delete_document(_collection, const_cast(id.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; + bool ret = r->result; + kuzzle_free_bool_result(r); + return ret; } - Document* Collection::fetchDocument(const std::string& id, query_options* options) Kuz_Throw_KuzzleException { - document_result *r = kuzzle_collection_fetch_document(_collection, const_cast(id.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); - return ret; + std::string Collection::list(const std::string& index, collection_list_options *collectionListOptions) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_list(_collection, const_cast(index.c_str()), collectionListOptions); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; } - std::vector Collection::mCreateDocument(std::vector& documents, query_options* options) Kuz_Throw_KuzzleException { - document **docs = new document *[documents.size()]; - int i = 0; - for(auto const& doc: documents) { - docs[i] = doc->_document; - i++; - } - document_array_result *r = kuzzle_collection_m_create_document(_collection, docs, documents.size(), options); + void Collection::truncate(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - delete[] docs; + kuzzle_free_void_result(r); + } - if (r->error != NULL) - throwExceptionFromStatus(r); + std::string Collection::getMapping(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_get_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); + std::string ret = r->result; + kuzzle_free_string_result(r); - delete(r); - return v; + return ret; } - std::vector Collection::mCreateOrReplaceDocument(std::vector& documents, query_options* options) Kuz_Throw_KuzzleException { - document **docs = new document *[documents.size()]; - int i = 0; - for (auto const& doc : documents) { - docs[i] = doc->_document; - i++; - } - document_array_result *r = kuzzle_collection_m_create_or_replace_document(_collection, docs, documents.size(), options); - - delete[] docs; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - - delete(r); - return v; - } + void Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - std::vector Collection::mDeleteDocument(std::vector& ids, query_options* options) Kuz_Throw_KuzzleException { - char **docsIds = new char *[ids.size()]; - int i = 0; - for (auto const& id : ids) { - docsIds[i] = const_cast(id.c_str()); - i++; - } - string_array_result *r = kuzzle_collection_m_delete_document(_collection, docsIds, ids.size(), options); - - delete[] docsIds; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(r->result[i]); - - delete(r); - return v; + kuzzle_free_void_result(r); } - std::vector Collection::mGetDocument(std::vector& ids, query_options* options) Kuz_Throw_KuzzleException { - char **docsIds = new char *[ids.size()]; - int i = 0; - for (auto const& id : ids) { - docsIds[i] = const_cast(id.c_str()); - i++; - } - document_array_result *r = kuzzle_collection_m_get_document(_collection, docsIds, ids.size(), options); - - delete[] docsIds; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - - delete(r); - return v; - } + std::string Collection::getSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_get_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - std::vector Collection::mReplaceDocument(std::vector& documents, query_options* options) Kuz_Throw_KuzzleException { - document **docs = new document *[documents.size()]; - int i = 0; - for (auto const& doc : documents) { - docs[i] = doc->_document; - i++; - } - document_array_result *r = kuzzle_collection_m_replace_document(_collection, docs, documents.size(), options); - - delete[] docs; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - - delete(r); - return v; - } + std::string ret = r->result; + kuzzle_free_string_result(r); - std::vector Collection::mUpdateDocument(std::vector& documents, query_options* options) Kuz_Throw_KuzzleException { - document **docs = new document *[documents.size()]; - int i = 0; - for (auto const& doc : documents) { - docs[i] = doc->_document; - i++; - } - document_array_result *r = kuzzle_collection_m_update_document(_collection, docs, documents.size(), options); - - delete[] docs; - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(new Document(this, (r->result + i)->id, (r->result + i)->content)); - - delete(r); - return v; + return ret; } - bool Collection::publishMessage(json_object* content, query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_collection_publish_message(_collection, content, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } + search_result* Collection::searchSpecifications(search_options *searchOptions) Kuz_Throw_KuzzleException { + search_result *r = kuzzle_collection_search_specifications(_collection, searchOptions); + if (r->error != NULL) + throwExceptionFromStatus(r); - Document* Collection::replaceDocument(const std::string& id, Document* document, query_options* options) Kuz_Throw_KuzzleException { - document_result* r = kuzzle_collection_update_document(_collection, const_cast(id.c_str()), document->_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); - return ret; - } + search_result *ret = r; + kuzzle_free_search_result(r); - search_result* Collection::scroll(const std::string& id, query_options* options) Kuz_Throw_KuzzleException { - search_result* r = kuzzle_collection_scroll(_collection, const_cast(id.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - return r; + return ret; } - search_result* Collection::search(search_filters* filters, query_options* options) Kuz_Throw_KuzzleException { - search_result* r = kuzzle_collection_search(_collection, filters, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - return r; - } + std::string Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_update_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - void call_collection_cb(notification_result* res, void* data) { - ((Collection*)data)->getListener()->onMessage(res); - } + std::string ret = r->result; + kuzzle_free_string_result(r); - NotificationListener* Collection::getListener() { - return _listener_instance; + return ret; } - Room* Collection::subscribe(search_filters* filters, NotificationListener *listener, room_options* options) Kuz_Throw_KuzzleException { - room_result* r = kuzzle_collection_subscribe(_collection, filters, options, &call_collection_cb, this); - if (r->error != NULL) - throwExceptionFromStatus(r); - _listener_instance = listener; - - Room* ret = new Room(r->result, NULL, listener); - free(r); - return ret; - } + void Collection::validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); - Document* Collection::updateDocument(const std::string& id, Document* document, query_options* options) Kuz_Throw_KuzzleException { - document_result* r = kuzzle_collection_update_document(_collection, const_cast(id.c_str()), document->_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(this, r->result->id, r->result->content); - delete(r); - return ret; + kuzzle_free_void_result(r); } -} \ No newline at end of file + void Collection::deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + + kuzzle_free_void_result(r); + } +} diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp deleted file mode 100644 index dc34c667..00000000 --- a/internal/wrappers/cpp/document.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "document.hpp" -#include "collection.hpp" - -namespace kuzzleio { - - Document::Document(Collection *collection, const std::string& id, json_object* content) Kuz_Throw_KuzzleException { - _document = new document(); - _collection = collection; - kuzzle_new_document(_document, collection->_collection, const_cast(id.c_str()), content); - } - - Document::~Document() { - unregisterDocument(_document); - delete(_document); - } - - std::string Document::delete_(query_options* options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_delete(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - - bool Document::exists(query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_document_exists(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - - bool Document::publish(query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_document_publish(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - - Document* Document::refresh(query_options* options) Kuz_Throw_KuzzleException { - document_result *r = kuzzle_document_refresh(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(_collection, r->result->id, r->result->content); - delete(r); - return ret; - } - - Document* Document::save(query_options* options) Kuz_Throw_KuzzleException { - document_result *r = kuzzle_document_save(_document, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - Document* ret = new Document(_collection, r->result->id, r->result->content); - - _document->id = r->result->id; - _document->version = r->result->version; - delete(r); - return ret; - } - - Document* Document::setContent(json_object* content, bool replace) { - kuzzle_document_set_content(_document, content, replace); - return this; - } - - json_object* Document::getContent() { - return kuzzle_document_get_content(_document); - } - - void call_cb(notification_result* res, void* data) { - ((Document*)data)->getListener()->onMessage(res); - } - - Room* Document::subscribe(NotificationListener* listener, room_options* options) { - room_result* r = kuzzle_document_subscribe(_document, options, &call_cb, this); - if (r->error != NULL) - throwExceptionFromStatus(r); - _listener_instance = listener; - - Room* ret = new Room(r->result, NULL, listener); - free(r); - return ret; - } - - NotificationListener* Document::getListener() { - return _listener_instance; - } -} diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 53da4700..db16a222 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -152,15 +152,6 @@ namespace kuzzleio { return ret; } - collection_entry* Kuzzle::listCollections(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { - collection_entry_result *r = kuzzle_list_collections(_kuzzle, const_cast(index.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - collection_entry *ret = r->result; - delete(r); - return ret; - } - std::vector Kuzzle::listIndexes(query_options* options) Kuz_Throw_KuzzleException { string_array_result *r = kuzzle_list_indexes(_kuzzle, options); if (r->error != NULL) @@ -310,5 +301,5 @@ namespace kuzzleio { int Kuzzle::listenerCount(Event event) { return kuzzle_listener_count(_kuzzle, event); } - + } diff --git a/internal/wrappers/cpp/room.cpp b/internal/wrappers/cpp/room.cpp deleted file mode 100644 index b975ab63..00000000 --- a/internal/wrappers/cpp/room.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "room.hpp" -#include "collection.hpp" - -namespace kuzzleio { - Room::Room(room* r, SubscribeListener* subscribe_listener, NotificationListener* notification_listener) { - this->_room = r; - this->_listener_instance = subscribe_listener; - this->_notification_listener_instance = notification_listener; - } - - Room::Room(Collection *collection, json_object *filters, room_options* options) { - this->_room = new room(); - room_new_room(this->_room, collection->_collection, filters, options); - } - - Room::~Room() { - unregisterRoom(this->_room); - delete(this->_room); - } - - int Room::count() Kuz_Throw_KuzzleException { - int_result *r = room_count(_room); - if (r->error != NULL) - throwExceptionFromStatus(r); - int ret = r->result; - delete(r); - return ret; - } - - void call_cb(room_result* res, void* data) { - ((Room*)data)->getSubscribeListener()->onSubscribe(res); - } - - void notify(notification_result* res, void* data) { - ((Room*)data)->getNotificationListener()->onMessage(res); - } - - SubscribeListener* Room::getSubscribeListener() { - return _listener_instance; - } - - NotificationListener* Room::getNotificationListener() { - return _notification_listener_instance; - } - - Room* Room::onDone(SubscribeListener *listener) { - _listener_instance = listener; - room_on_done(_room, &call_cb, this); - } - - Room* Room::subscribe(NotificationListener* listener) { - _notification_listener_instance = listener; - room_subscribe(_room, ¬ify, this); - } - - void Room::unsubscribe() Kuz_Throw_KuzzleException { - void_result *r = room_unsubscribe(_room); - if (r && r->error != NULL) - throwExceptionFromStatus(r); - _notification_listener_instance = NULL; - _listener_instance = NULL; - delete(r); - } -} \ No newline at end of file diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index b42ad65f..0c59b7ef 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -6,34 +6,26 @@ #include "core.hpp" namespace kuzzleio { - class Document; - class Room; class Collection { - public: - collection* _collection; - NotificationListener* _listener_instance; + collection* _collection; + Collection(); - Collection(Kuzzle* kuzzle, const std::string& collection, const std::string& index); + public: + Collection(Kuzzle* kuzzle); virtual ~Collection(); - int count(search_filters* filters, query_options* options=NULL) Kuz_Throw_KuzzleException; - Collection* createDocument(Document* document, const std::string& id="", query_options* options=NULL) Kuz_Throw_KuzzleException; - std::string deleteDocument(const std::string& id, query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* fetchDocument(const std::string& id, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mCreateDocument(std::vector& documents, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mCreateOrReplaceDocument(std::vector& documents, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mDeleteDocument(std::vector& ids, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mGetDocument(std::vector& ids, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mReplaceDocument(std::vector& documents, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector mUpdateDocument(std::vector& documents, query_options* options=NULL) Kuz_Throw_KuzzleException; - bool publishMessage(json_object* content, query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* replaceDocument(const std::string& id, Document* document, query_options* options=NULL) Kuz_Throw_KuzzleException; - search_result* scroll(const std::string& id, query_options* options=NULL) Kuz_Throw_KuzzleException; - search_result* search(search_filters* filters, query_options* options=NULL) Kuz_Throw_KuzzleException; - Room* subscribe(search_filters* filters, NotificationListener* listener, room_options* options=NULL) Kuz_Throw_KuzzleException; - NotificationListener* getListener(); - Document* updateDocument(const std::string& id, Document* document, query_options* options=NULL) Kuz_Throw_KuzzleException; + void create(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + std::string list(const std::string& index, collection_list_options *collectionListOptions) Kuz_Throw_KuzzleException; + void truncate(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + std::string getMapping(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + void updateMapping(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; + std::string getSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + search_result* searchSpecifications(search_options *searchOptions) Kuz_Throw_KuzzleException; + std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; + void validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException; + void deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; }; } -#endif \ No newline at end of file +#endif diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp deleted file mode 100644 index 5e4e121c..00000000 --- a/internal/wrappers/headers/document.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _DOCUMENT_HPP_ -#define _DOCUMENT_HPP_ - -#include "listeners.hpp" -#include "exceptions.hpp" -#include "core.hpp" -#include "room.hpp" - -#include -#include - -namespace kuzzleio { - class Collection; - - class Document { - Document(){}; - Collection *_collection; - NotificationListener* _listener_instance; - - public: - document *_document; - Document(Collection *collection, const std::string& id="", json_object* content=NULL) Kuz_Throw_KuzzleException; - virtual ~Document(); - std::string delete_(query_options* options=NULL) Kuz_Throw_KuzzleException; - bool exists(query_options* options=NULL) Kuz_Throw_KuzzleException; - bool publish(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* refresh(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* save(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* setContent(json_object* content, bool replace=false); - json_object* getContent(); - Room* subscribe(NotificationListener* listener, room_options* options=NULL); - NotificationListener* getListener(); - }; -} - -#endif \ No newline at end of file diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index cb3b09c5..c5607b34 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -39,7 +39,6 @@ namespace kuzzleio { std::string getJwt(); json_object* getMyRights(query_options* options=NULL) Kuz_Throw_KuzzleException; json_object* getServerInfo(query_options* options=NULL) Kuz_Throw_KuzzleException; - collection_entry* listCollections(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; std::vector listIndexes(query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); void logout(); @@ -69,4 +68,4 @@ namespace kuzzleio { }; } -#endif \ No newline at end of file +#endif diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 08631d34..2302edbd 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -93,6 +93,23 @@ typedef struct { kuzzle_offline_queue_loader loader; } kuzzle; +typedef struct { + enum { + ALL, + STORED, + REALTIME + } type_; + int from; + int size; +} collection_list_options; + +typedef struct { + char *type_; + int from; + int size; + char *scroll; +} search_options; + //options passed to room constructor typedef struct { char *scope; @@ -212,8 +229,6 @@ typedef struct { typedef struct { void *instance; - char *index; - char *collection; kuzzle *kuzzle; } collection; @@ -529,14 +544,13 @@ typedef struct specification_result { } specification_result; typedef struct search_result { - document *documents; - size_t documents_length; + json_object *documents; unsigned fetched; unsigned total; json_object *aggregations; search_filters *filters; query_options *options; - collection *collection; + json_object *collection; int status; char *error; char *stack; diff --git a/internal/wrappers/headers/room.hpp b/internal/wrappers/headers/room.hpp deleted file mode 100644 index 1640e54c..00000000 --- a/internal/wrappers/headers/room.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _ROOM_HPP_ -#define _ROOM_HPP_ - -#include "listeners.hpp" -#include "exceptions.hpp" -#include "core.hpp" -#include "room.hpp" - -namespace kuzzleio { - class Collection; - - class Room { - room *_room; - SubscribeListener *_listener_instance; - NotificationListener *_notification_listener_instance; - - Room(){} - - public: - Room(Collection *collection, json_object *filters=NULL, room_options* options=NULL); - Room(room* r, SubscribeListener* subscribe_listener, NotificationListener* notification_listener); - virtual ~Room(); - int count() Kuz_Throw_KuzzleException; - SubscribeListener *getSubscribeListener(); - NotificationListener *getNotificationListener(); - Room* onDone(SubscribeListener* listener); - Room* subscribe(NotificationListener* listener); - void unsubscribe() Kuz_Throw_KuzzleException; - }; -} - -#endif \ No newline at end of file diff --git a/internal/wrappers/headers/sdk_wrappers_internal.h b/internal/wrappers/headers/sdk_wrappers_internal.h index 05927566..0a492139 100644 --- a/internal/wrappers/headers/sdk_wrappers_internal.h +++ b/internal/wrappers/headers/sdk_wrappers_internal.h @@ -2,7 +2,6 @@ #define __SDK_WRAPPERS_INTERNAL typedef char *char_ptr; -typedef document *document_ptr; typedef policy *policy_ptr; typedef policy_restriction *policy_restriction_ptr; typedef json_object *json_object_ptr; diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index c1c717c7..a444972d 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -2,13 +2,11 @@ %module(directors="1") kcore %{ -#include "listeners.hpp" +#include "listeners.hpp" #include "exceptions.hpp" #include "event_emitter.hpp" #include "kuzzle.hpp" #include "collection.hpp" -#include "room.hpp" -#include "document.hpp" #include #include %} @@ -23,5 +21,3 @@ %include "event_emitter.hpp" %include "kuzzle.hpp" %include "collection.hpp" -%include "room.hpp" -%include "document.hpp" diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 115d108e..c8b1a6bf 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -34,8 +34,6 @@ %{ #include "kuzzle.cpp" #include "collection.cpp" -#include "room.cpp" -#include "document.cpp" %} %include "exceptions.i" @@ -50,7 +48,6 @@ %include "std_vector.i" %template(StringVector) std::vector; -%template(DocumentVector) std::vector; %typemap(out) const StringVector& %{ return $1; @@ -139,5 +136,3 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" -%include "room.cpp" -%include "document.cpp" \ No newline at end of file diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index 93f6f59c..a55141e6 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -26,7 +26,6 @@ func ExampleKuzzle_Connect() { return } - fmt.Println(k.State()) } func ExampleKuzzle_Jwt() { diff --git a/test.sh b/test.sh index e351d94a..08899e0f 100755 --- a/test.sh +++ b/test.sh @@ -36,7 +36,7 @@ linter_check() { make_wrappers() { cd "${dir}/internal/wrappers" - make all + make all } cd "$dir" @@ -53,4 +53,4 @@ case "$1" in show_cover_report html ;; *) echo >&2 "error: invalid option: $1"; exit 1 ;; -esac \ No newline at end of file +esac diff --git a/types/consts.go b/types/consts.go index eed0bb84..87c7611b 100644 --- a/types/consts.go +++ b/types/consts.go @@ -23,3 +23,10 @@ const ( USERS_OUT = "out" USERS_NONE = "none" ) + +// user notifications constants +const ( + TYPE_ALL = "all" + TYPE_STORED = "stored" + TYPE_REALTIME = "realtime" +) diff --git a/types/search_options.go b/types/search_options.go new file mode 100644 index 00000000..481a6e7a --- /dev/null +++ b/types/search_options.go @@ -0,0 +1,37 @@ +package types + +type SearchOptions struct { + Type string + From int + Size int + Scroll string +} + +func NewSearchOptions(t string, from int, size int, scroll string) *SearchOptions { + return &SearchOptions{ + Type: t, + From: from, + Size: size, + Scroll: scroll, + } +} + +func (so *SearchOptions) SetType(nt string) *SearchOptions { + so.Type = nt + return so +} + +func (so *SearchOptions) SetFrom(nf int) *SearchOptions { + so.From = nf + return so +} + +func (so *SearchOptions) SetSize(ns int) *SearchOptions { + so.Size = ns + return so +} + +func (so *SearchOptions) SetScroll(ns string) *SearchOptions { + so.Scroll = ns + return so +} diff --git a/types/search_result.go b/types/search_result.go new file mode 100644 index 00000000..8fee1d19 --- /dev/null +++ b/types/search_result.go @@ -0,0 +1,111 @@ +package types + +import ( + "encoding/json" +) + +type SearchResult struct { + Collection json.RawMessage + Documents json.RawMessage + Total int + Fetched int + Aggregations json.RawMessage + Options QueryOptions + Filters *SearchFilters +} + +func NewSearchResult(collection json.RawMessage, filters *SearchFilters, options QueryOptions, raw *KuzzleResponse) *SearchResult { + type ParseSearchResult struct { + Documents json.RawMessage `json:"hits"` + Total int `json:"total"` + ScrollId string `json:"_scroll_id"` + Aggregations json.RawMessage `json:"aggregations"` + } + + var parsed ParseSearchResult + json.Unmarshal(raw.Result, &parsed) + + sr := &SearchResult{ + Collection: collection, + Filters: filters, + Documents: parsed.Documents, + Total: parsed.Total, + Fetched: len(parsed.Documents), + Aggregations: parsed.Aggregations, + Options: NewQueryOptions(), + } + + sr.Options.SetScrollId(parsed.ScrollId) + + if options != nil { + sr.Options.SetFrom(options.From()) + sr.Options.SetSize(options.Size()) + } else { + sr.Options.SetFrom(0) + sr.Options.SetSize(0) + } + + return sr +} + +//// FetchNext returns a new SearchResult that corresponds to the next result page +//func (ksr *SearchResult) FetchNext() (*SearchResult, error) { +// if ksr.Fetched >= ksr.Total { +// return nil, nil +// } +// +// if ksr.Options.ScrollId() != "" { +// res, err := ksr.Scroll(ksr.Options.ScrollId(), nil) +// return ksr.afterFetch(res, err) +// } +// +// if ksr.Options.Size() > 0 { +// if ksr.Filters != nil && len(ksr.Filters.Sort) > 0 { +// source := ksr.Documents[len(ksr.Documents)-1].SourceToMap() +// +// filters := &SearchFilters{ +// Query: ksr.Filters.Query, +// Sort: ksr.Filters.Sort, +// Aggregations: ksr.Filters.Aggregations, +// } +// +// for _, sortRules := range ksr.Filters.Sort { +// switch t := sortRules.(type) { +// case string: +// filters.SearchAfter = append(filters.SearchAfter, source[t]) +// case map[string]interface{}: +// for field := range t { +// filters.SearchAfter = append(filters.SearchAfter, source[field]) +// } +// } +// } +// +// res, err := ksr.Collection.Search(filters, ksr.Options) +// return ksr.afterFetch(res, err) +// } else { +// opts := NewQueryOptions() +// opts.SetFrom(ksr.Options.From() + ksr.Options.Size()) +// +// if opts.From() >= ksr.Total { +// return nil, nil +// } +// +// opts.SetSize(ksr.Options.Size()) +// +// res, err := ksr.Collection.Search(ksr.Filters, opts) +// return ksr.afterFetch(res, err) +// } +// } +// +// return nil, NewError("SearchResult.FetchNext: Unable to retrieve results: missing scrollId or from/size parameters", 400) +//} +// +//func (ksr *SearchResult) afterFetch(nextResult *SearchResult, err error) (*SearchResult, error) { +// if err != nil { +// return nextResult, err +// } +// +// nextResult.Fetched = len(nextResult.Documents) + ksr.Fetched +// +// return nextResult, nil +//} From bcc077083389d79b89c3c997292b05d0ffb9b92f Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 12:45:15 +0100 Subject: [PATCH 033/363] Remove old specifications files --- collection/specifications.go | 71 ----- collection/specifications_test.go | 484 ------------------------------ 2 files changed, 555 deletions(-) delete mode 100644 collection/specifications.go delete mode 100644 collection/specifications_test.go diff --git a/collection/specifications.go b/collection/specifications.go deleted file mode 100644 index 8ce10072..00000000 --- a/collection/specifications.go +++ /dev/null @@ -1,71 +0,0 @@ -package collection - -// -//import ( -// "encoding/json" -// "fmt" -// "github.com/kuzzleio/sdk-go/types" -//) -// -//// ScrollSpecifications retrieves next result of a specification search with scroll query. -//func (dc *Collection) ScrollSpecifications(scrollId string, options types.QueryOptions) (*types.SpecificationSearchResult, error) { -// if scrollId == "" { -// return nil, types.NewError("Collection.ScrollSpecifications: scroll id required") -// } -// -// ch := make(chan *types.KuzzleResponse) -// -// query := &types.KuzzleRequest{ -// Controller: "collection", -// Action: "scrollSpecifications", -// ScrollId: scrollId, -// } -// -// if options != nil { -// scroll := options.Scroll() -// if scroll != "" { -// query.Scroll = scroll -// } -// } -// -// go dc.Kuzzle.Query(query, options, ch) -// -// res := <-ch -// -// if res.Error != nil { -// return nil, res.Error -// } -// -// specifications := &types.SpecificationSearchResult{} -// json.Unmarshal(res.Result, specifications) -// -// return specifications, nil -//} -// -//// DeleteSpecifications deletes the current specifications of this collection. -//func (dc *Collection) DeleteSpecifications(options types.QueryOptions) (bool, error) { -// ch := make(chan *types.KuzzleResponse) -// -// query := &types.KuzzleRequest{ -// Collection: dc.collection, -// Index: dc.index, -// Controller: "collection", -// Action: "deleteSpecifications", -// } -// go dc.Kuzzle.Query(query, options, ch) -// -// res := <-ch -// -// if res.Error != nil { -// return false, res.Error -// } -// -// ack := &struct { -// Acknowledged bool `json:"acknowledged"` -// }{} -// err := json.Unmarshal(res.Result, ack) -// if err != nil { -// return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) -// } -// return ack.Acknowledged, nil -//} diff --git a/collection/specifications_test.go b/collection/specifications_test.go deleted file mode 100644 index bd0a2efd..00000000 --- a/collection/specifications_test.go +++ /dev/null @@ -1,484 +0,0 @@ -package collection_test - -// -//import ( -// "encoding/json" -// "fmt" -// "github.com/kuzzleio/sdk-go/collection" -// "github.com/kuzzleio/sdk-go/internal" -// "github.com/kuzzleio/sdk-go/kuzzle" -// "github.com/kuzzleio/sdk-go/types" -// "github.com/stretchr/testify/assert" -// "testing" -//) -// -//func TestGetSpecificationsError(t *testing.T) { -// type Document struct { -// Title string -// } -// -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// _, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) -// assert.NotNil(t, err) -//} -// -//func TestGetSpecifications(t *testing.T) { -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// parsedQuery := &types.KuzzleRequest{} -// json.Unmarshal(query, parsedQuery) -// -// assert.Equal(t, "collection", parsedQuery.Controller) -// assert.Equal(t, "getSpecifications", parsedQuery.Action) -// assert.Equal(t, "index", parsedQuery.Index) -// assert.Equal(t, "collection", parsedQuery.Collection) -// -// validation := types.Specification{ -// Strict: false, -// Fields: types.SpecificationFields{ -// "foo": { -// Mandatory: false, -// Type: "bool", -// DefaultValue: "Boring value", -// }, -// }, -// } -// -// res := types.SpecificationEntry{ -// Index: parsedQuery.Index, -// Collection: parsedQuery.Collection, -// Validation: &validation, -// } -// r, _ := json.Marshal(res) -// return &types.KuzzleResponse{Result: r} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// res, _ := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) -// assert.Equal(t, "index", res.Index) -// assert.Equal(t, "collection", res.Collection) -// assert.Equal(t, false, res.Validation.Strict) -// assert.Equal(t, 1, len(res.Validation.Fields)) -// assert.Equal(t, false, res.Validation.Fields["foo"].Mandatory) -// assert.Equal(t, "bool", res.Validation.Fields["foo"].Type) -// assert.Equal(t, "Boring value", res.Validation.Fields["foo"].DefaultValue) -//} -// -//func ExampleCollection_GetSpecifications() { -// c := &internal.MockedConnection{} -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// res, err := collection.NewCollection(k, "collection", "index").GetSpecifications(nil) -// -// if err != nil { -// fmt.Println(err.Error()) -// return -// } -// -// fmt.Println(res.Index, res.Collection, res.Validation) -//} -// -//func TestSearchSpecificationsError(t *testing.T) { -// type Document struct { -// Title string -// } -// -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// _, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, nil) -// assert.NotNil(t, err) -//} -// -//func TestSearchSpecifications(t *testing.T) { -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// parsedQuery := &types.KuzzleRequest{} -// json.Unmarshal(query, parsedQuery) -// -// assert.Equal(t, "collection", parsedQuery.Controller) -// assert.Equal(t, "searchSpecifications", parsedQuery.Action) -// -// res := types.SpecificationSearchResult{ -// ScrollId: "f00b4r", -// Total: 1, -// Hits: make([]types.SpecificationSearchResultHit, 1), -// } -// res.Hits[0] = types.SpecificationSearchResultHit{ -// Source: types.SpecificationEntry{ -// Index: "index", -// Collection: "collection", -// Validation: &types.Specification{ -// Strict: false, -// Fields: types.SpecificationFields{ -// "foo": types.SpecificationField{ -// Mandatory: true, -// Type: "string", -// DefaultValue: "Value found with search", -// }, -// }, -// }, -// }, -// } -// -// r, _ := json.Marshal(res) -// return &types.KuzzleResponse{Result: r} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// opts := types.NewQueryOptions() -// opts.SetFrom(2) -// opts.SetSize(4) -// opts.SetScroll("1m") -// -// res, _ := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) -// assert.Equal(t, "f00b4r", res.ScrollId) -// assert.Equal(t, 1, res.Total) -// assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) -//} -// -//func ExampleCollection_SearchSpecifications() { -// c := &internal.MockedConnection{} -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// opts := types.NewQueryOptions() -// opts.SetFrom(2) -// opts.SetSize(4) -// opts.SetScroll("1m") -// -// res, err := collection.NewCollection(k, "collection", "index").SearchSpecifications(nil, opts) -// -// if err != nil { -// fmt.Println(err.Error()) -// return -// } -// -// fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) -//} -// -//func TestScrollSpecificationsEmptyScrollId(t *testing.T) { -// type Document struct { -// Title string -// } -// -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ScrollSpecifications: scroll id required"}} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("", nil) -// assert.NotNil(t, err) -//} -// -//func TestScrollSpecificationsError(t *testing.T) { -// type Document struct { -// Title string -// } -// -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// _, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", nil) -// assert.NotNil(t, err) -//} -// -//func TestScrollSpecifications(t *testing.T) { -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// parsedQuery := &types.KuzzleRequest{} -// json.Unmarshal(query, parsedQuery) -// -// assert.Equal(t, "collection", parsedQuery.Controller) -// assert.Equal(t, "scrollSpecifications", parsedQuery.Action) -// -// res := types.SpecificationSearchResult{ -// ScrollId: "f00b4r", -// Total: 1, -// Hits: make([]types.SpecificationSearchResultHit, 1), -// } -// res.Hits[0] = types.SpecificationSearchResultHit{ -// Source: types.SpecificationEntry{ -// Index: "index", -// Collection: "collection", -// Validation: &types.Specification{ -// Strict: false, -// Fields: types.SpecificationFields{ -// "foo": types.SpecificationField{ -// Mandatory: true, -// Type: "string", -// DefaultValue: "Value found with search", -// }, -// }, -// }, -// }, -// } -// r, _ := json.Marshal(res) -// return &types.KuzzleResponse{Result: r} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// opts := types.NewQueryOptions() -// opts.SetScroll("1m") -// -// res, _ := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) -// assert.Equal(t, "f00b4r", res.ScrollId) -// assert.Equal(t, 1, res.Total) -// assert.Equal(t, "Value found with search", res.Hits[0].Source.Validation.Fields["foo"].DefaultValue) -//} -// -//func ExampleCollection_ScrollSpecifications() { -// c := &internal.MockedConnection{} -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// opts := types.NewQueryOptions() -// opts.SetScroll("1m") -// -// res, err := collection.NewCollection(k, "collection", "index").ScrollSpecifications("f00b4r", opts) -// -// if err != nil { -// fmt.Println(err.Error()) -// return -// } -// -// fmt.Println(res.Hits[0].Source.Index, res.Hits[0].Source.Collection, res.Hits[0].Source.Validation) -//} -// -//func TestValidateSpecificationsError(t *testing.T) { -// type Document struct { -// Title string -// } -// -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// _, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&types.Specification{}, nil) -// assert.NotNil(t, err) -//} -// -//func TestValidateSpecifications(t *testing.T) { -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// parsedQuery := &types.KuzzleRequest{} -// json.Unmarshal(query, parsedQuery) -// -// assert.Equal(t, "collection", parsedQuery.Controller) -// assert.Equal(t, "validateSpecifications", parsedQuery.Action) -// assert.Equal(t, "index", parsedQuery.Index) -// assert.Equal(t, "collection", parsedQuery.Collection) -// -// res := types.ValidResponse{Valid: true} -// r, _ := json.Marshal(res) -// return &types.KuzzleResponse{Result: r} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// specifications := types.Specification{ -// Strict: false, -// Fields: types.SpecificationFields{ -// "foo": { -// Mandatory: true, -// Type: "string", -// DefaultValue: "Exciting value", -// }, -// }, -// } -// -// res, _ := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) -// assert.Equal(t, true, res.Valid) -//} -// -//func ExampleCollection_ValidateSpecifications() { -// c := &internal.MockedConnection{} -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// specifications := types.Specification{ -// Strict: false, -// Fields: types.SpecificationFields{ -// "foo": { -// Mandatory: true, -// Type: "string", -// DefaultValue: "Exciting value", -// }, -// }, -// } -// -// res, err := collection.NewCollection(k, "collection", "index").ValidateSpecifications(&specifications, nil) -// -// if err != nil { -// fmt.Println(err.Error()) -// return -// } -// -// fmt.Println(res.Valid) -//} -//func TestUpdateSpecificationsError(t *testing.T) { -// type Document struct { -// Title string -// } -// -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// _, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&types.Specification{}, nil) -// assert.NotNil(t, err) -//} -// -//func TestUpdateSpecifications(t *testing.T) { -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// type Specifications map[string]map[string]*types.Specification -// -// parsedQuery := &types.KuzzleRequest{} -// json.Unmarshal(query, parsedQuery) -// -// assert.Equal(t, "collection", parsedQuery.Controller) -// assert.Equal(t, "updateSpecifications", parsedQuery.Action) -// assert.Equal(t, "index", parsedQuery.Index) -// assert.Equal(t, "collection", parsedQuery.Collection) -// -// res := Specifications{ -// "index": { -// "collection": &types.Specification{ -// Strict: true, -// Fields: types.SpecificationFields{ -// "foo": { -// Mandatory: true, -// Type: "string", -// DefaultValue: "Exciting value", -// }, -// }, -// }, -// }, -// } -// r, _ := json.Marshal(res) -// return &types.KuzzleResponse{Result: r} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// specifications := types.Specification{ -// Strict: true, -// Fields: types.SpecificationFields{ -// "foo": { -// Mandatory: true, -// Type: "string", -// DefaultValue: "Exciting value", -// }, -// }, -// } -// -// specs, _ := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) -// -// fields := specs.Fields -// -// assert.Equal(t, true, specs.Strict) -// assert.Equal(t, 1, len(fields)) -// assert.Equal(t, true, fields["foo"].Mandatory) -// assert.Equal(t, "string", fields["foo"].Type) -// assert.Equal(t, "Exciting value", fields["foo"].DefaultValue) -//} -// -//func ExampleCollection_UpdateSpecifications() { -// c := &internal.MockedConnection{} -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// specifications := types.Specification{ -// Strict: true, -// Fields: types.SpecificationFields{ -// "foo": { -// Mandatory: true, -// Type: "string", -// DefaultValue: "Exciting value", -// }, -// }, -// } -// -// res, err := collection.NewCollection(k, "collection", "index").UpdateSpecifications(&specifications, nil) -// -// if err != nil { -// fmt.Println(err.Error()) -// return -// } -// -// fmt.Println(res.Strict, res.Fields) -//} -// -//func TestDeleteSpecificationsError(t *testing.T) { -// type Document struct { -// Title string -// } -// -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// _, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) -// assert.NotNil(t, err) -//} -// -//func TestDeleteSpecifications(t *testing.T) { -// c := &internal.MockedConnection{ -// MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { -// parsedQuery := &types.KuzzleRequest{} -// json.Unmarshal(query, parsedQuery) -// -// assert.Equal(t, "collection", parsedQuery.Controller) -// assert.Equal(t, "deleteSpecifications", parsedQuery.Action) -// assert.Equal(t, "index", parsedQuery.Index) -// assert.Equal(t, "collection", parsedQuery.Collection) -// -// return &types.KuzzleResponse{Result: []byte(`{ -// "acknowledged": true -// }`)} -// }, -// } -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// res, _ := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) -// assert.Equal(t, true, res) -//} -// -//func ExampleCollection_DeleteSpecifications() { -// c := &internal.MockedConnection{} -// k, _ := kuzzle.NewKuzzle(c, nil) -// -// res, err := collection.NewCollection(k, "collection", "index").DeleteSpecifications(nil) -// -// if err != nil { -// fmt.Println(err.Error()) -// return -// } -// -// fmt.Printf("%#v\n", res) -//} From 706534cd980a0156bcdfee3ed7ab9d5937a26bf9 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 13:39:57 +0100 Subject: [PATCH 034/363] Add missing functions --- document/create_document.go | 50 + document/create_document_test.go | 128 + document/delete_document.go | 35 + document/delete_document_test.go | 82 + document/document.go | 276 + document/document_exists.go | 34 + document/document_exists_test.go | 80 + document/document_test.go | 466 + document/fetch_document.go | 35 + document/fetch_document_test.go | 80 + document/replace_document.go | 36 + document/replace_document_test.go | 89 + document/update_document.go | 36 + document/update_document_test.go | 94 + index/getAutoRefresh.go | 39 + index/getAutoRefresh_test.go | 71 + index/list.go | 25 + index/list_test.go | 73 + internal/wrappers/cgo/kuzzle/index.go | 12 + internal/wrappers/cpp/index.cpp | 32 +- internal/wrappers/headers/index.hpp | 2 + internal/wrappers/kcore_wrap.cxx | 32062 ++++++++++++++++++++++++ internal/wrappers/kcore_wrap.h | 60 + 23 files changed, 33890 insertions(+), 7 deletions(-) create mode 100644 document/create_document.go create mode 100644 document/create_document_test.go create mode 100644 document/delete_document.go create mode 100644 document/delete_document_test.go create mode 100644 document/document.go create mode 100644 document/document_exists.go create mode 100644 document/document_exists_test.go create mode 100644 document/document_test.go create mode 100644 document/fetch_document.go create mode 100644 document/fetch_document_test.go create mode 100644 document/replace_document.go create mode 100644 document/replace_document_test.go create mode 100644 document/update_document.go create mode 100644 document/update_document_test.go create mode 100644 index/getAutoRefresh.go create mode 100644 index/getAutoRefresh_test.go create mode 100644 index/list.go create mode 100644 index/list_test.go create mode 100644 internal/wrappers/kcore_wrap.cxx create mode 100644 internal/wrappers/kcore_wrap.h diff --git a/document/create_document.go b/document/create_document.go new file mode 100644 index 00000000..cfb29125 --- /dev/null +++ b/document/create_document.go @@ -0,0 +1,50 @@ +package collection + +import ( + "encoding/json" + "fmt" + "github.com/kuzzleio/sdk-go/types" +) + +// Create a new document in Kuzzle. +// Takes an optional argument object with the following properties: +// - volatile (object, default: null): +// Additional information passed to notifications to other users +// - ifExist (string, allowed values: "error" (default), "replace"): +// If the same document already exists: +// - resolves with an error if set to "error". +// - replaces the existing document if set to "replace" +func (dc *Collection) CreateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { + ch := make(chan *types.KuzzleResponse) + + action := "create" + + if options != nil { + if options.IfExist() == "replace" { + action = "createOrReplace" + } else if options.IfExist() != "error" { + return nil, types.NewError(fmt.Sprintf("Invalid value for the 'ifExist' option: '%s'", options.IfExist()), 400) + } + } + + query := &types.KuzzleRequest{ + Collection: dc.collection, + Index: dc.index, + Controller: "document", + Action: action, + Body: document.Content, + Id: id, + } + go dc.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + documentResponse := &Document{collection: dc} + json.Unmarshal(res.Result, documentResponse) + + return documentResponse, nil +} diff --git a/document/create_document_test.go b/document/create_document_test.go new file mode 100644 index 00000000..00a9a52b --- /dev/null +++ b/document/create_document_test.go @@ -0,0 +1,128 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestCreateDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestCreateDocumentWrongOptionError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + newCollection := collection.NewCollection(k, "collection", "index") + opts := types.NewQueryOptions() + opts.SetIfExist("unknown") + + _, err := newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, opts) + assert.Equal(t, "[400] Invalid value for the 'ifExist' option: 'unknown'", fmt.Sprint(err)) +} + +func TestCreateDocument(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "create", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + body := make(map[string]interface{}, 0) + body["title"] = "yolo" + + assert.Equal(t, body, parsedQuery.Body) + + res := collection.Document{Id: id, Content: []byte(`{"title":"yolo"}`)} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) + assert.Equal(t, id, res.Id) +} + +func TestCreateDocumentReplace(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "createOrReplace", parsedQuery.Action) + + res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + newCollection := collection.NewCollection(k, "collection", "index") + opts := types.NewQueryOptions() + opts.SetIfExist("replace") + newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) +} + +func TestCreateDocumentCreate(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "create", parsedQuery.Action) + + res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + newCollection := collection.NewCollection(k, "collection", "index") + opts := types.NewQueryOptions() + opts.SetIfExist("error") + + newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) +} + +func ExampleCollection_CreateDocument() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + id := "myId" + + res, err := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res.Id, res.Content) +} diff --git a/document/delete_document.go b/document/delete_document.go new file mode 100644 index 00000000..198db81d --- /dev/null +++ b/document/delete_document.go @@ -0,0 +1,35 @@ +package collection + +import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" +) + +// DeleteDocument deletes the Document using its provided unique id. +func (dc *Collection) DeleteDocument(id string, options types.QueryOptions) (string, error) { + if id == "" { + return "", types.NewError("Collection.DeleteDocument: document id required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: dc.collection, + Index: dc.index, + Controller: "document", + Action: "delete", + Id: id, + } + go dc.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + document := &Document{collection: dc} + json.Unmarshal(res.Result, document) + + return document.Id, nil +} diff --git a/document/delete_document_test.go b/document/delete_document_test.go new file mode 100644 index 00000000..3fbb904f --- /dev/null +++ b/document/delete_document_test.go @@ -0,0 +1,82 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestDeleteDocumentEmptyId(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("should have stopped before receiving a response")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("", nil) + assert.NotNil(t, err) + assert.Equal(t, "Collection.DeleteDocument: document id required", err.(*types.KuzzleError).Message) +} + +func TestDeleteDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("myId", nil) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestDeleteDocument(t *testing.T) { + type Document struct { + Title string + } + + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "delete", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + res := collection.Document{Id: id} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) + assert.Equal(t, id, res) +} + +func ExampleCollection_DeleteDocument() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + id := "myId" + + res, err := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/document/document.go b/document/document.go new file mode 100644 index 00000000..38e7e174 --- /dev/null +++ b/document/document.go @@ -0,0 +1,276 @@ +package collection + +import ( + "encoding/json" + "strconv" + + "github.com/kuzzleio/sdk-go/types" +) + +type IDocument interface { + Save() + Refresh() + SetContent() + Publish() + Exists() + Delete() +} + +type Document struct { + Id string `json:"_id"` + Index string `json:"_index"` + Meta *types.Meta `json:"_meta"` + Shards *types.Shards `json:"_shards"` + Content json.RawMessage `json:"_source"` + Version int `json:"_version"` + Result string `json:"result"` + Created bool `json:"created"` + Collection string `json:"_collection"` + collection *Collection `json:"-"` +} + +type DocumentContent map[string]interface{} + +/* + * Instanciate a new document + */ +func NewDocument(col *Collection, id string) *Document { + return &Document{ + collection: col, + Id: id, + Collection: col.collection, + Index: col.index, + } +} + +func (documentContent *DocumentContent) ToString() string { + s, _ := json.Marshal(documentContent) + + return string(s) +} + +func (d *Document) SourceToMap() DocumentContent { + sourceMap := DocumentContent{} + + json.Unmarshal(d.Content, &sourceMap) + + return sourceMap +} + +// Subscribe listens to events concerning this document. Has no effect if the document does not have an ID +// (i.e. if the document has not yet been created as a persisted document). +func (d *Document) Subscribe(options types.RoomOptions, ch chan<- types.KuzzleNotification) (*Room, error) { + if d.Id == "" { + return nil, types.NewError("Document.Subscribe: cannot subscribe to a document if no ID has been provided", 400) + } + + filters := map[string]map[string][]string{ + "ids": { + "values": []string{d.Id}, + }, + } + + return d.collection.Subscribe(filters, options, ch), nil +} + +/* + Saves the document into Kuzzle. + + If this is a new document, will create it in Kuzzle and the id property will be made available. + Otherwise, will replace the latest version of the document in Kuzzle by the current content of this object. +*/ +func (d *Document) Save(options types.QueryOptions) (*Document, error) { + if d.Id == "" { + return d, types.NewError("Document.Save: missing document id", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: d.collection.index, + Collection: d.collection.collection, + Controller: "document", + Action: "createOrReplace", + Id: d.Id, + Body: d.Content, + } + + go d.collection.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return d, res.Error + } + + return d, nil +} + +/* + Replaces the document with the latest version stored in Kuzzle. +*/ +func (d *Document) Refresh(options types.QueryOptions) (*Document, error) { + if d.Id == "" { + return d, types.NewError("Document.Refresh: missing document id", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: d.collection.index, + Collection: d.collection.collection, + Controller: "document", + Action: "get", + Id: d.Id, + } + + go d.collection.Kuzzle.Query(query, options, ch) + + res := <-ch + if res.Error != nil { + return d, res.Error + } + + json.Unmarshal(res.Result, d) + + return d, nil +} + +/* + Sets the document id. +*/ +func (d *Document) SetDocumentId(id string) *Document { + if id != "" { + d.Id = id + } + + return d +} + +/* + Replaces the current document content with provided data. + Changes made by this function won’t be applied until the save method is called. + If replace is set to true, the entire content will be replaced, otherwise, only existing and new fields will be impacted. +*/ +func (d *Document) SetContent(content DocumentContent, replace bool) *Document { + if replace { + d.Content, _ = json.Marshal(content) + } else { + source := DocumentContent{} + json.Unmarshal(d.Content, &source) + + for attr, value := range content { + if source[attr] == nil { + source[attr] = value + } + } + + d.Content, _ = json.Marshal(source) + } + + return d +} + +/* + Sends the content of the document as a realtime message. +*/ +func (d *Document) Publish(options types.QueryOptions) (bool, error) { + ch := make(chan *types.KuzzleResponse) + + type message struct { + Id string `json:"_id,omitempty"` + Version int `json:"_version,omitempty"` + Body json.RawMessage `json:"body"` + Meta *types.Meta `json:"meta"` + } + + query := &types.KuzzleRequest{ + Index: d.collection.index, + Collection: d.collection.collection, + Controller: "realtime", + Action: "publish", + Body: message{ + Id: d.Id, + Version: d.Version, + Body: d.Content, + Meta: d.Meta, + }, + } + + go d.collection.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return false, res.Error + } + + response := types.RealtimeResponse{} + + json.Unmarshal(res.Result, &response) + + return response.Published, nil +} + +/* + Checks if the document exists in Kuzzle. +*/ +func (d *Document) Exists(options types.QueryOptions) (bool, error) { + if d.Id == "" { + return false, types.NewError("Document.Exists: missing document id", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: d.collection.index, + Collection: d.collection.collection, + Controller: "document", + Action: "exists", + Id: d.Id, + } + + go d.collection.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return false, res.Error + } + + exists, _ := strconv.ParseBool(string(res.Result)) + + return exists, nil +} + +/* + Deletes the document in Kuzzle. +*/ +func (d *Document) Delete(options types.QueryOptions) (string, error) { + if d.Id == "" { + return "", types.NewError("Document.Delete: missing document id", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: d.collection.index, + Collection: d.collection.collection, + Controller: "document", + Action: "delete", + Id: d.Id, + } + + go d.collection.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + document := Document{collection: d.collection} + json.Unmarshal(res.Result, &document) + + return document.Id, nil +} diff --git a/document/document_exists.go b/document/document_exists.go new file mode 100644 index 00000000..27c8e204 --- /dev/null +++ b/document/document_exists.go @@ -0,0 +1,34 @@ +package collection + +import ( + "github.com/kuzzleio/sdk-go/types" + "strconv" +) + +// DocumentExists returns a boolean indicating whether or not a document with provided ID exists. +func (dc *Collection) DocumentExists(id string, options types.QueryOptions) (bool, error) { + if id == "" { + return false, types.NewError("Collection.DocumentExists: document id required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: dc.collection, + Index: dc.index, + Controller: "document", + Action: "exists", + Id: id, + } + go dc.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return false, res.Error + } + + exists, _ := strconv.ParseBool(string(res.Result)) + + return exists, nil +} diff --git a/document/document_exists_test.go b/document/document_exists_test.go new file mode 100644 index 00000000..b41a98da --- /dev/null +++ b/document/document_exists_test.go @@ -0,0 +1,80 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "github.com/kuzzleio/sdk-go/collection" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestDocumentExistsEmptyId(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.DocumentExists: document id required"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").DocumentExists("", nil) + assert.NotNil(t, err) +} + +func TestDocumentExistsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").DocumentExists("myId", nil) + assert.NotNil(t, err) +} + +func TestDocumentExists(t *testing.T) { + type Document struct { + Title string + } + + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "exists", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + r, _ := json.Marshal(true) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) + assert.Equal(t, true, res) +} + +func ExampleCollection_DocumentExists() { + id := "myId" + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/document/document_test.go b/document/document_test.go new file mode 100644 index 00000000..760845fc --- /dev/null +++ b/document/document_test.go @@ -0,0 +1,466 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/state" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestDocumentSetContent(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + dc := collection.NewCollection(k, "collection", "index") + + d := dc.Document() + d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) + + assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) + + d = d.SetContent(collection.DocumentContent{ + "subfield": collection.DocumentContent{ + "john": "cena", + }, + }, false) + + assert.Equal(t, string(json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`))), string(d.Content)) +} + +func ExampleDocument_SetContent() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + + d := dc.Document() + + d = d.SetContent(collection.DocumentContent{ + "subfield": collection.DocumentContent{ + "john": "cena", + }, + }, false) + + fmt.Println(d.Content) +} + +func TestDocumentSetContentReplace(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + dc := collection.NewCollection(k, "collection", "index") + + d := dc.Document() + d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) + + assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) + + d = d.SetContent(collection.DocumentContent{ + "subfield": collection.DocumentContent{ + "john": "cena", + "subsubfield": collection.DocumentContent{ + "hi": "there", + }, + }, + }, true) + + assert.Equal(t, string(json.RawMessage([]byte(`{"subfield":{"john":"cena","subsubfield":{"hi":"there"}}}`))), string(d.Content)) +} + +func TestDocumentSubscribeEmptyId(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + dc := collection.NewCollection(k, "collection", "index") + cd := dc.Document() + + ch := make(chan types.KuzzleNotification) + _, err := cd.Subscribe(types.NewRoomOptions(), ch) + + assert.Equal(t, "[400] Document.Subscribe: cannot subscribe to a document if no ID has been provided", err.Error()) +} + +func TestDocumentSubscribe(t *testing.T) { + id := "docId" + var k *kuzzle.Kuzzle + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + // Fetch query + if parsedQuery.Controller == "document" { + assert.Equal(t, "get", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} + r, _ := json.Marshal(res) + + return &types.KuzzleResponse{Result: r} + } + + // Subscribe query + assert.Equal(t, "realtime", parsedQuery.Controller) + assert.Equal(t, "subscribe", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, map[string]interface{}(map[string]interface{}{"ids": map[string]interface{}{"values": []interface{}{"docId"}}}), parsedQuery.Body) + roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) + return &types.KuzzleResponse{Result: roomRaw} + }, + } + k, _ = kuzzle.NewKuzzle(c, nil) + c.SetState(state.Connected) + dc := collection.NewCollection(k, "collection", "index") + d := dc.Document() + d.Id = id + + ch := make(chan types.KuzzleNotification) + room, _ := d.Subscribe(types.NewRoomOptions(), ch) + r := <-room.ResponseChannel() + + assert.Nil(t, r.Error) + assert.NotNil(t, r.Room) + assert.Equal(t, "42", r.Room.RoomId()) +} + +func ExampleDocument_Subscribe() { + id := "docId" + var k *kuzzle.Kuzzle + + c := &internal.MockedConnection{} + k, _ = kuzzle.NewKuzzle(c, nil) + c.SetState(state.Connected) + dc := collection.NewCollection(k, "collection", "index") + d := dc.Document() + d.Id = id + + ch := make(chan types.KuzzleNotification) + room, _ := d.Subscribe(types.NewRoomOptions(), ch) + + notification := <-room.ResponseChannel() + + fmt.Println(notification.Room.RoomId(), notification.Error) +} + +func TestDocumentSaveEmptyId(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + dc := collection.NewCollection(k, "collection", "index") + _, err := dc.Document().Save(nil) + + assert.NotNil(t, err) + assert.Equal(t, "[400] Document.Save: missing document id", fmt.Sprint(err)) +} + +func TestDocumentSaveError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + _, err := dc.Document().SetDocumentId("myId").Save(nil) + + assert.NotNil(t, err) +} + +func TestDocumentSave(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "createOrReplace", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + + documentContent := collection.DocumentContent{"foo": "bar"} + + d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) + + assert.Equal(t, id, d.Id) + assert.Equal(t, documentContent.ToString(), string(d.Content)) +} + +func ExampleDocument_Save() { + id := "myId" + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + + documentContent := collection.DocumentContent{"foo": "bar"} + + res, err := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res.Id, res.Collection) +} + +func TestDocumentRefreshEmptyId(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + dc := collection.NewCollection(k, "collection", "index") + _, err := dc.Document().Refresh(nil) + + assert.NotNil(t, err) + assert.Equal(t, "[400] Document.Refresh: missing document id", fmt.Sprint(err)) +} + +func TestDocumentRefreshError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + _, err := dc.Document().SetDocumentId("myId").Refresh(nil) + + assert.NotNil(t, err) +} + +func TestDocumentRefresh(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "get", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + res := collection.Document{Id: id, Content: []byte(`{"name":"Anakin","function":"Jedi"}`)} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + + documentContent := collection.DocumentContent{ + "name": "Anakin", + "function": "Padawan", + } + + d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Refresh(nil) + + result := collection.Document{} + json.Unmarshal(d.Content, &result.Content) + + ic := collection.DocumentContent{} + json.Unmarshal(result.Content, &ic) + + assert.Equal(t, id, d.Id) + assert.Equal(t, "Padawan", documentContent["function"]) + assert.Equal(t, "Jedi", ic["function"]) + assert.NotEqual(t, documentContent["function"], ic["function"]) +} + +func ExampleDocument_Refresh() { + id := "myId" + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + res, err := dc.Document().SetDocumentId(id).Refresh(nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res.Id, res.Collection) +} + +func TestCollectionDocumentExistsEmptyId(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + dc := collection.NewCollection(k, "collection", "index") + _, err := dc.Document().Exists(nil) + + assert.NotNil(t, err) + assert.Equal(t, "[400] Document.Exists: missing document id", fmt.Sprint(err)) +} + +func TestCollectionDocumentExistsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + _, err := dc.Document().SetDocumentId("myId").Exists(nil) + + assert.NotNil(t, err) +} + +func TestCollectionDocumentExists(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "exists", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + r, _ := json.Marshal(true) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + exists, _ := dc.Document().SetDocumentId(id).Exists(nil) + + assert.Equal(t, true, exists) +} + +func ExampleDocument_Exists() { + id := "myId" + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + res, err := dc.Document().SetDocumentId(id).Exists(nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} + +func TestDocumentPublishError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "realtime", "publish") + _, err := dc.Document().SetDocumentId("myId").Publish(nil) + + assert.NotNil(t, err) +} + +func TestDocumentPublish(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "realtime", parsedQuery.Controller) + assert.Equal(t, "publish", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + r, _ := json.Marshal(types.RealtimeResponse{Published: true}) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + res, _ := dc.Document().SetDocumentId("myId").Publish(nil) + + assert.Equal(t, true, res) +} + +func ExampleDocument_Publish() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + res, err := dc.Document().SetDocumentId("myId").Publish(nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} + +func TestDocumentDeleteEmptyId(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + dc := collection.NewCollection(k, "collection", "index") + _, err := dc.Document().Delete(nil) + + assert.NotNil(t, err) + assert.Equal(t, "[400] Document.Delete: missing document id", fmt.Sprint(err)) +} + +func TestDocumentDeleteError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + _, err := dc.Document().SetDocumentId("myId").Delete(nil) + + assert.NotNil(t, err) +} + +func TestDocumentDelete(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "delete", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + r, _ := json.Marshal(collection.Document{Id: id}) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + res, _ := dc.Document().SetDocumentId("myId").Delete(nil) + + assert.Equal(t, id, res) +} + +func ExampleDocument_Delete() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + dc := collection.NewCollection(k, "collection", "index") + res, err := dc.Document().SetDocumentId("myId").Delete(nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/document/fetch_document.go b/document/fetch_document.go new file mode 100644 index 00000000..7f4fa8f7 --- /dev/null +++ b/document/fetch_document.go @@ -0,0 +1,35 @@ +package collection + +import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" +) + +// FetchDocument retrieves a Document using its provided unique id. +func (dc *Collection) FetchDocument(id string, options types.QueryOptions) (*Document, error) { + if id == "" { + return nil, types.NewError("Collection.FetchDocument: document id required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: dc.collection, + Index: dc.index, + Controller: "document", + Action: "get", + Id: id, + } + go dc.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + document := &Document{collection: dc} + json.Unmarshal(res.Result, document) + + return document, nil +} diff --git a/document/fetch_document_test.go b/document/fetch_document_test.go new file mode 100644 index 00000000..73d71c51 --- /dev/null +++ b/document/fetch_document_test.go @@ -0,0 +1,80 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestFetchDocumentEmptyId(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.FetchDocument: document id required"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").FetchDocument("", nil) + assert.NotNil(t, err) +} + +func TestFetchDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").FetchDocument("myId", nil) + assert.NotNil(t, err) +} + +func TestFetchDocument(t *testing.T) { + type Document struct { + Title string + } + + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "get", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + res := collection.Document{Id: id, Content: []byte(`{"foo": "bar"}`)} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) + assert.Equal(t, id, res.Id) +} + +func ExampleCollection_FetchDocument() { + id := "myId" + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res.Id, res.Collection) +} diff --git a/document/replace_document.go b/document/replace_document.go new file mode 100644 index 00000000..223a8848 --- /dev/null +++ b/document/replace_document.go @@ -0,0 +1,36 @@ +package collection + +import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" +) + +// ReplaceDocument replaces a document in Kuzzle. +func (dc *Collection) ReplaceDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { + if id == "" { + return nil, types.NewError("Collection.ReplaceDocument: document id required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: dc.collection, + Index: dc.index, + Controller: "document", + Action: "replace", + Body: document.Content, + Id: id, + } + go dc.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + d := &Document{collection: dc} + json.Unmarshal(res.Result, d) + + return d, nil +} diff --git a/document/replace_document_test.go b/document/replace_document_test.go new file mode 100644 index 00000000..e221bef6 --- /dev/null +++ b/document/replace_document_test.go @@ -0,0 +1,89 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "github.com/kuzzleio/sdk-go/collection" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestReplaceDocumentEmptyId(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ReplaceDocument: document id required"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) + assert.NotNil(t, err) +} + +func TestReplaceDocumentError(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) + assert.NotNil(t, err) +} + +func TestReplaceDocument(t *testing.T) { + type Document struct { + Title string + } + + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "replace", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) + + res := collection.Document{Id: id, Content: []byte(`{"title": "jonathan"}`)} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) + assert.Equal(t, id, res.Id) +} + +func ExampleCollection_ReplaceDocument() { + type Document struct { + Title string + } + + id := "myId" + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res.Id, res.Collection) +} diff --git a/document/update_document.go b/document/update_document.go new file mode 100644 index 00000000..2fdc057e --- /dev/null +++ b/document/update_document.go @@ -0,0 +1,36 @@ +package collection + +import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" +) + +// UpdateDocument updates a document in Kuzzle. +func (dc *Collection) UpdateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { + if id == "" { + return nil, types.NewError("Collection.UpdateDocument: document id required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: dc.collection, + Index: dc.index, + Controller: "document", + Action: "update", + Body: document.Content, + Id: id, + } + go dc.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + documentResponse := &Document{collection: dc} + json.Unmarshal(res.Result, documentResponse) + + return documentResponse, nil +} diff --git a/document/update_document_test.go b/document/update_document_test.go new file mode 100644 index 00000000..5a2be52b --- /dev/null +++ b/document/update_document_test.go @@ -0,0 +1,94 @@ +package collection_test + +import ( + "encoding/json" + "fmt" + "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestUpdateDocumentEmptyId(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.UpdateDocument: document id required"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) + assert.NotNil(t, err) +} + +func TestUpdateDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) + assert.NotNil(t, err) +} + +func TestUpdateDocument(t *testing.T) { + id := "myId" + + type Content struct { + Title string `json:"title"` + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "update", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, 10, options.RetryOnConflict()) + assert.Equal(t, id, parsedQuery.Id) + + assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) + + res := collection.Document{Id: id, Content: []byte(`{"title": "arthur"}`)} + r, _ := json.Marshal(res) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + qo := types.NewQueryOptions() + qo.SetRetryOnConflict(10) + + res, _ := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) + + assert.Equal(t, id, res.Id) + + var result Content + + json.Unmarshal(res.Content, &result) + + assert.Equal(t, result.Title, "arthur") +} + +func ExampleCollection_UpdateDocument() { + id := "myId" + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + qo := types.NewQueryOptions() + qo.SetRetryOnConflict(10) + + res, err := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res.Id, res.Content) +} diff --git a/index/getAutoRefresh.go b/index/getAutoRefresh.go new file mode 100644 index 00000000..f7121c9d --- /dev/null +++ b/index/getAutoRefresh.go @@ -0,0 +1,39 @@ +package index + +import ( + "encoding/json" + "fmt" + + "github.com/kuzzleio/sdk-go/types" +) + +func (i *Index) GetAutoRefresh(index string) (bool, error) { + if index == "" { + return false, types.NewError("Index.GetAutoRefresh: index required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Controller: "index", + Action: "getAutoRefresh", + } + + go i.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return false, res.Error + } + + var autoR bool + + err := json.Unmarshal(res.Result, &autoR) + if err != nil { + return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + } + return autoR, nil + +} diff --git a/index/getAutoRefresh_test.go b/index/getAutoRefresh_test.go new file mode 100644 index 00000000..00ffdc37 --- /dev/null +++ b/index/getAutoRefresh_test.go @@ -0,0 +1,71 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetAutoRefreshNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + i := index.NewIndex(k) + _, err := i.GetAutoRefresh("") + assert.NotNil(t, err) +} + +func TestGetAutoRefreshQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + _, err := i.GetAutoRefresh("index") + assert.NotNil(t, err) +} + +func TestGetAutoRefresh(t *testing.T) { + type ackResult struct { + Acknowledged bool + ShardsAcknowledged bool + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + q := &types.KuzzleRequest{} + json.Unmarshal(query, q) + + assert.Equal(t, "index", q.Controller) + assert.Equal(t, "getAutoRefresh", q.Action) + assert.Equal(t, "index", q.Index) + + return &types.KuzzleResponse{Result: []byte(`true`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + i := index.NewIndex(k) + _, err := i.GetAutoRefresh("index") + + assert.Nil(t, err) +} + +func ExampleIndex_GetAutoRefresh() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + i := index.NewIndex(k) + i.Create("index") + _, err := i.GetAutoRefresh("index") + if err != nil { + fmt.Println(err.Error()) + return + } +} diff --git a/index/list.go b/index/list.go new file mode 100644 index 00000000..93d4e0e2 --- /dev/null +++ b/index/list.go @@ -0,0 +1,25 @@ +package index + +import "github.com/kuzzleio/sdk-go/types" + +func (i *Index) List() (string, error) { + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "index", + Action: "list", + } + + go i.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return "", res.Error + } + + var collectionList string + collectionList = string(res.Result) + + return collectionList, nil +} diff --git a/index/list_test.go b/index/list_test.go new file mode 100644 index 00000000..205f5276 --- /dev/null +++ b/index/list_test.go @@ -0,0 +1,73 @@ +package index_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestListError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + i := index.NewIndex(k) + _, err := i.List() + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestList(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "index", parsedQuery.Controller) + assert.Equal(t, "list", parsedQuery.Action) + + res := types.KuzzleResponse{Result: []byte(` + { + "total": 2, + "hits": [ + "index_1", + "index_2" + ] + }`), + } + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + i := index.NewIndex(k) + res, err := i.List() + assert.Nil(t, err) + assert.NotNil(t, res) +} + +func ExampleIndex_List() { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + + i := index.NewIndex(k) + res, err := i.List() + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index 7a2647ef..896e12c1 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -86,3 +86,15 @@ func kuzzle_index_set_auto_refresh(i *C.kuzzle_index, index *C.char, autoRefresh err := (*indexPkg.Index)(i.instance).SetAutoRefresh(C.GoString(index), bool(autoRefresh)) return goToCVoidResult(err) } + +//export kuzzle_index_get_auto_refresh +func kuzzle_index_get_auto_refresh(i *C.kuzzle_index, index *C.char) *C.bool_result { + res, err := (*indexPkg.Index)(i.instance).GetAutoRefresh(C.GoString(index)) + return goToCBoolResult(res, err) +} + +//export kuzzle_index_list +func kuzzle_index_list(i *C.kuzzle_index) *C.string_result { + res, err := (*indexPkg.Index)(i.instance).List() + return goToCStringResult(&res, err) +} diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index aafc7dc5..c3808a98 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -18,14 +18,14 @@ namespace kuzzleio { void_result *r = kuzzle_index_create(_index, const_cast(index.c_str())); if (r->error != NULL) throwExceptionFromStatus(r); - delete(r); + kuzzle_free_void_result(r); } void Index::delete_(const std::string& index) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_delete(_index, const_cast(index.c_str())); if (r->error != NULL) throwExceptionFromStatus(r); - delete(r); + kuzzle_free_void_result(r); } std::vector Index::mDelete(const std::vector& indexes) Kuz_Throw_KuzzleException { @@ -45,7 +45,7 @@ namespace kuzzleio { for (int i = 0; i < r->result_length; i++) v.push_back(r->result[i]); - delete(r); + kuzzle_free_string_array_result(r); return v; } @@ -54,7 +54,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; - delete(r); + kuzzle_free_bool_result(r); return ret; } @@ -62,20 +62,38 @@ namespace kuzzleio { void_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str())); if (r->error != NULL) throwExceptionFromStatus(r); - delete(r); + kuzzle_free_void_result(r); } void Index::refreshInternal() Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_refresh_internal(_index); if (r->error != NULL) throwExceptionFromStatus(r); - delete(r); + kuzzle_free_void_result(r); } void Index::setAutoRefresh(const std::string& index, bool autoRefresh) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh); if (r->error != NULL) throwExceptionFromStatus(r); - delete(r); + kuzzle_free_void_result(r); + } + + bool Index::getAutoRefresh(const std::string& index) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_index_get_auto_refresh(_index, const_cast(index.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + bool ret = r->result; + kuzzle_free_bool_result(r); + return ret; + } + + std::string Index::list() Kuz_Throw_KuzzleException { + string_result *r = kuzzle_index_list(_index); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; } } diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp index 8479f430..0f559884 100644 --- a/internal/wrappers/headers/index.hpp +++ b/internal/wrappers/headers/index.hpp @@ -19,6 +19,8 @@ namespace kuzzleio { void refresh(const std::string& index) Kuz_Throw_KuzzleException; void refreshInternal() Kuz_Throw_KuzzleException; void setAutoRefresh(const std::string& index, bool autoRefresh) Kuz_Throw_KuzzleException; + bool getAutoRefresh(const std::string& index) Kuz_Throw_KuzzleException; + std::string list() Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/kcore_wrap.cxx b/internal/wrappers/kcore_wrap.cxx new file mode 100644 index 00000000..440c63c6 --- /dev/null +++ b/internal/wrappers/kcore_wrap.cxx @@ -0,0 +1,32062 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.12 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifndef SWIGJAVA +#define SWIGJAVA +#endif + +#define SWIG_DIRECTORS + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); + SwigValueWrapper(const SwigValueWrapper& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + + +/* Fix for jlong on some versions of gcc on Windows */ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) + typedef long long __int64; +#endif + +/* Fix for jlong on 64-bit x86 Solaris */ +#if defined(__x86_64) +# ifdef _LP64 +# undef _LP64 +# endif +#endif + +#include +#include +#include + + +/* Support for throwing Java exceptions */ +typedef enum { + SWIG_JavaOutOfMemoryError = 1, + SWIG_JavaIOException, + SWIG_JavaRuntimeException, + SWIG_JavaIndexOutOfBoundsException, + SWIG_JavaArithmeticException, + SWIG_JavaIllegalArgumentException, + SWIG_JavaNullPointerException, + SWIG_JavaDirectorPureVirtual, + SWIG_JavaUnknownError +} SWIG_JavaExceptionCodes; + +typedef struct { + SWIG_JavaExceptionCodes code; + const char *java_exception; +} SWIG_JavaExceptions_t; + + +static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { + jclass excep; + static const SWIG_JavaExceptions_t java_exceptions[] = { + { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, + { SWIG_JavaIOException, "java/io/IOException" }, + { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, + { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, + { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, + { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, + { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, + { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, + { SWIG_JavaUnknownError, "java/lang/UnknownError" }, + { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } + }; + const SWIG_JavaExceptions_t *except_ptr = java_exceptions; + + while (except_ptr->code != code && except_ptr->code) + except_ptr++; + + jenv->ExceptionClear(); + excep = jenv->FindClass(except_ptr->java_exception); + if (excep) + jenv->ThrowNew(excep, msg); +} + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else + +/* ----------------------------------------------------------------------------- + * director_common.swg + * + * This file contains support for director classes which is common between + * languages. + * ----------------------------------------------------------------------------- */ + +/* + Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the + 'Swig' namespace. This could be useful for multi-modules projects. +*/ +#ifdef SWIG_DIRECTOR_STATIC +/* Force anonymous (static) namespace */ +#define Swig +#endif +/* ----------------------------------------------------------------------------- + * director.swg + * + * This file contains support for director classes so that Java proxy + * methods can be called from C++. + * ----------------------------------------------------------------------------- */ + +#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) +#include +#endif + +#include + +namespace Swig { + + /* Java object wrapper */ + class JObjectWrapper { + public: + JObjectWrapper() : jthis_(NULL), weak_global_(true) { + } + + ~JObjectWrapper() { + jthis_ = NULL; + weak_global_ = true; + } + + bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) { + if (!jthis_) { + weak_global_ = weak_global || !mem_own; // hold as weak global if explicitly requested or not owned + if (jobj) + jthis_ = weak_global_ ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj); +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl; +#endif + return true; + } else { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl; +#endif + return false; + } + } + + jobject get(JNIEnv *jenv) const { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::get("; + if (jthis_) + std::cout << jthis_; + else + std::cout << "null"; + std::cout << ") -> return new local ref" << std::endl; +#endif + return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_); + } + + void release(JNIEnv *jenv) { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl; +#endif + if (jthis_) { + if (weak_global_) { + if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) + jenv->DeleteWeakGlobalRef((jweak)jthis_); + } else + jenv->DeleteGlobalRef(jthis_); + } + + jthis_ = NULL; + weak_global_ = true; + } + + /* Only call peek if you know what you are doing wrt to weak/global references */ + jobject peek() { + return jthis_; + } + + /* Java proxy releases ownership of C++ object, C++ object is now + responsible for destruction (creates NewGlobalRef to pin Java proxy) */ + void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { + if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */ + if (!weak_global_) { + jenv->DeleteGlobalRef(jthis_); + jthis_ = jenv->NewWeakGlobalRef(jself); + weak_global_ = true; + } + } else { + /* Java releases ownership of C++ object's lifetime */ + if (weak_global_) { + jenv->DeleteWeakGlobalRef((jweak)jthis_); + jthis_ = jenv->NewGlobalRef(jself); + weak_global_ = false; + } + } + } + + private: + /* pointer to Java object */ + jobject jthis_; + /* Local or global reference flag */ + bool weak_global_; + }; + + /* Local JNI reference deleter */ + class LocalRefGuard { + JNIEnv *jenv_; + jobject jobj_; + + // non-copyable + LocalRefGuard(const LocalRefGuard &); + LocalRefGuard &operator=(const LocalRefGuard &); + public: + LocalRefGuard(JNIEnv *jenv, jobject jobj): jenv_(jenv), jobj_(jobj) {} + ~LocalRefGuard() { + if (jobj_) + jenv_->DeleteLocalRef(jobj_); + } + }; + + /* director base class */ + class Director { + /* pointer to Java virtual machine */ + JavaVM *swig_jvm_; + + protected: +#if defined (_MSC_VER) && (_MSC_VER<1300) + class JNIEnvWrapper; + friend class JNIEnvWrapper; +#endif + /* Utility class for managing the JNI environment */ + class JNIEnvWrapper { + const Director *director_; + JNIEnv *jenv_; + int env_status; + public: + JNIEnvWrapper(const Director *director) : director_(director), jenv_(0), env_status(0) { +#if defined(__ANDROID__) + JNIEnv **jenv = &jenv_; +#else + void **jenv = (void **)&jenv_; +#endif + env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2); +#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON) + // Attach a daemon thread to the JVM. Useful when the JVM should not wait for + // the thread to exit upon shutdown. Only for jdk-1.4 and later. + director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, NULL); +#else + director_->swig_jvm_->AttachCurrentThread(jenv, NULL); +#endif + } + ~JNIEnvWrapper() { +#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) + // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. + // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. + if (env_status == JNI_EDETACHED) + director_->swig_jvm_->DetachCurrentThread(); +#endif + } + JNIEnv *getJNIEnv() const { + return jenv_; + } + }; + + /* Java object wrapper */ + JObjectWrapper swig_self_; + + /* Disconnect director from Java object */ + void swig_disconnect_director_self(const char *disconn_method) { + JNIEnvWrapper jnienv(this) ; + JNIEnv *jenv = jnienv.getJNIEnv() ; + jobject jobj = swig_self_.get(jenv); + LocalRefGuard ref_deleter(jenv, jobj); +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; +#endif + if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { + jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); + if (disconn_meth) { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl; +#endif + jenv->CallVoidMethod(jobj, disconn_meth); + } + } + } + + public: + Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() { + /* Acquire the Java VM pointer */ + jenv->GetJavaVM(&swig_jvm_); + } + + virtual ~Director() { + JNIEnvWrapper jnienv(this) ; + JNIEnv *jenv = jnienv.getJNIEnv() ; + swig_self_.release(jenv); + } + + bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global) { + return swig_self_.set(jenv, jself, mem_own, weak_global); + } + + jobject swig_get_self(JNIEnv *jenv) const { + return swig_self_.get(jenv); + } + + // Change C++ object's ownership, relative to Java + void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { + swig_self_.java_change_ownership(jenv, jself, take_or_release); + } + }; + + // Zero initialized bool array + template class BoolArray { + bool array_[N]; + public: + BoolArray() { + memset(array_, 0, sizeof(array_)); + } + bool& operator[](size_t n) { + return array_[n]; + } + bool operator[](size_t n) const { + return array_[n]; + } + }; + + // Utility classes and functions for exception handling. + + // Simple holder for a Java string during exception handling, providing access to a c-style string + class JavaString { + public: + JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) { + if (jenv_ && jstr_) + cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, NULL); + } + + ~JavaString() { + if (jenv_ && jstr_ && cstr_) + jenv_->ReleaseStringUTFChars(jstr_, cstr_); + } + + const char *c_str(const char *null_string = "null JavaString") const { + return cstr_ ? cstr_ : null_string; + } + + private: + // non-copyable + JavaString(const JavaString &); + JavaString &operator=(const JavaString &); + + JNIEnv *jenv_; + jstring jstr_; + const char *cstr_; + }; + + // Helper class to extract the exception message from a Java throwable + class JavaExceptionMessage { + public: + JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) { + } + + const char *message() const { + return message_.c_str("Could not get exception message in JavaExceptionMessage"); + } + + private: + // non-copyable + JavaExceptionMessage(const JavaExceptionMessage &); + JavaExceptionMessage &operator=(const JavaExceptionMessage &); + + // Get exception message by calling Java method Throwable.getMessage() + static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) { + jstring jmsg = NULL; + if (jenv && throwable) { + jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions + jclass throwclz = jenv->GetObjectClass(throwable); + if (throwclz) { + // All Throwable classes have a getMessage() method, so call it to extract the exception message + jmethodID getMessageMethodID = jenv->GetMethodID(throwclz, "getMessage", "()Ljava/lang/String;"); + if (getMessageMethodID) + jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID); + } + if (jmsg == NULL && jenv->ExceptionCheck()) + jenv->ExceptionClear(); + } + return jmsg; + } + + JavaString message_; + }; + + // C++ Exception class for handling Java exceptions thrown during a director method Java upcall + class DirectorException : public std::exception { + public: + + // Construct exception from a Java throwable + DirectorException(JNIEnv *jenv, jthrowable throwable) : classname_(0), msg_(0) { + + // Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/') + if (throwable) { + jclass throwclz = jenv->GetObjectClass(throwable); + if (throwclz) { + jclass clzclz = jenv->GetObjectClass(throwclz); + if (clzclz) { + jmethodID getNameMethodID = jenv->GetMethodID(clzclz, "getName", "()Ljava/lang/String;"); + if (getNameMethodID) { + jstring jstr_classname = (jstring)(jenv->CallObjectMethod(throwclz, getNameMethodID)); + // Copy strings, since there is no guarantee that jenv will be active when handled + if (jstr_classname) { + JavaString jsclassname(jenv, jstr_classname); + const char *classname = jsclassname.c_str(0); + if (classname) + classname_ = copypath(classname); + } + } + } + } + } + + JavaExceptionMessage exceptionmsg(jenv, throwable); + msg_ = copystr(exceptionmsg.message()); + } + + // More general constructor for handling as a java.lang.RuntimeException + DirectorException(const char *msg) : classname_(0), msg_(copystr(msg ? msg : "Unspecified DirectorException message")) { + } + + ~DirectorException() throw() { + delete[] classname_; + delete[] msg_; + } + + const char *what() const throw() { + return msg_; + } + + // Reconstruct and raise/throw the Java Exception that caused the DirectorException + // Note that any error in the JNI exception handling results in a Java RuntimeException + void raiseJavaException(JNIEnv *jenv) const { + if (jenv) { + jenv->ExceptionClear(); + + jmethodID ctorMethodID = 0; + jclass throwableclass = 0; + if (classname_) { + throwableclass = jenv->FindClass(classname_); + if (throwableclass) + ctorMethodID = jenv->GetMethodID(throwableclass, "", "(Ljava/lang/String;)V"); + } + + if (ctorMethodID) { + jenv->ThrowNew(throwableclass, what()); + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what()); + } + } + } + + private: + static char *copypath(const char *srcmsg) { + char *target = copystr(srcmsg); + for (char *c=target; *c; ++c) { + if ('.' == *c) + *c = '/'; + } + return target; + } + + static char *copystr(const char *srcmsg) { + char *target = 0; + if (srcmsg) { + size_t msglen = strlen(srcmsg) + 1; + target = new char[msglen]; + strncpy(target, srcmsg, msglen); + } + return target; + } + + const char *classname_; + const char *msg_; + }; + + // Helper method to determine if a Java throwable matches a particular Java class type + SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) { + bool matches = false; + + if (throwable && jenv && classname) { + // Exceptions need to be cleared for correct behavior. + // The caller of ExceptionMatches should restore pending exceptions if desired - + // the caller already has the throwable. + jenv->ExceptionClear(); + + jclass clz = jenv->FindClass(classname); + if (clz) { + jclass classclz = jenv->GetObjectClass(clz); + jmethodID isInstanceMethodID = jenv->GetMethodID(classclz, "isInstance", "(Ljava/lang/Object;)Z"); + if (isInstanceMethodID) { + matches = jenv->CallBooleanMethod(clz, isInstanceMethodID, throwable) != 0; + } + } + +#if defined(DEBUG_DIRECTOR_EXCEPTION) + if (jenv->ExceptionCheck()) { + // Typically occurs when an invalid classname argument is passed resulting in a ClassNotFoundException + JavaExceptionMessage exc(jenv, jenv->ExceptionOccurred()); + std::cout << "Error: ExceptionMatches: class '" << classname << "' : " << exc.message() << std::endl; + } +#endif + } + return matches; + } +} + +namespace Swig { + namespace { + jclass jclass_kcoreJNI = NULL; + jmethodID director_method_ids[3]; + } +} + +#include "kuzzle.cpp" +#include "collection.cpp" +#include "room.cpp" +#include "document.cpp" +#include "index.cpp" + + +#include + + +#include "listeners.hpp" +#include "exceptions.hpp" +#include "event_emitter.hpp" +#include "kuzzle.hpp" +#include "collection.hpp" +#include "room.hpp" +#include "document.hpp" +#include "index.hpp" +#include +#include + +SWIGINTERN options *new_options(){ + options *o = kuzzle_new_options(); + return o; + } +SWIGINTERN void delete_options(options *self){ + free(self); + } + +#include +#include + + +#include +#include + +SWIGINTERN std::vector< std::string >::const_reference std_vector_Sl_std_string_Sg__get(std::vector< std::string > *self,int i){ + int size = int(self->size()); + if (i>=0 && i *self,int i,std::vector< std::string >::value_type const &val){ + int size = int(self->size()); + if (i>=0 && i::const_reference std_vector_Sl_kuzzleio_Document_Sm__Sg__get(std::vector< kuzzleio::Document * > *self,int i){ + int size = int(self->size()); + if (i>=0 && i *self,int i,std::vector< kuzzleio::Document * >::value_type const &val){ + int size = int(self->size()); + if (i>=0 && iIsSameObject(swigjobj, NULL) == JNI_FALSE) { + *((notification_result **)&jarg0) = (notification_result *) arg0; + jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[0], swigjobj, jarg0); + jthrowable swigerror = jenv->ExceptionOccurred(); + if (swigerror) { + jenv->ExceptionClear(); + throw Swig::DirectorException(jenv, swigerror); + } + + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::NotificationListener::onMessage "); + } + if (swigjobj) jenv->DeleteLocalRef(swigjobj); +} + +void SwigDirector_NotificationListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { + static struct { + const char *mname; + const char *mdesc; + jmethodID base_methid; + } methods[] = { + { + "onMessage", "(Lio/kuzzle/sdk/notification_result;)V", NULL + } + }; + + static jclass baseclass = 0 ; + + if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { + if (!baseclass) { + baseclass = jenv->FindClass("io/kuzzle/sdk/NotificationListener"); + if (!baseclass) return; + baseclass = (jclass) jenv->NewGlobalRef(baseclass); + } + bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); + for (int i = 0; i < 1; ++i) { + if (!methods[i].base_methid) { + methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); + if (!methods[i].base_methid) return; + } + swig_override[i] = false; + if (derived) { + jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); + swig_override[i] = (methid != methods[i].base_methid); + jenv->ExceptionClear(); + } + } + } +} + + +SwigDirector_EventListener::SwigDirector_EventListener(JNIEnv *jenv) : kuzzleio::EventListener(), Swig::Director(jenv) { +} + +SwigDirector_EventListener::~SwigDirector_EventListener() { + swig_disconnect_director_self("swigDirectorDisconnect"); +} + + +void SwigDirector_EventListener::trigger(json_object *arg0) const { + JNIEnvWrapper swigjnienv(this) ; + JNIEnv * jenv = swigjnienv.getJNIEnv() ; + jobject swigjobj = (jobject) NULL ; + jlong jarg0 = 0 ; + + if (!swig_override[0]) { + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method kuzzleio::EventListener::trigger."); + return; + } + swigjobj = swig_get_self(jenv); + if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { + *((json_object **)&jarg0) = (json_object *) arg0; + jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[1], swigjobj, jarg0); + jthrowable swigerror = jenv->ExceptionOccurred(); + if (swigerror) { + jenv->ExceptionClear(); + throw Swig::DirectorException(jenv, swigerror); + } + + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::EventListener::trigger "); + } + if (swigjobj) jenv->DeleteLocalRef(swigjobj); +} + +void SwigDirector_EventListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { + static struct { + const char *mname; + const char *mdesc; + jmethodID base_methid; + } methods[] = { + { + "trigger", "(Lio/kuzzle/sdk/JsonObject;)V", NULL + } + }; + + static jclass baseclass = 0 ; + + if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { + if (!baseclass) { + baseclass = jenv->FindClass("io/kuzzle/sdk/EventListener"); + if (!baseclass) return; + baseclass = (jclass) jenv->NewGlobalRef(baseclass); + } + bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); + for (int i = 0; i < 1; ++i) { + if (!methods[i].base_methid) { + methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); + if (!methods[i].base_methid) return; + } + swig_override[i] = false; + if (derived) { + jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); + swig_override[i] = (methid != methods[i].base_methid); + jenv->ExceptionClear(); + } + } + } +} + + +SwigDirector_SubscribeListener::SwigDirector_SubscribeListener(JNIEnv *jenv) : kuzzleio::SubscribeListener(), Swig::Director(jenv) { +} + +SwigDirector_SubscribeListener::~SwigDirector_SubscribeListener() { + swig_disconnect_director_self("swigDirectorDisconnect"); +} + + +void SwigDirector_SubscribeListener::onSubscribe(room_result *arg0) const { + JNIEnvWrapper swigjnienv(this) ; + JNIEnv * jenv = swigjnienv.getJNIEnv() ; + jobject swigjobj = (jobject) NULL ; + jlong jarg0 = 0 ; + + if (!swig_override[0]) { + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method kuzzleio::SubscribeListener::onSubscribe."); + return; + } + swigjobj = swig_get_self(jenv); + if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { + *((room_result **)&jarg0) = (room_result *) arg0; + jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[2], swigjobj, jarg0); + jthrowable swigerror = jenv->ExceptionOccurred(); + if (swigerror) { + jenv->ExceptionClear(); + throw Swig::DirectorException(jenv, swigerror); + } + + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::SubscribeListener::onSubscribe "); + } + if (swigjobj) jenv->DeleteLocalRef(swigjobj); +} + +void SwigDirector_SubscribeListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { + static struct { + const char *mname; + const char *mdesc; + jmethodID base_methid; + } methods[] = { + { + "onSubscribe", "(Lio/kuzzle/sdk/room_result;)V", NULL + } + }; + + static jclass baseclass = 0 ; + + if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { + if (!baseclass) { + baseclass = jenv->FindClass("io/kuzzle/sdk/SubscribeListener"); + if (!baseclass) return; + baseclass = (jclass) jenv->NewGlobalRef(baseclass); + } + bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); + for (int i = 0; i < 1; ++i) { + if (!methods[i].base_methid) { + methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); + if (!methods[i].base_methid) return; + } + swig_override[i] = false; + if (derived) { + jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); + swig_override[i] = (methid != methods[i].base_methid); + jenv->ExceptionClear(); + } + } + } +} + + + +#ifdef __cplusplus +extern "C" { +#endif + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1query_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + query_object *arg1 = (query_object *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(query_object **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->query = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1query_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + query_object *arg1 = (query_object *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + result = (json_object *) ((arg1)->query); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + query_object *arg1 = (query_object *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->timestamp = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + query_object *arg1 = (query_object *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + result = (unsigned long long) ((arg1)->timestamp); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_object *arg1 = (query_object *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->request_id; + if (arg2) { + arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->request_id, (const char *)arg2); + } else { + arg1->request_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_object *arg1 = (query_object *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + result = (char *) ((arg1)->request_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1query_1object(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + query_object *result = 0 ; + + (void)jenv; + (void)jcls; + result = (query_object *)new query_object(); + *(query_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1query_1object(JNIEnv *jenv, jclass jcls, jlong jarg1) { + query_object *arg1 = (query_object *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(query_object **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + offline_queue *arg1 = (offline_queue *) 0 ; + query_object **arg2 = (query_object **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + arg2 = *(query_object ***)&jarg2; + if (arg1) (arg1)->queries = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + offline_queue *arg1 = (offline_queue *) 0 ; + query_object **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + result = (query_object **) ((arg1)->queries); + *(query_object ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + offline_queue *arg1 = (offline_queue *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->queries_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + offline_queue *arg1 = (offline_queue *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + result = ((arg1)->queries_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1offline_1queue(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + offline_queue *result = 0 ; + + (void)jenv; + (void)jcls; + result = (offline_queue *)new offline_queue(); + *(offline_queue **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1) { + offline_queue *arg1 = (offline_queue *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(offline_queue **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->request_id; + if (arg2) { + arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->request_id, (const char *)arg2); + } else { + arg1->request_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->request_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->controller; + if (arg2) { + arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->controller, (const char *)arg2); + } else { + arg1->controller = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->controller); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->action; + if (arg2) { + arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->action, (const char *)arg2); + } else { + arg1->action = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->action); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1body_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->body = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1body_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (json_object *) ((arg1)->body); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->from = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->from); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->size = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->size); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll; + if (arg2) { + arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll, (const char *)arg2); + } else { + arg1->scroll = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->scroll); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1strategy_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->strategy; + if (arg2) { + arg1->strategy = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->strategy, (const char *)arg2); + } else { + arg1->strategy = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1strategy_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->strategy); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1expires_1in_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->expires_in = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1expires_1in_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (unsigned long long) ((arg1)->expires_in); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scope; + if (arg2) { + arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scope, (const char *)arg2); + } else { + arg1->scope = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->scope); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->state; + if (arg2) { + arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->state, (const char *)arg2); + } else { + arg1->state = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->state); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->user; + if (arg2) { + arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->user, (const char *)arg2); + } else { + arg1->user = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->user); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1start_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->start = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1start_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->start); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1stop_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->stop = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1stop_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->stop); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1end_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->end = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1end_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->end); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1bit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jshort jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned char arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (unsigned char)jarg2; + if (arg1) (arg1)->bit = arg2; +} + + +SWIGEXPORT jshort JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1bit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jshort jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned char result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (unsigned char) ((arg1)->bit); + jresult = (jshort)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->member; + if (arg2) { + arg1->member = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->member, (const char *)arg2); + } else { + arg1->member = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->member); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member1_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->member1; + if (arg2) { + arg1->member1 = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->member1, (const char *)arg2); + } else { + arg1->member1 = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->member1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member2_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->member2; + if (arg2) { + arg1->member2 = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->member2, (const char *)arg2); + } else { + arg1->member2 = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member2_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->member2); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->members = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char **) ((arg1)->members); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->members_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = ((arg1)->members_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lon_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (double)jarg2; + if (arg1) (arg1)->lon = arg2; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lon_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jdouble jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (double) ((arg1)->lon); + jresult = (jdouble)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lat_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (double)jarg2; + if (arg1) (arg1)->lat = arg2; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lat_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jdouble jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (double) ((arg1)->lat); + jresult = (jdouble)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1distance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (double)jarg2; + if (arg1) (arg1)->distance = arg2; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1distance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jdouble jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (double) ((arg1)->distance); + jresult = (jdouble)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1unit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->unit; + if (arg2) { + arg1->unit = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->unit, (const char *)arg2); + } else { + arg1->unit = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1unit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->unit); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->options = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (json_object *) ((arg1)->options); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->keys = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char **) ((arg1)->keys); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->keys_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = ((arg1)->keys_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1cursor_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->cursor = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1cursor_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->cursor); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1offset_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->offset = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1offset_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->offset); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1field_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->field; + if (arg2) { + arg1->field = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->field, (const char *)arg2); + } else { + arg1->field = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1field_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->field); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->fields = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char **) ((arg1)->fields); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->fields_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = ((arg1)->fields_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1subcommand_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->subcommand; + if (arg2) { + arg1->subcommand = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->subcommand, (const char *)arg2); + } else { + arg1->subcommand = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1subcommand_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->subcommand); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1pattern_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->pattern; + if (arg2) { + arg1->pattern = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->pattern, (const char *)arg2); + } else { + arg1->pattern = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1pattern_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->pattern); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1idx_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->idx = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1idx_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->idx); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1min_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->min; + if (arg2) { + arg1->min = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->min, (const char *)arg2); + } else { + arg1->min = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1min_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->min); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1max_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->max; + if (arg2) { + arg1->max = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->max, (const char *)arg2); + } else { + arg1->max = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1max_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->max); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1limit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->limit; + if (arg2) { + arg1->limit = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->limit, (const char *)arg2); + } else { + arg1->limit = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1limit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->limit); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1count_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (unsigned long)jarg2; + if (arg1) (arg1)->count = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1count_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (unsigned long) ((arg1)->count); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1match_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->match; + if (arg2) { + arg1->match = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->match, (const char *)arg2); + } else { + arg1->match = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1match_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->match); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleRequest(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzle_request *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzle_request *)new kuzzle_request(); + *(kuzzle_request **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleRequest(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzle_request **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1filter_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_queue_filter arg2 = (kuzzle_queue_filter) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_queue_filter *)&jarg2; + if (arg1) (arg1)->filter = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1filter_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_queue_filter result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (kuzzle_queue_filter) ((arg1)->filter); + *(kuzzle_queue_filter *)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1loader_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_offline_queue_loader arg2 = (kuzzle_offline_queue_loader) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_offline_queue_loader *)&jarg2; + if (arg1) (arg1)->loader = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1loader_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_offline_queue_loader result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (kuzzle_offline_queue_loader) ((arg1)->loader); + *(kuzzle_offline_queue_loader *)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1kuzzle(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzle *)new kuzzle(); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzle **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1kuzzle_1index(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzle_index *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzle_index *)new kuzzle_index(); + *(kuzzle_index **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1kuzzle_1index(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzle_index **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_options *arg1 = (room_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scope; + if (arg2) { + arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scope, (const char *)arg2); + } else { + arg1->scope = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (char *) ((arg1)->scope); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_options *arg1 = (room_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->state; + if (arg2) { + arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->state, (const char *)arg2); + } else { + arg1->state = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (char *) ((arg1)->state); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_options *arg1 = (room_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->user; + if (arg2) { + arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->user, (const char *)arg2); + } else { + arg1->user = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (char *) ((arg1)->user); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1subscribe_1to_1self_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + room_options *arg1 = (room_options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->subscribe_to_self = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1subscribe_1to_1self_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (bool) ((arg1)->subscribe_to_self); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + room_options *arg1 = (room_options *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(room_options **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1RoomOptions(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + room_options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (room_options *)new room_options(); + *(room_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1RoomOptions(JNIEnv *jenv, jclass jcls, jlong jarg1) { + room_options *arg1 = (room_options *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(room_options **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + room *arg1 = (room *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1filters_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + room *arg1 = (room *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(room **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->filters = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1filters_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + result = (json_object *) ((arg1)->filters); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + room *arg1 = (room *) 0 ; + room_options *arg2 = (room_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(room **)&jarg1; + arg2 = *(room_options **)&jarg2; + if (arg1) (arg1)->options = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + room_options *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + result = (room_options *) ((arg1)->options); + *(room_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1room(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + room *result = 0 ; + + (void)jenv; + (void)jcls; + result = (room *)new room(); + *(room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1room(JNIEnv *jenv, jclass jcls, jlong jarg1) { + room *arg1 = (room *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(room **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + room_result *arg1 = (room_result *) 0 ; + room *arg2 = (room *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(room_result **)&jarg1; + arg2 = *(room **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room_result *arg1 = (room_result *) 0 ; + room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + result = (room *) ((arg1)->result); + *(room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + room_result *arg1 = (room_result *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->status = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + room_result *arg1 = (room_result *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + result = (int) ((arg1)->status); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_result *arg1 = (room_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->error; + if (arg2) { + arg1->error = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->error, (const char *)arg2); + } else { + arg1->error = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_result *arg1 = (room_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + result = (char *) ((arg1)->error); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1stack_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_result *arg1 = (room_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->stack; + if (arg2) { + arg1->stack = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->stack, (const char *)arg2); + } else { + arg1->stack = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1stack_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_result *arg1 = (room_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + result = (char *) ((arg1)->stack); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1room_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + room_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (room_result *)new room_result(); + *(room_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1room_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + room_result *arg1 = (room_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(room_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1queuable_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + query_options *arg1 = (query_options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->queuable = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1queuable_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (bool) ((arg1)->queuable); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withdist_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + query_options *arg1 = (query_options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->withdist = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withdist_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (bool) ((arg1)->withdist); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withcoord_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + query_options *arg1 = (query_options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->withcoord = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withcoord_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (bool) ((arg1)->withcoord); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + query_options *arg1 = (query_options *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->from = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (long) ((arg1)->from); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + query_options *arg1 = (query_options *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->size = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (long) ((arg1)->size); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_options *arg1 = (query_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll; + if (arg2) { + arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll, (const char *)arg2); + } else { + arg1->scroll = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (char *) ((arg1)->scroll); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_options *arg1 = (query_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1refresh_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_options *arg1 = (query_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->refresh; + if (arg2) { + arg1->refresh = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->refresh, (const char *)arg2); + } else { + arg1->refresh = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1refresh_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (char *) ((arg1)->refresh); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1if_1exist_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_options *arg1 = (query_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->if_exist; + if (arg2) { + arg1->if_exist = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->if_exist, (const char *)arg2); + } else { + arg1->if_exist = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1if_1exist_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (char *) ((arg1)->if_exist); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1retry_1on_1conflict_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + query_options *arg1 = (query_options *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->retry_on_conflict = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1retry_1on_1conflict_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (int) ((arg1)->retry_on_conflict); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + query_options *arg1 = (query_options *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(query_options **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1QueryOptions(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + query_options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (query_options *)new query_options(); + *(query_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1QueryOptions(JNIEnv *jenv, jclass jcls, jlong jarg1) { + query_options *arg1 = (query_options *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(query_options **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queueTTL_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + options *arg1 = (options *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->queue_ttl = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queueTTL_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned int) ((arg1)->queue_ttl); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queue_1max_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + options *arg1 = (options *) 0 ; + unsigned long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned long)jarg2; + if (arg1) (arg1)->queue_max_size = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queue_1max_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned long) ((arg1)->queue_max_size); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1offline_1mode_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jshort jarg2) { + options *arg1 = (options *) 0 ; + unsigned char arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned char)jarg2; + if (arg1) (arg1)->offline_mode = arg2; +} + + +SWIGEXPORT jshort JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1offline_1mode_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jshort jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned char result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned char) ((arg1)->offline_mode); + jresult = (jshort)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1queue_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + options *arg1 = (options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->auto_queue = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1queue_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + options *arg1 = (options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (bool) ((arg1)->auto_queue); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1reconnect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + options *arg1 = (options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->auto_reconnect = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1reconnect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + options *arg1 = (options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (bool) ((arg1)->auto_reconnect); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1replay_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + options *arg1 = (options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->auto_replay = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1replay_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + options *arg1 = (options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (bool) ((arg1)->auto_replay); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1resubscribe_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + options *arg1 = (options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->auto_resubscribe = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1resubscribe_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + options *arg1 = (options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (bool) ((arg1)->auto_resubscribe); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1reconnection_1delay_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + options *arg1 = (options *) 0 ; + unsigned long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned long)jarg2; + if (arg1) (arg1)->reconnection_delay = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1reconnection_1delay_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned long) ((arg1)->reconnection_delay); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1replay_1interval_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + options *arg1 = (options *) 0 ; + unsigned long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned long)jarg2; + if (arg1) (arg1)->replay_interval = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1replay_1interval_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned long) ((arg1)->replay_interval); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1connect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + options *arg1 = (options *) 0 ; + enum Mode arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (enum Mode)jarg2; + if (arg1) (arg1)->connect = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1connect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + options *arg1 = (options *) 0 ; + enum Mode result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (enum Mode) ((arg1)->connect); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1refresh_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + options *arg1 = (options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->refresh; + if (arg2) { + arg1->refresh = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->refresh, (const char *)arg2); + } else { + arg1->refresh = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1refresh_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + options *arg1 = (options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (char *) ((arg1)->refresh); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1default_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + options *arg1 = (options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->default_index; + if (arg2) { + arg1->default_index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->default_index, (const char *)arg2); + } else { + arg1->default_index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1default_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + options *arg1 = (options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (char *) ((arg1)->default_index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Options(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (options *)new_options(); + *(options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Options(JNIEnv *jenv, jclass jcls, jlong jarg1) { + options *arg1 = (options *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(options **)&jarg1; + delete_options(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1author_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + meta *arg1 = (meta *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->author; + if (arg2) { + arg1->author = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->author, (const char *)arg2); + } else { + arg1->author = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1author_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + meta *arg1 = (meta *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (char *) ((arg1)->author); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1created_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + meta *arg1 = (meta *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->created_at = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1created_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + meta *arg1 = (meta *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (unsigned long long) ((arg1)->created_at); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updated_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + meta *arg1 = (meta *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->updated_at = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updated_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + meta *arg1 = (meta *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (unsigned long long) ((arg1)->updated_at); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updater_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + meta *arg1 = (meta *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->updater; + if (arg2) { + arg1->updater = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->updater, (const char *)arg2); + } else { + arg1->updater = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updater_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + meta *arg1 = (meta *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (char *) ((arg1)->updater); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1active_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + meta *arg1 = (meta *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->active = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1active_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + meta *arg1 = (meta *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (bool) ((arg1)->active); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1deleted_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + meta *arg1 = (meta *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->deleted_at = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1deleted_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + meta *arg1 = (meta *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (unsigned long long) ((arg1)->deleted_at); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1meta(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + meta *result = 0 ; + + (void)jenv; + (void)jcls; + result = (meta *)new meta(); + *(meta **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1meta(JNIEnv *jenv, jclass jcls, jlong jarg1) { + meta *arg1 = (meta *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(meta **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + policy_restriction *arg1 = (policy_restriction *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->collections = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + policy_restriction *arg1 = (policy_restriction *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + result = (char **) ((arg1)->collections); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->collections_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + policy_restriction *arg1 = (policy_restriction *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + result = ((arg1)->collections_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1policy_1restriction(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + policy_restriction *result = 0 ; + + (void)jenv; + (void)jcls; + result = (policy_restriction *)new policy_restriction(); + *(policy_restriction **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1policy_1restriction(JNIEnv *jenv, jclass jcls, jlong jarg1) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(policy_restriction **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1role_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + policy *arg1 = (policy *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->role_id; + if (arg2) { + arg1->role_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->role_id, (const char *)arg2); + } else { + arg1->role_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1role_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + policy *arg1 = (policy *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + result = (char *) ((arg1)->role_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + policy *arg1 = (policy *) 0 ; + policy_restriction *arg2 = (policy_restriction *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(policy **)&jarg1; + arg2 = *(policy_restriction **)&jarg2; + if (arg1) (arg1)->restricted_to = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + policy *arg1 = (policy *) 0 ; + policy_restriction *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + result = (policy_restriction *) ((arg1)->restricted_to); + *(policy_restriction **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + policy *arg1 = (policy *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->restricted_to_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + policy *arg1 = (policy *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + result = ((arg1)->restricted_to_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1policy(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + policy *result = 0 ; + + (void)jenv; + (void)jcls; + result = (policy *)new policy(); + *(policy **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1) { + policy *arg1 = (policy *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(policy **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + profile *arg1 = (profile *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + profile *arg1 = (profile *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profile *arg1 = (profile *) 0 ; + policy *arg2 = (policy *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(policy **)&jarg2; + if (arg1) (arg1)->policies = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + policy *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + result = (policy *) ((arg1)->policies); + *(policy **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + profile *arg1 = (profile *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->policies_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + result = ((arg1)->policies_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profile *arg1 = (profile *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + result = (profile *)new profile(); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1) { + profile *arg1 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(profile **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + role *arg1 = (role *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + role *arg1 = (role *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1controllers_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + role *arg1 = (role *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->controllers = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1controllers_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role *arg1 = (role *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + result = (json_object *) ((arg1)->controllers); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + role *arg1 = (role *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role *arg1 = (role *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + role *result = 0 ; + + (void)jenv; + (void)jcls; + result = (role *)new role(); + *(role **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role(JNIEnv *jenv, jclass jcls, jlong jarg1) { + role *arg1 = (role *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(role **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user *arg1 = (user *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user *arg1 = (user *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->content = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = (json_object *) ((arg1)->content); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user *arg1 = (user *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->profile_ids = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = (char **) ((arg1)->profile_ids); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user *arg1 = (user *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->profile_ids_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = ((arg1)->profile_ids_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user *arg1 = (user *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1User(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user *)new user(); + *(user **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1User(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user *arg1 = (user *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user_data *arg1 = (user_data *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user_data **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->content = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_data *arg1 = (user_data *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + result = (json_object *) ((arg1)->content); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_data *arg1 = (user_data *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->profile_ids = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_data *arg1 = (user_data *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + result = (char **) ((arg1)->profile_ids); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_data *arg1 = (user_data *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->profile_ids_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_data *arg1 = (user_data *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + result = ((arg1)->profile_ids_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UserData(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_data *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_data *)new user_data(); + *(user_data **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1UserData(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_data *arg1 = (user_data *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_data **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1failed_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + shards *arg1 = (shards *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->failed = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1failed_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + shards *arg1 = (shards *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + result = (int) ((arg1)->failed); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1successful_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + shards *arg1 = (shards *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->successful = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1successful_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + shards *arg1 = (shards *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + result = (int) ((arg1)->successful); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + shards *arg1 = (shards *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + shards *arg1 = (shards *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + result = (int) ((arg1)->total); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1shards(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + shards *result = 0 ; + + (void)jenv; + (void)jcls; + result = (shards *)new shards(); + *(shards **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1shards(JNIEnv *jenv, jclass jcls, jlong jarg1) { + shards *arg1 = (shards *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(shards **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + collection *arg1 = (collection *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + collection *arg1 = (collection *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { + collection *arg1 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(collection **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + document *arg1 = (document *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document *arg1 = (document *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document *arg1 = (document *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document *arg1 = (document *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document *arg1 = (document *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1meta_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document *arg1 = (document *) 0 ; + meta *arg2 = (meta *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(meta **)&jarg2; + if (arg1) (arg1)->meta = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1meta_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + meta *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (meta *) ((arg1)->meta); + *(meta **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1shards_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document *arg1 = (document *) 0 ; + shards *arg2 = (shards *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(shards **)&jarg2; + if (arg1) (arg1)->shards = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1shards_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + shards *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (shards *) ((arg1)->shards); + *(shards **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document *arg1 = (document *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->content = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (json_object *) ((arg1)->content); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1version_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + document *arg1 = (document *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->version = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1version_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + document *arg1 = (document *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (int) ((arg1)->version); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document *arg1 = (document *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->result; + if (arg2) { + arg1->result = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->result, (const char *)arg2); + } else { + arg1->result = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document *arg1 = (document *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (char *) ((arg1)->result); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1created_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + document *arg1 = (document *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->created = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1created_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + document *arg1 = (document *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (bool) ((arg1)->created); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document *arg1 = (document *) 0 ; + collection *arg2 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(collection **)&jarg2; + if (arg1) (arg1)->_collection = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (collection *) ((arg1)->_collection); + *(collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document *arg1 = (document *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document *arg1 = (document *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + result = (document *)new document(); + *(document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document(JNIEnv *jenv, jclass jcls, jlong jarg1) { + document *arg1 = (document *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(document **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document_result *arg1 = (document_result *) 0 ; + document *arg2 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document_result **)&jarg1; + arg2 = *(document **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document_result *arg1 = (document_result *) 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_result **)&jarg1; + result = (document *) ((arg1)->result); + *(document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + document_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (document_result *)new document_result(); + *(document_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + document_result *arg1 = (document_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(document_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document_array_result *arg1 = (document_array_result *) 0 ; + document *arg2 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document_array_result **)&jarg1; + arg2 = *(document **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = (document *) ((arg1)->result); + *(document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + document_array_result *arg1 = (document_array_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + document_array_result *arg1 = (document_array_result *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->status = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = (int) ((arg1)->status); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document_array_result *arg1 = (document_array_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->error; + if (arg2) { + arg1->error = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->error, (const char *)arg2); + } else { + arg1->error = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = (char *) ((arg1)->error); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1stack_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document_array_result *arg1 = (document_array_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->stack; + if (arg2) { + arg1->stack = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->stack, (const char *)arg2); + } else { + arg1->stack = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1stack_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = (char *) ((arg1)->stack); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document_1array_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + document_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (document_array_result *)new document_array_result(); + *(document_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + document_array_result *arg1 = (document_array_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(document_array_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_content *arg1 = (notification_content *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_content *arg1 = (notification_content *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1meta_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + notification_content *arg1 = (notification_content *) 0 ; + meta *arg2 = (meta *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(notification_content **)&jarg1; + arg2 = *(meta **)&jarg2; + if (arg1) (arg1)->meta = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1meta_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + notification_content *arg1 = (notification_content *) 0 ; + meta *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + result = (meta *) ((arg1)->meta); + *(meta **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + notification_content *arg1 = (notification_content *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(notification_content **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->content = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + notification_content *arg1 = (notification_content *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + result = (json_object *) ((arg1)->content); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1count_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + notification_content *arg1 = (notification_content *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->count = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1count_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + notification_content *arg1 = (notification_content *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + result = (int) ((arg1)->count); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1notification_1content(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + notification_content *result = 0 ; + + (void)jenv; + (void)jcls; + result = (notification_content *)new notification_content(); + *(notification_content **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1notification_1content(JNIEnv *jenv, jclass jcls, jlong jarg1) { + notification_content *arg1 = (notification_content *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(notification_content **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->request_id; + if (arg2) { + arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->request_id, (const char *)arg2); + } else { + arg1->request_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->request_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + notification_result *arg1 = (notification_result *) 0 ; + notification_content *arg2 = (notification_content *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(notification_result **)&jarg1; + arg2 = *(notification_content **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + notification_content *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (notification_content *) ((arg1)->result); + *(notification_content **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + notification_result *arg1 = (notification_result *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(notification_result **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->controller; + if (arg2) { + arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->controller, (const char *)arg2); + } else { + arg1->controller = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->controller); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->action; + if (arg2) { + arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->action, (const char *)arg2); + } else { + arg1->action = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->action); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1protocol_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->protocol; + if (arg2) { + arg1->protocol = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->protocol, (const char *)arg2); + } else { + arg1->protocol = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1protocol_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->protocol); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scope; + if (arg2) { + arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scope, (const char *)arg2); + } else { + arg1->scope = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->scope); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->state; + if (arg2) { + arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->state, (const char *)arg2); + } else { + arg1->state = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->state); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->user; + if (arg2) { + arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->user, (const char *)arg2); + } else { + arg1->user = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->user); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1n_1type_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->n_type; + if (arg2) { + arg1->n_type = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->n_type, (const char *)arg2); + } else { + arg1->n_type = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1n_1type_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->n_type); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1room_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->room_id; + if (arg2) { + arg1->room_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->room_id, (const char *)arg2); + } else { + arg1->room_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1room_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->room_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->timestamp = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (unsigned long long) ((arg1)->timestamp); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1notification_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + notification_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (notification_result *)new notification_result(); + *(notification_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1notification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + notification_result *arg1 = (notification_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(notification_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1result_1profile_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profile_result *arg1 = (profile_result *) 0 ; + profile *arg2 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile_result **)&jarg1; + arg2 = *(profile **)&jarg2; + if (arg1) (arg1)->profile = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1result_1profile_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile_result *arg1 = (profile_result *) 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_result **)&jarg1; + result = (profile *) ((arg1)->profile); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + profile_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (profile_result *)new profile_result(); + *(profile_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + profile_result *arg1 = (profile_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(profile_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profiles_result *arg1 = (profiles_result *) 0 ; + profile *arg2 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profiles_result **)&jarg1; + arg2 = *(profile **)&jarg2; + if (arg1) (arg1)->profiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profiles_result *arg1 = (profiles_result *) 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profiles_result **)&jarg1; + result = (profile *) ((arg1)->profiles); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + profiles_result *arg1 = (profiles_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profiles_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->profiles_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profiles_result *arg1 = (profiles_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profiles_result **)&jarg1; + result = ((arg1)->profiles_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profiles_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (profiles_result *)new profiles_result(); + *(profiles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + profiles_result *arg1 = (profiles_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(profiles_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1result_1role_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + role_result *arg1 = (role_result *) 0 ; + role *arg2 = (role *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role_result **)&jarg1; + arg2 = *(role **)&jarg2; + if (arg1) (arg1)->role = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1result_1role_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role_result *arg1 = (role_result *) 0 ; + role *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_result **)&jarg1; + result = (role *) ((arg1)->role); + *(role **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + role_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (role_result *)new role_result(); + *(role_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + role_result *arg1 = (role_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(role_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->controller; + if (arg2) { + arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->controller, (const char *)arg2); + } else { + arg1->controller = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->controller); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->action; + if (arg2) { + arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->action, (const char *)arg2); + } else { + arg1->action = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->action); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1value_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->value; + if (arg2) { + arg1->value = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->value, (const char *)arg2); + } else { + arg1->value = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1value_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->value); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1right(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_right *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_right *)new user_right(); + *(user_right **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1right(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_right *arg1 = (user_right *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_right **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user_rights_result *arg1 = (user_rights_result *) 0 ; + user_right *arg2 = (user_right *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user_rights_result **)&jarg1; + arg2 = *(user_right **)&jarg2; + if (arg1) (arg1)->user_rights = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_rights_result *arg1 = (user_rights_result *) 0 ; + user_right *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_rights_result **)&jarg1; + result = (user_right *) ((arg1)->user_rights); + *(user_right **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_rights_result *arg1 = (user_rights_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_rights_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->user_rights_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_rights_result *arg1 = (user_rights_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_rights_result **)&jarg1; + result = ((arg1)->user_rights_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1rights_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_rights_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_rights_result *)new user_rights_result(); + *(user_rights_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1rights_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_rights_result *arg1 = (user_rights_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_rights_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1result_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user_result *arg1 = (user_result *) 0 ; + user *arg2 = (user *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user_result **)&jarg1; + arg2 = *(user **)&jarg2; + if (arg1) (arg1)->user = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1result_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_result *arg1 = (user_result *) 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_result **)&jarg1; + result = (user *) ((arg1)->user); + *(user **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_result *)new user_result(); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_result *arg1 = (user_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_ALLOWED_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + is_action_allowed result; + + (void)jenv; + (void)jcls; + result = (is_action_allowed)ALLOWED; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_CONDITIONNAL_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + is_action_allowed result; + + (void)jenv; + (void)jcls; + result = (is_action_allowed)CONDITIONNAL; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_DENIED_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + is_action_allowed result; + + (void)jenv; + (void)jcls; + result = (is_action_allowed)DENIED; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1completed_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics *arg1 = (statistics *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->completed_requests = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1completed_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (json_object *) ((arg1)->completed_requests); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1connections_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics *arg1 = (statistics *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->connections = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1connections_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (json_object *) ((arg1)->connections); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1failed_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics *arg1 = (statistics *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->failed_requests = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1failed_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (json_object *) ((arg1)->failed_requests); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1ongoing_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics *arg1 = (statistics *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->ongoing_requests = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1ongoing_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (json_object *) ((arg1)->ongoing_requests); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + statistics *arg1 = (statistics *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->timestamp = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (unsigned long long) ((arg1)->timestamp); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Statistics(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + result = (statistics *)new statistics(); + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Statistics(JNIEnv *jenv, jclass jcls, jlong jarg1) { + statistics *arg1 = (statistics *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(statistics **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StatisticsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics_result *arg1 = (statistics_result *) 0 ; + statistics *arg2 = (statistics *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics_result **)&jarg1; + arg2 = *(statistics **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StatisticsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics_result *arg1 = (statistics_result *) 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics_result **)&jarg1; + result = (statistics *) ((arg1)->result); + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StatisticsResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + statistics_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (statistics_result *)new statistics_result(); + *(statistics_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StatisticsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + statistics_result *arg1 = (statistics_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(statistics_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + statistics *arg2 = (statistics *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(all_statistics_result **)&jarg1; + arg2 = *(statistics **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(all_statistics_result **)&jarg1; + result = (statistics *) ((arg1)->result); + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(all_statistics_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(all_statistics_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1AllStatisticsResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + all_statistics_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (all_statistics_result *)new all_statistics_result(); + *(all_statistics_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1AllStatisticsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(all_statistics_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + geopos_result *arg1 = (geopos_result *) 0 ; + double (*arg2)[2] = (double (*)[2]) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + arg2 = *(double (**)[2])&jarg2; + if (arg1) (arg1)->result = (double (*)[2])arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + geopos_result *arg1 = (geopos_result *) 0 ; + double (*result)[2] = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + result = (double (*)[2]) ((arg1)->result); + *(double (**)[2])&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + geopos_result *arg1 = (geopos_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + geopos_result *arg1 = (geopos_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1geopos_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + geopos_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (geopos_result *)new geopos_result(); + *(geopos_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1geopos_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + geopos_result *arg1 = (geopos_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(geopos_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1valid_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + token_validity *arg1 = (token_validity *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->valid = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1valid_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + token_validity *arg1 = (token_validity *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + result = (bool) ((arg1)->valid); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + token_validity *arg1 = (token_validity *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->state; + if (arg2) { + arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->state, (const char *)arg2); + } else { + arg1->state = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + token_validity *arg1 = (token_validity *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + result = (char *) ((arg1)->state); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1expires_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + token_validity *arg1 = (token_validity *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->expires_at = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1expires_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + token_validity *arg1 = (token_validity *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + result = (unsigned long long) ((arg1)->expires_at); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1TokenValidity(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + token_validity *result = 0 ; + + (void)jenv; + (void)jcls; + result = (token_validity *)new token_validity(); + *(token_validity **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1TokenValidity(JNIEnv *jenv, jclass jcls, jlong jarg1) { + token_validity *arg1 = (token_validity *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(token_validity **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->request_id; + if (arg2) { + arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->request_id, (const char *)arg2); + } else { + arg1->request_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->request_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (json_object *) ((arg1)->result); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->controller; + if (arg2) { + arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->controller, (const char *)arg2); + } else { + arg1->controller = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->controller); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->action; + if (arg2) { + arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->action, (const char *)arg2); + } else { + arg1->action = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->action); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1room_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->room_id; + if (arg2) { + arg1->room_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->room_id, (const char *)arg2); + } else { + arg1->room_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1room_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->room_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1channel_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->channel; + if (arg2) { + arg1->channel = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->channel, (const char *)arg2); + } else { + arg1->channel = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1channel_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->channel); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleResponse(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzle_response *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzle_response *)new kuzzle_response(); + *(kuzzle_response **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleResponse(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzle_response **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1void_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (void_result *)new void_result(); + *(void_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1void_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + void_result *arg1 = (void_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(void_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + json_result *arg1 = (json_result *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(json_result **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + json_result *arg1 = (json_result *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_result **)&jarg1; + result = (json_object *) ((arg1)->result); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1JsonResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (json_result *)new json_result(); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1JsonResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + json_result *arg1 = (json_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(json_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + json_array_result *arg1 = (json_array_result *) 0 ; + json_object **arg2 = (json_object **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + arg2 = *(json_object ***)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + json_array_result *arg1 = (json_array_result *) 0 ; + json_object **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + result = (json_object **) ((arg1)->result); + *(json_object ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + json_array_result *arg1 = (json_array_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + json_array_result *arg1 = (json_array_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1json_1array_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (json_array_result *)new json_array_result(); + *(json_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1json_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + json_array_result *arg1 = (json_array_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(json_array_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_BoolResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + bool_result *arg1 = (bool_result *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(bool_result **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_BoolResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + bool_result *arg1 = (bool_result *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(bool_result **)&jarg1; + result = (bool) ((arg1)->result); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BoolResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (bool_result *)new bool_result(); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1BoolResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + bool_result *arg1 = (bool_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(bool_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + int_result *arg1 = (int_result *) 0 ; + long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_result **)&jarg1; + arg2 = (long long)jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + int_result *arg1 = (int_result *) 0 ; + long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_result **)&jarg1; + result = (long long) ((arg1)->result); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1int_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (int_result *)new int_result(); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1int_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + int_result *arg1 = (int_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(int_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DateResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + date_result *arg1 = (date_result *) 0 ; + long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(date_result **)&jarg1; + arg2 = (long long)jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DateResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + date_result *arg1 = (date_result *) 0 ; + long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(date_result **)&jarg1; + result = (long long) ((arg1)->result); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1DateResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + date_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (date_result *)new date_result(); + *(date_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1DateResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + date_result *arg1 = (date_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(date_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_double_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { + double_result *arg1 = (double_result *) 0 ; + double arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(double_result **)&jarg1; + arg2 = (double)jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_double_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jdouble jresult = 0 ; + double_result *arg1 = (double_result *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(double_result **)&jarg1; + result = (double) ((arg1)->result); + jresult = (jdouble)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1double_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (double_result *)new double_result(); + *(double_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1double_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + double_result *arg1 = (double_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(double_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + int_array_result *arg1 = (int_array_result *) 0 ; + long long *arg2 = (long long *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + arg2 = *(long long **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + int_array_result *arg1 = (int_array_result *) 0 ; + long long *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + result = (long long *) ((arg1)->result); + *(long long **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + int_array_result *arg1 = (int_array_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + int_array_result *arg1 = (int_array_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1int_1array_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + int_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (int_array_result *)new int_array_result(); + *(int_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1int_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + int_array_result *arg1 = (int_array_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(int_array_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_string_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + string_result *arg1 = (string_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->result; + if (arg2) { + arg1->result = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->result, (const char *)arg2); + } else { + arg1->result = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_string_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + string_result *arg1 = (string_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_result **)&jarg1; + result = (char *) ((arg1)->result); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1string_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (string_result *)new string_result(); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1string_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + string_result *arg1 = (string_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(string_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + string_array_result *arg1 = (string_array_result *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + string_array_result *arg1 = (string_array_result *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + result = (char **) ((arg1)->result); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + string_array_result *arg1 = (string_array_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + string_array_result *arg1 = (string_array_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringArrayResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (string_array_result *)new string_array_result(); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StringArrayResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + string_array_result *arg1 = (string_array_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(string_array_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1query_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_filters *arg1 = (search_filters *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_filters **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->query = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1query_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_filters *arg1 = (search_filters *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + result = (json_object *) ((arg1)->query); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1sort_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_filters *arg1 = (search_filters *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_filters **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->sort = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1sort_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_filters *arg1 = (search_filters *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + result = (json_object *) ((arg1)->sort); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1aggregations_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_filters *arg1 = (search_filters *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_filters **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->aggregations = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1aggregations_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_filters *arg1 = (search_filters *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + result = (json_object *) ((arg1)->aggregations); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1search_1after_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_filters *arg1 = (search_filters *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_filters **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->search_after = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1search_1after_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_filters *arg1 = (search_filters *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + result = (json_object *) ((arg1)->search_after); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SearchFilters(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_filters *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_filters *)new search_filters(); + *(search_filters **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SearchFilters(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_filters *arg1 = (search_filters *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_filters **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profile_search *arg1 = (profile_search *) 0 ; + profile *arg2 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile_search **)&jarg1; + arg2 = *(profile **)&jarg2; + if (arg1) (arg1)->hits = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile_search *arg1 = (profile_search *) 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + result = (profile *) ((arg1)->hits); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + profile_search *arg1 = (profile_search *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->hits_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile_search *arg1 = (profile_search *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + result = ((arg1)->hits_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + profile_search *arg1 = (profile_search *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile_search *arg1 = (profile_search *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + profile_search *arg1 = (profile_search *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + profile_search *arg1 = (profile_search *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile_1search(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + profile_search *result = 0 ; + + (void)jenv; + (void)jcls; + result = (profile_search *)new profile_search(); + *(profile_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { + profile_search *arg1 = (profile_search *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(profile_search **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + role_search *arg1 = (role_search *) 0 ; + role *arg2 = (role *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role_search **)&jarg1; + arg2 = *(role **)&jarg2; + if (arg1) (arg1)->hits = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role_search *arg1 = (role_search *) 0 ; + role *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + result = (role *) ((arg1)->hits); + *(role **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + role_search *arg1 = (role_search *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->hits_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role_search *arg1 = (role_search *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + result = ((arg1)->hits_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + role_search *arg1 = (role_search *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role_search *arg1 = (role_search *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role_1search(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + role_search *result = 0 ; + + (void)jenv; + (void)jcls; + result = (role_search *)new role_search(); + *(role_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { + role_search *arg1 = (role_search *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(role_search **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user_search *arg1 = (user_search *) 0 ; + user *arg2 = (user *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user_search **)&jarg1; + arg2 = *(user **)&jarg2; + if (arg1) (arg1)->hits = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_search *arg1 = (user_search *) 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + result = (user *) ((arg1)->hits); + *(user **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_search *arg1 = (user_search *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->hits_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_search *arg1 = (user_search *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + result = ((arg1)->hits_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_search *arg1 = (user_search *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_search *arg1 = (user_search *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_search *arg1 = (user_search *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_search *arg1 = (user_search *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1search(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_search *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_search *)new user_search(); + *(user_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_search *arg1 = (user_search *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_search **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1acknowledged_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + ack_result *arg1 = (ack_result *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->acknowledged = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1acknowledged_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + ack_result *arg1 = (ack_result *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + result = (bool) ((arg1)->acknowledged); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1shards_1acknowledged_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + ack_result *arg1 = (ack_result *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->shards_acknowledged = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1shards_1acknowledged_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + ack_result *arg1 = (ack_result *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + result = (bool) ((arg1)->shards_acknowledged); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ack_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + ack_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (ack_result *)new ack_result(); + *(ack_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ack_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + ack_result *arg1 = (ack_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(ack_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ShardsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + shards_result *arg1 = (shards_result *) 0 ; + shards *arg2 = (shards *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(shards_result **)&jarg1; + arg2 = *(shards **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ShardsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + shards_result *arg1 = (shards_result *) 0 ; + shards *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards_result **)&jarg1; + result = (shards *) ((arg1)->result); + *(shards **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ShardsResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + shards_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (shards_result *)new shards_result(); + *(shards_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ShardsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + shards_result *arg1 = (shards_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(shards_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1strict_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + specification *arg1 = (specification *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->strict = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1strict_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + specification *arg1 = (specification *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + result = (bool) ((arg1)->strict); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1fields_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification *arg1 = (specification *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->fields = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1fields_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification *arg1 = (specification *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + result = (json_object *) ((arg1)->fields); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1validators_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification *arg1 = (specification *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->validators = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1validators_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification *arg1 = (specification *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + result = (json_object *) ((arg1)->validators); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification *)new specification(); + *(specification **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification *arg1 = (specification *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1validation_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification_entry *arg1 = (specification_entry *) 0 ; + specification *arg2 = (specification *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification_entry **)&jarg1; + arg2 = *(specification **)&jarg2; + if (arg1) (arg1)->validation = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1validation_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_entry *arg1 = (specification_entry *) 0 ; + specification *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + result = (specification *) ((arg1)->validation); + *(specification **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + specification_entry *arg1 = (specification_entry *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + specification_entry *arg1 = (specification_entry *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + specification_entry *arg1 = (specification_entry *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + specification_entry *arg1 = (specification_entry *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1entry(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification_entry *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification_entry *)new specification_entry(); + *(specification_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification_entry *arg1 = (specification_entry *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification_entry **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification_result *arg1 = (specification_result *) 0 ; + specification *arg2 = (specification *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification_result **)&jarg1; + arg2 = *(specification **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_result *arg1 = (specification_result *) 0 ; + specification *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_result **)&jarg1; + result = (specification *) ((arg1)->result); + *(specification **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification_result *)new specification_result(); + *(specification_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification_result *arg1 = (specification_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + document *arg2 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(document **)&jarg2; + if (arg1) (arg1)->documents = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (document *) ((arg1)->documents); + *(document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + search_result *arg1 = (search_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->documents_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = ((arg1)->documents_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1fetched_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + search_result *arg1 = (search_result *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->fetched = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1fetched_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (unsigned int) ((arg1)->fetched); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + search_result *arg1 = (search_result *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1aggregations_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->aggregations = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1aggregations_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (json_object *) ((arg1)->aggregations); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1filters_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(search_filters **)&jarg2; + if (arg1) (arg1)->filters = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1filters_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + search_filters *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (search_filters *) ((arg1)->filters); + *(search_filters **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + query_options *arg2 = (query_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(query_options **)&jarg2; + if (arg1) (arg1)->options = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + query_options *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (query_options *) ((arg1)->options); + *(query_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + collection *arg2 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(collection **)&jarg2; + if (arg1) (arg1)->collection = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (collection *) ((arg1)->collection); + *(collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SearchResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_result *)new search_result(); + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SearchResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_result *arg1 = (search_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1profiles_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_profiles_result *arg1 = (search_profiles_result *) 0 ; + profile_search *arg2 = (profile_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_profiles_result **)&jarg1; + arg2 = *(profile_search **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1profiles_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_profiles_result *arg1 = (search_profiles_result *) 0 ; + profile_search *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_profiles_result **)&jarg1; + result = (profile_search *) ((arg1)->result); + *(profile_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1profiles_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_profiles_result *)new search_profiles_result(); + *(search_profiles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_profiles_result *arg1 = (search_profiles_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_profiles_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1roles_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_roles_result *arg1 = (search_roles_result *) 0 ; + role_search *arg2 = (role_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_roles_result **)&jarg1; + arg2 = *(role_search **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1roles_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_roles_result *arg1 = (search_roles_result *) 0 ; + role_search *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_roles_result **)&jarg1; + result = (role_search *) ((arg1)->result); + *(role_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1roles_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_roles_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_roles_result *)new search_roles_result(); + *(search_roles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1roles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_roles_result *arg1 = (search_roles_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_roles_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1users_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_users_result *arg1 = (search_users_result *) 0 ; + user_search *arg2 = (user_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_users_result **)&jarg1; + arg2 = *(user_search **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1users_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_users_result *arg1 = (search_users_result *) 0 ; + user_search *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_users_result **)&jarg1; + result = (user_search *) ((arg1)->result); + *(user_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1users_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_users_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_users_result *)new search_users_result(); + *(search_users_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1users_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_users_result *arg1 = (search_users_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_users_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification_search *arg1 = (specification_search *) 0 ; + specification_entry *arg2 = (specification_entry *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification_search **)&jarg1; + arg2 = *(specification_entry **)&jarg2; + if (arg1) (arg1)->hits = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_search *arg1 = (specification_search *) 0 ; + specification_entry *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + result = (specification_entry *) ((arg1)->hits); + *(specification_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + specification_search *arg1 = (specification_search *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->hits_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_search *arg1 = (specification_search *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + result = ((arg1)->hits_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + specification_search *arg1 = (specification_search *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_search *arg1 = (specification_search *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + specification_search *arg1 = (specification_search *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + specification_search *arg1 = (specification_search *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1search(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification_search *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification_search *)new specification_search(); + *(specification_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification_search *arg1 = (specification_search *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification_search **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification_search_result *arg1 = (specification_search_result *) 0 ; + specification_search *arg2 = (specification_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification_search_result **)&jarg1; + arg2 = *(specification_search **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_search_result *arg1 = (specification_search_result *) 0 ; + specification_search *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search_result **)&jarg1; + result = (specification_search *) ((arg1)->result); + *(specification_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1search_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification_search_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification_search_result *)new specification_search_result(); + *(specification_search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification_search_result *arg1 = (specification_search_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification_search_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1mapping_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + mapping *arg1 = (mapping *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->mapping = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1mapping_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + mapping *arg1 = (mapping *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping **)&jarg1; + result = (json_object *) ((arg1)->mapping); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + mapping *arg1 = (mapping *) 0 ; + collection *arg2 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping **)&jarg1; + arg2 = *(collection **)&jarg2; + if (arg1) (arg1)->collection = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + mapping *arg1 = (mapping *) 0 ; + collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping **)&jarg1; + result = (collection *) ((arg1)->collection); + *(collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1) { + mapping *arg1 = (mapping *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(mapping **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + mapping_result *arg1 = (mapping_result *) 0 ; + mapping *arg2 = (mapping *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping_result **)&jarg1; + arg2 = *(mapping **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + mapping_result *arg1 = (mapping_result *) 0 ; + mapping *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping_result **)&jarg1; + result = (mapping *) ((arg1)->result); + *(mapping **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1mapping_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + mapping_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (mapping_result *)new mapping_result(); + *(mapping_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1mapping_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + mapping_result *arg1 = (mapping_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(mapping_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1persisted_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + collection_entry *arg1 = (collection_entry *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->persisted = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1persisted_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + collection_entry *arg1 = (collection_entry *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + result = (bool) ((arg1)->persisted); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1name_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + collection_entry *arg1 = (collection_entry *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->name; + if (arg2) { + arg1->name = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->name, (const char *)arg2); + } else { + arg1->name = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1name_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + collection_entry *arg1 = (collection_entry *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + result = (char *) ((arg1)->name); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1CollectionsList(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + collection_entry *result = 0 ; + + (void)jenv; + (void)jcls; + result = (collection_entry *)new collection_entry(); + *(collection_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1CollectionsList(JNIEnv *jenv, jclass jcls, jlong jarg1) { + collection_entry *arg1 = (collection_entry *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(collection_entry **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + collection_entry *arg2 = (collection_entry *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection_entry_result **)&jarg1; + arg2 = *(collection_entry **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + collection_entry *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry_result **)&jarg1; + result = (collection_entry *) ((arg1)->result); + *(collection_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1CollectionsListResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + collection_entry_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (collection_entry_result *)new collection_entry_result(); + *(collection_entry_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1CollectionsListResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(collection_entry_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1p_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + _GoString_ *arg1 = (_GoString_ *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(_GoString_ **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + if (arg2) { + arg1->p = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->p, (const char *)arg2); + } else { + arg1->p = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1p_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + _GoString_ *arg1 = (_GoString_ *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(_GoString_ **)&jarg1; + result = (char *) ((arg1)->p); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1n_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + _GoString_ *arg1 = (_GoString_ *) 0 ; + ptrdiff_t arg2 ; + ptrdiff_t *argp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(_GoString_ **)&jarg1; + argp2 = *(ptrdiff_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null ptrdiff_t"); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->n = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1n_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + _GoString_ *arg1 = (_GoString_ *) 0 ; + ptrdiff_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(_GoString_ **)&jarg1; + result = ((arg1)->n); + *(ptrdiff_t **)&jresult = new ptrdiff_t((const ptrdiff_t &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1_1GoString_1(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + _GoString_ *result = 0 ; + + (void)jenv; + (void)jcls; + result = (_GoString_ *)new _GoString_(); + *(_GoString_ **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1_1GoString_1(JNIEnv *jenv, jclass jcls, jlong jarg1) { + _GoString_ *arg1 = (_GoString_ *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(_GoString_ **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_free_1char_1array(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) { + char **arg1 = (char **) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + arg1 = *(char ***)&jarg1; + arg2 = (size_t)jarg2; + free_char_array(arg1,arg2); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_assign_1geopos(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jdouble jarg3, jdouble jarg4) { + double (*arg1)[2] = (double (*)[2]) 0 ; + int arg2 ; + double arg3 ; + double arg4 ; + + (void)jenv; + (void)jcls; + arg1 = *(double (**)[2])&jarg1; + arg2 = (int)jarg2; + arg3 = (double)jarg3; + arg4 = (double)jarg4; + assign_geopos((double (*)[2])arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1t_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoInterface *arg1 = (GoInterface *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoInterface **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->t = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1t_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoInterface *arg1 = (GoInterface *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoInterface **)&jarg1; + result = (void *) ((arg1)->t); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1v_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoInterface *arg1 = (GoInterface *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoInterface **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->v = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1v_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoInterface *arg1 = (GoInterface *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoInterface **)&jarg1; + result = (void *) ((arg1)->v); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GoInterface(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + GoInterface *result = 0 ; + + (void)jenv; + (void)jcls; + result = (GoInterface *)new GoInterface(); + *(GoInterface **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GoInterface(JNIEnv *jenv, jclass jcls, jlong jarg1) { + GoInterface *arg1 = (GoInterface *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(GoInterface **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoSlice *arg1 = (GoSlice *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->data = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoSlice *arg1 = (GoSlice *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + result = (void *) ((arg1)->data); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoSlice *arg1 = (GoSlice *) 0 ; + GoInt arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + arg2 = (GoInt)jarg2; + if (arg1) (arg1)->len = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoSlice *arg1 = (GoSlice *) 0 ; + GoInt result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + result = (GoInt) ((arg1)->len); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoSlice *arg1 = (GoSlice *) 0 ; + GoInt arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + arg2 = (GoInt)jarg2; + if (arg1) (arg1)->cap = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoSlice *arg1 = (GoSlice *) 0 ; + GoInt result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + result = (GoInt) ((arg1)->cap); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GoSlice(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + GoSlice *result = 0 ; + + (void)jenv; + (void)jcls; + result = (GoSlice *)new GoSlice(); + *(GoSlice **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GoSlice(JNIEnv *jenv, jclass jcls, jlong jarg1) { + GoSlice *arg1 = (GoSlice *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(GoSlice **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + kuzzle_set_jwt(arg1,arg2); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1unset_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_unset_jwt(arg1); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_get_jwt(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1login(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + controllers *arg3 = (controllers *) 0 ; + int *arg4 = (int *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers **)&jarg3; + arg4 = *(int **)&jarg4; + result = (string_result *)kuzzle_login(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_logout(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1check_1token(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + token_validity *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (token_validity *)kuzzle_check_token(arg1,arg2); + *(token_validity **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1create_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + controllers *arg3 = (controllers *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_create_my_credentials(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1delete_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_delete_my_credentials(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_get_my_credentials(arg1,arg2,arg3); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + controllers *arg3 = (controllers *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_update_my_credentials(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1validate_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + controllers *arg3 = (controllers *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_validate_my_credentials(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1my_1rights(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (json_result *)kuzzle_get_my_rights(arg1,arg2); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1self(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + user_data *arg2 = (user_data *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(user_data **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_update_self(arg1,arg2,arg3); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1who_1am_1i(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (user_result *)kuzzle_who_am_i(arg1); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterCollection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + collection *arg1 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + unregisterCollection(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jstring jarg4) { + collection *arg1 = (collection *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return ; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return ; + } + kuzzle_new_collection(arg1,arg2,arg3,arg4); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_collection_create(arg1,arg2); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1publish_1message(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + controllers *arg2 = (controllers *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = *(controllers **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_collection_publish_message(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1truncate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_collection_truncate(arg1,arg2); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jlong jarg5) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + room_options *arg3 = (room_options *) 0 ; + kuzzle_notification_listener arg4 = (kuzzle_notification_listener) 0 ; + void *arg5 = (void *) 0 ; + room_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(room_options **)&jarg3; + arg4 = *(kuzzle_notification_listener *)&jarg4; + arg5 = *(void **)&jarg5; + result = (room_result *)kuzzle_collection_subscribe(arg1,arg2,arg3,arg4,arg5); + *(room_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_collection_count(arg1,arg2,arg3); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1create_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + document *arg3 = (document *) 0 ; + query_options *arg4 = (query_options *) 0 ; + document_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(document **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (document_result *)kuzzle_collection_create_document(arg1,arg2,arg3,arg4); + *(document_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1delete_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_collection_delete_document(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1document_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_collection_document_exists(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1fetch_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + document_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (document_result *)kuzzle_collection_fetch_document(arg1,arg2,arg3); + *(document_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1replace_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + document *arg3 = (document *) 0 ; + query_options *arg4 = (query_options *) 0 ; + document_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(document **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (document_result *)kuzzle_collection_replace_document(arg1,arg2,arg3,arg4); + *(document_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1update_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + document *arg3 = (document *) 0 ; + query_options *arg4 = (query_options *) 0 ; + document_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(document **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (document_result *)kuzzle_collection_update_document(arg1,arg2,arg3,arg4); + *(document_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1scroll(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (search_result *)kuzzle_collection_scroll(arg1,arg2,arg3); + *(search_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (search_result *)kuzzle_collection_search(arg1,arg2,arg3); + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1create_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + document **arg2 = (document **) 0 ; + unsigned int arg3 ; + query_options *arg4 = (query_options *) 0 ; + document_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = *(document ***)&jarg2; + arg3 = (unsigned int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (document_array_result *)kuzzle_collection_m_create_document(arg1,arg2,arg3,arg4); + *(document_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1create_1or_1replace_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + document **arg2 = (document **) 0 ; + unsigned int arg3 ; + query_options *arg4 = (query_options *) 0 ; + document_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = *(document ***)&jarg2; + arg3 = (unsigned int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (document_array_result *)kuzzle_collection_m_create_or_replace_document(arg1,arg2,arg3,arg4); + *(document_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1delete_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_array_result *)kuzzle_collection_m_delete_document(arg1,arg2,arg3,arg4); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1get_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + document_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (document_array_result *)kuzzle_collection_m_get_document(arg1,arg2,arg3,arg4); + *(document_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1replace_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + document **arg2 = (document **) 0 ; + unsigned int arg3 ; + query_options *arg4 = (query_options *) 0 ; + document_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = *(document ***)&jarg2; + arg3 = (unsigned int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (document_array_result *)kuzzle_collection_m_replace_document(arg1,arg2,arg3,arg4); + *(document_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1update_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + document **arg2 = (document **) 0 ; + unsigned int arg3 ; + query_options *arg4 = (query_options *) 0 ; + document_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(collection **)&jarg1; + arg2 = *(document ***)&jarg2; + arg3 = (unsigned int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (document_array_result *)kuzzle_collection_m_update_document(arg1,arg2,arg3,arg4); + *(document_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + mapping *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + result = (mapping *)kuzzle_new_mapping(arg1); + *(mapping **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1get_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + query_options *arg2 = (query_options *) 0 ; + mapping_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (mapping_result *)kuzzle_collection_get_mapping(arg1,arg2); + *(mapping_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1mapping_1apply(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + mapping *arg1 = (mapping *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_mapping_apply(arg1,arg2); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1mapping_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + mapping *arg1 = (mapping *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_mapping_refresh(arg1,arg2); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1mapping_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + mapping *arg1 = (mapping *) 0 ; + controllers *arg2 = (controllers *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping **)&jarg1; + arg2 = *(controllers **)&jarg2; + kuzzle_mapping_set(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1delete_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_collection_delete_specifications(arg1,arg2); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1get_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + query_options *arg2 = (query_options *) 0 ; + specification_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (specification_result *)kuzzle_collection_get_specifications(arg1,arg2); + *(specification_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1scroll_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + specification_search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (specification_search_result *)kuzzle_collection_scroll_specifications(arg1,arg2,arg3); + *(specification_search_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1search_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + specification_search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (specification_search_result *)kuzzle_collection_search_specifications(arg1,arg2,arg3); + *(specification_search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1update_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + specification *arg2 = (specification *) 0 ; + query_options *arg3 = (query_options *) 0 ; + specification_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = *(specification **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (specification_result *)kuzzle_collection_update_specifications(arg1,arg2,arg3); + *(specification_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1validate_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + specification *arg2 = (specification *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = *(specification **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_collection_validate_specifications(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1kuzzle_1request(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + kuzzle_free_kuzzle_request(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1query_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + query_object *arg1 = (query_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + kuzzle_free_query_object(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + offline_queue *arg1 = (offline_queue *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + kuzzle_free_offline_queue(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1query_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + query_options *arg1 = (query_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + kuzzle_free_query_options(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1room_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + room_options *arg1 = (room_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + kuzzle_free_room_options(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + options *arg1 = (options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + kuzzle_free_options(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1meta(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + meta *arg1 = (meta *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + kuzzle_free_meta(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1policy_1restriction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + kuzzle_free_policy_restriction(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + policy *arg1 = (policy *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + kuzzle_free_policy(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profile *arg1 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + kuzzle_free_profile(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + role *arg1 = (role *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + kuzzle_free_role(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user *arg1 = (user *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + kuzzle_free_user(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1data(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_data *arg1 = (user_data *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + kuzzle_free_user_data(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + collection *arg1 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + kuzzle_free_collection(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + document *arg1 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + kuzzle_free_document(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + document_result *arg1 = (document_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_result **)&jarg1; + kuzzle_free_document_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1notification_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + notification_content *arg1 = (notification_content *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + kuzzle_free_notification_content(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1notification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + notification_result *arg1 = (notification_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + kuzzle_free_notification_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profile_result *arg1 = (profile_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_result **)&jarg1; + kuzzle_free_profile_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profiles_result *arg1 = (profiles_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profiles_result **)&jarg1; + kuzzle_free_profiles_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + role_result *arg1 = (role_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_result **)&jarg1; + kuzzle_free_role_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1right(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_right *arg1 = (user_right *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + kuzzle_free_user_right(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1rights_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_rights_result *arg1 = (user_rights_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_rights_result **)&jarg1; + kuzzle_free_user_rights_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_result *arg1 = (user_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_result **)&jarg1; + kuzzle_free_user_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1statistics(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + statistics *arg1 = (statistics *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + kuzzle_free_statistics(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1statistics_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + statistics_result *arg1 = (statistics_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics_result **)&jarg1; + kuzzle_free_statistics_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1all_1statistics_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(all_statistics_result **)&jarg1; + kuzzle_free_all_statistics_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1geopos_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + geopos_result *arg1 = (geopos_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + kuzzle_free_geopos_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1token_1validity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + token_validity *arg1 = (token_validity *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + kuzzle_free_token_validity(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1kuzzle_1response(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + kuzzle_free_kuzzle_response(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + json_result *arg1 = (json_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_result **)&jarg1; + kuzzle_free_json_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + json_array_result *arg1 = (json_array_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + kuzzle_free_json_array_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1bool_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + bool_result *arg1 = (bool_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(bool_result **)&jarg1; + kuzzle_free_bool_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1int_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + int_result *arg1 = (int_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_result **)&jarg1; + kuzzle_free_int_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1double_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + double_result *arg1 = (double_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(double_result **)&jarg1; + kuzzle_free_double_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1int_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + int_array_result *arg1 = (int_array_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + kuzzle_free_int_array_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1string_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + string_result *arg1 = (string_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_result **)&jarg1; + kuzzle_free_string_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1string_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + string_array_result *arg1 = (string_array_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + kuzzle_free_string_array_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1filters(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_filters *arg1 = (search_filters *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + kuzzle_free_search_filters(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profile_search *arg1 = (profile_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + kuzzle_free_profile_search(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + role_search *arg1 = (role_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + kuzzle_free_role_search(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1ack_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + ack_result *arg1 = (ack_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + kuzzle_free_ack_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1shards_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + shards_result *arg1 = (shards_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards_result **)&jarg1; + kuzzle_free_shards_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification *arg1 = (specification *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + kuzzle_free_specification(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification_entry *arg1 = (specification_entry *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + kuzzle_free_specification_entry(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification_result *arg1 = (specification_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_result **)&jarg1; + kuzzle_free_specification_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_result *arg1 = (search_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + kuzzle_free_search_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_profiles_result *arg1 = (search_profiles_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_profiles_result **)&jarg1; + kuzzle_free_search_profiles_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1roles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_roles_result *arg1 = (search_roles_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_roles_result **)&jarg1; + kuzzle_free_search_roles_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification_search *arg1 = (specification_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + kuzzle_free_specification_search(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification_search_result *arg1 = (specification_search_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search_result **)&jarg1; + kuzzle_free_specification_search_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + mapping *arg1 = (mapping *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping **)&jarg1; + kuzzle_free_mapping(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1mapping_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + mapping_result *arg1 = (mapping_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping_result **)&jarg1; + kuzzle_free_mapping_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1void_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + void_result *arg1 = (void_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(void_result **)&jarg1; + kuzzle_free_void_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + collection_entry *arg1 = (collection_entry *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + kuzzle_free_collection_entry(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection_1entry_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry_result **)&jarg1; + kuzzle_free_collection_entry_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_search *arg1 = (user_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + kuzzle_free_user_search(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1users_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_users_result *arg1 = (search_users_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_users_result **)&jarg1; + kuzzle_free_search_users_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + document_array_result *arg1 = (document_array_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + kuzzle_free_document_array_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterDocument(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + document *arg1 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + unregisterDocument(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jlong jarg4, jobject jarg4_) { + document *arg1 = (document *) 0 ; + collection *arg2 = (collection *) 0 ; + char *arg3 = (char *) 0 ; + controllers *arg4 = (controllers *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg4_; + arg1 = *(document **)&jarg1; + arg2 = *(collection **)&jarg2; + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return ; + } + arg4 = *(controllers **)&jarg4; + kuzzle_new_document(arg1,arg2,arg3,arg4); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jlong jarg4) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + room_options *arg2 = (room_options *) 0 ; + kuzzle_notification_listener arg3 = (kuzzle_notification_listener) 0 ; + void *arg4 = (void *) 0 ; + room_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(room_options **)&jarg2; + arg3 = *(kuzzle_notification_listener *)&jarg3; + arg4 = *(void **)&jarg4; + result = (room_result *)kuzzle_document_subscribe(arg1,arg2,arg3,arg4); + *(room_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + document_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (document_result *)kuzzle_document_save(arg1,arg2); + *(document_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + document_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (document_result *)kuzzle_document_refresh(arg1,arg2); + *(document_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1publish(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_document_publish(arg1,arg2); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_document_exists(arg1,arg2); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_document_delete(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1set_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3) { + document *arg1 = (document *) 0 ; + controllers *arg2 = (controllers *) 0 ; + _Bool arg3 ; + _Bool *argp3 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(controllers **)&jarg2; + argp3 = *(_Bool **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); + return ; + } + arg3 = *argp3; + kuzzle_document_set_content(arg1,arg2,arg3); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1get_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + controllers *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (controllers *)kuzzle_document_get_content(arg1); + *(controllers **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterIndex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + unregisterIndex(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + kuzzle_new_index(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + char *arg2 = (char *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (void_result *)kuzzle_index_create(arg1,arg2); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + char *arg2 = (char *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (void_result *)kuzzle_index_delete(arg1,arg2); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1mdelete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + result = (string_array_result *)kuzzle_index_mdelete(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + char *arg2 = (char *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (bool_result *)kuzzle_index_exists(arg1,arg2); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + char *arg2 = (char *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (void_result *)kuzzle_index_refresh(arg1,arg2); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1refresh_1internal(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + result = (void_result *)kuzzle_index_refresh_internal(arg1); + *(void_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1set_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + char *arg2 = (char *) 0 ; + _Bool arg3 ; + _Bool *argp3 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + argp3 = *(_Bool **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); + return 0; + } + arg3 = *argp3; + result = (void_result *)kuzzle_index_set_auto_refresh(arg1,arg2,arg3); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1get_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + char *arg2 = (char *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (bool_result *)kuzzle_index_get_auto_refresh(arg1,arg2); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_index *arg1 = (kuzzle_index *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_index **)&jarg1; + result = (string_result *)kuzzle_index_list(arg1); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1new(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + controllers *arg1 = (controllers *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(controllers **)&jarg1; + kuzzle_json_new(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1put(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jint jarg4) { + controllers *arg1 = (controllers *) 0 ; + char *arg2 = (char *) 0 ; + void *arg3 = (void *) 0 ; + int arg4 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(controllers **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + arg3 = *(void **)&jarg3; + arg4 = (int)jarg4; + kuzzle_json_put(arg1,arg2,arg3,arg4); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1string(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jstring jresult = 0 ; + controllers *arg1 = (controllers *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(controllers **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (char *)kuzzle_json_get_string(arg1,arg2); + if (result) jresult = jenv->NewStringUTF((const char *)result); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1int(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jint jresult = 0 ; + controllers *arg1 = (controllers *) 0 ; + char *arg2 = (char *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(controllers **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (int)kuzzle_json_get_int(arg1,arg2); + jresult = (jint)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1double(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jdouble jresult = 0 ; + controllers *arg1 = (controllers *) 0 ; + char *arg2 = (char *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(controllers **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (double)kuzzle_json_get_double(arg1,arg2); + jresult = (jdouble)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1bool(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + controllers *arg1 = (controllers *) 0 ; + char *arg2 = (char *) 0 ; + json_bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(controllers **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = kuzzle_json_get_bool(arg1,arg2); + *(json_bool **)&jresult = new json_bool((const json_bool &)result); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + controllers *arg1 = (controllers *) 0 ; + char *arg2 = (char *) 0 ; + controllers *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(controllers **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (controllers *)kuzzle_json_get_json_object(arg1,arg2); + *(controllers **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + controllers *arg1 = (controllers *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(controllers **)&jarg1; + kuzzle_free_json_object(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterKuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + unregisterKuzzle(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + options *arg4 = (options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return ; + } + arg4 = *(options **)&jarg4; + kuzzle_new_kuzzle(arg1,arg2,arg3,arg4); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_connect(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_disconnect(arg1); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1default_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_get_default_index(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1default_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (int)kuzzle_set_default_index(arg1,arg2); + jresult = (jint)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + offline_queue *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (offline_queue *)kuzzle_get_offline_queue(arg1); + *(offline_queue **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1flush_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_flush_queue(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1replay_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_replay_queue(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1start_1queuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_start_queuing(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1stop_1queuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_stop_queuing(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1add_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jlong jarg4) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + kuzzle_event_listener arg3 = (kuzzle_event_listener) 0 ; + void *arg4 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + arg3 = *(kuzzle_event_listener *)&jarg3; + arg4 = *(void **)&jarg4; + kuzzle_add_listener(arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jlong jarg4) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + kuzzle_event_listener arg3 = (kuzzle_event_listener) 0 ; + void *arg4 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + arg3 = *(kuzzle_event_listener *)&jarg3; + arg4 = *(void **)&jarg4; + kuzzle_once(arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1listener_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + GoInt result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + result = (GoInt)kuzzle_listener_count(arg1,arg2); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1remove_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + void *arg3 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + arg3 = *(void **)&jarg3; + kuzzle_remove_listener(arg1,arg2,arg3); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1remove_1all_1listeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + kuzzle_remove_all_listeners(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_auto_queue(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool arg2 ; + _Bool *argp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + argp2 = *(_Bool **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); + return ; + } + arg2 = *argp2; + kuzzle_set_auto_queue(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1reconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_auto_reconnect(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1resubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_auto_resubscribe(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1replay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_auto_replay(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1replay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool arg2 ; + _Bool *argp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + argp2 = *(_Bool **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); + return ; + } + arg2 = *argp2; + kuzzle_set_auto_replay(arg1,arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1host(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_get_host(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1offline_1queue_1loader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_offline_queue_loader result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (kuzzle_offline_queue_loader)kuzzle_get_offline_queue_loader(arg1); + *(kuzzle_offline_queue_loader *)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1offline_1queue_1loader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_offline_queue_loader arg2 = (kuzzle_offline_queue_loader) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_offline_queue_loader *)&jarg2; + kuzzle_set_offline_queue_loader(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1port(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_port(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_queue_filter result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (kuzzle_queue_filter)kuzzle_get_queue_filter(arg1); + *(kuzzle_queue_filter *)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_queue_filter arg2 = (kuzzle_queue_filter) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_queue_filter *)&jarg2; + kuzzle_set_queue_filter(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1max_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_queue_max_size(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1max_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + kuzzle_set_queue_max_size(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_queue_ttl(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + kuzzle_set_queue_ttl(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1replay_1interval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_replay_interval(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1replay_1interval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + kuzzle_set_replay_interval(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1reconnection_1delay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_reconnection_delay(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1ssl_1connection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_ssl_connection(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + controllers *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (controllers *)kuzzle_get_volatile(arg1); + *(controllers **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle *arg1 = (kuzzle *) 0 ; + controllers *arg2 = (controllers *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(controllers **)&jarg2; + kuzzle_set_volatile(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1append(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_append(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_bitcount(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jlong jarg6, jobject jarg6_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char **arg4 = (char **) 0 ; + size_t arg5 ; + query_options *arg6 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg6_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(char ***)&jarg4; + arg5 = (size_t)jarg5; + arg6 = *(query_options **)&jarg6; + result = (int_result *)kuzzle_ms_bitop(arg1,arg2,arg3,arg4,arg5,arg6); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitpos(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jshort jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned char arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (unsigned char)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_bitpos(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1dbsize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (int_result *)kuzzle_ms_dbsize(arg1,arg2); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1decr(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_decr(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1decrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_decrby(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1del(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_del(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_exists(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1expire(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned long arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (unsigned long)jarg3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_expire(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1expireat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jobject jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned long long arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return 0; + } + clazz = jenv->GetObjectClass(jarg3); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg3 = 0; + if (sz > 0) { + arg3 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_expireat(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1flushdb(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (void_result *)kuzzle_ms_flushdb(arg1,arg2); + *(void_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geoadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + controllers **arg3 = (controllers **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_geoadd(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geodist(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (double_result *)kuzzle_ms_geodist(arg1,arg2,arg3,arg4,arg5); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geohash(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_geohash(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geopos(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + geopos_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (geopos_result *)kuzzle_ms_geopos(arg1,arg2,arg3,arg4,arg5); + *(geopos_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1georadius(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jdouble jarg5, jstring jarg6, jlong jarg7, jobject jarg7_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + double arg4 ; + double arg5 ; + char *arg6 = (char *) 0 ; + query_options *arg7 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg7_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = (double)jarg4; + arg5 = (double)jarg5; + arg6 = 0; + if (jarg6) { + arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); + if (!arg6) return 0; + } + arg7 = *(query_options **)&jarg7; + result = (json_array_result *)kuzzle_ms_georadius(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1georadiusbymember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + double arg4 ; + char *arg5 = (char *) 0 ; + query_options *arg6 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg6_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (double)jarg4; + arg5 = 0; + if (jarg5) { + arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); + if (!arg5) return 0; + } + arg6 = *(query_options **)&jarg6; + result = (json_array_result *)kuzzle_ms_georadiusbymember(arg1,arg2,arg3,arg4,arg5,arg6); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_ms_get(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getbit(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_getbit(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + int arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = (int)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_result *)kuzzle_ms_getrange(arg1,arg2,arg3,arg4,arg5); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_getset(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hdel(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_hdel(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hexists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_hexists(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_hget(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hgetall(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_ms_hgetall(arg1,arg2,arg3); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hincrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_hincrby(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hincrbyfloat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (double_result *)kuzzle_ms_hincrbyfloat(arg1,arg2,arg3,arg4,arg5); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hkeys(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_hkeys(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_hlen(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_hmget(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + controllers **arg3 = (controllers **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_hmset(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_ms_hscan(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (bool_result *)kuzzle_ms_hset(arg1,arg2,arg3,arg4,arg5); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hsetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (bool_result *)kuzzle_ms_hsetnx(arg1,arg2,arg3,arg4,arg5); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hstrlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_hstrlen(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hvals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_hvals(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incr(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_incr(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_incrby(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incrbyfloat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + query_options *arg4 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = *(query_options **)&jarg4; + result = (double_result *)kuzzle_ms_incrbyfloat(arg1,arg2,arg3,arg4); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1keys(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_keys(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lindex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_lindex(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1linsert(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + char *arg5 = (char *) 0 ; + query_options *arg6 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg6_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = 0; + if (jarg5) { + arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); + if (!arg5) return 0; + } + arg6 = *(query_options **)&jarg6; + result = (int_result *)kuzzle_ms_linsert(arg1,arg2,arg3,arg4,arg5,arg6); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1llen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_llen(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_ms_lpop(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_lpush(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpushx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_lpushx(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_lrange(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lrem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_lrem(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_lset(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ltrim(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_ltrim(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_array_result *)kuzzle_ms_mget(arg1,arg2,arg3,arg4); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + controllers **arg2 = (controllers **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(controllers ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (void_result *)kuzzle_ms_mset(arg1,arg2,arg3,arg4); + *(void_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1msetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + controllers **arg2 = (controllers **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(controllers ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_msetnx(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_object(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1persist(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_ms_persist(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pexpire(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned long arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (unsigned long)jarg3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_pexpire(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pexpireat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jobject jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned long long arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return 0; + } + clazz = jenv->GetObjectClass(jarg3); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg3 = 0; + if (sz > 0) { + arg3 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_pexpireat(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (bool_result *)kuzzle_ms_pfadd(arg1,arg2,arg3,arg4,arg5); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_pfcount(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfmerge(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_pfmerge(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_ms_ping(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1psetex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + unsigned long arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (unsigned long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_psetex(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_pttl(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1randomkey(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_ms_randomkey(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rename(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (void_result *)kuzzle_ms_rename(arg1,arg2,arg3,arg4); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1renamenx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_renamenx(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_ms_rpop(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpoplpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_rpoplpush(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_rpush(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpushx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_rpushx(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_sadd(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1scan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_ms_scan(arg1,arg2,arg3); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1scard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_scard(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sdiff(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_sdiff(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sdiffstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + char *arg5 = (char *) 0 ; + query_options *arg6 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg6_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = 0; + if (jarg5) { + arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); + if (!arg5) return 0; + } + arg6 = *(query_options **)&jarg6; + result = (int_result *)kuzzle_ms_sdiffstore(arg1,arg2,arg3,arg4,arg5,arg6); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (void_result *)kuzzle_ms_set(arg1,arg2,arg3,arg4); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1setex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + unsigned long arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (unsigned long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_setex(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1setnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_setnx(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sinter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_array_result *)kuzzle_ms_sinter(arg1,arg2,arg3,arg4); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sinterstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_sinterstore(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sismember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_sismember(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1smembers(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_smembers(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1smove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (bool_result *)kuzzle_ms_smove(arg1,arg2,arg3,arg4,arg5); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sort(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_sort(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1spop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_spop(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1srandmember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_srandmember(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1srem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_srem(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_ms_sscan(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1strlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_strlen(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sunion(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_array_result *)kuzzle_ms_sunion(arg1,arg2,arg3,arg4); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sunionstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_sunionstore(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1time(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + int_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (int_array_result *)kuzzle_ms_time(arg1,arg2); + *(int_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1touch(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_touch(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_ttl(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1type(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_ms_type(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + controllers **arg3 = (controllers **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zadd(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zcard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_zcard(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zcount(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zincrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (double_result *)kuzzle_ms_zincrby(arg1,arg2,arg3,arg4,arg5); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zinterstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zinterstore(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zlexcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zlexcount(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (json_array_result *)kuzzle_ms_zrange(arg1,arg2,arg3,arg4,arg5); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_zrangebylex(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (json_array_result *)kuzzle_ms_zrangebyscore(arg1,arg2,arg3,arg4,arg5); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_zrank(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zrem(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zremrangebylex(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebyrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zremrangebyrank(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zremrangebyscore(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (json_array_result *)kuzzle_ms_zrevrange(arg1,arg2,arg3,arg4,arg5); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_zrevrangebylex(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (json_array_result *)kuzzle_ms_zrevrangebyscore(arg1,arg2,arg3,arg4,arg5); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_zrevrank(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_ms_zscan(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (double_result *)kuzzle_ms_zscore(arg1,arg2,arg3,arg4); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1options(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (options *)kuzzle_new_options(); + *(options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1query(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_request *arg2 = (kuzzle_request *) 0 ; + query_options *arg3 = (query_options *) 0 ; + kuzzle_response *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_request **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (kuzzle_response *)kuzzle_query(arg1,arg2,arg3); + *(kuzzle_response **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterRoom(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + room *arg1 = (room *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + unregisterRoom(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1new_1room(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + room *arg1 = (room *) 0 ; + collection *arg2 = (collection *) 0 ; + controllers *arg3 = (controllers *) 0 ; + room_options *arg4 = (room_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(room **)&jarg1; + arg2 = *(collection **)&jarg2; + arg3 = *(controllers **)&jarg3; + arg4 = *(room_options **)&jarg4; + room_new_room(arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + result = (int_result *)room_count(arg1); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1on_1done(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { + room *arg1 = (room *) 0 ; + kuzzle_subscribe_listener arg2 = (kuzzle_subscribe_listener) 0 ; + void *arg3 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + arg2 = *(kuzzle_subscribe_listener *)&jarg2; + arg3 = *(void **)&jarg3; + room_on_done(arg1,arg2,arg3); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { + room *arg1 = (room *) 0 ; + kuzzle_notification_listener arg2 = (kuzzle_notification_listener) 0 ; + void *arg3 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + arg2 = *(kuzzle_notification_listener *)&jarg2; + arg3 = *(void **)&jarg3; + room_subscribe(arg1,arg2,arg3); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1unsubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + result = (void_result *)room_unsubscribe(arg1); + *(void_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1list_1collections(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + collection_entry_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (collection_entry_result *)kuzzle_list_collections(arg1,arg2,arg3); + *(collection_entry_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1list_1indexes(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_array_result *)kuzzle_list_indexes(arg1,arg2); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_get_auto_refresh(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1server_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (json_result *)kuzzle_get_server_info(arg1,arg2); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1all_1statistics(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + all_statistics_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (all_statistics_result *)kuzzle_get_all_statistics(arg1,arg2); + *(all_statistics_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1statistics(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + time_t arg2 ; + time_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + time_t *argp2 ; + time_t *argp3 ; + statistics_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + arg4 = *(query_options **)&jarg4; + result = (statistics_result *)kuzzle_get_statistics(arg1,arg2,arg3,arg4); + *(statistics_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1now(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + date_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (date_result *)kuzzle_now(arg1,arg2); + *(date_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1search_1result_1fetch_1next(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (search_result *)kuzzle_search_result_fetch_next(arg1); + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + policy *arg3 = (policy *) 0 ; + size_t arg4 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(policy **)&jarg3; + arg4 = (size_t)jarg4; + result = (profile *)kuzzle_security_new_profile(arg1,arg2,arg3,arg4); + *(profile **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profile *arg1 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + kuzzle_security_destroy_profile(arg1); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + profile_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (profile_result *)kuzzle_security_fetch_profile(arg1,arg2,arg3); + *(profile_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1scroll_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (search_profiles_result *)kuzzle_security_scroll_profiles(arg1,arg2,arg3); + *(search_profiles_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (search_profiles_result *)kuzzle_security_search_profiles(arg1,arg2,arg3); + *(search_profiles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1add_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + policy *arg2 = (policy *) 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(policy **)&jarg2; + result = (profile *)kuzzle_security_profile_add_policy(arg1,arg2); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_security_profile_delete(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + query_options *arg2 = (query_options *) 0 ; + profile_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (profile_result *)kuzzle_security_profile_save(arg1,arg2); + *(profile_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + controllers *arg3 = (controllers *) 0 ; + role *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers **)&jarg3; + result = (role *)kuzzle_security_new_role(arg1,arg2,arg3); + *(role **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + role *arg1 = (role *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + kuzzle_security_destroy_role(arg1); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + role_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (role_result *)kuzzle_security_fetch_role(arg1,arg2,arg3); + *(role_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1roles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_roles_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (search_roles_result *)kuzzle_security_search_roles(arg1,arg2,arg3); + *(search_roles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1role_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + role *arg1 = (role *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_security_role_delete(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1role_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + role *arg1 = (role *) 0 ; + query_options *arg2 = (query_options *) 0 ; + role_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (role_result *)kuzzle_security_role_save(arg1,arg2); + *(role_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + user_data *arg3 = (user_data *) 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(user_data **)&jarg3; + result = (user *)kuzzle_security_new_user(arg1,arg2,arg3); + *(user **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user *arg1 = (user *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + kuzzle_security_destroy_user(arg1); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (user_result *)kuzzle_security_fetch_user(arg1,arg2,arg3); + *(user_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1scroll_1users(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_users_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (search_users_result *)kuzzle_security_scroll_users(arg1,arg2,arg3); + *(search_users_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1users(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_users_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (search_users_result *)kuzzle_security_search_users(arg1,arg2,arg3); + *(search_users_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (user_result *)kuzzle_security_user_create(arg1,arg2); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + controllers *arg3 = (controllers *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_security_user_create_credentials(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1with_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + controllers *arg2 = (controllers *) 0 ; + query_options *arg3 = (query_options *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(user **)&jarg1; + arg2 = *(controllers **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (user_result *)kuzzle_security_user_create_with_credentials(arg1,arg2,arg3); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_security_user_delete(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1delete_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_security_user_delete_credentials(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1credentials_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_security_user_get_credentials_info(arg1,arg2,arg3); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (profiles_result *)kuzzle_security_user_get_profiles(arg1,arg2); + *(profiles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1rights(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + user_rights_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (user_rights_result *)kuzzle_security_user_get_rights(arg1,arg2); + *(user_rights_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1has_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_security_user_has_credentials(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1replace(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (user_result *)kuzzle_security_user_replace(arg1,arg2); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1update_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + controllers *arg3 = (controllers *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(controllers **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_security_update_credentials(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1is_1action_1allowed(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6) { + jlong jresult = 0 ; + user_right **arg1 = (user_right **) 0 ; + unsigned int arg2 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + char *arg5 = (char *) 0 ; + char *arg6 = (char *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + arg1 = *(user_right ***)&jarg1; + arg2 = (unsigned int)jarg2; + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = 0; + if (jarg5) { + arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); + if (!arg5) return 0; + } + arg6 = 0; + if (jarg6) { + arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); + if (!arg6) return 0; + } + result = (unsigned int)kuzzle_security_is_action_allowed(arg1,arg2,arg3,arg4,arg5,arg6); + jresult = (jlong)result; + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); + if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::NotificationListener **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1onMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; + notification_result *arg2 = (notification_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::NotificationListener **)&jarg1; + arg2 = *(notification_result **)&jarg2; + ((kuzzleio::NotificationListener const *)arg1)->onMessage(arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotificationListener(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::NotificationListener *)new SwigDirector_NotificationListener(jenv); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { + kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); + (void)jcls; + SwigDirector_NotificationListener *director = dynamic_cast(obj); + if (director) { + director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { + kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); + SwigDirector_NotificationListener *director = dynamic_cast(obj); + (void)jcls; + if (director) { + director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1EventListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::EventListener **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1trigger(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::EventListener **)&jarg1; + arg2 = *(json_object **)&jarg2; + ((kuzzleio::EventListener const *)arg1)->trigger(arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1EventListener(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::EventListener *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::EventListener *)new SwigDirector_EventListener(jenv); + *(kuzzleio::EventListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { + kuzzleio::EventListener *obj = *((kuzzleio::EventListener **)&objarg); + (void)jcls; + SwigDirector_EventListener *director = dynamic_cast(obj); + if (director) { + director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { + kuzzleio::EventListener *obj = *((kuzzleio::EventListener **)&objarg); + SwigDirector_EventListener *director = dynamic_cast(obj); + (void)jcls; + if (director) { + director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SubscribeListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::SubscribeListener *arg1 = (kuzzleio::SubscribeListener *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::SubscribeListener **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1onSubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::SubscribeListener *arg1 = (kuzzleio::SubscribeListener *) 0 ; + room_result *arg2 = (room_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::SubscribeListener **)&jarg1; + arg2 = *(room_result **)&jarg2; + ((kuzzleio::SubscribeListener const *)arg1)->onSubscribe(arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SubscribeListener(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::SubscribeListener *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::SubscribeListener *)new SwigDirector_SubscribeListener(jenv); + *(kuzzleio::SubscribeListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { + kuzzleio::SubscribeListener *obj = *((kuzzleio::SubscribeListener **)&objarg); + (void)jcls; + SwigDirector_SubscribeListener *director = dynamic_cast(obj); + if (director) { + director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { + kuzzleio::SubscribeListener *obj = *((kuzzleio::SubscribeListener **)&objarg); + SwigDirector_SubscribeListener *director = dynamic_cast(obj); + (void)jcls; + if (director) { + director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); + } +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_PARTIAL_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(206); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_BAD_1REQUEST_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(400); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_UNAUTHORIZED_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(401); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_FORBIDDEN_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(403); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_NOT_1FOUND_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(404); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_PRECONDITION_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(412); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_SIZE_1LIMIT_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(413); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_INTERNAL_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(500); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_SERVICE_1UNAVAILABLE_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(503); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_GATEWAY_1TIMEOUT_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(504); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jint jarg1, jstring jarg2) { + jlong jresult = 0 ; + int arg1 ; + std::string *arg2 = 0 ; + kuzzleio::KuzzleException *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = (int)jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(arg1,(std::string const &)*arg2); + *(kuzzleio::KuzzleException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jint jarg1) { + jlong jresult = 0 ; + int arg1 ; + kuzzleio::KuzzleException *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = (int)jarg1; + result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(arg1); + *(kuzzleio::KuzzleException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_12(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::KuzzleException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(); + *(kuzzleio::KuzzleException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::KuzzleException *arg1 = 0 ; + kuzzleio::KuzzleException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::KuzzleException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::KuzzleException const & reference is null"); + return 0; + } + result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException((kuzzleio::KuzzleException const &)*arg1); + *(kuzzleio::KuzzleException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::KuzzleException *arg1 = (kuzzleio::KuzzleException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::KuzzleException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleException_1getMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::KuzzleException *arg1 = (kuzzleio::KuzzleException *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::KuzzleException **)&jarg1; + result = ((kuzzleio::KuzzleException const *)arg1)->getMessage(); + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::BadRequestException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException((std::string const &)*arg1); + *(kuzzleio::BadRequestException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::BadRequestException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException(); + *(kuzzleio::BadRequestException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::BadRequestException *arg1 = 0 ; + kuzzleio::BadRequestException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::BadRequestException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::BadRequestException const & reference is null"); + return 0; + } + result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException((kuzzleio::BadRequestException const &)*arg1); + *(kuzzleio::BadRequestException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1BadRequestException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::BadRequestException *arg1 = (kuzzleio::BadRequestException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::BadRequestException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::ForbiddenException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException((std::string const &)*arg1); + *(kuzzleio::ForbiddenException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::ForbiddenException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException(); + *(kuzzleio::ForbiddenException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::ForbiddenException *arg1 = 0 ; + kuzzleio::ForbiddenException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::ForbiddenException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::ForbiddenException const & reference is null"); + return 0; + } + result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException((kuzzleio::ForbiddenException const &)*arg1); + *(kuzzleio::ForbiddenException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ForbiddenException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::ForbiddenException *arg1 = (kuzzleio::ForbiddenException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::ForbiddenException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::GatewayTimeoutException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException((std::string const &)*arg1); + *(kuzzleio::GatewayTimeoutException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::GatewayTimeoutException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException(); + *(kuzzleio::GatewayTimeoutException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::GatewayTimeoutException *arg1 = 0 ; + kuzzleio::GatewayTimeoutException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::GatewayTimeoutException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::GatewayTimeoutException const & reference is null"); + return 0; + } + result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException((kuzzleio::GatewayTimeoutException const &)*arg1); + *(kuzzleio::GatewayTimeoutException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GatewayTimeoutException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::GatewayTimeoutException *arg1 = (kuzzleio::GatewayTimeoutException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::GatewayTimeoutException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::InternalException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::InternalException *)new kuzzleio::InternalException((std::string const &)*arg1); + *(kuzzleio::InternalException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::InternalException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::InternalException *)new kuzzleio::InternalException(); + *(kuzzleio::InternalException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::InternalException *arg1 = 0 ; + kuzzleio::InternalException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::InternalException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::InternalException const & reference is null"); + return 0; + } + result = (kuzzleio::InternalException *)new kuzzleio::InternalException((kuzzleio::InternalException const &)*arg1); + *(kuzzleio::InternalException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1InternalException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::InternalException *arg1 = (kuzzleio::InternalException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::InternalException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::NotFoundException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException((std::string const &)*arg1); + *(kuzzleio::NotFoundException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::NotFoundException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException(); + *(kuzzleio::NotFoundException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::NotFoundException *arg1 = 0 ; + kuzzleio::NotFoundException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::NotFoundException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::NotFoundException const & reference is null"); + return 0; + } + result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException((kuzzleio::NotFoundException const &)*arg1); + *(kuzzleio::NotFoundException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotFoundException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::NotFoundException *arg1 = (kuzzleio::NotFoundException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::NotFoundException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::PartialException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::PartialException *)new kuzzleio::PartialException((std::string const &)*arg1); + *(kuzzleio::PartialException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::PartialException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::PartialException *)new kuzzleio::PartialException(); + *(kuzzleio::PartialException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::PartialException *arg1 = 0 ; + kuzzleio::PartialException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::PartialException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::PartialException const & reference is null"); + return 0; + } + result = (kuzzleio::PartialException *)new kuzzleio::PartialException((kuzzleio::PartialException const &)*arg1); + *(kuzzleio::PartialException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1PartialException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::PartialException *arg1 = (kuzzleio::PartialException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::PartialException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::PreconditionException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException((std::string const &)*arg1); + *(kuzzleio::PreconditionException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::PreconditionException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException(); + *(kuzzleio::PreconditionException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::PreconditionException *arg1 = 0 ; + kuzzleio::PreconditionException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::PreconditionException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::PreconditionException const & reference is null"); + return 0; + } + result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException((kuzzleio::PreconditionException const &)*arg1); + *(kuzzleio::PreconditionException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1PreconditionException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::PreconditionException *arg1 = (kuzzleio::PreconditionException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::PreconditionException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::ServiceUnavailableException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException((std::string const &)*arg1); + *(kuzzleio::ServiceUnavailableException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::ServiceUnavailableException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException(); + *(kuzzleio::ServiceUnavailableException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::ServiceUnavailableException *arg1 = 0 ; + kuzzleio::ServiceUnavailableException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::ServiceUnavailableException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::ServiceUnavailableException const & reference is null"); + return 0; + } + result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException((kuzzleio::ServiceUnavailableException const &)*arg1); + *(kuzzleio::ServiceUnavailableException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ServiceUnavailableException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::ServiceUnavailableException *arg1 = (kuzzleio::ServiceUnavailableException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::ServiceUnavailableException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::SizeLimitException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException((std::string const &)*arg1); + *(kuzzleio::SizeLimitException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::SizeLimitException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException(); + *(kuzzleio::SizeLimitException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::SizeLimitException *arg1 = 0 ; + kuzzleio::SizeLimitException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::SizeLimitException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::SizeLimitException const & reference is null"); + return 0; + } + result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException((kuzzleio::SizeLimitException const &)*arg1); + *(kuzzleio::SizeLimitException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SizeLimitException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::SizeLimitException *arg1 = (kuzzleio::SizeLimitException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::SizeLimitException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::UnauthorizedException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException((std::string const &)*arg1); + *(kuzzleio::UnauthorizedException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::UnauthorizedException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException(); + *(kuzzleio::UnauthorizedException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::UnauthorizedException *arg1 = 0 ; + kuzzleio::UnauthorizedException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::UnauthorizedException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::UnauthorizedException const & reference is null"); + return 0; + } + result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException((kuzzleio::UnauthorizedException const &)*arg1); + *(kuzzleio::UnauthorizedException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1UnauthorizedException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::UnauthorizedException *arg1 = (kuzzleio::UnauthorizedException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::UnauthorizedException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jint jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + result = (int)(arg1)->listenerCount(arg2); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleEventEmitter(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->_kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzle *) ((arg1)->_kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Kuzzle_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + options *arg2 = (options *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg2_; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + arg2 = *(options **)&jarg2; + result = (kuzzleio::Kuzzle *)new kuzzleio::Kuzzle((std::string const &)*arg1,arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Kuzzle_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::Kuzzle *)new kuzzleio::Kuzzle((std::string const &)*arg1); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1checkToken(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + token_validity *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (token_validity *)(arg1)->checkToken((std::string const &)*arg2); + *(token_validity **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (char *)(arg1)->connect(); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + try { + result = (json_object *)(arg1)->createMyCredentials((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (json_object *)(arg1)->createMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1deleteMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (bool)(arg1)->deleteMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1deleteMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (bool)(arg1)->deleteMyCredentials((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (json_object *)(arg1)->getMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (json_object *)(arg1)->getMyCredentials((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + try { + result = (json_object *)(arg1)->updateMyCredentials((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (json_object *)(arg1)->updateMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1validateMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + try { + result = (bool)(arg1)->validateMyCredentials((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1validateMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (bool)(arg1)->validateMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1login_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jint jarg4) { + jstring jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + int arg4 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + arg4 = (int)jarg4; + try { + result = (arg1)->login((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1login_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jstring jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (arg1)->login((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAllStatistics_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (statistics *)(arg1)->getAllStatistics(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAllStatistics_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (statistics *)(arg1)->getAllStatistics(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getStatistics_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + time_t arg2 ; + time_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + time_t *argp2 ; + time_t *argp3 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + arg4 = *(query_options **)&jarg4; + try { + result = (statistics *)(arg1)->getStatistics(arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getStatistics_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + time_t arg2 ; + time_t arg3 ; + time_t *argp2 ; + time_t *argp3 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + try { + result = (statistics *)(arg1)->getStatistics(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAutoRefresh_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAutoRefresh_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (arg1)->getJwt(); + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (json_object *)(arg1)->getMyRights(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (json_object *)(arg1)->getMyRights(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getServerInfo_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (json_object *)(arg1)->getServerInfo(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getServerInfo_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (json_object *)(arg1)->getServerInfo(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + collection_entry *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (collection_entry *)(arg1)->listCollections((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(collection_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + collection_entry *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (collection_entry *)(arg1)->listCollections((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(collection_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::vector< std::string > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (arg1)->listIndexes(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::vector< std::string > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (arg1)->listIndexes(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + (arg1)->disconnect(); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + (arg1)->logout(); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzle_request *arg2 = (kuzzle_request *) 0 ; + query_options *arg3 = (query_options *) 0 ; + kuzzle_response *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(kuzzle_request **)&jarg2; + arg3 = *(query_options **)&jarg3; + try { + result = (kuzzle_response *)(arg1)->query(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzle_response **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzle_request *arg2 = (kuzzle_request *) 0 ; + kuzzle_response *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(kuzzle_request **)&jarg2; + try { + result = (kuzzle_response *)(arg1)->query(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzle_response **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1now_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (long long)(arg1)->now(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1now_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (long long)(arg1)->now(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1replayQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->replayQueue(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setAutoReplay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + bool arg2 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = jarg2 ? true : false; + result = (kuzzleio::Kuzzle *)(arg1)->setAutoReplay(arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setDefaultIndex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (kuzzleio::Kuzzle *)(arg1)->setDefaultIndex((std::string const &)*arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (kuzzleio::Kuzzle *)(arg1)->setJwt((std::string const &)*arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1startQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->startQueuing(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1stopQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->stopQueuing(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1unsetJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->unsetJwt(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + user_data *arg2 = (user_data *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(user_data **)&jarg2; + arg3 = *(query_options **)&jarg3; + try { + result = (json_object *)(arg1)->updateSelf(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + user_data *arg2 = (user_data *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(user_data **)&jarg2; + try { + result = (json_object *)(arg1)->updateSelf(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1whoAmI(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (user *)(arg1)->whoAmI(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(user **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1flushQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->flushQueue(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (json_object *)(arg1)->getVolatile(); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + json_object *arg2 = (json_object *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(json_object **)&jarg2; + result = (kuzzleio::Kuzzle *)(arg1)->setVolatile(arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + SwigValueWrapper< std::map< int,kuzzleio::EventListener * > > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (arg1)->getListeners(); + *(std::map< int,kuzzleio::EventListener * > **)&jresult = new std::map< int,kuzzleio::EventListener * >((const std::map< int,kuzzleio::EventListener * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jint jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + result = (int)(arg1)->listenerCount(arg2); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + collection *arg2 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(collection **)&jarg2; + if (arg1) (arg1)->_collection = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + result = (collection *) ((arg1)->_collection); + *(collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1listener_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(kuzzleio::NotificationListener **)&jarg2; + if (arg1) (arg1)->_listener_instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1listener_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + result = (kuzzleio::NotificationListener *) ((arg1)->_listener_instance); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + kuzzleio::Collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + result = (kuzzleio::Collection *)new kuzzleio::Collection(arg1,(std::string const &)*arg2,(std::string const &)*arg3); + *(kuzzleio::Collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Collection **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jint jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + try { + result = (int)(arg1)->count(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jint jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + try { + result = (int)(arg1)->count(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; + std::string *arg3 = 0 ; + query_options *arg4 = (query_options *) 0 ; + kuzzleio::Collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg4_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(kuzzleio::Document **)&jarg2; + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + arg4 = *(query_options **)&jarg4; + try { + result = (kuzzleio::Collection *)(arg1)->createDocument(arg2,(std::string const &)*arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; + std::string *arg3 = 0 ; + kuzzleio::Collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(kuzzleio::Document **)&jarg2; + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + result = (kuzzleio::Collection *)(arg1)->createDocument(arg2,(std::string const &)*arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; + kuzzleio::Collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(kuzzleio::Document **)&jarg2; + try { + result = (kuzzleio::Collection *)(arg1)->createDocument(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jstring jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->deleteDocument((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jstring jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (arg1)->deleteDocument((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (kuzzleio::Document *)(arg1)->fetchDocument((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (kuzzleio::Document *)(arg1)->fetchDocument((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->mCreateDocument(*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + try { + result = (arg1)->mCreateDocument(*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->mCreateOrReplaceDocument(*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + try { + result = (arg1)->mCreateOrReplaceDocument(*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< std::string > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< std::string > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->mDeleteDocument(*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< std::string > *arg2 = 0 ; + std::vector< std::string > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); + return 0; + } + try { + result = (arg1)->mDeleteDocument(*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< std::string > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->mGetDocument(*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< std::string > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); + return 0; + } + try { + result = (arg1)->mGetDocument(*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->mReplaceDocument(*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + try { + result = (arg1)->mReplaceDocument(*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->mUpdateDocument(*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + try { + result = (arg1)->mUpdateDocument(*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessage_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + json_object *arg2 = (json_object *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(json_object **)&jarg2; + arg3 = *(query_options **)&jarg3; + try { + result = (bool)(arg1)->publishMessage(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessage_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + json_object *arg2 = (json_object *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(json_object **)&jarg2; + try { + result = (bool)(arg1)->publishMessage(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + query_options *arg4 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(kuzzleio::Document **)&jarg3; + arg4 = *(query_options **)&jarg4; + try { + result = (kuzzleio::Document *)(arg1)->replaceDocument((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(kuzzleio::Document **)&jarg3; + try { + result = (kuzzleio::Document *)(arg1)->replaceDocument((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (search_result *)(arg1)->scroll((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (search_result *)(arg1)->scroll((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + try { + result = (search_result *)(arg1)->search(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + try { + result = (search_result *)(arg1)->search(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; + room_options *arg4 = (room_options *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(kuzzleio::NotificationListener **)&jarg3; + arg4 = *(room_options **)&jarg4; + try { + result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(kuzzleio::NotificationListener **)&jarg3; + try { + result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1getListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + result = (kuzzleio::NotificationListener *)(arg1)->getListener(); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + query_options *arg4 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(kuzzleio::Document **)&jarg3; + arg4 = *(query_options **)&jarg4; + try { + result = (kuzzleio::Document *)(arg1)->updateDocument((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(kuzzleio::Document **)&jarg3; + try { + result = (kuzzleio::Document *)(arg1)->updateDocument((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + json_object *arg2 = (json_object *) 0 ; + room_options *arg3 = (room_options *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(json_object **)&jarg2; + arg3 = *(room_options **)&jarg3; + result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2,arg3); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + json_object *arg2 = (json_object *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(json_object **)&jarg2; + result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + result = (kuzzleio::Room *)new kuzzleio::Room(arg1); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + kuzzleio::SubscribeListener *arg2 = (kuzzleio::SubscribeListener *) 0 ; + kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(room **)&jarg1; + arg2 = *(kuzzleio::SubscribeListener **)&jarg2; + arg3 = *(kuzzleio::NotificationListener **)&jarg3; + result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2,arg3); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Room(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Room **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Room **)&jarg1; + try { + result = (int)(arg1)->count(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1getSubscribeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::SubscribeListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Room **)&jarg1; + result = (kuzzleio::SubscribeListener *)(arg1)->getSubscribeListener(); + *(kuzzleio::SubscribeListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1getNotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Room **)&jarg1; + result = (kuzzleio::NotificationListener *)(arg1)->getNotificationListener(); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1onDone(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::SubscribeListener *arg2 = (kuzzleio::SubscribeListener *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Room **)&jarg1; + arg2 = *(kuzzleio::SubscribeListener **)&jarg2; + result = (kuzzleio::Room *)(arg1)->onDone(arg2); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Room **)&jarg1; + arg2 = *(kuzzleio::NotificationListener **)&jarg2; + result = (kuzzleio::Room *)(arg1)->subscribe(arg2); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Room **)&jarg1; + try { + (arg1)->unsubscribe(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1_1document_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + document *arg2 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(document **)&jarg2; + if (arg1) (arg1)->_document = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1_1document_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + result = (document *) ((arg1)->_document); + *(document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (kuzzleio::Document *)new kuzzleio::Document(arg1,(std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (kuzzleio::Document *)new kuzzleio::Document(arg1,(std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + try { + result = (kuzzleio::Document *)new kuzzleio::Document(arg1); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Document(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Document **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (arg1)->delete_(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + try { + result = (arg1)->delete_(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (bool)(arg1)->exists(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + try { + result = (bool)(arg1)->exists(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (bool)(arg1)->publish(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + try { + result = (bool)(arg1)->publish(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (kuzzleio::Document *)(arg1)->refresh(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + try { + result = (kuzzleio::Document *)(arg1)->refresh(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (kuzzleio::Document *)(arg1)->save(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + try { + result = (kuzzleio::Document *)(arg1)->save(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1setContent_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jboolean jarg3) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + json_object *arg2 = (json_object *) 0 ; + bool arg3 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(json_object **)&jarg2; + arg3 = jarg3 ? true : false; + result = (kuzzleio::Document *)(arg1)->setContent(arg2,arg3); + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1setContent_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + json_object *arg2 = (json_object *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(json_object **)&jarg2; + result = (kuzzleio::Document *)(arg1)->setContent(arg2); + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1getContent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + result = (json_object *)(arg1)->getContent(); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1subscribe_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; + room_options *arg3 = (room_options *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(kuzzleio::NotificationListener **)&jarg2; + arg3 = *(room_options **)&jarg3; + result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1subscribe_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(kuzzleio::NotificationListener **)&jarg2; + result = (kuzzleio::Room *)(arg1)->subscribe(arg2); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1getListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + result = (kuzzleio::NotificationListener *)(arg1)->getListener(); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Index *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Index *)new kuzzleio::Index(arg1); + *(kuzzleio::Index **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Index(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Index **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + (arg1)->create((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + (arg1)->delete_((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1mDelete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::vector< std::string > *arg2 = 0 ; + std::vector< std::string > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Index **)&jarg1; + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > const & reference is null"); + return 0; + } + try { + result = (arg1)->mDelete((std::vector< std::string > const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (bool)(arg1)->exists((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + (arg1)->refresh((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; + try { + (arg1)->refreshInternal(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jboolean jarg3) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + bool arg3 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = jarg3 ? true : false; + try { + (arg1)->setAutoRefresh((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1getAutoRefresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; + try { + result = (arg1)->list(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + std::vector< std::string > *result = 0 ; + + (void)jenv; + (void)jcls; + result = (std::vector< std::string > *)new std::vector< std::string >(); + *(std::vector< std::string > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong jresult = 0 ; + std::vector< std::string >::size_type arg1 ; + std::vector< std::string > *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = (std::vector< std::string >::size_type)jarg1; + result = (std::vector< std::string > *)new std::vector< std::string >(arg1); + *(std::vector< std::string > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + result = ((std::vector< std::string > const *)arg1)->size(); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + result = ((std::vector< std::string > const *)arg1)->capacity(); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = (std::vector< std::string >::size_type)jarg2; + (arg1)->reserve(arg2); +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + result = (bool)((std::vector< std::string > const *)arg1)->empty(); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + (arg1)->clear(); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1add(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::value_type *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::vector< std::string >::value_type arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + (arg1)->push_back((std::vector< std::string >::value_type const &)*arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jstring jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + int arg2 ; + std::vector< std::string >::value_type *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = (int)jarg2; + try { + result = (std::vector< std::string >::value_type *) &std_vector_Sl_std_string_Sg__get(arg1,arg2); + } + catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + + jresult = jenv->NewStringUTF(result->c_str()); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + int arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = (int)jarg2; + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return ; + std::vector< std::string >::value_type arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + std_vector_Sl_std_string_Sg__set(arg1,arg2,(std::string const &)*arg3); + } + catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } + +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StringVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(std::vector< std::string > **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1DocumentVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + std::vector< kuzzleio::Document * > *result = 0 ; + + (void)jenv; + (void)jcls; + result = (std::vector< kuzzleio::Document * > *)new std::vector< kuzzleio::Document * >(); + *(std::vector< kuzzleio::Document * > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1DocumentVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong jresult = 0 ; + std::vector< kuzzleio::Document * >::size_type arg1 ; + std::vector< kuzzleio::Document * > *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = (std::vector< kuzzleio::Document * >::size_type)jarg1; + result = (std::vector< kuzzleio::Document * > *)new std::vector< kuzzleio::Document * >(arg1); + *(std::vector< kuzzleio::Document * > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + std::vector< kuzzleio::Document * >::size_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + result = ((std::vector< kuzzleio::Document * > const *)arg1)->size(); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + std::vector< kuzzleio::Document * >::size_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + result = ((std::vector< kuzzleio::Document * > const *)arg1)->capacity(); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + std::vector< kuzzleio::Document * >::size_type arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + arg2 = (std::vector< kuzzleio::Document * >::size_type)jarg2; + (arg1)->reserve(arg2); +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + result = (bool)((std::vector< kuzzleio::Document * > const *)arg1)->empty(); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + (arg1)->clear(); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1add(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + std::vector< kuzzleio::Document * >::value_type *arg2 = 0 ; + std::vector< kuzzleio::Document * >::value_type temp2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + temp2 = *(std::vector< kuzzleio::Document * >::value_type *)&jarg2; + arg2 = (std::vector< kuzzleio::Document * >::value_type *)&temp2; + (arg1)->push_back((std::vector< kuzzleio::Document * >::value_type const &)*arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + int arg2 ; + std::vector< kuzzleio::Document * >::value_type *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + arg2 = (int)jarg2; + try { + result = (std::vector< kuzzleio::Document * >::value_type *) &std_vector_Sl_kuzzleio_Document_Sm__Sg__get(arg1,arg2); + } + catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + + *(std::vector< kuzzleio::Document * >::value_type *)&jresult = *result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + int arg2 ; + std::vector< kuzzleio::Document * >::value_type *arg3 = 0 ; + std::vector< kuzzleio::Document * >::value_type temp3 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + arg2 = (int)jarg2; + temp3 = *(std::vector< kuzzleio::Document * >::value_type *)&jarg3; + arg3 = (std::vector< kuzzleio::Document * >::value_type *)&temp3; + try { + std_vector_Sl_kuzzleio_Document_Sm__Sg__set(arg1,arg2,(kuzzleio::Document *const &)*arg3); + } + catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } + +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1DocumentVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { + std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1JsonObject(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + result = (json_object *)new_json_object(); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1JsonObject(JNIEnv *jenv, jclass jcls, jlong jarg1) { + json_object *arg1 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(json_object **)&jarg1; + delete_json_object(arg1); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + result = (json_object *)json_object_put__SWIG_0(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + result = (json_object *)json_object_put__SWIG_1(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + result = (json_object *)json_object_put__SWIG_2(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jboolean jarg3) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + bool arg3 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = jarg3 ? true : false; + result = (json_object *)json_object_put__SWIG_3(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_14(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + result = (json_object *)json_object_put__SWIG_4(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jstring jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (char *)json_object_getString(arg1,arg2); + if (result) jresult = jenv->NewStringUTF((const char *)result); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getInt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jint jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (int)json_object_getInt(arg1,arg2); + jresult = (jint)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getDouble(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jdouble jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (double)json_object_getDouble(arg1,arg2); + jresult = (jdouble)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getBoolean(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (bool)json_object_getBoolean(arg1,arg2); + jresult = (jboolean)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getJsonObject(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (json_object *)json_object_getJsonObject(arg1,arg2); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_trigger_1event_1listener(JNIEnv *jenv, jclass jcls, jint jarg1, jlong jarg2, jobject jarg2_, jlong jarg3) { + int arg1 ; + json_object *arg2 = (json_object *) 0 ; + void *arg3 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg2_; + arg1 = (int)jarg1; + arg2 = *(json_object **)&jarg2; + arg3 = *(void **)&jarg3; + kuzzleio::trigger_event_listener(arg1,arg2,arg3); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_call_1collection_1cb(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = *(void **)&jarg2; + kuzzleio::call_collection_cb(arg1,arg2); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_call_1cb_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + room_result *arg1 = (room_result *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + arg2 = *(void **)&jarg2; + kuzzleio::call_cb(arg1,arg2); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notify(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = *(void **)&jarg2; + kuzzleio::notify(arg1,arg2); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_call_1cb_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = *(void **)&jarg2; + kuzzleio::call_cb(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_BadRequestException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::BadRequestException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ForbiddenException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::ForbiddenException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GatewayTimeoutException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::GatewayTimeoutException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_InternalException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::InternalException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotFoundException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::NotFoundException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_PartialException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::PartialException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_PreconditionException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::PreconditionException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ServiceUnavailableException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::ServiceUnavailableException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SizeLimitException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::SizeLimitException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UnauthorizedException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::UnauthorizedException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleEventEmitter **)&baseptr = *(kuzzleio::Kuzzle **)&jarg1; + return baseptr; +} + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_swig_1module_1init(JNIEnv *jenv, jclass jcls) { + int i; + + static struct { + const char *method; + const char *signature; + } methods[3] = { + { + "SwigDirector_NotificationListener_onMessage", "(Lio/kuzzle/sdk/NotificationListener;J)V" + }, + { + "SwigDirector_EventListener_trigger", "(Lio/kuzzle/sdk/EventListener;J)V" + }, + { + "SwigDirector_SubscribeListener_onSubscribe", "(Lio/kuzzle/sdk/SubscribeListener;J)V" + } + }; + Swig::jclass_kcoreJNI = (jclass) jenv->NewGlobalRef(jcls); + if (!Swig::jclass_kcoreJNI) return; + for (i = 0; i < (int) (sizeof(methods)/sizeof(methods[0])); ++i) { + Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature); + if (!Swig::director_method_ids[i]) return; + } +} + + +#ifdef __cplusplus +} +#endif + diff --git a/internal/wrappers/kcore_wrap.h b/internal/wrappers/kcore_wrap.h new file mode 100644 index 00000000..9b466232 --- /dev/null +++ b/internal/wrappers/kcore_wrap.h @@ -0,0 +1,60 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.12 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#ifndef SWIG_kcore_WRAP_H_ +#define SWIG_kcore_WRAP_H_ + +class SwigDirector_NotificationListener : public kuzzleio::NotificationListener, public Swig::Director { + +public: + void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); + SwigDirector_NotificationListener(JNIEnv *jenv); + virtual ~SwigDirector_NotificationListener(); + virtual void onMessage(notification_result *arg0) const; +public: + bool swig_overrides(int n) { + return (n < 1 ? swig_override[n] : false); + } +protected: + Swig::BoolArray<1> swig_override; +}; + +class SwigDirector_EventListener : public kuzzleio::EventListener, public Swig::Director { + +public: + void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); + SwigDirector_EventListener(JNIEnv *jenv); + virtual ~SwigDirector_EventListener(); + virtual void trigger(json_object *arg0) const; +public: + bool swig_overrides(int n) { + return (n < 1 ? swig_override[n] : false); + } +protected: + Swig::BoolArray<1> swig_override; +}; + +class SwigDirector_SubscribeListener : public kuzzleio::SubscribeListener, public Swig::Director { + +public: + void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); + SwigDirector_SubscribeListener(JNIEnv *jenv); + virtual ~SwigDirector_SubscribeListener(); + virtual void onSubscribe(room_result *arg0) const; +public: + bool swig_overrides(int n) { + return (n < 1 ? swig_override[n] : false); + } +protected: + Swig::BoolArray<1> swig_override; +}; + + +#endif From e227907297e19ca89146a8776a6519efa10093f9 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 13:51:10 +0100 Subject: [PATCH 035/363] Fix merge issue --- internal/wrappers/cpp/kuzzle.cpp | 10 - internal/wrappers/headers/kuzzle.hpp | 1 - internal/wrappers/kcore_wrap.cxx | 4733 ++++++++++++++++---------- 3 files changed, 2991 insertions(+), 1753 deletions(-) diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 1a3a350c..cc90ca82 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -152,16 +152,6 @@ namespace kuzzleio { return r; } - // java wrapper for this method is in typemap.i - long long Kuzzle::now(query_options* options) Kuz_Throw_KuzzleException { - date_result *r = kuzzle_now(_kuzzle, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - long long ret = r->result; - delete(r); - return ret; - } - Kuzzle* Kuzzle::replayQueue() { kuzzle_replay_queue(_kuzzle); return this; diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 3b491f7c..07e1e2aa 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -42,7 +42,6 @@ namespace kuzzleio { void disconnect(); void logout(); kuzzle_response* query(kuzzle_request* query, query_options* options=NULL) Kuz_Throw_KuzzleException; - long long now(query_options* options=NULL) Kuz_Throw_KuzzleException; Kuzzle* replayQueue(); Kuzzle* setAutoReplay(bool autoReplay); Kuzzle* setDefaultIndex(const std::string& index); diff --git a/internal/wrappers/kcore_wrap.cxx b/internal/wrappers/kcore_wrap.cxx index 440c63c6..34a257b1 100644 --- a/internal/wrappers/kcore_wrap.cxx +++ b/internal/wrappers/kcore_wrap.cxx @@ -670,6 +670,7 @@ namespace Swig { #include "room.cpp" #include "document.cpp" #include "index.cpp" +#include "server.cpp" #include @@ -683,6 +684,7 @@ namespace Swig { #include "room.hpp" #include "document.hpp" #include "index.hpp" +#include "server.hpp" #include #include @@ -3073,6 +3075,85 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1kuzzle_1index(JNIEnv } +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + server *arg1 = (server *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(server **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(server **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + server *arg1 = (server *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(server **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1server(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + server *result = 0 ; + + (void)jenv; + (void)jcls; + result = (server *)new server(); + *(server **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1server(JNIEnv *jenv, jclass jcls, jlong jarg1) { + server *arg1 = (server *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(server **)&jarg1; + delete arg1; +} + + SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { room_options *arg1 = (room_options *) 0 ; char *arg2 = (char *) 0 ; @@ -11375,7 +11456,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1login(JNIEnv *jenv, jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; char *arg2 = (char *) 0 ; - controllers *arg3 = (controllers *) 0 ; + json_object *arg3 = (json_object *) 0 ; int *arg4 = (int *) 0 ; string_result *result = 0 ; @@ -11389,7 +11470,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1login(JNIEnv *jenv, arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers **)&jarg3; + arg3 = *(json_object **)&jarg3; arg4 = *(int **)&jarg4; result = (string_result *)kuzzle_login(arg1,arg2,arg3,arg4); *(string_result **)&jresult = result; @@ -11439,7 +11520,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1create_1my_1credent jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; char *arg2 = (char *) 0 ; - controllers *arg3 = (controllers *) 0 ; + json_object *arg3 = (json_object *) 0 ; query_options *arg4 = (query_options *) 0 ; json_result *result = 0 ; @@ -11454,7 +11535,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1create_1my_1credent arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers **)&jarg3; + arg3 = *(json_object **)&jarg3; arg4 = *(query_options **)&jarg4; result = (json_result *)kuzzle_create_my_credentials(arg1,arg2,arg3,arg4); *(json_result **)&jresult = result; @@ -11517,7 +11598,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1my_1credent jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; char *arg2 = (char *) 0 ; - controllers *arg3 = (controllers *) 0 ; + json_object *arg3 = (json_object *) 0 ; query_options *arg4 = (query_options *) 0 ; json_result *result = 0 ; @@ -11532,7 +11613,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1my_1credent arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers **)&jarg3; + arg3 = *(json_object **)&jarg3; arg4 = *(query_options **)&jarg4; result = (json_result *)kuzzle_update_my_credentials(arg1,arg2,arg3,arg4); *(json_result **)&jresult = result; @@ -11545,7 +11626,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1validate_1my_1crede jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; char *arg2 = (char *) 0 ; - controllers *arg3 = (controllers *) 0 ; + json_object *arg3 = (json_object *) 0 ; query_options *arg4 = (query_options *) 0 ; bool_result *result = 0 ; @@ -11560,7 +11641,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1validate_1my_1crede arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers **)&jarg3; + arg3 = *(json_object **)&jarg3; arg4 = *(query_options **)&jarg4; result = (bool_result *)kuzzle_validate_my_credentials(arg1,arg2,arg3,arg4); *(bool_result **)&jresult = result; @@ -11683,7 +11764,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1create( SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1publish_1message(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; collection *arg1 = (collection *) 0 ; - controllers *arg2 = (controllers *) 0 ; + json_object *arg2 = (json_object *) 0 ; query_options *arg3 = (query_options *) 0 ; bool_result *result = 0 ; @@ -11693,7 +11774,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1publish (void)jarg2_; (void)jarg3_; arg1 = *(collection **)&jarg1; - arg2 = *(controllers **)&jarg2; + arg2 = *(json_object **)&jarg2; arg3 = *(query_options **)&jarg3; result = (bool_result *)kuzzle_collection_publish_message(arg1,arg2,arg3); *(bool_result **)&jresult = result; @@ -12173,14 +12254,14 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1mapping_1refresh(JN SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1mapping_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { mapping *arg1 = (mapping *) 0 ; - controllers *arg2 = (controllers *) 0 ; + json_object *arg2 = (json_object *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(mapping **)&jarg1; - arg2 = *(controllers **)&jarg2; + arg2 = *(json_object **)&jarg2; kuzzle_mapping_set(arg1,arg2); } @@ -12973,7 +13054,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1document(JNIEnv document *arg1 = (document *) 0 ; collection *arg2 = (collection *) 0 ; char *arg3 = (char *) 0 ; - controllers *arg4 = (controllers *) 0 ; + json_object *arg4 = (json_object *) 0 ; (void)jenv; (void)jcls; @@ -12987,7 +13068,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1document(JNIEnv arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); if (!arg3) return ; } - arg4 = *(controllers **)&jarg4; + arg4 = *(json_object **)&jarg4; kuzzle_new_document(arg1,arg2,arg3,arg4); if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); } @@ -13107,7 +13188,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1delete(JN SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1set_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3) { document *arg1 = (document *) 0 ; - controllers *arg2 = (controllers *) 0 ; + json_object *arg2 = (json_object *) 0 ; _Bool arg3 ; _Bool *argp3 ; @@ -13116,7 +13197,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1set_1conte (void)jarg1_; (void)jarg2_; arg1 = *(document **)&jarg1; - arg2 = *(controllers **)&jarg2; + arg2 = *(json_object **)&jarg2; argp3 = *(_Bool **)&jarg3; if (!argp3) { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); @@ -13130,14 +13211,14 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1set_1conte SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1get_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; document *arg1 = (document *) 0 ; - controllers *result = 0 ; + json_object *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(document **)&jarg1; - result = (controllers *)kuzzle_document_get_content(arg1); - *(controllers **)&jresult = result; + result = (json_object *)kuzzle_document_get_content(arg1); + *(json_object **)&jresult = result; return jresult; } @@ -13357,18 +13438,18 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1list(JNIEnv SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1new(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - controllers *arg1 = (controllers *) 0 ; + json_object *arg1 = (json_object *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(controllers **)&jarg1; + arg1 = *(json_object **)&jarg1; kuzzle_json_new(arg1); } SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1put(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jint jarg4) { - controllers *arg1 = (controllers *) 0 ; + json_object *arg1 = (json_object *) 0 ; char *arg2 = (char *) 0 ; void *arg3 = (void *) 0 ; int arg4 ; @@ -13376,7 +13457,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1put(JNIEnv *je (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(controllers **)&jarg1; + arg1 = *(json_object **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); @@ -13391,14 +13472,14 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1put(JNIEnv *je SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1string(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jstring jresult = 0 ; - controllers *arg1 = (controllers *) 0 ; + json_object *arg1 = (json_object *) 0 ; char *arg2 = (char *) 0 ; char *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(controllers **)&jarg1; + arg1 = *(json_object **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); @@ -13413,14 +13494,14 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1string SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1int(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jint jresult = 0 ; - controllers *arg1 = (controllers *) 0 ; + json_object *arg1 = (json_object *) 0 ; char *arg2 = (char *) 0 ; int result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(controllers **)&jarg1; + arg1 = *(json_object **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); @@ -13435,14 +13516,14 @@ SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1int(JNIEn SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1double(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jdouble jresult = 0 ; - controllers *arg1 = (controllers *) 0 ; + json_object *arg1 = (json_object *) 0 ; char *arg2 = (char *) 0 ; double result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(controllers **)&jarg1; + arg1 = *(json_object **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); @@ -13457,14 +13538,14 @@ SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1double SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1bool(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jlong jresult = 0 ; - controllers *arg1 = (controllers *) 0 ; + json_object *arg1 = (json_object *) 0 ; char *arg2 = (char *) 0 ; json_bool result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(controllers **)&jarg1; + arg1 = *(json_object **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); @@ -13479,33 +13560,33 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1bool(JNI SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jlong jresult = 0 ; - controllers *arg1 = (controllers *) 0 ; + json_object *arg1 = (json_object *) 0 ; char *arg2 = (char *) 0 ; - controllers *result = 0 ; + json_object *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(controllers **)&jarg1; + arg1 = *(json_object **)&jarg1; arg2 = 0; if (jarg2) { arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - result = (controllers *)kuzzle_json_get_json_object(arg1,arg2); - *(controllers **)&jresult = result; + result = (json_object *)kuzzle_json_get_json_object(arg1,arg2); + *(json_object **)&jresult = result; if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); return jresult; } SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - controllers *arg1 = (controllers *) 0 ; + json_object *arg1 = (json_object *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(controllers **)&jarg1; + arg1 = *(json_object **)&jarg1; kuzzle_free_json_object(arg1); } @@ -14051,28 +14132,28 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1ssl_1connectio SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; - controllers *result = 0 ; + json_object *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzle **)&jarg1; - result = (controllers *)kuzzle_get_volatile(arg1); - *(controllers **)&jresult = result; + result = (json_object *)kuzzle_get_volatile(arg1); + *(json_object **)&jresult = result; return jresult; } SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { kuzzle *arg1 = (kuzzle *) 0 ; - controllers *arg2 = (controllers *) 0 ; + json_object *arg2 = (json_object *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(kuzzle **)&jarg1; - arg2 = *(controllers **)&jarg2; + arg2 = *(json_object **)&jarg2; kuzzle_set_volatile(arg1,arg2); } @@ -14412,7 +14493,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geoadd(JNIEnv * jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; char *arg2 = (char *) 0 ; - controllers **arg3 = (controllers **) 0 ; + json_object **arg3 = (json_object **) 0 ; size_t arg4 ; query_options *arg5 = (query_options *) 0 ; int_result *result = 0 ; @@ -14427,7 +14508,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geoadd(JNIEnv * arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers ***)&jarg3; + arg3 = *(json_object ***)&jarg3; arg4 = (size_t)jarg4; arg5 = *(query_options **)&jarg5; result = (int_result *)kuzzle_ms_geoadd(arg1,arg2,arg3,arg4,arg5); @@ -14995,7 +15076,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmset(JNIEnv *j jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; char *arg2 = (char *) 0 ; - controllers **arg3 = (controllers **) 0 ; + json_object **arg3 = (json_object **) 0 ; size_t arg4 ; query_options *arg5 = (query_options *) 0 ; void_result *result = 0 ; @@ -15010,7 +15091,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmset(JNIEnv *j arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers ***)&jarg3; + arg3 = *(json_object ***)&jarg3; arg4 = (size_t)jarg4; arg5 = *(query_options **)&jarg5; result = (void_result *)kuzzle_ms_hmset(arg1,arg2,arg3,arg4,arg5); @@ -15621,7 +15702,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mget(JNIEnv *je SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; - controllers **arg2 = (controllers **) 0 ; + json_object **arg2 = (json_object **) 0 ; size_t arg3 ; query_options *arg4 = (query_options *) 0 ; void_result *result = 0 ; @@ -15631,7 +15712,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mset(JNIEnv *je (void)jarg1_; (void)jarg4_; arg1 = *(kuzzle **)&jarg1; - arg2 = *(controllers ***)&jarg2; + arg2 = *(json_object ***)&jarg2; arg3 = (size_t)jarg3; arg4 = *(query_options **)&jarg4; result = (void_result *)kuzzle_ms_mset(arg1,arg2,arg3,arg4); @@ -15643,7 +15724,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mset(JNIEnv *je SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1msetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; - controllers **arg2 = (controllers **) 0 ; + json_object **arg2 = (json_object **) 0 ; size_t arg3 ; query_options *arg4 = (query_options *) 0 ; bool_result *result = 0 ; @@ -15653,7 +15734,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1msetnx(JNIEnv * (void)jarg1_; (void)jarg4_; arg1 = *(kuzzle **)&jarg1; - arg2 = *(controllers ***)&jarg2; + arg2 = *(json_object ***)&jarg2; arg3 = (size_t)jarg3; arg4 = *(query_options **)&jarg4; result = (bool_result *)kuzzle_ms_msetnx(arg1,arg2,arg3,arg4); @@ -16840,7 +16921,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zadd(JNIEnv *je jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; char *arg2 = (char *) 0 ; - controllers **arg3 = (controllers **) 0 ; + json_object **arg3 = (json_object **) 0 ; size_t arg4 ; query_options *arg5 = (query_options *) 0 ; int_result *result = 0 ; @@ -16855,7 +16936,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zadd(JNIEnv *je arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers ***)&jarg3; + arg3 = *(json_object ***)&jarg3; arg4 = (size_t)jarg4; arg5 = *(query_options **)&jarg5; result = (int_result *)kuzzle_ms_zadd(arg1,arg2,arg3,arg4,arg5); @@ -17511,7 +17592,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterRoom(JNIEnv *jenv, SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1new_1room(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { room *arg1 = (room *) 0 ; collection *arg2 = (collection *) 0 ; - controllers *arg3 = (controllers *) 0 ; + json_object *arg3 = (json_object *) 0 ; room_options *arg4 = (room_options *) 0 ; (void)jenv; @@ -17522,7 +17603,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1new_1room(JNIEnv *jenv (void)jarg4_; arg1 = *(room **)&jarg1; arg2 = *(collection **)&jarg2; - arg3 = *(controllers **)&jarg3; + arg3 = *(json_object **)&jarg3; arg4 = *(room_options **)&jarg4; room_new_room(arg1,arg2,arg3,arg4); } @@ -17656,94 +17737,6 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1refresh( } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1server_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (json_result *)kuzzle_get_server_info(arg1,arg2); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1all_1statistics(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - all_statistics_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (all_statistics_result *)kuzzle_get_all_statistics(arg1,arg2); - *(all_statistics_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1statistics(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - time_t arg2 ; - time_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - time_t *argp2 ; - time_t *argp3 ; - statistics_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - arg4 = *(query_options **)&jarg4; - result = (statistics_result *)kuzzle_get_statistics(arg1,arg2,arg3,arg4); - *(statistics_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1now(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - date_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (date_result *)kuzzle_now(arg1,arg2); - *(date_result **)&jresult = result; - return jresult; -} - - SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1search_1result_1fetch_1next(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; search_result *arg1 = (search_result *) 0 ; @@ -17926,7 +17919,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1role jlong jresult = 0 ; kuzzle *arg1 = (kuzzle *) 0 ; char *arg2 = (char *) 0 ; - controllers *arg3 = (controllers *) 0 ; + json_object *arg3 = (json_object *) 0 ; role *result = 0 ; (void)jenv; @@ -17939,7 +17932,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1role arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers **)&jarg3; + arg3 = *(json_object **)&jarg3; result = (role *)kuzzle_security_new_role(arg1,arg2,arg3); *(role **)&jresult = result; if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); @@ -18169,7 +18162,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1cre jlong jresult = 0 ; user *arg1 = (user *) 0 ; char *arg2 = (char *) 0 ; - controllers *arg3 = (controllers *) 0 ; + json_object *arg3 = (json_object *) 0 ; query_options *arg4 = (query_options *) 0 ; json_result *result = 0 ; @@ -18184,7 +18177,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1cre arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers **)&jarg3; + arg3 = *(json_object **)&jarg3; arg4 = *(query_options **)&jarg4; result = (json_result *)kuzzle_security_user_create_credentials(arg1,arg2,arg3,arg4); *(json_result **)&jresult = result; @@ -18196,7 +18189,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1cre SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1with_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; user *arg1 = (user *) 0 ; - controllers *arg2 = (controllers *) 0 ; + json_object *arg2 = (json_object *) 0 ; query_options *arg3 = (query_options *) 0 ; user_result *result = 0 ; @@ -18206,7 +18199,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1cre (void)jarg2_; (void)jarg3_; arg1 = *(user **)&jarg1; - arg2 = *(controllers **)&jarg2; + arg2 = *(json_object **)&jarg2; arg3 = *(query_options **)&jarg3; result = (user_result *)kuzzle_security_user_create_with_credentials(arg1,arg2,arg3); *(user_result **)&jresult = result; @@ -18365,7 +18358,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1update_1c jlong jresult = 0 ; user *arg1 = (user *) 0 ; char *arg2 = (char *) 0 ; - controllers *arg3 = (controllers *) 0 ; + json_object *arg3 = (json_object *) 0 ; query_options *arg4 = (query_options *) 0 ; json_result *result = 0 ; @@ -18380,7 +18373,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1update_1c arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); if (!arg2) return 0; } - arg3 = *(controllers **)&jarg3; + arg3 = *(json_object **)&jarg3; arg4 = *(query_options **)&jarg4; result = (json_result *)kuzzle_security_update_credentials(arg1,arg2,arg3,arg4); *(json_result **)&jresult = result; @@ -18433,71 +18426,238 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1is_1actio } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterServer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + server *arg1 = (server *) 0 ; (void)jenv; (void)jcls; - arg1 = *(kuzzleio::NotificationListener **)&jarg1; - delete arg1; + (void)jarg1_; + arg1 = *(server **)&jarg1; + unregisterServer(arg1); } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1onMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; - notification_result *arg2 = (notification_result *) 0 ; +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1server(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + server *arg1 = (server *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - arg1 = *(kuzzleio::NotificationListener **)&jarg1; - arg2 = *(notification_result **)&jarg2; - ((kuzzleio::NotificationListener const *)arg1)->onMessage(arg2); + arg1 = *(server **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + kuzzle_new_server(arg1,arg2); } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotificationListener(JNIEnv *jenv, jclass jcls) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1admin_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; - kuzzleio::NotificationListener *result = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; (void)jenv; (void)jcls; - result = (kuzzleio::NotificationListener *)new SwigDirector_NotificationListener(jenv); - *(kuzzleio::NotificationListener **)&jresult = result; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_admin_exists(arg1,arg2); + *(bool_result **)&jresult = result; return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); - (void)jcls; - SwigDirector_NotificationListener *director = dynamic_cast(obj); - if (director) { - director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); - SwigDirector_NotificationListener *director = dynamic_cast(obj); +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1all_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; (void)jcls; - if (director) { - director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); - } + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_get_all_stats(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1EventListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + time_t arg2 ; + time_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + time_t *argp2 ; + time_t *argp3 ; + string_result *result = 0 ; (void)jenv; (void)jcls; - arg1 = *(kuzzleio::EventListener **)&jarg1; - delete arg1; -} - + (void)jarg1_; + (void)jarg4_; + arg1 = *(server **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_get_stats(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1last_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_get_last_stats(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1config(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_get_config(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_info(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1now(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + date_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (date_result *)kuzzle_now(arg1,arg2); + *(date_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::NotificationListener **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1onMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; + notification_result *arg2 = (notification_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::NotificationListener **)&jarg1; + arg2 = *(notification_result **)&jarg2; + ((kuzzleio::NotificationListener const *)arg1)->onMessage(arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotificationListener(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::NotificationListener *)new SwigDirector_NotificationListener(jenv); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { + kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); + (void)jcls; + SwigDirector_NotificationListener *director = dynamic_cast(obj); + if (director) { + director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { + kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); + SwigDirector_NotificationListener *director = dynamic_cast(obj); + (void)jcls; + if (director) { + director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1EventListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::EventListener **)&jarg1; + delete arg1; +} + SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1trigger(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; @@ -22175,20 +22335,30 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getServerInfo_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - json_object *result = 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + collection_entry *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; try { - result = (json_object *)(arg1)->getServerInfo(arg2); + result = (collection_entry *)(arg1)->listCollections((std::string const &)*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -22286,22 +22456,32 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getServerInfo_1_1SW } } - *(json_object **)&jresult = result; + *(collection_entry **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getServerInfo_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *result = 0 ; + std::string *arg2 = 0 ; + collection_entry *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); try { - result = (json_object *)(arg1)->getServerInfo(); + result = (collection_entry *)(arg1)->listCollections((std::string const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -22399,35 +22579,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getServerInfo_1_1SW } } - *(json_object **)&jresult = result; + *(collection_entry **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - collection_entry *result = 0 ; + query_options *arg2 = (query_options *) 0 ; + std::vector< std::string > result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg3_; + (void)jarg2_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; + arg2 = *(query_options **)&jarg2; try { - result = (collection_entry *)(arg1)->listCollections((std::string const &)*arg2,arg3); + result = (arg1)->listIndexes(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -22525,32 +22695,22 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1 } } - *(collection_entry **)&jresult = result; + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - collection_entry *result = 0 ; + std::vector< std::string > result; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); try { - result = (collection_entry *)(arg1)->listCollections((std::string const &)*arg2); + result = (arg1)->listIndexes(); } catch(kuzzleio::BadRequestException &_e) { { @@ -22648,25 +22808,50 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1 } } - *(collection_entry **)&jresult = result; + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + (arg1)->disconnect(); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + (arg1)->logout(); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::vector< std::string > result; + kuzzle_request *arg2 = (kuzzle_request *) 0 ; + query_options *arg3 = (query_options *) 0 ; + kuzzle_response *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; + arg2 = *(kuzzle_request **)&jarg2; + arg3 = *(query_options **)&jarg3; try { - result = (arg1)->listIndexes(arg2); + result = (kuzzle_response *)(arg1)->query(arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -22764,22 +22949,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG } } - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + *(kuzzle_response **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::vector< std::string > result; + kuzzle_request *arg2 = (kuzzle_request *) 0 ; + kuzzle_response *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(kuzzle_request **)&jarg2; try { - result = (arg1)->listIndexes(); + result = (kuzzle_response *)(arg1)->query(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -22877,166 +23065,155 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG } } - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + *(kuzzle_response **)&jresult = result; return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1replayQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - (arg1)->disconnect(); + result = (kuzzleio::Kuzzle *)(arg1)->replayQueue(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setAutoReplay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + bool arg2 ; + kuzzleio::Kuzzle *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - (arg1)->logout(); + arg2 = jarg2 ? true : false; + result = (kuzzleio::Kuzzle *)(arg1)->setAutoReplay(arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setDefaultIndex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle_request *arg2 = (kuzzle_request *) 0 ; - query_options *arg3 = (query_options *) 0 ; - kuzzle_response *result = 0 ; + std::string *arg2 = 0 ; + kuzzleio::Kuzzle *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - (void)jarg3_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(kuzzle_request **)&jarg2; - arg3 = *(query_options **)&jarg3; - try { - result = (kuzzle_response *)(arg1)->query(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (kuzzleio::Kuzzle *)(arg1)->setDefaultIndex((std::string const &)*arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (kuzzleio::Kuzzle *)(arg1)->setJwt((std::string const &)*arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1startQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; - *(kuzzle_response **)&jresult = result; + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->startQueuing(); + *(kuzzleio::Kuzzle **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1stopQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle_request *arg2 = (kuzzle_request *) 0 ; - kuzzle_response *result = 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->stopQueuing(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1unsetJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->unsetJwt(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + user_data *arg2 = (user_data *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_object *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(kuzzle_request **)&jarg2; + arg2 = *(user_data **)&jarg2; + arg3 = *(query_options **)&jarg3; try { - result = (kuzzle_response *)(arg1)->query(arg2); + result = (json_object *)(arg1)->updateSelf(arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -23134,25 +23311,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_11(JN } } - *(kuzzle_response **)&jresult = result; + *(json_object **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1now_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - long long result; + user_data *arg2 = (user_data *) 0 ; + json_object *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; + arg2 = *(user_data **)&jarg2; try { - result = (long long)(arg1)->now(arg2); + result = (json_object *)(arg1)->updateSelf(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -23250,22 +23427,22 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1now_1_1SWIG_10(JN } } - jresult = (jlong)result; + *(json_object **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1now_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1whoAmI(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - long long result; + user *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; try { - result = (long long)(arg1)->now(); + result = (user *)(arg1)->whoAmI(); } catch(kuzzleio::BadRequestException &_e) { { @@ -23363,12 +23540,12 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1now_1_1SWIG_11(JN } } - jresult = (jlong)result; + *(user **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1replayQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1flushQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; kuzzleio::Kuzzle *result = 0 ; @@ -23377,141 +23554,274 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1replayQueue(JNIEnv (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->replayQueue(); + result = (kuzzleio::Kuzzle *)(arg1)->flushQueue(); *(kuzzleio::Kuzzle **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setAutoReplay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - bool arg2 ; - kuzzleio::Kuzzle *result = 0 ; + json_object *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = jarg2 ? true : false; - result = (kuzzleio::Kuzzle *)(arg1)->setAutoReplay(arg2); - *(kuzzleio::Kuzzle **)&jresult = result; + result = (json_object *)(arg1)->getVolatile(); + *(json_object **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setDefaultIndex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; + json_object *arg2 = (json_object *) 0 ; kuzzleio::Kuzzle *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (kuzzleio::Kuzzle *)(arg1)->setDefaultIndex((std::string const &)*arg2); + arg2 = *(json_object **)&jarg2; + result = (kuzzleio::Kuzzle *)(arg1)->setVolatile(arg2); *(kuzzleio::Kuzzle **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Kuzzle *result = 0 ; + SwigValueWrapper< std::map< int,kuzzleio::EventListener * > > result; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (kuzzleio::Kuzzle *)(arg1)->setJwt((std::string const &)*arg2); - *(kuzzleio::Kuzzle **)&jresult = result; + result = (arg1)->getListeners(); + *(std::map< int,kuzzleio::EventListener * > **)&jresult = new std::map< int,kuzzleio::EventListener * >((const std::map< int,kuzzleio::EventListener * > &)result); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1startQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg3_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->startQueuing(); - *(kuzzleio::Kuzzle **)&jresult = result; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1stopQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg3_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->stopQueuing(); - *(kuzzleio::Kuzzle **)&jresult = result; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1unsetJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; + Event arg2 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->unsetJwt(); - *(kuzzleio::Kuzzle **)&jresult = result; + arg2 = (Event)jarg2; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user_data *arg2 = (user_data *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jint jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + result = (int)(arg1)->listenerCount(arg2); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + collection *arg2 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(collection **)&jarg2; + if (arg1) (arg1)->_collection = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + result = (collection *) ((arg1)->_collection); + *(collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1listener_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(kuzzleio::NotificationListener **)&jarg2; + if (arg1) (arg1)->_listener_instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1listener_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + result = (kuzzleio::NotificationListener *) ((arg1)->_listener_instance); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + kuzzleio::Collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + result = (kuzzleio::Collection *)new kuzzleio::Collection(arg1,(std::string const &)*arg2,(std::string const &)*arg3); + *(kuzzleio::Collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Collection **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jint jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; query_options *arg3 = (query_options *) 0 ; - json_object *result = 0 ; + int result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(user_data **)&jarg2; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; arg3 = *(query_options **)&jarg3; try { - result = (json_object *)(arg1)->updateSelf(arg2,arg3); + result = (int)(arg1)->count(arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -23609,25 +23919,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_ } } - *(json_object **)&jresult = result; + jresult = (jint)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user_data *arg2 = (user_data *) 0 ; - json_object *result = 0 ; +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jint jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + int result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(user_data **)&jarg2; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_filters **)&jarg2; try { - result = (json_object *)(arg1)->updateSelf(arg2); + result = (int)(arg1)->count(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -23725,22 +24035,38 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_ } } - *(json_object **)&jresult = result; + jresult = (jint)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1whoAmI(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jlong jarg4, jobject jarg4_) { jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user *result = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; + std::string *arg3 = 0 ; + query_options *arg4 = (query_options *) 0 ; + kuzzleio::Collection *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; + (void)jarg2_; + (void)jarg4_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(kuzzleio::Document **)&jarg2; + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + arg4 = *(query_options **)&jarg4; try { - result = (user *)(arg1)->whoAmI(); + result = (kuzzleio::Collection *)(arg1)->createDocument(arg2,(std::string const &)*arg3,arg4); } catch(kuzzleio::BadRequestException &_e) { { @@ -23838,277 +24164,1243 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1whoAmI(JNIEnv *jenv } } - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1flushQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->flushQueue(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (json_object *)(arg1)->getVolatile(); - *(json_object **)&jresult = result; + *(kuzzleio::Collection **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3) { jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *arg2 = (json_object *) 0 ; - kuzzleio::Kuzzle *result = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; + std::string *arg3 = 0 ; + kuzzleio::Collection *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(json_object **)&jarg2; - result = (kuzzleio::Kuzzle *)(arg1)->setVolatile(arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - SwigValueWrapper< std::map< int,kuzzleio::EventListener * > > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (arg1)->getListeners(); - *(std::map< int,kuzzleio::EventListener * > **)&jresult = new std::map< int,kuzzleio::EventListener * >((const std::map< int,kuzzleio::EventListener * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(kuzzleio::Document **)&jarg2; + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + result = (kuzzleio::Collection *)(arg1)->createDocument(arg2,(std::string const &)*arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + *(kuzzleio::Collection **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; + kuzzleio::Collection *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(kuzzleio::Document **)&jarg2; + try { + result = (kuzzleio::Collection *)(arg1)->createDocument(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jstring jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->deleteDocument((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jstring jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (arg1)->deleteDocument((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (kuzzleio::Document *)(arg1)->fetchDocument((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (kuzzleio::Document *)(arg1)->fetchDocument((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; + + (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->mCreateDocument(*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jint jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - int result; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - result = (int)(arg1)->listenerCount(arg2); - jresult = (jint)result; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + try { + result = (arg1)->mCreateDocument(*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - collection *arg2 = (collection *) 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(collection **)&jarg2; - if (arg1) (arg1)->_collection = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - collection *result = 0 ; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; + try { + result = (arg1)->mCreateOrReplaceDocument(*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - result = (collection *) ((arg1)->_collection); - *(collection **)&jresult = result; + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1listener_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(kuzzleio::NotificationListener **)&jarg2; - if (arg1) (arg1)->_listener_instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1listener_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::NotificationListener *result = 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; arg1 = *(kuzzleio::Collection **)&jarg1; - result = (kuzzleio::NotificationListener *) ((arg1)->_listener_instance); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - kuzzleio::Collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); return 0; + } + try { + result = (arg1)->mCreateOrReplaceDocument(*arg2); } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - result = (kuzzleio::Collection *)new kuzzleio::Collection(arg1,(std::string const &)*arg2,(std::string const &)*arg3); - *(kuzzleio::Collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Collection **)&jarg1; - delete arg1; + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + return jresult; } -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jint jresult = 0 ; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; + std::vector< std::string > *arg2 = 0 ; query_options *arg3 = (query_options *) 0 ; - int result; + std::vector< std::string > result; (void)jenv; (void)jcls; @@ -24116,10 +25408,14 @@ SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_10 (void)jarg2_; (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); + return 0; + } arg3 = *(query_options **)&jarg3; try { - result = (int)(arg1)->count(arg2,arg3); + result = (arg1)->mDeleteDocument(*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -24217,25 +25513,29 @@ SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_10 } } - jresult = (jint)result; + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); return jresult; } -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jint jresult = 0 ; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - int result; + std::vector< std::string > *arg2 = 0 ; + std::vector< std::string > result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); + return 0; + } try { - result = (int)(arg1)->count(arg2); + result = (arg1)->mDeleteDocument(*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -24333,38 +25633,32 @@ SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_11 } } - jresult = (jint)result; + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jlong jarg4, jobject jarg4_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; - std::string *arg3 = 0 ; - query_options *arg4 = (query_options *) 0 ; - kuzzleio::Collection *result = 0 ; + std::vector< std::string > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - (void)jarg4_; + (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(kuzzleio::Document **)&jarg2; - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - arg4 = *(query_options **)&jarg4; + } + arg3 = *(query_options **)&jarg3; try { - result = (kuzzleio::Collection *)(arg1)->createDocument(arg2,(std::string const &)*arg3,arg4); + result = (arg1)->mGetDocument(*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -24462,35 +25756,29 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_ } } - *(kuzzleio::Collection **)&jresult = result; + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; - std::string *arg3 = 0 ; - kuzzleio::Collection *result = 0 ; + std::vector< std::string > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(kuzzleio::Document **)&jarg2; - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + } try { - result = (kuzzleio::Collection *)(arg1)->createDocument(arg2,(std::string const &)*arg3); + result = (arg1)->mGetDocument(*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -24588,25 +25876,32 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_ } } - *(kuzzleio::Collection **)&jresult = result; + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; - kuzzleio::Collection *result = 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(kuzzleio::Document **)&jarg2; + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + return 0; + } + arg3 = *(query_options **)&jarg3; try { - result = (kuzzleio::Collection *)(arg1)->createDocument(arg2); + result = (arg1)->mReplaceDocument(*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -24704,35 +25999,29 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_ } } - *(kuzzleio::Collection **)&jresult = result; + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jstring jresult = 0 ; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::string result; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg3_; + (void)jarg2_; arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; + } try { - result = (arg1)->deleteDocument((std::string const &)*arg2,arg3); + result = (arg1)->mReplaceDocument(*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -24830,32 +26119,32 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocumen } } - jresult = jenv->NewStringUTF((&result)->c_str()); + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jstring jresult = 0 ; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string result; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + } + arg3 = *(query_options **)&jarg3; try { - result = (arg1)->deleteDocument((std::string const &)*arg2); + result = (arg1)->mUpdateDocument(*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -24953,35 +26242,29 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocumen } } - jresult = jenv->NewStringUTF((&result)->c_str()); + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - kuzzleio::Document *result = 0 ; + std::vector< kuzzleio::Document * > *arg2 = 0 ; + std::vector< kuzzleio::Document * > result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg3_; + (void)jarg2_; arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; + } try { - result = (kuzzleio::Document *)(arg1)->fetchDocument((std::string const &)*arg2,arg3); + result = (arg1)->mUpdateDocument(*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -25079,32 +26362,28 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1 } } - *(kuzzleio::Document **)&jresult = result; + *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessage_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *result = 0 ; + json_object *arg2 = (json_object *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg2 = *(json_object **)&jarg2; + arg3 = *(query_options **)&jarg3; try { - result = (kuzzleio::Document *)(arg1)->fetchDocument((std::string const &)*arg2); + result = (bool)(arg1)->publishMessage(arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -25202,32 +26481,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1 } } - *(kuzzleio::Document **)&jresult = result; + jresult = (jboolean)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessage_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; + json_object *arg2 = (json_object *) 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; + arg2 = *(json_object **)&jarg2; try { - result = (arg1)->mCreateDocument(*arg2,arg3); + result = (bool)(arg1)->publishMessage(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -25325,29 +26597,38 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + jresult = (jboolean)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; + std::string *arg2 = 0 ; + kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + query_options *arg4 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; + (void)jarg3_; + (void)jarg4_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); return 0; - } + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(kuzzleio::Document **)&jarg3; + arg4 = *(query_options **)&jarg4; try { - result = (arg1)->mCreateDocument(*arg2); + result = (kuzzleio::Document *)(arg1)->replaceDocument((std::string const &)*arg2,arg3,arg4); } catch(kuzzleio::BadRequestException &_e) { { @@ -25445,32 +26726,35 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + *(kuzzleio::Document **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; + std::string *arg2 = 0 ; + kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); return 0; - } - arg3 = *(query_options **)&jarg3; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(kuzzleio::Document **)&jarg3; try { - result = (arg1)->mCreateOrReplaceDocument(*arg2,arg3); + result = (kuzzleio::Document *)(arg1)->replaceDocument((std::string const &)*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -25568,29 +26852,35 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplac } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + *(kuzzleio::Document **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + search_result *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); return 0; - } + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; try { - result = (arg1)->mCreateOrReplaceDocument(*arg2); + result = (search_result *)(arg1)->scroll((std::string const &)*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -25688,32 +26978,32 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplac } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + *(search_result **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< std::string > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< std::string > result; + std::string *arg2 = 0 ; + search_result *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); return 0; - } - arg3 = *(query_options **)&jarg3; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); try { - result = (arg1)->mDeleteDocument(*arg2,arg3); + result = (search_result *)(arg1)->scroll((std::string const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -25811,29 +27101,28 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument } } - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + *(search_result **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< std::string > *arg2 = 0 ; - std::vector< std::string > result; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_result *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); - return 0; - } + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; try { - result = (arg1)->mDeleteDocument(*arg2); + result = (search_result *)(arg1)->search(arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -25931,32 +27220,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument } } - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + *(search_result **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< std::string > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; + search_filters *arg2 = (search_filters *) 0 ; + search_result *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; + arg2 = *(search_filters **)&jarg2; try { - result = (arg1)->mGetDocument(*arg2,arg3); + result = (search_result *)(arg1)->search(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -26054,29 +27336,31 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_ } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + *(search_result **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< std::string > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; + search_filters *arg2 = (search_filters *) 0 ; + kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; + room_options *arg4 = (room_options *) 0 ; + kuzzleio::Room *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; + (void)jarg3_; + (void)jarg4_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); - return 0; - } + arg2 = *(search_filters **)&jarg2; + arg3 = *(kuzzleio::NotificationListener **)&jarg3; + arg4 = *(room_options **)&jarg4; try { - result = (arg1)->mGetDocument(*arg2); + result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3,arg4); } catch(kuzzleio::BadRequestException &_e) { { @@ -26174,17 +27458,17 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_ } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + *(kuzzleio::Room **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; + search_filters *arg2 = (search_filters *) 0 ; + kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; + kuzzleio::Room *result = 0 ; (void)jenv; (void)jcls; @@ -26192,14 +27476,10 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocumen (void)jarg2_; (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; + arg2 = *(search_filters **)&jarg2; + arg3 = *(kuzzleio::NotificationListener **)&jarg3; try { - result = (arg1)->mReplaceDocument(*arg2,arg3); + result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -26297,29 +27577,53 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocumen } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + *(kuzzleio::Room **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1getListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; + kuzzleio::NotificationListener *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + result = (kuzzleio::NotificationListener *)(arg1)->getListener(); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + query_options *arg4 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); return 0; - } + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(kuzzleio::Document **)&jarg3; + arg4 = *(query_options **)&jarg4; try { - result = (arg1)->mReplaceDocument(*arg2); + result = (kuzzleio::Document *)(arg1)->updateDocument((std::string const &)*arg2,arg3,arg4); } catch(kuzzleio::BadRequestException &_e) { { @@ -26417,32 +27721,35 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocumen } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + *(kuzzleio::Document **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; + std::string *arg2 = 0 ; + kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); return 0; - } - arg3 = *(query_options **)&jarg3; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(kuzzleio::Document **)&jarg3; try { - result = (arg1)->mUpdateDocument(*arg2,arg3); + result = (kuzzleio::Document *)(arg1)->updateDocument((std::string const &)*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -26540,29 +27847,107 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; + *(kuzzleio::Document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + json_object *arg2 = (json_object *) 0 ; + room_options *arg3 = (room_options *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(json_object **)&jarg2; + arg3 = *(room_options **)&jarg3; + result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2,arg3); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + json_object *arg2 = (json_object *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(json_object **)&jarg2; + result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + result = (kuzzleio::Room *)new kuzzleio::Room(arg1); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + kuzzleio::SubscribeListener *arg2 = (kuzzleio::SubscribeListener *) 0 ; + kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(room **)&jarg1; + arg2 = *(kuzzleio::SubscribeListener **)&jarg2; + arg3 = *(kuzzleio::NotificationListener **)&jarg3; + result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2,arg3); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Room(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Room **)&jarg1; + delete arg1; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + int result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } + arg1 = *(kuzzleio::Room **)&jarg1; try { - result = (arg1)->mUpdateDocument(*arg2); + result = (int)(arg1)->count(); } catch(kuzzleio::BadRequestException &_e) { { @@ -26660,28 +28045,86 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument } } - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); + jresult = (jint)result; return jresult; } -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessage_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool result; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1getSubscribeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::SubscribeListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Room **)&jarg1; + result = (kuzzleio::SubscribeListener *)(arg1)->getSubscribeListener(); + *(kuzzleio::SubscribeListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1getNotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Room **)&jarg1; + result = (kuzzleio::NotificationListener *)(arg1)->getNotificationListener(); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1onDone(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::SubscribeListener *arg2 = (kuzzleio::SubscribeListener *) 0 ; + kuzzleio::Room *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(query_options **)&jarg3; + arg1 = *(kuzzleio::Room **)&jarg1; + arg2 = *(kuzzleio::SubscribeListener **)&jarg2; + result = (kuzzleio::Room *)(arg1)->onDone(arg2); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Room **)&jarg1; + arg2 = *(kuzzleio::NotificationListener **)&jarg2; + result = (kuzzleio::Room *)(arg1)->subscribe(arg2); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Room **)&jarg1; try { - result = (bool)(arg1)->publishMessage(arg2,arg3); + (arg1)->unsubscribe(); } catch(kuzzleio::BadRequestException &_e) { { @@ -26690,7 +28133,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ForbiddenException &_e) { @@ -26700,7 +28143,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -26710,7 +28153,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::InternalException &_e) { @@ -26720,7 +28163,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::NotFoundException &_e) { @@ -26730,7 +28173,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PartialException &_e) { @@ -26740,7 +28183,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PreconditionException &_e) { @@ -26750,7 +28193,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -26760,13 +28203,13 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; + return ; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -26775,29 +28218,66 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } - jresult = (jboolean)result; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1_1document_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + document *arg2 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(document **)&jarg2; + if (arg1) (arg1)->_document = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1_1document_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + result = (document *) ((arg1)->_document); + *(document **)&jresult = result; return jresult; } -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessage_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jboolean jresult = 0 ; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - bool result; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; + (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(json_object **)&jarg2; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; try { - result = (bool)(arg1)->publishMessage(arg2); + result = (kuzzleio::Document *)new kuzzleio::Document(arg1,(std::string const &)*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -26895,24 +28375,20 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessa } } - jresult = (jboolean)result; + *(kuzzleio::Document **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; std::string *arg2 = 0 ; - kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; - query_options *arg4 = (query_options *) 0 ; kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg3_; - (void)jarg4_; arg1 = *(kuzzleio::Collection **)&jarg1; if(!jarg2) { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); @@ -26923,10 +28399,8 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument std::string arg2_str(arg2_pstr); arg2 = &arg2_str; jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(kuzzleio::Document **)&jarg3; - arg4 = *(query_options **)&jarg4; try { - result = (kuzzleio::Document *)(arg1)->replaceDocument((std::string const &)*arg2,arg3,arg4); + result = (kuzzleio::Document *)new kuzzleio::Document(arg1,(std::string const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -27029,30 +28503,17 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg3_; arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(kuzzleio::Document **)&jarg3; try { - result = (kuzzleio::Document *)(arg1)->replaceDocument((std::string const &)*arg2,arg3); + result = (kuzzleio::Document *)new kuzzleio::Document(arg1); } catch(kuzzleio::BadRequestException &_e) { { @@ -27155,30 +28616,30 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - search_result *result = 0 ; +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Document(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Document **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - result = (search_result *)(arg1)->scroll((std::string const &)*arg2,arg3); + result = (arg1)->delete_(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -27276,32 +28737,22 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_ } } - *(search_result **)&jresult = result; + jresult = jenv->NewStringUTF((&result)->c_str()); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - search_result *result = 0 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg1 = *(kuzzleio::Document **)&jarg1; try { - result = (search_result *)(arg1)->scroll((std::string const &)*arg2); + result = (arg1)->delete_(); } catch(kuzzleio::BadRequestException &_e) { { @@ -27399,28 +28850,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_ } } - *(search_result **)&jresult = result; + jresult = jenv->NewStringUTF((&result)->c_str()); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_result *result = 0 ; +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - result = (search_result *)(arg1)->search(arg2,arg3); + result = (bool)(arg1)->exists(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -27518,25 +28966,22 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_ } } - *(search_result **)&jresult = result; + jresult = (jboolean)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - search_result *result = 0 ; +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; + arg1 = *(kuzzleio::Document **)&jarg1; try { - result = (search_result *)(arg1)->search(arg2); + result = (bool)(arg1)->exists(); } catch(kuzzleio::BadRequestException &_e) { { @@ -27634,31 +29079,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_ } } - *(search_result **)&jresult = result; + jresult = (jboolean)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; - room_options *arg4 = (room_options *) 0 ; - kuzzleio::Room *result = 0 ; +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(kuzzleio::NotificationListener **)&jarg3; - arg4 = *(room_options **)&jarg4; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3,arg4); + result = (bool)(arg1)->publish(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -27756,28 +29195,22 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SW } } - *(kuzzleio::Room **)&jresult = result; + jresult = (jboolean)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; - kuzzleio::Room *result = 0 ; +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(kuzzleio::NotificationListener **)&jarg3; + arg1 = *(kuzzleio::Document **)&jarg1; try { - result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3); + result = (bool)(arg1)->publish(); } catch(kuzzleio::BadRequestException &_e) { { @@ -27875,53 +29308,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SW } } - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1getListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - result = (kuzzleio::NotificationListener *)(arg1)->getListener(); - *(kuzzleio::NotificationListener **)&jresult = result; + jresult = (jboolean)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; - query_options *arg4 = (query_options *) 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(kuzzleio::Document **)&jarg3; - arg4 = *(query_options **)&jarg4; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - result = (kuzzleio::Document *)(arg1)->updateDocument((std::string const &)*arg2,arg3,arg4); + result = (kuzzleio::Document *)(arg1)->refresh(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -28024,30 +29429,17 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_ } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(kuzzleio::Document **)&jarg3; + arg1 = *(kuzzleio::Document **)&jarg1; try { - result = (kuzzleio::Document *)(arg1)->updateDocument((std::string const &)*arg2,arg3); + result = (kuzzleio::Document *)(arg1)->refresh(); } catch(kuzzleio::BadRequestException &_e) { { @@ -28133,119 +29525,37 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_ (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - room_options *arg3 = (room_options *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(room_options **)&jarg3; - result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2,arg3); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(json_object **)&jarg2; - result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - result = (kuzzleio::Room *)new kuzzleio::Room(arg1); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - kuzzleio::SubscribeListener *arg2 = (kuzzleio::SubscribeListener *) 0 ; - kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(room **)&jarg1; - arg2 = *(kuzzleio::SubscribeListener **)&jarg2; - arg3 = *(kuzzleio::NotificationListener **)&jarg3; - result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2,arg3); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Room(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Room **)&jarg1; - delete arg1; + *(kuzzleio::Document **)&jresult = result; + return jresult; } -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - int result; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + query_options *arg2 = (query_options *) 0 ; + kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Room **)&jarg1; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - result = (int)(arg1)->count(); + result = (kuzzleio::Document *)(arg1)->save(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -28343,86 +29653,22 @@ SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1count(JNIEnv *jenv, jc } } - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1getSubscribeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - kuzzleio::SubscribeListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Room **)&jarg1; - result = (kuzzleio::SubscribeListener *)(arg1)->getSubscribeListener(); - *(kuzzleio::SubscribeListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1getNotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Room **)&jarg1; - result = (kuzzleio::NotificationListener *)(arg1)->getNotificationListener(); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1onDone(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - kuzzleio::SubscribeListener *arg2 = (kuzzleio::SubscribeListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Room **)&jarg1; - arg2 = *(kuzzleio::SubscribeListener **)&jarg2; - result = (kuzzleio::Room *)(arg1)->onDone(arg2); - *(kuzzleio::Room **)&jresult = result; + *(kuzzleio::Document **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Room **)&jarg1; - arg2 = *(kuzzleio::NotificationListener **)&jarg2; - result = (kuzzleio::Room *)(arg1)->subscribe(arg2); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Room **)&jarg1; + arg1 = *(kuzzleio::Document **)&jarg1; try { - (arg1)->unsubscribe(); + result = (kuzzleio::Document *)(arg1)->save(); } catch(kuzzleio::BadRequestException &_e) { { @@ -28431,7 +29677,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ForbiddenException &_e) { @@ -28441,7 +29687,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -28451,7 +29697,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::InternalException &_e) { @@ -28461,7 +29707,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::NotFoundException &_e) { @@ -28471,7 +29717,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PartialException &_e) { @@ -28481,7 +29727,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PreconditionException &_e) { @@ -28491,7 +29737,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -28501,13 +29747,13 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; + return 0; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -28516,66 +29762,166 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *je if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } + *(kuzzleio::Document **)&jresult = result; + return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1_1document_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1setContent_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jboolean jarg3) { + jlong jresult = 0 ; kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - document *arg2 = (document *) 0 ; + json_object *arg2 = (json_object *) 0 ; + bool arg3 ; + kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(document **)&jarg2; - if (arg1) (arg1)->_document = arg2; + arg2 = *(json_object **)&jarg2; + arg3 = jarg3 ? true : false; + result = (kuzzleio::Document *)(arg1)->setContent(arg2,arg3); + *(kuzzleio::Document **)&jresult = result; + return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1_1document_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1setContent_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - document *result = 0 ; + json_object *arg2 = (json_object *) 0 ; + kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; arg1 = *(kuzzleio::Document **)&jarg1; - result = (document *) ((arg1)->_document); - *(document **)&jresult = result; + arg2 = *(json_object **)&jarg2; + result = (kuzzleio::Document *)(arg1)->setContent(arg2); + *(kuzzleio::Document **)&jresult = result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1getContent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - kuzzleio::Document *result = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + result = (json_object *)(arg1)->getContent(); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1subscribe_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; + room_options *arg3 = (room_options *) 0 ; + kuzzleio::Room *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; + (void)jarg2_; (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(kuzzleio::NotificationListener **)&jarg2; + arg3 = *(room_options **)&jarg3; + result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1subscribe_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; + kuzzleio::Room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Document **)&jarg1; + arg2 = *(kuzzleio::NotificationListener **)&jarg2; + result = (kuzzleio::Room *)(arg1)->subscribe(arg2); + *(kuzzleio::Room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1getListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Document **)&jarg1; + result = (kuzzleio::NotificationListener *)(arg1)->getListener(); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Index *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Index *)new kuzzleio::Index(arg1); + *(kuzzleio::Index **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Index(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Index **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Index **)&jarg1; if(!jarg2) { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; + return ; } const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; + if (!arg2_pstr) return ; std::string arg2_str(arg2_pstr); arg2 = &arg2_str; jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; try { - result = (kuzzleio::Document *)new kuzzleio::Document(arg1,(std::string const &)*arg2,arg3); + (arg1)->create((std::string const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -28584,7 +29930,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ForbiddenException &_e) { @@ -28594,7 +29940,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -28604,7 +29950,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::InternalException &_e) { @@ -28614,7 +29960,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::NotFoundException &_e) { @@ -28624,7 +29970,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PartialException &_e) { @@ -28634,7 +29980,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PreconditionException &_e) { @@ -28644,7 +29990,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -28654,13 +30000,13 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; + return ; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -28669,36 +30015,32 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } - *(kuzzleio::Document **)&jresult = result; - return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; std::string *arg2 = 0 ; - kuzzleio::Document *result = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; + arg1 = *(kuzzleio::Index **)&jarg1; if(!jarg2) { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; + return ; } const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; + if (!arg2_pstr) return ; std::string arg2_str(arg2_pstr); arg2 = &arg2_str; jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); try { - result = (kuzzleio::Document *)new kuzzleio::Document(arg1,(std::string const &)*arg2); + (arg1)->delete_((std::string const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -28707,7 +30049,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ForbiddenException &_e) { @@ -28717,7 +30059,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -28727,7 +30069,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::InternalException &_e) { @@ -28737,7 +30079,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::NotFoundException &_e) { @@ -28747,7 +30089,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PartialException &_e) { @@ -28757,7 +30099,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PreconditionException &_e) { @@ -28767,7 +30109,7 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -28777,13 +30119,13 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; + return ; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -28792,26 +30134,31 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JN if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } - *(kuzzleio::Document **)&jresult = result; - return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1mDelete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Document *result = 0 ; + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::vector< std::string > *arg2 = 0 ; + std::vector< std::string > result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; + (void)jarg2_; + arg1 = *(kuzzleio::Index **)&jarg1; + arg2 = *(std::vector< std::string > **)&jarg2; + if (!arg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > const & reference is null"); + return 0; + } try { - result = (kuzzleio::Document *)new kuzzleio::Document(arg1); + result = (arg1)->mDelete((std::vector< std::string > const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -28909,35 +30256,32 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_12(JN } } - *(kuzzleio::Document **)&jresult = result; + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Document(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Document **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); try { - result = (arg1)->delete_(arg2); + result = (bool)(arg1)->exists((std::string const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -29035,22 +30379,30 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI } } - jresult = jenv->NewStringUTF((&result)->c_str()); + jresult = (jboolean)result; return jresult; } -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - std::string result; +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); try { - result = (arg1)->delete_(); + (arg1)->refresh((std::string const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -29059,7 +30411,7 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ForbiddenException &_e) { @@ -29069,7 +30421,7 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -29079,7 +30431,7 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::InternalException &_e) { @@ -29089,7 +30441,7 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::NotFoundException &_e) { @@ -29099,7 +30451,7 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PartialException &_e) { @@ -29109,7 +30461,7 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PreconditionException &_e) { @@ -29119,7 +30471,7 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -29129,13 +30481,13 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; + return ; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -29144,29 +30496,22 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWI if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; } -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jboolean jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool result; +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; + arg1 = *(kuzzleio::Index **)&jarg1; try { - result = (bool)(arg1)->exists(arg2); + (arg1)->refreshInternal(); } catch(kuzzleio::BadRequestException &_e) { { @@ -29175,7 +30520,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ForbiddenException &_e) { @@ -29185,7 +30530,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -29195,7 +30540,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::InternalException &_e) { @@ -29205,7 +30550,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::NotFoundException &_e) { @@ -29215,7 +30560,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PartialException &_e) { @@ -29225,7 +30570,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PreconditionException &_e) { @@ -29235,7 +30580,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -29245,13 +30590,13 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; + return ; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -29260,26 +30605,34 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } - jresult = (jboolean)result; - return jresult; } -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - bool result; +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jboolean jarg3) { + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; + bool arg3 ; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = jarg3 ? true : false; try { - result = (bool)(arg1)->exists(); + (arg1)->setAutoRefresh((std::string const &)*arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -29288,7 +30641,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ForbiddenException &_e) { @@ -29298,7 +30651,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -29308,7 +30661,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::InternalException &_e) { @@ -29318,7 +30671,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::NotFoundException &_e) { @@ -29328,7 +30681,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PartialException &_e) { @@ -29338,7 +30691,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::PreconditionException &_e) { @@ -29348,7 +30701,7 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -29358,13 +30711,13 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; + return ; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -29373,29 +30726,34 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return 0; + return ; } } - jresult = (jboolean)result; - return jresult; } -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1getAutoRefresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { jboolean jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string *arg2 = 0 ; bool result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; + arg1 = *(kuzzleio::Index **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); try { - result = (bool)(arg1)->publish(arg2); + result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -29498,17 +30856,17 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWI } -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - bool result; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; + arg1 = *(kuzzleio::Index **)&jarg1; try { - result = (bool)(arg1)->publish(); + result = (arg1)->list(); } catch(kuzzleio::BadRequestException &_e) { { @@ -29606,25 +30964,50 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWI } } - jresult = (jboolean)result; + jresult = jenv->NewStringUTF((&result)->c_str()); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Server(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Server *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Server *)new kuzzleio::Server(arg1); + *(kuzzleio::Server **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Server(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Server **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1adminExists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; query_options *arg2 = (query_options *) 0 ; - kuzzleio::Document *result = 0 ; + bool result; (void)jenv; (void)jcls; (void)jarg1_; (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; + arg1 = *(kuzzleio::Server **)&jarg1; arg2 = *(query_options **)&jarg2; try { - result = (kuzzleio::Document *)(arg1)->refresh(arg2); + result = (bool)(arg1)->adminExists(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -29722,22 +31105,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_1 } } - *(kuzzleio::Document **)&jresult = result; + jresult = (jboolean)result; return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::Document *result = 0 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getAllStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - result = (kuzzleio::Document *)(arg1)->refresh(); + result = (arg1)->getAllStats(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -29835,25 +31221,22 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_1 } } - *(kuzzleio::Document **)&jresult = result; + jresult = jenv->NewStringUTF((&result)->c_str()); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - kuzzleio::Document *result = 0 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getAllStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; + arg1 = *(kuzzleio::Server **)&jarg1; try { - result = (kuzzleio::Document *)(arg1)->save(arg2); + result = (arg1)->getAllStats(); } catch(kuzzleio::BadRequestException &_e) { { @@ -29951,22 +31334,41 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_10(J } } - *(kuzzleio::Document **)&jresult = result; + jresult = jenv->NewStringUTF((&result)->c_str()); return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::Document *result = 0 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + time_t arg2 ; + time_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + time_t *argp2 ; + time_t *argp3 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; + (void)jarg4_; + arg1 = *(kuzzleio::Server **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + arg4 = *(query_options **)&jarg4; try { - result = (kuzzleio::Document *)(arg1)->save(); + result = (arg1)->getStats(arg2,arg3,arg4); } catch(kuzzleio::BadRequestException &_e) { { @@ -30064,162 +31466,38 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_11(J } } - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1setContent_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jboolean jarg3) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - json_object *arg2 = (json_object *) 0 ; - bool arg3 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = jarg3 ? true : false; - result = (kuzzleio::Document *)(arg1)->setContent(arg2,arg3); - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1setContent_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - json_object *arg2 = (json_object *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(json_object **)&jarg2; - result = (kuzzleio::Document *)(arg1)->setContent(arg2); - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1getContent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - result = (json_object *)(arg1)->getContent(); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1subscribe_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; - room_options *arg3 = (room_options *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(kuzzleio::NotificationListener **)&jarg2; - arg3 = *(room_options **)&jarg3; - result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1subscribe_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(kuzzleio::NotificationListener **)&jarg2; - result = (kuzzleio::Room *)(arg1)->subscribe(arg2); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1getListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - result = (kuzzleio::NotificationListener *)(arg1)->getListener(); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Index *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Index *)new kuzzleio::Index(arg1); - *(kuzzleio::Index **)&jresult = result; + jresult = jenv->NewStringUTF((&result)->c_str()); return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Index(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Index **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + time_t arg2 ; + time_t arg3 ; + time_t *argp2 ; + time_t *argp3 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; + arg1 = *(kuzzleio::Server **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *argp3; try { - (arg1)->create((std::string const &)*arg2); + result = (arg1)->getStats(arg2,arg3); } catch(kuzzleio::BadRequestException &_e) { { @@ -30228,7 +31506,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ForbiddenException &_e) { @@ -30238,7 +31516,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -30248,7 +31526,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::InternalException &_e) { @@ -30258,7 +31536,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::NotFoundException &_e) { @@ -30268,7 +31546,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PartialException &_e) { @@ -30278,7 +31556,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PreconditionException &_e) { @@ -30288,7 +31566,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -30298,13 +31576,13 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; + return 0; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -30313,32 +31591,29 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getLastStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - (arg1)->delete_((std::string const &)*arg2); + result = (arg1)->getLastStats(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -30347,7 +31622,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ForbiddenException &_e) { @@ -30357,7 +31632,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -30367,7 +31642,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::InternalException &_e) { @@ -30377,7 +31652,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::NotFoundException &_e) { @@ -30387,7 +31662,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PartialException &_e) { @@ -30397,7 +31672,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PreconditionException &_e) { @@ -30407,7 +31682,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -30417,13 +31692,13 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; + return 0; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -30432,31 +31707,26 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; } -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1mDelete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::vector< std::string > *arg2 = 0 ; - std::vector< std::string > result; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getLastStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Index **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > const & reference is null"); - return 0; - } + arg1 = *(kuzzleio::Server **)&jarg1; try { - result = (arg1)->mDelete((std::vector< std::string > const &)*arg2); + result = (arg1)->getLastStats(); } catch(kuzzleio::BadRequestException &_e) { { @@ -30554,32 +31824,25 @@ SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1mDelete(JNIEnv *jenv } } - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + jresult = jenv->NewStringUTF((&result)->c_str()); return jresult; } -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - bool result; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getConfig_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - result = (bool)(arg1)->exists((std::string const &)*arg2); + result = (arg1)->getConfig(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -30677,30 +31940,22 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1exists(JNIEnv *je } } - jresult = (jboolean)result; + jresult = jenv->NewStringUTF((&result)->c_str()); return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getConfig_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg1 = *(kuzzleio::Server **)&jarg1; try { - (arg1)->refresh((std::string const &)*arg2); + result = (arg1)->getConfig(); } catch(kuzzleio::BadRequestException &_e) { { @@ -30709,7 +31964,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ForbiddenException &_e) { @@ -30719,7 +31974,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -30729,7 +31984,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::InternalException &_e) { @@ -30739,7 +31994,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::NotFoundException &_e) { @@ -30749,7 +32004,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PartialException &_e) { @@ -30759,7 +32014,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PreconditionException &_e) { @@ -30769,7 +32024,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -30779,13 +32034,13 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; + return 0; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -30794,22 +32049,29 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1info_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - (arg1)->refreshInternal(); + result = (arg1)->info(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -30818,7 +32080,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ForbiddenException &_e) { @@ -30828,7 +32090,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -30838,7 +32100,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::InternalException &_e) { @@ -30848,7 +32110,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::NotFoundException &_e) { @@ -30858,7 +32120,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PartialException &_e) { @@ -30868,7 +32130,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PreconditionException &_e) { @@ -30878,7 +32140,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -30888,13 +32150,13 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; + return 0; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -30903,34 +32165,26 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEn if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; } -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jboolean jarg3) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - bool arg3 ; +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1info_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + std::string result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = jarg3 ? true : false; + arg1 = *(kuzzleio::Server **)&jarg1; try { - (arg1)->setAutoRefresh((std::string const &)*arg2,arg3); + result = (arg1)->info(); } catch(kuzzleio::BadRequestException &_e) { { @@ -30939,7 +32193,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ForbiddenException &_e) { @@ -30949,7 +32203,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::GatewayTimeoutException &_e) { @@ -30959,7 +32213,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::InternalException &_e) { @@ -30969,7 +32223,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::NotFoundException &_e) { @@ -30979,7 +32233,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PartialException &_e) { @@ -30989,7 +32243,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::PreconditionException &_e) { @@ -30999,7 +32253,7 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::ServiceUnavailableException &_e) { @@ -31009,13 +32263,13 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } catch(kuzzleio::SizeLimitException &_e) { (void)_e; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; + return 0; } catch(kuzzleio::UnauthorizedException &_e) { { @@ -31024,34 +32278,29 @@ SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv if (excpcls) { jenv->ThrowNew(excpcls, (&_e)->what()); } - return ; + return 0; } } + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; } -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1getAutoRefresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - bool result; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1_1now_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + long long result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; try { - result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2); + result = (long long)(arg1)->now(arg2); } catch(kuzzleio::BadRequestException &_e) { { @@ -31149,22 +32398,22 @@ SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1getAutoRefresh(JN } } - jresult = (jboolean)result; + jresult = (jlong)result; return jresult; } -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string result; +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1_1now_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + long long result; (void)jenv; (void)jcls; (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; + arg1 = *(kuzzleio::Server **)&jarg1; try { - result = (arg1)->list(); + result = (long long)(arg1)->now(); } catch(kuzzleio::BadRequestException &_e) { { @@ -31262,7 +32511,7 @@ SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1list(JNIEnv *jenv, } } - jresult = jenv->NewStringUTF((&result)->c_str()); + jresult = (jlong)result; return jresult; } From 4a260755f214e84be63c003dfa1a312e65e16c8f Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 13:59:57 +0100 Subject: [PATCH 036/363] Fix merge issue --- internal/wrappers/kcore_wrap.cxx | 26859 ++++++++++++++++++++++ internal/wrappers/kcore_wrap.h | 60 + internal/wrappers/templates/java/core.i | 10 - 3 files changed, 26919 insertions(+), 10 deletions(-) create mode 100644 internal/wrappers/kcore_wrap.cxx create mode 100644 internal/wrappers/kcore_wrap.h diff --git a/internal/wrappers/kcore_wrap.cxx b/internal/wrappers/kcore_wrap.cxx new file mode 100644 index 00000000..906cdd00 --- /dev/null +++ b/internal/wrappers/kcore_wrap.cxx @@ -0,0 +1,26859 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.12 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + + +#ifndef SWIGJAVA +#define SWIGJAVA +#endif + +#define SWIG_DIRECTORS + + +#ifdef __cplusplus +/* SwigValueWrapper is described in swig.swg */ +template class SwigValueWrapper { + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { delete ptr; } + SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); + SwigValueWrapper(const SwigValueWrapper& rhs); +public: + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } + operator T&() const { return *pointer.ptr; } + T *operator&() { return pointer.ptr; } +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + + +/* Fix for jlong on some versions of gcc on Windows */ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) + typedef long long __int64; +#endif + +/* Fix for jlong on 64-bit x86 Solaris */ +#if defined(__x86_64) +# ifdef _LP64 +# undef _LP64 +# endif +#endif + +#include +#include +#include + + +/* Support for throwing Java exceptions */ +typedef enum { + SWIG_JavaOutOfMemoryError = 1, + SWIG_JavaIOException, + SWIG_JavaRuntimeException, + SWIG_JavaIndexOutOfBoundsException, + SWIG_JavaArithmeticException, + SWIG_JavaIllegalArgumentException, + SWIG_JavaNullPointerException, + SWIG_JavaDirectorPureVirtual, + SWIG_JavaUnknownError +} SWIG_JavaExceptionCodes; + +typedef struct { + SWIG_JavaExceptionCodes code; + const char *java_exception; +} SWIG_JavaExceptions_t; + + +static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { + jclass excep; + static const SWIG_JavaExceptions_t java_exceptions[] = { + { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, + { SWIG_JavaIOException, "java/io/IOException" }, + { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, + { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, + { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, + { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, + { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, + { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, + { SWIG_JavaUnknownError, "java/lang/UnknownError" }, + { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } + }; + const SWIG_JavaExceptions_t *except_ptr = java_exceptions; + + while (except_ptr->code != code && except_ptr->code) + except_ptr++; + + jenv->ExceptionClear(); + excep = jenv->FindClass(except_ptr->java_exception); + if (excep) + jenv->ThrowNew(excep, msg); +} + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else + +/* ----------------------------------------------------------------------------- + * director_common.swg + * + * This file contains support for director classes which is common between + * languages. + * ----------------------------------------------------------------------------- */ + +/* + Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the + 'Swig' namespace. This could be useful for multi-modules projects. +*/ +#ifdef SWIG_DIRECTOR_STATIC +/* Force anonymous (static) namespace */ +#define Swig +#endif +/* ----------------------------------------------------------------------------- + * director.swg + * + * This file contains support for director classes so that Java proxy + * methods can be called from C++. + * ----------------------------------------------------------------------------- */ + +#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) +#include +#endif + +#include + +namespace Swig { + + /* Java object wrapper */ + class JObjectWrapper { + public: + JObjectWrapper() : jthis_(NULL), weak_global_(true) { + } + + ~JObjectWrapper() { + jthis_ = NULL; + weak_global_ = true; + } + + bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) { + if (!jthis_) { + weak_global_ = weak_global || !mem_own; // hold as weak global if explicitly requested or not owned + if (jobj) + jthis_ = weak_global_ ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj); +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl; +#endif + return true; + } else { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl; +#endif + return false; + } + } + + jobject get(JNIEnv *jenv) const { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::get("; + if (jthis_) + std::cout << jthis_; + else + std::cout << "null"; + std::cout << ") -> return new local ref" << std::endl; +#endif + return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_); + } + + void release(JNIEnv *jenv) { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl; +#endif + if (jthis_) { + if (weak_global_) { + if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) + jenv->DeleteWeakGlobalRef((jweak)jthis_); + } else + jenv->DeleteGlobalRef(jthis_); + } + + jthis_ = NULL; + weak_global_ = true; + } + + /* Only call peek if you know what you are doing wrt to weak/global references */ + jobject peek() { + return jthis_; + } + + /* Java proxy releases ownership of C++ object, C++ object is now + responsible for destruction (creates NewGlobalRef to pin Java proxy) */ + void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { + if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */ + if (!weak_global_) { + jenv->DeleteGlobalRef(jthis_); + jthis_ = jenv->NewWeakGlobalRef(jself); + weak_global_ = true; + } + } else { + /* Java releases ownership of C++ object's lifetime */ + if (weak_global_) { + jenv->DeleteWeakGlobalRef((jweak)jthis_); + jthis_ = jenv->NewGlobalRef(jself); + weak_global_ = false; + } + } + } + + private: + /* pointer to Java object */ + jobject jthis_; + /* Local or global reference flag */ + bool weak_global_; + }; + + /* Local JNI reference deleter */ + class LocalRefGuard { + JNIEnv *jenv_; + jobject jobj_; + + // non-copyable + LocalRefGuard(const LocalRefGuard &); + LocalRefGuard &operator=(const LocalRefGuard &); + public: + LocalRefGuard(JNIEnv *jenv, jobject jobj): jenv_(jenv), jobj_(jobj) {} + ~LocalRefGuard() { + if (jobj_) + jenv_->DeleteLocalRef(jobj_); + } + }; + + /* director base class */ + class Director { + /* pointer to Java virtual machine */ + JavaVM *swig_jvm_; + + protected: +#if defined (_MSC_VER) && (_MSC_VER<1300) + class JNIEnvWrapper; + friend class JNIEnvWrapper; +#endif + /* Utility class for managing the JNI environment */ + class JNIEnvWrapper { + const Director *director_; + JNIEnv *jenv_; + int env_status; + public: + JNIEnvWrapper(const Director *director) : director_(director), jenv_(0), env_status(0) { +#if defined(__ANDROID__) + JNIEnv **jenv = &jenv_; +#else + void **jenv = (void **)&jenv_; +#endif + env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2); +#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON) + // Attach a daemon thread to the JVM. Useful when the JVM should not wait for + // the thread to exit upon shutdown. Only for jdk-1.4 and later. + director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, NULL); +#else + director_->swig_jvm_->AttachCurrentThread(jenv, NULL); +#endif + } + ~JNIEnvWrapper() { +#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) + // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. + // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. + if (env_status == JNI_EDETACHED) + director_->swig_jvm_->DetachCurrentThread(); +#endif + } + JNIEnv *getJNIEnv() const { + return jenv_; + } + }; + + /* Java object wrapper */ + JObjectWrapper swig_self_; + + /* Disconnect director from Java object */ + void swig_disconnect_director_self(const char *disconn_method) { + JNIEnvWrapper jnienv(this) ; + JNIEnv *jenv = jnienv.getJNIEnv() ; + jobject jobj = swig_self_.get(jenv); + LocalRefGuard ref_deleter(jenv, jobj); +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; +#endif + if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { + jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); + if (disconn_meth) { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl; +#endif + jenv->CallVoidMethod(jobj, disconn_meth); + } + } + } + + public: + Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() { + /* Acquire the Java VM pointer */ + jenv->GetJavaVM(&swig_jvm_); + } + + virtual ~Director() { + JNIEnvWrapper jnienv(this) ; + JNIEnv *jenv = jnienv.getJNIEnv() ; + swig_self_.release(jenv); + } + + bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global) { + return swig_self_.set(jenv, jself, mem_own, weak_global); + } + + jobject swig_get_self(JNIEnv *jenv) const { + return swig_self_.get(jenv); + } + + // Change C++ object's ownership, relative to Java + void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { + swig_self_.java_change_ownership(jenv, jself, take_or_release); + } + }; + + // Zero initialized bool array + template class BoolArray { + bool array_[N]; + public: + BoolArray() { + memset(array_, 0, sizeof(array_)); + } + bool& operator[](size_t n) { + return array_[n]; + } + bool operator[](size_t n) const { + return array_[n]; + } + }; + + // Utility classes and functions for exception handling. + + // Simple holder for a Java string during exception handling, providing access to a c-style string + class JavaString { + public: + JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) { + if (jenv_ && jstr_) + cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, NULL); + } + + ~JavaString() { + if (jenv_ && jstr_ && cstr_) + jenv_->ReleaseStringUTFChars(jstr_, cstr_); + } + + const char *c_str(const char *null_string = "null JavaString") const { + return cstr_ ? cstr_ : null_string; + } + + private: + // non-copyable + JavaString(const JavaString &); + JavaString &operator=(const JavaString &); + + JNIEnv *jenv_; + jstring jstr_; + const char *cstr_; + }; + + // Helper class to extract the exception message from a Java throwable + class JavaExceptionMessage { + public: + JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) { + } + + const char *message() const { + return message_.c_str("Could not get exception message in JavaExceptionMessage"); + } + + private: + // non-copyable + JavaExceptionMessage(const JavaExceptionMessage &); + JavaExceptionMessage &operator=(const JavaExceptionMessage &); + + // Get exception message by calling Java method Throwable.getMessage() + static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) { + jstring jmsg = NULL; + if (jenv && throwable) { + jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions + jclass throwclz = jenv->GetObjectClass(throwable); + if (throwclz) { + // All Throwable classes have a getMessage() method, so call it to extract the exception message + jmethodID getMessageMethodID = jenv->GetMethodID(throwclz, "getMessage", "()Ljava/lang/String;"); + if (getMessageMethodID) + jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID); + } + if (jmsg == NULL && jenv->ExceptionCheck()) + jenv->ExceptionClear(); + } + return jmsg; + } + + JavaString message_; + }; + + // C++ Exception class for handling Java exceptions thrown during a director method Java upcall + class DirectorException : public std::exception { + public: + + // Construct exception from a Java throwable + DirectorException(JNIEnv *jenv, jthrowable throwable) : classname_(0), msg_(0) { + + // Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/') + if (throwable) { + jclass throwclz = jenv->GetObjectClass(throwable); + if (throwclz) { + jclass clzclz = jenv->GetObjectClass(throwclz); + if (clzclz) { + jmethodID getNameMethodID = jenv->GetMethodID(clzclz, "getName", "()Ljava/lang/String;"); + if (getNameMethodID) { + jstring jstr_classname = (jstring)(jenv->CallObjectMethod(throwclz, getNameMethodID)); + // Copy strings, since there is no guarantee that jenv will be active when handled + if (jstr_classname) { + JavaString jsclassname(jenv, jstr_classname); + const char *classname = jsclassname.c_str(0); + if (classname) + classname_ = copypath(classname); + } + } + } + } + } + + JavaExceptionMessage exceptionmsg(jenv, throwable); + msg_ = copystr(exceptionmsg.message()); + } + + // More general constructor for handling as a java.lang.RuntimeException + DirectorException(const char *msg) : classname_(0), msg_(copystr(msg ? msg : "Unspecified DirectorException message")) { + } + + ~DirectorException() throw() { + delete[] classname_; + delete[] msg_; + } + + const char *what() const throw() { + return msg_; + } + + // Reconstruct and raise/throw the Java Exception that caused the DirectorException + // Note that any error in the JNI exception handling results in a Java RuntimeException + void raiseJavaException(JNIEnv *jenv) const { + if (jenv) { + jenv->ExceptionClear(); + + jmethodID ctorMethodID = 0; + jclass throwableclass = 0; + if (classname_) { + throwableclass = jenv->FindClass(classname_); + if (throwableclass) + ctorMethodID = jenv->GetMethodID(throwableclass, "", "(Ljava/lang/String;)V"); + } + + if (ctorMethodID) { + jenv->ThrowNew(throwableclass, what()); + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what()); + } + } + } + + private: + static char *copypath(const char *srcmsg) { + char *target = copystr(srcmsg); + for (char *c=target; *c; ++c) { + if ('.' == *c) + *c = '/'; + } + return target; + } + + static char *copystr(const char *srcmsg) { + char *target = 0; + if (srcmsg) { + size_t msglen = strlen(srcmsg) + 1; + target = new char[msglen]; + strncpy(target, srcmsg, msglen); + } + return target; + } + + const char *classname_; + const char *msg_; + }; + + // Helper method to determine if a Java throwable matches a particular Java class type + SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) { + bool matches = false; + + if (throwable && jenv && classname) { + // Exceptions need to be cleared for correct behavior. + // The caller of ExceptionMatches should restore pending exceptions if desired - + // the caller already has the throwable. + jenv->ExceptionClear(); + + jclass clz = jenv->FindClass(classname); + if (clz) { + jclass classclz = jenv->GetObjectClass(clz); + jmethodID isInstanceMethodID = jenv->GetMethodID(classclz, "isInstance", "(Ljava/lang/Object;)Z"); + if (isInstanceMethodID) { + matches = jenv->CallBooleanMethod(clz, isInstanceMethodID, throwable) != 0; + } + } + +#if defined(DEBUG_DIRECTOR_EXCEPTION) + if (jenv->ExceptionCheck()) { + // Typically occurs when an invalid classname argument is passed resulting in a ClassNotFoundException + JavaExceptionMessage exc(jenv, jenv->ExceptionOccurred()); + std::cout << "Error: ExceptionMatches: class '" << classname << "' : " << exc.message() << std::endl; + } +#endif + } + return matches; + } +} + +namespace Swig { + namespace { + jclass jclass_kcoreJNI = NULL; + jmethodID director_method_ids[3]; + } +} + +#include "kuzzle.cpp" +#include "collection.cpp" +#include "server.cpp" + + +#include + + +#include "listeners.hpp" +#include "exceptions.hpp" +#include "event_emitter.hpp" +#include "kuzzle.hpp" +#include "collection.hpp" +#include "server.hpp" +#include +#include + +SWIGINTERN options *new_options(){ + options *o = kuzzle_new_options(); + return o; + } +SWIGINTERN void delete_options(options *self){ + free(self); + } + +#include +#include + + +#include +#include + +SWIGINTERN std::vector< std::string >::const_reference std_vector_Sl_std_string_Sg__get(std::vector< std::string > *self,int i){ + int size = int(self->size()); + if (i>=0 && i *self,int i,std::vector< std::string >::value_type const &val){ + int size = int(self->size()); + if (i>=0 && iIsSameObject(swigjobj, NULL) == JNI_FALSE) { + *((notification_result **)&jarg0) = (notification_result *) arg0; + jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[0], swigjobj, jarg0); + jthrowable swigerror = jenv->ExceptionOccurred(); + if (swigerror) { + jenv->ExceptionClear(); + throw Swig::DirectorException(jenv, swigerror); + } + + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::NotificationListener::onMessage "); + } + if (swigjobj) jenv->DeleteLocalRef(swigjobj); +} + +void SwigDirector_NotificationListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { + static struct { + const char *mname; + const char *mdesc; + jmethodID base_methid; + } methods[] = { + { + "onMessage", "(Lio/kuzzle/sdk/notification_result;)V", NULL + } + }; + + static jclass baseclass = 0 ; + + if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { + if (!baseclass) { + baseclass = jenv->FindClass("io/kuzzle/sdk/NotificationListener"); + if (!baseclass) return; + baseclass = (jclass) jenv->NewGlobalRef(baseclass); + } + bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); + for (int i = 0; i < 1; ++i) { + if (!methods[i].base_methid) { + methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); + if (!methods[i].base_methid) return; + } + swig_override[i] = false; + if (derived) { + jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); + swig_override[i] = (methid != methods[i].base_methid); + jenv->ExceptionClear(); + } + } + } +} + + +SwigDirector_EventListener::SwigDirector_EventListener(JNIEnv *jenv) : kuzzleio::EventListener(), Swig::Director(jenv) { +} + +SwigDirector_EventListener::~SwigDirector_EventListener() { + swig_disconnect_director_self("swigDirectorDisconnect"); +} + + +void SwigDirector_EventListener::trigger(json_object *arg0) const { + JNIEnvWrapper swigjnienv(this) ; + JNIEnv * jenv = swigjnienv.getJNIEnv() ; + jobject swigjobj = (jobject) NULL ; + jlong jarg0 = 0 ; + + if (!swig_override[0]) { + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method kuzzleio::EventListener::trigger."); + return; + } + swigjobj = swig_get_self(jenv); + if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { + *((json_object **)&jarg0) = (json_object *) arg0; + jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[1], swigjobj, jarg0); + jthrowable swigerror = jenv->ExceptionOccurred(); + if (swigerror) { + jenv->ExceptionClear(); + throw Swig::DirectorException(jenv, swigerror); + } + + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::EventListener::trigger "); + } + if (swigjobj) jenv->DeleteLocalRef(swigjobj); +} + +void SwigDirector_EventListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { + static struct { + const char *mname; + const char *mdesc; + jmethodID base_methid; + } methods[] = { + { + "trigger", "(Lio/kuzzle/sdk/JsonObject;)V", NULL + } + }; + + static jclass baseclass = 0 ; + + if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { + if (!baseclass) { + baseclass = jenv->FindClass("io/kuzzle/sdk/EventListener"); + if (!baseclass) return; + baseclass = (jclass) jenv->NewGlobalRef(baseclass); + } + bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); + for (int i = 0; i < 1; ++i) { + if (!methods[i].base_methid) { + methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); + if (!methods[i].base_methid) return; + } + swig_override[i] = false; + if (derived) { + jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); + swig_override[i] = (methid != methods[i].base_methid); + jenv->ExceptionClear(); + } + } + } +} + + +SwigDirector_SubscribeListener::SwigDirector_SubscribeListener(JNIEnv *jenv) : kuzzleio::SubscribeListener(), Swig::Director(jenv) { +} + +SwigDirector_SubscribeListener::~SwigDirector_SubscribeListener() { + swig_disconnect_director_self("swigDirectorDisconnect"); +} + + +void SwigDirector_SubscribeListener::onSubscribe(room_result *arg0) const { + JNIEnvWrapper swigjnienv(this) ; + JNIEnv * jenv = swigjnienv.getJNIEnv() ; + jobject swigjobj = (jobject) NULL ; + jlong jarg0 = 0 ; + + if (!swig_override[0]) { + SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method kuzzleio::SubscribeListener::onSubscribe."); + return; + } + swigjobj = swig_get_self(jenv); + if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { + *((room_result **)&jarg0) = (room_result *) arg0; + jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[2], swigjobj, jarg0); + jthrowable swigerror = jenv->ExceptionOccurred(); + if (swigerror) { + jenv->ExceptionClear(); + throw Swig::DirectorException(jenv, swigerror); + } + + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::SubscribeListener::onSubscribe "); + } + if (swigjobj) jenv->DeleteLocalRef(swigjobj); +} + +void SwigDirector_SubscribeListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { + static struct { + const char *mname; + const char *mdesc; + jmethodID base_methid; + } methods[] = { + { + "onSubscribe", "(Lio/kuzzle/sdk/room_result;)V", NULL + } + }; + + static jclass baseclass = 0 ; + + if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { + if (!baseclass) { + baseclass = jenv->FindClass("io/kuzzle/sdk/SubscribeListener"); + if (!baseclass) return; + baseclass = (jclass) jenv->NewGlobalRef(baseclass); + } + bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); + for (int i = 0; i < 1; ++i) { + if (!methods[i].base_methid) { + methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); + if (!methods[i].base_methid) return; + } + swig_override[i] = false; + if (derived) { + jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); + swig_override[i] = (methid != methods[i].base_methid); + jenv->ExceptionClear(); + } + } + } +} + + + +#ifdef __cplusplus +extern "C" { +#endif + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1query_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + query_object *arg1 = (query_object *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(query_object **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->query = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1query_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + query_object *arg1 = (query_object *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + result = (json_object *) ((arg1)->query); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + query_object *arg1 = (query_object *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->timestamp = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + query_object *arg1 = (query_object *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + result = (unsigned long long) ((arg1)->timestamp); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_object *arg1 = (query_object *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->request_id; + if (arg2) { + arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->request_id, (const char *)arg2); + } else { + arg1->request_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_object *arg1 = (query_object *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + result = (char *) ((arg1)->request_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1query_1object(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + query_object *result = 0 ; + + (void)jenv; + (void)jcls; + result = (query_object *)new query_object(); + *(query_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1query_1object(JNIEnv *jenv, jclass jcls, jlong jarg1) { + query_object *arg1 = (query_object *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(query_object **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + offline_queue *arg1 = (offline_queue *) 0 ; + query_object **arg2 = (query_object **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + arg2 = *(query_object ***)&jarg2; + if (arg1) (arg1)->queries = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + offline_queue *arg1 = (offline_queue *) 0 ; + query_object **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + result = (query_object **) ((arg1)->queries); + *(query_object ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + offline_queue *arg1 = (offline_queue *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->queries_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + offline_queue *arg1 = (offline_queue *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + result = ((arg1)->queries_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1offline_1queue(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + offline_queue *result = 0 ; + + (void)jenv; + (void)jcls; + result = (offline_queue *)new offline_queue(); + *(offline_queue **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1) { + offline_queue *arg1 = (offline_queue *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(offline_queue **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->request_id; + if (arg2) { + arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->request_id, (const char *)arg2); + } else { + arg1->request_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->request_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->controller; + if (arg2) { + arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->controller, (const char *)arg2); + } else { + arg1->controller = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->controller); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->action; + if (arg2) { + arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->action, (const char *)arg2); + } else { + arg1->action = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->action); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1body_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->body = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1body_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (json_object *) ((arg1)->body); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->from = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->from); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->size = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->size); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll; + if (arg2) { + arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll, (const char *)arg2); + } else { + arg1->scroll = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->scroll); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1strategy_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->strategy; + if (arg2) { + arg1->strategy = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->strategy, (const char *)arg2); + } else { + arg1->strategy = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1strategy_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->strategy); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1expires_1in_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->expires_in = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1expires_1in_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (unsigned long long) ((arg1)->expires_in); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scope; + if (arg2) { + arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scope, (const char *)arg2); + } else { + arg1->scope = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->scope); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->state; + if (arg2) { + arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->state, (const char *)arg2); + } else { + arg1->state = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->state); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->user; + if (arg2) { + arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->user, (const char *)arg2); + } else { + arg1->user = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->user); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1start_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->start = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1start_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->start); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1stop_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->stop = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1stop_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->stop); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1end_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->end = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1end_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->end); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1bit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jshort jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned char arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (unsigned char)jarg2; + if (arg1) (arg1)->bit = arg2; +} + + +SWIGEXPORT jshort JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1bit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jshort jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned char result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (unsigned char) ((arg1)->bit); + jresult = (jshort)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->member; + if (arg2) { + arg1->member = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->member, (const char *)arg2); + } else { + arg1->member = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->member); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member1_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->member1; + if (arg2) { + arg1->member1 = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->member1, (const char *)arg2); + } else { + arg1->member1 = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->member1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member2_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->member2; + if (arg2) { + arg1->member2 = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->member2, (const char *)arg2); + } else { + arg1->member2 = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member2_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->member2); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->members = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char **) ((arg1)->members); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->members_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = ((arg1)->members_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lon_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (double)jarg2; + if (arg1) (arg1)->lon = arg2; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lon_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jdouble jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (double) ((arg1)->lon); + jresult = (jdouble)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lat_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (double)jarg2; + if (arg1) (arg1)->lat = arg2; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lat_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jdouble jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (double) ((arg1)->lat); + jresult = (jdouble)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1distance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (double)jarg2; + if (arg1) (arg1)->distance = arg2; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1distance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jdouble jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (double) ((arg1)->distance); + jresult = (jdouble)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1unit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->unit; + if (arg2) { + arg1->unit = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->unit, (const char *)arg2); + } else { + arg1->unit = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1unit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->unit); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->options = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (json_object *) ((arg1)->options); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->keys = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char **) ((arg1)->keys); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->keys_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = ((arg1)->keys_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1cursor_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->cursor = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1cursor_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->cursor); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1offset_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->offset = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1offset_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->offset); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1field_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->field; + if (arg2) { + arg1->field = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->field, (const char *)arg2); + } else { + arg1->field = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1field_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->field); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->fields = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char **) ((arg1)->fields); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->fields_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = ((arg1)->fields_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1subcommand_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->subcommand; + if (arg2) { + arg1->subcommand = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->subcommand, (const char *)arg2); + } else { + arg1->subcommand = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1subcommand_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->subcommand); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1pattern_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->pattern; + if (arg2) { + arg1->pattern = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->pattern, (const char *)arg2); + } else { + arg1->pattern = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1pattern_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->pattern); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1idx_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->idx = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1idx_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (long) ((arg1)->idx); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1min_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->min; + if (arg2) { + arg1->min = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->min, (const char *)arg2); + } else { + arg1->min = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1min_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->min); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1max_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->max; + if (arg2) { + arg1->max = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->max, (const char *)arg2); + } else { + arg1->max = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1max_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->max); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1limit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->limit; + if (arg2) { + arg1->limit = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->limit, (const char *)arg2); + } else { + arg1->limit = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1limit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->limit); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1count_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = (unsigned long)jarg2; + if (arg1) (arg1)->count = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1count_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + unsigned long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (unsigned long) ((arg1)->count); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1match_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->match; + if (arg2) { + arg1->match = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->match, (const char *)arg2); + } else { + arg1->match = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1match_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + result = (char *) ((arg1)->match); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleRequest(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzle_request *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzle_request *)new kuzzle_request(); + *(kuzzle_request **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleRequest(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzle_request **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1filter_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_queue_filter arg2 = (kuzzle_queue_filter) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_queue_filter *)&jarg2; + if (arg1) (arg1)->filter = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1filter_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_queue_filter result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (kuzzle_queue_filter) ((arg1)->filter); + *(kuzzle_queue_filter *)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1loader_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_offline_queue_loader arg2 = (kuzzle_offline_queue_loader) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_offline_queue_loader *)&jarg2; + if (arg1) (arg1)->loader = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1loader_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_offline_queue_loader result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (kuzzle_offline_queue_loader) ((arg1)->loader); + *(kuzzle_offline_queue_loader *)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1kuzzle(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzle *)new kuzzle(); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzle **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1ALL_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)collection_list_options::ALL; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1STORED_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)collection_list_options::STORED; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1REALTIME_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)collection_list_options::REALTIME; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1type_1_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + collection_list_options *arg1 = (collection_list_options *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_list_options **)&jarg1; + arg2 = (int)jarg2; + if (arg1 && sizeof(int) == sizeof((arg1)->type_)) *(int*)(void*)&((arg1)->type_) = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1type_1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + collection_list_options *arg1 = (collection_list_options *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_list_options **)&jarg1; + result = (int) ((arg1)->type_); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + collection_list_options *arg1 = (collection_list_options *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_list_options **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->from = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + collection_list_options *arg1 = (collection_list_options *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_list_options **)&jarg1; + result = (int) ((arg1)->from); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + collection_list_options *arg1 = (collection_list_options *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_list_options **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->size = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + collection_list_options *arg1 = (collection_list_options *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_list_options **)&jarg1; + result = (int) ((arg1)->size); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1collection_1list_1options(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + collection_list_options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (collection_list_options *)new collection_list_options(); + *(collection_list_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1collection_1list_1options(JNIEnv *jenv, jclass jcls, jlong jarg1) { + collection_list_options *arg1 = (collection_list_options *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(collection_list_options **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1type_1_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + search_options *arg1 = (search_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->type_; + if (arg2) { + arg1->type_ = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->type_, (const char *)arg2); + } else { + arg1->type_ = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1type_1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + search_options *arg1 = (search_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_options **)&jarg1; + result = (char *) ((arg1)->type_); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + search_options *arg1 = (search_options *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_options **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->from = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + search_options *arg1 = (search_options *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_options **)&jarg1; + result = (int) ((arg1)->from); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + search_options *arg1 = (search_options *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_options **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->size = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + search_options *arg1 = (search_options *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_options **)&jarg1; + result = (int) ((arg1)->size); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + search_options *arg1 = (search_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll; + if (arg2) { + arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll, (const char *)arg2); + } else { + arg1->scroll = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + search_options *arg1 = (search_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_options **)&jarg1; + result = (char *) ((arg1)->scroll); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1options(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_options *)new search_options(); + *(search_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1options(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_options *arg1 = (search_options *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_options **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + server *arg1 = (server *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(server **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(server **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + server *arg1 = (server *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(server **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1server(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + server *result = 0 ; + + (void)jenv; + (void)jcls; + result = (server *)new server(); + *(server **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1server(JNIEnv *jenv, jclass jcls, jlong jarg1) { + server *arg1 = (server *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(server **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_options *arg1 = (room_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scope; + if (arg2) { + arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scope, (const char *)arg2); + } else { + arg1->scope = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (char *) ((arg1)->scope); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_options *arg1 = (room_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->state; + if (arg2) { + arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->state, (const char *)arg2); + } else { + arg1->state = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (char *) ((arg1)->state); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_options *arg1 = (room_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->user; + if (arg2) { + arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->user, (const char *)arg2); + } else { + arg1->user = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (char *) ((arg1)->user); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1subscribe_1to_1self_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + room_options *arg1 = (room_options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->subscribe_to_self = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1subscribe_1to_1self_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (bool) ((arg1)->subscribe_to_self); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + room_options *arg1 = (room_options *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(room_options **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room_options *arg1 = (room_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1RoomOptions(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + room_options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (room_options *)new room_options(); + *(room_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1RoomOptions(JNIEnv *jenv, jclass jcls, jlong jarg1) { + room_options *arg1 = (room_options *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(room_options **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + room *arg1 = (room *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1filters_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + room *arg1 = (room *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(room **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->filters = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1filters_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + result = (json_object *) ((arg1)->filters); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + room *arg1 = (room *) 0 ; + room_options *arg2 = (room_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(room **)&jarg1; + arg2 = *(room_options **)&jarg2; + if (arg1) (arg1)->options = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room *arg1 = (room *) 0 ; + room_options *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room **)&jarg1; + result = (room_options *) ((arg1)->options); + *(room_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1room(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + room *result = 0 ; + + (void)jenv; + (void)jcls; + result = (room *)new room(); + *(room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1room(JNIEnv *jenv, jclass jcls, jlong jarg1) { + room *arg1 = (room *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(room **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + room_result *arg1 = (room_result *) 0 ; + room *arg2 = (room *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(room_result **)&jarg1; + arg2 = *(room **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + room_result *arg1 = (room_result *) 0 ; + room *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + result = (room *) ((arg1)->result); + *(room **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + room_result *arg1 = (room_result *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->status = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + room_result *arg1 = (room_result *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + result = (int) ((arg1)->status); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_result *arg1 = (room_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->error; + if (arg2) { + arg1->error = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->error, (const char *)arg2); + } else { + arg1->error = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_result *arg1 = (room_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + result = (char *) ((arg1)->error); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1stack_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + room_result *arg1 = (room_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->stack; + if (arg2) { + arg1->stack = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->stack, (const char *)arg2); + } else { + arg1->stack = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1stack_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + room_result *arg1 = (room_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_result **)&jarg1; + result = (char *) ((arg1)->stack); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1room_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + room_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (room_result *)new room_result(); + *(room_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1room_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + room_result *arg1 = (room_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(room_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1queuable_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + query_options *arg1 = (query_options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->queuable = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1queuable_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (bool) ((arg1)->queuable); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withdist_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + query_options *arg1 = (query_options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->withdist = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withdist_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (bool) ((arg1)->withdist); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withcoord_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + query_options *arg1 = (query_options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->withcoord = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withcoord_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (bool) ((arg1)->withcoord); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + query_options *arg1 = (query_options *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->from = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (long) ((arg1)->from); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + query_options *arg1 = (query_options *) 0 ; + long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = (long)jarg2; + if (arg1) (arg1)->size = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (long) ((arg1)->size); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_options *arg1 = (query_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll; + if (arg2) { + arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll, (const char *)arg2); + } else { + arg1->scroll = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (char *) ((arg1)->scroll); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_options *arg1 = (query_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1refresh_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_options *arg1 = (query_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->refresh; + if (arg2) { + arg1->refresh = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->refresh, (const char *)arg2); + } else { + arg1->refresh = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1refresh_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (char *) ((arg1)->refresh); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1if_1exist_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + query_options *arg1 = (query_options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->if_exist; + if (arg2) { + arg1->if_exist = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->if_exist, (const char *)arg2); + } else { + arg1->if_exist = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1if_1exist_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (char *) ((arg1)->if_exist); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1retry_1on_1conflict_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + query_options *arg1 = (query_options *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->retry_on_conflict = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1retry_1on_1conflict_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (int) ((arg1)->retry_on_conflict); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + query_options *arg1 = (query_options *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(query_options **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + query_options *arg1 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1QueryOptions(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + query_options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (query_options *)new query_options(); + *(query_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1QueryOptions(JNIEnv *jenv, jclass jcls, jlong jarg1) { + query_options *arg1 = (query_options *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(query_options **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queueTTL_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + options *arg1 = (options *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->queue_ttl = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queueTTL_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned int) ((arg1)->queue_ttl); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queue_1max_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + options *arg1 = (options *) 0 ; + unsigned long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned long)jarg2; + if (arg1) (arg1)->queue_max_size = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queue_1max_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned long) ((arg1)->queue_max_size); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1offline_1mode_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jshort jarg2) { + options *arg1 = (options *) 0 ; + unsigned char arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned char)jarg2; + if (arg1) (arg1)->offline_mode = arg2; +} + + +SWIGEXPORT jshort JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1offline_1mode_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jshort jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned char result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned char) ((arg1)->offline_mode); + jresult = (jshort)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1queue_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + options *arg1 = (options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->auto_queue = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1queue_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + options *arg1 = (options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (bool) ((arg1)->auto_queue); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1reconnect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + options *arg1 = (options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->auto_reconnect = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1reconnect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + options *arg1 = (options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (bool) ((arg1)->auto_reconnect); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1replay_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + options *arg1 = (options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->auto_replay = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1replay_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + options *arg1 = (options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (bool) ((arg1)->auto_replay); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1resubscribe_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + options *arg1 = (options *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->auto_resubscribe = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1resubscribe_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + options *arg1 = (options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (bool) ((arg1)->auto_resubscribe); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1reconnection_1delay_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + options *arg1 = (options *) 0 ; + unsigned long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned long)jarg2; + if (arg1) (arg1)->reconnection_delay = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1reconnection_1delay_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned long) ((arg1)->reconnection_delay); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1replay_1interval_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + options *arg1 = (options *) 0 ; + unsigned long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (unsigned long)jarg2; + if (arg1) (arg1)->replay_interval = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1replay_1interval_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + options *arg1 = (options *) 0 ; + unsigned long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (unsigned long) ((arg1)->replay_interval); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1connect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + options *arg1 = (options *) 0 ; + enum Mode arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = (enum Mode)jarg2; + if (arg1) (arg1)->connect = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1connect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + options *arg1 = (options *) 0 ; + enum Mode result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (enum Mode) ((arg1)->connect); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1refresh_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + options *arg1 = (options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->refresh; + if (arg2) { + arg1->refresh = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->refresh, (const char *)arg2); + } else { + arg1->refresh = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1refresh_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + options *arg1 = (options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (char *) ((arg1)->refresh); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1default_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + options *arg1 = (options *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->default_index; + if (arg2) { + arg1->default_index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->default_index, (const char *)arg2); + } else { + arg1->default_index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1default_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + options *arg1 = (options *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + result = (char *) ((arg1)->default_index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Options(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (options *)new_options(); + *(options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Options(JNIEnv *jenv, jclass jcls, jlong jarg1) { + options *arg1 = (options *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(options **)&jarg1; + delete_options(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1author_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + meta *arg1 = (meta *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->author; + if (arg2) { + arg1->author = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->author, (const char *)arg2); + } else { + arg1->author = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1author_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + meta *arg1 = (meta *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (char *) ((arg1)->author); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1created_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + meta *arg1 = (meta *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->created_at = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1created_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + meta *arg1 = (meta *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (unsigned long long) ((arg1)->created_at); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updated_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + meta *arg1 = (meta *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->updated_at = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updated_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + meta *arg1 = (meta *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (unsigned long long) ((arg1)->updated_at); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updater_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + meta *arg1 = (meta *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->updater; + if (arg2) { + arg1->updater = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->updater, (const char *)arg2); + } else { + arg1->updater = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updater_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + meta *arg1 = (meta *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (char *) ((arg1)->updater); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1active_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + meta *arg1 = (meta *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->active = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1active_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + meta *arg1 = (meta *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (bool) ((arg1)->active); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1deleted_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + meta *arg1 = (meta *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->deleted_at = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1deleted_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + meta *arg1 = (meta *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + result = (unsigned long long) ((arg1)->deleted_at); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1meta(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + meta *result = 0 ; + + (void)jenv; + (void)jcls; + result = (meta *)new meta(); + *(meta **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1meta(JNIEnv *jenv, jclass jcls, jlong jarg1) { + meta *arg1 = (meta *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(meta **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + policy_restriction *arg1 = (policy_restriction *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->collections = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + policy_restriction *arg1 = (policy_restriction *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + result = (char **) ((arg1)->collections); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->collections_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + policy_restriction *arg1 = (policy_restriction *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + result = ((arg1)->collections_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1policy_1restriction(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + policy_restriction *result = 0 ; + + (void)jenv; + (void)jcls; + result = (policy_restriction *)new policy_restriction(); + *(policy_restriction **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1policy_1restriction(JNIEnv *jenv, jclass jcls, jlong jarg1) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(policy_restriction **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1role_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + policy *arg1 = (policy *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->role_id; + if (arg2) { + arg1->role_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->role_id, (const char *)arg2); + } else { + arg1->role_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1role_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + policy *arg1 = (policy *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + result = (char *) ((arg1)->role_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + policy *arg1 = (policy *) 0 ; + policy_restriction *arg2 = (policy_restriction *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(policy **)&jarg1; + arg2 = *(policy_restriction **)&jarg2; + if (arg1) (arg1)->restricted_to = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + policy *arg1 = (policy *) 0 ; + policy_restriction *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + result = (policy_restriction *) ((arg1)->restricted_to); + *(policy_restriction **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + policy *arg1 = (policy *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->restricted_to_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + policy *arg1 = (policy *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + result = ((arg1)->restricted_to_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1policy(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + policy *result = 0 ; + + (void)jenv; + (void)jcls; + result = (policy *)new policy(); + *(policy **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1) { + policy *arg1 = (policy *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(policy **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + profile *arg1 = (profile *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + profile *arg1 = (profile *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profile *arg1 = (profile *) 0 ; + policy *arg2 = (policy *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(policy **)&jarg2; + if (arg1) (arg1)->policies = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + policy *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + result = (policy *) ((arg1)->policies); + *(policy **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + profile *arg1 = (profile *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->policies_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + result = ((arg1)->policies_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profile *arg1 = (profile *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + result = (profile *)new profile(); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1) { + profile *arg1 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(profile **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + role *arg1 = (role *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + role *arg1 = (role *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1controllers_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + role *arg1 = (role *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->controllers = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1controllers_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role *arg1 = (role *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + result = (json_object *) ((arg1)->controllers); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + role *arg1 = (role *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role *arg1 = (role *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + role *result = 0 ; + + (void)jenv; + (void)jcls; + result = (role *)new role(); + *(role **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role(JNIEnv *jenv, jclass jcls, jlong jarg1) { + role *arg1 = (role *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(role **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user *arg1 = (user *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user *arg1 = (user *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->content = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = (json_object *) ((arg1)->content); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user *arg1 = (user *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->profile_ids = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = (char **) ((arg1)->profile_ids); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user *arg1 = (user *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->profile_ids_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = ((arg1)->profile_ids_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user *arg1 = (user *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1User(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user *)new user(); + *(user **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1User(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user *arg1 = (user *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user_data *arg1 = (user_data *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user_data **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->content = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_data *arg1 = (user_data *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + result = (json_object *) ((arg1)->content); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_data *arg1 = (user_data *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->profile_ids = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_data *arg1 = (user_data *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + result = (char **) ((arg1)->profile_ids); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_data *arg1 = (user_data *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->profile_ids_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_data *arg1 = (user_data *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + result = ((arg1)->profile_ids_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UserData(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_data *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_data *)new user_data(); + *(user_data **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1UserData(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_data *arg1 = (user_data *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_data **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1failed_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + shards *arg1 = (shards *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->failed = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1failed_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + shards *arg1 = (shards *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + result = (int) ((arg1)->failed); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1successful_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + shards *arg1 = (shards *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->successful = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1successful_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + shards *arg1 = (shards *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + result = (int) ((arg1)->successful); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + shards *arg1 = (shards *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + shards *arg1 = (shards *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards **)&jarg1; + result = (int) ((arg1)->total); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1shards(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + shards *result = 0 ; + + (void)jenv; + (void)jcls; + result = (shards *)new shards(); + *(shards **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1shards(JNIEnv *jenv, jclass jcls, jlong jarg1) { + shards *arg1 = (shards *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(shards **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + collection *arg1 = (collection *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + collection *arg1 = (collection *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + result = (kuzzle *) ((arg1)->kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1collection(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + collection *result = 0 ; + + (void)jenv; + (void)jcls; + result = (collection *)new collection(); + *(collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { + collection *arg1 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(collection **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + document *arg1 = (document *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->instance = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (void *) ((arg1)->instance); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document *arg1 = (document *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document *arg1 = (document *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document *arg1 = (document *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document *arg1 = (document *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1meta_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document *arg1 = (document *) 0 ; + meta *arg2 = (meta *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(meta **)&jarg2; + if (arg1) (arg1)->meta = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1meta_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + meta *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (meta *) ((arg1)->meta); + *(meta **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1shards_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document *arg1 = (document *) 0 ; + shards *arg2 = (shards *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(shards **)&jarg2; + if (arg1) (arg1)->shards = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1shards_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + shards *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (shards *) ((arg1)->shards); + *(shards **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document *arg1 = (document *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->content = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (json_object *) ((arg1)->content); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1version_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + document *arg1 = (document *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->version = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1version_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + document *arg1 = (document *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (int) ((arg1)->version); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document *arg1 = (document *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->result; + if (arg2) { + arg1->result = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->result, (const char *)arg2); + } else { + arg1->result = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document *arg1 = (document *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (char *) ((arg1)->result); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1created_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + document *arg1 = (document *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->created = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1created_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + document *arg1 = (document *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (bool) ((arg1)->created); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document *arg1 = (document *) 0 ; + collection *arg2 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document **)&jarg1; + arg2 = *(collection **)&jarg2; + if (arg1) (arg1)->_collection = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document *arg1 = (document *) 0 ; + collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (collection *) ((arg1)->_collection); + *(collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document *arg1 = (document *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document *arg1 = (document *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + result = (document *)new document(); + *(document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document(JNIEnv *jenv, jclass jcls, jlong jarg1) { + document *arg1 = (document *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(document **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document_result *arg1 = (document_result *) 0 ; + document *arg2 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document_result **)&jarg1; + arg2 = *(document **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document_result *arg1 = (document_result *) 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_result **)&jarg1; + result = (document *) ((arg1)->result); + *(document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + document_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (document_result *)new document_result(); + *(document_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + document_result *arg1 = (document_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(document_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + document_array_result *arg1 = (document_array_result *) 0 ; + document *arg2 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(document_array_result **)&jarg1; + arg2 = *(document **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + document *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = (document *) ((arg1)->result); + *(document **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + document_array_result *arg1 = (document_array_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + document_array_result *arg1 = (document_array_result *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->status = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = (int) ((arg1)->status); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document_array_result *arg1 = (document_array_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->error; + if (arg2) { + arg1->error = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->error, (const char *)arg2); + } else { + arg1->error = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = (char *) ((arg1)->error); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1stack_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + document_array_result *arg1 = (document_array_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->stack; + if (arg2) { + arg1->stack = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->stack, (const char *)arg2); + } else { + arg1->stack = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1stack_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + document_array_result *arg1 = (document_array_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + result = (char *) ((arg1)->stack); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document_1array_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + document_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (document_array_result *)new document_array_result(); + *(document_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + document_array_result *arg1 = (document_array_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(document_array_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_content *arg1 = (notification_content *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->id; + if (arg2) { + arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->id, (const char *)arg2); + } else { + arg1->id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_content *arg1 = (notification_content *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + result = (char *) ((arg1)->id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1meta_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + notification_content *arg1 = (notification_content *) 0 ; + meta *arg2 = (meta *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(notification_content **)&jarg1; + arg2 = *(meta **)&jarg2; + if (arg1) (arg1)->meta = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1meta_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + notification_content *arg1 = (notification_content *) 0 ; + meta *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + result = (meta *) ((arg1)->meta); + *(meta **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + notification_content *arg1 = (notification_content *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(notification_content **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->content = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + notification_content *arg1 = (notification_content *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + result = (json_object *) ((arg1)->content); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1count_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + notification_content *arg1 = (notification_content *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->count = arg2; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1count_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + notification_content *arg1 = (notification_content *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + result = (int) ((arg1)->count); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1notification_1content(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + notification_content *result = 0 ; + + (void)jenv; + (void)jcls; + result = (notification_content *)new notification_content(); + *(notification_content **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1notification_1content(JNIEnv *jenv, jclass jcls, jlong jarg1) { + notification_content *arg1 = (notification_content *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(notification_content **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->request_id; + if (arg2) { + arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->request_id, (const char *)arg2); + } else { + arg1->request_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->request_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + notification_result *arg1 = (notification_result *) 0 ; + notification_content *arg2 = (notification_content *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(notification_result **)&jarg1; + arg2 = *(notification_content **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + notification_content *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (notification_content *) ((arg1)->result); + *(notification_content **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + notification_result *arg1 = (notification_result *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(notification_result **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->controller; + if (arg2) { + arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->controller, (const char *)arg2); + } else { + arg1->controller = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->controller); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->action; + if (arg2) { + arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->action, (const char *)arg2); + } else { + arg1->action = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->action); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1protocol_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->protocol; + if (arg2) { + arg1->protocol = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->protocol, (const char *)arg2); + } else { + arg1->protocol = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1protocol_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->protocol); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scope; + if (arg2) { + arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scope, (const char *)arg2); + } else { + arg1->scope = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->scope); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->state; + if (arg2) { + arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->state, (const char *)arg2); + } else { + arg1->state = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->state); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->user; + if (arg2) { + arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->user, (const char *)arg2); + } else { + arg1->user = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->user); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1n_1type_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->n_type; + if (arg2) { + arg1->n_type = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->n_type, (const char *)arg2); + } else { + arg1->n_type = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1n_1type_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->n_type); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1room_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->room_id; + if (arg2) { + arg1->room_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->room_id, (const char *)arg2); + } else { + arg1->room_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1room_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (char *) ((arg1)->room_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + notification_result *arg1 = (notification_result *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->timestamp = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + notification_result *arg1 = (notification_result *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + result = (unsigned long long) ((arg1)->timestamp); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1notification_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + notification_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (notification_result *)new notification_result(); + *(notification_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1notification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + notification_result *arg1 = (notification_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(notification_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1result_1profile_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profile_result *arg1 = (profile_result *) 0 ; + profile *arg2 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile_result **)&jarg1; + arg2 = *(profile **)&jarg2; + if (arg1) (arg1)->profile = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1result_1profile_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile_result *arg1 = (profile_result *) 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_result **)&jarg1; + result = (profile *) ((arg1)->profile); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + profile_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (profile_result *)new profile_result(); + *(profile_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + profile_result *arg1 = (profile_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(profile_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profiles_result *arg1 = (profiles_result *) 0 ; + profile *arg2 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profiles_result **)&jarg1; + arg2 = *(profile **)&jarg2; + if (arg1) (arg1)->profiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profiles_result *arg1 = (profiles_result *) 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profiles_result **)&jarg1; + result = (profile *) ((arg1)->profiles); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + profiles_result *arg1 = (profiles_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profiles_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->profiles_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profiles_result *arg1 = (profiles_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profiles_result **)&jarg1; + result = ((arg1)->profiles_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profiles_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (profiles_result *)new profiles_result(); + *(profiles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + profiles_result *arg1 = (profiles_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(profiles_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1result_1role_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + role_result *arg1 = (role_result *) 0 ; + role *arg2 = (role *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role_result **)&jarg1; + arg2 = *(role **)&jarg2; + if (arg1) (arg1)->role = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1result_1role_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role_result *arg1 = (role_result *) 0 ; + role *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_result **)&jarg1; + result = (role *) ((arg1)->role); + *(role **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + role_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (role_result *)new role_result(); + *(role_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + role_result *arg1 = (role_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(role_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->controller; + if (arg2) { + arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->controller, (const char *)arg2); + } else { + arg1->controller = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->controller); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->action; + if (arg2) { + arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->action, (const char *)arg2); + } else { + arg1->action = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->action); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1value_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_right *arg1 = (user_right *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->value; + if (arg2) { + arg1->value = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->value, (const char *)arg2); + } else { + arg1->value = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1value_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_right *arg1 = (user_right *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + result = (char *) ((arg1)->value); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1right(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_right *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_right *)new user_right(); + *(user_right **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1right(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_right *arg1 = (user_right *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_right **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user_rights_result *arg1 = (user_rights_result *) 0 ; + user_right *arg2 = (user_right *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user_rights_result **)&jarg1; + arg2 = *(user_right **)&jarg2; + if (arg1) (arg1)->user_rights = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_rights_result *arg1 = (user_rights_result *) 0 ; + user_right *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_rights_result **)&jarg1; + result = (user_right *) ((arg1)->user_rights); + *(user_right **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_rights_result *arg1 = (user_rights_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_rights_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->user_rights_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_rights_result *arg1 = (user_rights_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_rights_result **)&jarg1; + result = ((arg1)->user_rights_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1rights_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_rights_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_rights_result *)new user_rights_result(); + *(user_rights_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1rights_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_rights_result *arg1 = (user_rights_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_rights_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1result_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user_result *arg1 = (user_result *) 0 ; + user *arg2 = (user *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user_result **)&jarg1; + arg2 = *(user **)&jarg2; + if (arg1) (arg1)->user = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1result_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_result *arg1 = (user_result *) 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_result **)&jarg1; + result = (user *) ((arg1)->user); + *(user **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_result *)new user_result(); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_result *arg1 = (user_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_ALLOWED_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + is_action_allowed result; + + (void)jenv; + (void)jcls; + result = (is_action_allowed)ALLOWED; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_CONDITIONNAL_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + is_action_allowed result; + + (void)jenv; + (void)jcls; + result = (is_action_allowed)CONDITIONNAL; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_DENIED_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + is_action_allowed result; + + (void)jenv; + (void)jcls; + result = (is_action_allowed)DENIED; + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1completed_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics *arg1 = (statistics *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->completed_requests = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1completed_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (json_object *) ((arg1)->completed_requests); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1connections_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics *arg1 = (statistics *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->connections = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1connections_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (json_object *) ((arg1)->connections); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1failed_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics *arg1 = (statistics *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->failed_requests = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1failed_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (json_object *) ((arg1)->failed_requests); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1ongoing_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics *arg1 = (statistics *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->ongoing_requests = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1ongoing_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (json_object *) ((arg1)->ongoing_requests); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + statistics *arg1 = (statistics *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->timestamp = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + statistics *arg1 = (statistics *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + result = (unsigned long long) ((arg1)->timestamp); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Statistics(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + result = (statistics *)new statistics(); + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Statistics(JNIEnv *jenv, jclass jcls, jlong jarg1) { + statistics *arg1 = (statistics *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(statistics **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StatisticsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + statistics_result *arg1 = (statistics_result *) 0 ; + statistics *arg2 = (statistics *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(statistics_result **)&jarg1; + arg2 = *(statistics **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StatisticsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + statistics_result *arg1 = (statistics_result *) 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics_result **)&jarg1; + result = (statistics *) ((arg1)->result); + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StatisticsResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + statistics_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (statistics_result *)new statistics_result(); + *(statistics_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StatisticsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + statistics_result *arg1 = (statistics_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(statistics_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + statistics *arg2 = (statistics *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(all_statistics_result **)&jarg1; + arg2 = *(statistics **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(all_statistics_result **)&jarg1; + result = (statistics *) ((arg1)->result); + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(all_statistics_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(all_statistics_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1AllStatisticsResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + all_statistics_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (all_statistics_result *)new all_statistics_result(); + *(all_statistics_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1AllStatisticsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(all_statistics_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + geopos_result *arg1 = (geopos_result *) 0 ; + double (*arg2)[2] = (double (*)[2]) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + arg2 = *(double (**)[2])&jarg2; + if (arg1) (arg1)->result = (double (*)[2])arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + geopos_result *arg1 = (geopos_result *) 0 ; + double (*result)[2] = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + result = (double (*)[2]) ((arg1)->result); + *(double (**)[2])&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + geopos_result *arg1 = (geopos_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + geopos_result *arg1 = (geopos_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1geopos_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + geopos_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (geopos_result *)new geopos_result(); + *(geopos_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1geopos_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + geopos_result *arg1 = (geopos_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(geopos_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1valid_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + token_validity *arg1 = (token_validity *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->valid = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1valid_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + token_validity *arg1 = (token_validity *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + result = (bool) ((arg1)->valid); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + token_validity *arg1 = (token_validity *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->state; + if (arg2) { + arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->state, (const char *)arg2); + } else { + arg1->state = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + token_validity *arg1 = (token_validity *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + result = (char *) ((arg1)->state); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1expires_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { + token_validity *arg1 = (token_validity *) 0 ; + unsigned long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return ; + } + clazz = jenv->GetObjectClass(jarg2); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg2 = 0; + if (sz > 0) { + arg2 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + if (arg1) (arg1)->expires_at = arg2; +} + + +SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1expires_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jobject jresult = 0 ; + token_validity *arg1 = (token_validity *) 0 ; + unsigned long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + result = (unsigned long long) ((arg1)->expires_at); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jenv->DeleteLocalRef(ba); + jresult = bigint; + } + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1TokenValidity(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + token_validity *result = 0 ; + + (void)jenv; + (void)jcls; + result = (token_validity *)new token_validity(); + *(token_validity **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1TokenValidity(JNIEnv *jenv, jclass jcls, jlong jarg1) { + token_validity *arg1 = (token_validity *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(token_validity **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->request_id; + if (arg2) { + arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->request_id, (const char *)arg2); + } else { + arg1->request_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->request_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (json_object *) ((arg1)->result); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->volatiles = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (json_object *) ((arg1)->volatiles); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->controller; + if (arg2) { + arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->controller, (const char *)arg2); + } else { + arg1->controller = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->controller); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->action; + if (arg2) { + arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->action, (const char *)arg2); + } else { + arg1->action = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->action); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1room_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->room_id; + if (arg2) { + arg1->room_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->room_id, (const char *)arg2); + } else { + arg1->room_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1room_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->room_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1channel_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->channel; + if (arg2) { + arg1->channel = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->channel, (const char *)arg2); + } else { + arg1->channel = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1channel_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + result = (char *) ((arg1)->channel); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleResponse(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzle_response *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzle_response *)new kuzzle_response(); + *(kuzzle_response **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleResponse(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzle_response **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1void_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (void_result *)new void_result(); + *(void_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1void_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + void_result *arg1 = (void_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(void_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + json_result *arg1 = (json_result *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(json_result **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + json_result *arg1 = (json_result *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_result **)&jarg1; + result = (json_object *) ((arg1)->result); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1JsonResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (json_result *)new json_result(); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1JsonResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + json_result *arg1 = (json_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(json_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + json_array_result *arg1 = (json_array_result *) 0 ; + json_object **arg2 = (json_object **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + arg2 = *(json_object ***)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + json_array_result *arg1 = (json_array_result *) 0 ; + json_object **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + result = (json_object **) ((arg1)->result); + *(json_object ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + json_array_result *arg1 = (json_array_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + json_array_result *arg1 = (json_array_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1json_1array_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (json_array_result *)new json_array_result(); + *(json_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1json_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + json_array_result *arg1 = (json_array_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(json_array_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_BoolResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + bool_result *arg1 = (bool_result *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(bool_result **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_BoolResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + bool_result *arg1 = (bool_result *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(bool_result **)&jarg1; + result = (bool) ((arg1)->result); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BoolResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (bool_result *)new bool_result(); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1BoolResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + bool_result *arg1 = (bool_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(bool_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + int_result *arg1 = (int_result *) 0 ; + long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_result **)&jarg1; + arg2 = (long long)jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + int_result *arg1 = (int_result *) 0 ; + long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_result **)&jarg1; + result = (long long) ((arg1)->result); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1int_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (int_result *)new int_result(); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1int_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + int_result *arg1 = (int_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(int_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DateResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + date_result *arg1 = (date_result *) 0 ; + long long arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(date_result **)&jarg1; + arg2 = (long long)jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DateResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + date_result *arg1 = (date_result *) 0 ; + long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(date_result **)&jarg1; + result = (long long) ((arg1)->result); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1DateResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + date_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (date_result *)new date_result(); + *(date_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1DateResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + date_result *arg1 = (date_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(date_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_double_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { + double_result *arg1 = (double_result *) 0 ; + double arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(double_result **)&jarg1; + arg2 = (double)jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_double_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jdouble jresult = 0 ; + double_result *arg1 = (double_result *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(double_result **)&jarg1; + result = (double) ((arg1)->result); + jresult = (jdouble)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1double_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (double_result *)new double_result(); + *(double_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1double_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + double_result *arg1 = (double_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(double_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + int_array_result *arg1 = (int_array_result *) 0 ; + long long *arg2 = (long long *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + arg2 = *(long long **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + int_array_result *arg1 = (int_array_result *) 0 ; + long long *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + result = (long long *) ((arg1)->result); + *(long long **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + int_array_result *arg1 = (int_array_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + int_array_result *arg1 = (int_array_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1int_1array_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + int_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (int_array_result *)new int_array_result(); + *(int_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1int_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + int_array_result *arg1 = (int_array_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(int_array_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_string_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + string_result *arg1 = (string_result *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_result **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->result; + if (arg2) { + arg1->result = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->result, (const char *)arg2); + } else { + arg1->result = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_string_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + string_result *arg1 = (string_result *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_result **)&jarg1; + result = (char *) ((arg1)->result); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1string_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (string_result *)new string_result(); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1string_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + string_result *arg1 = (string_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(string_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + string_array_result *arg1 = (string_array_result *) 0 ; + char **arg2 = (char **) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + arg2 = *(char ***)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + string_array_result *arg1 = (string_array_result *) 0 ; + char **result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + result = (char **) ((arg1)->result); + *(char ***)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + string_array_result *arg1 = (string_array_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + string_array_result *arg1 = (string_array_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringArrayResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (string_array_result *)new string_array_result(); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StringArrayResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + string_array_result *arg1 = (string_array_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(string_array_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1query_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_filters *arg1 = (search_filters *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_filters **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->query = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1query_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_filters *arg1 = (search_filters *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + result = (json_object *) ((arg1)->query); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1sort_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_filters *arg1 = (search_filters *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_filters **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->sort = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1sort_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_filters *arg1 = (search_filters *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + result = (json_object *) ((arg1)->sort); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1aggregations_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_filters *arg1 = (search_filters *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_filters **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->aggregations = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1aggregations_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_filters *arg1 = (search_filters *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + result = (json_object *) ((arg1)->aggregations); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1search_1after_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_filters *arg1 = (search_filters *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_filters **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->search_after = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1search_1after_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_filters *arg1 = (search_filters *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + result = (json_object *) ((arg1)->search_after); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SearchFilters(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_filters *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_filters *)new search_filters(); + *(search_filters **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SearchFilters(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_filters *arg1 = (search_filters *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_filters **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + profile_search *arg1 = (profile_search *) 0 ; + profile *arg2 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile_search **)&jarg1; + arg2 = *(profile **)&jarg2; + if (arg1) (arg1)->hits = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile_search *arg1 = (profile_search *) 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + result = (profile *) ((arg1)->hits); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + profile_search *arg1 = (profile_search *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->hits_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile_search *arg1 = (profile_search *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + result = ((arg1)->hits_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + profile_search *arg1 = (profile_search *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + profile_search *arg1 = (profile_search *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + profile_search *arg1 = (profile_search *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + profile_search *arg1 = (profile_search *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile_1search(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + profile_search *result = 0 ; + + (void)jenv; + (void)jcls; + result = (profile_search *)new profile_search(); + *(profile_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { + profile_search *arg1 = (profile_search *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(profile_search **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + role_search *arg1 = (role_search *) 0 ; + role *arg2 = (role *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role_search **)&jarg1; + arg2 = *(role **)&jarg2; + if (arg1) (arg1)->hits = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role_search *arg1 = (role_search *) 0 ; + role *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + result = (role *) ((arg1)->hits); + *(role **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + role_search *arg1 = (role_search *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->hits_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role_search *arg1 = (role_search *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + result = ((arg1)->hits_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + role_search *arg1 = (role_search *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + role_search *arg1 = (role_search *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role_1search(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + role_search *result = 0 ; + + (void)jenv; + (void)jcls; + result = (role_search *)new role_search(); + *(role_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { + role_search *arg1 = (role_search *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(role_search **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + user_search *arg1 = (user_search *) 0 ; + user *arg2 = (user *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user_search **)&jarg1; + arg2 = *(user **)&jarg2; + if (arg1) (arg1)->hits = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_search *arg1 = (user_search *) 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + result = (user *) ((arg1)->hits); + *(user **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_search *arg1 = (user_search *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->hits_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_search *arg1 = (user_search *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + result = ((arg1)->hits_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + user_search *arg1 = (user_search *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + user_search *arg1 = (user_search *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + user_search *arg1 = (user_search *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + user_search *arg1 = (user_search *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1search(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + user_search *result = 0 ; + + (void)jenv; + (void)jcls; + result = (user_search *)new user_search(); + *(user_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { + user_search *arg1 = (user_search *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(user_search **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1acknowledged_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + ack_result *arg1 = (ack_result *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->acknowledged = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1acknowledged_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + ack_result *arg1 = (ack_result *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + result = (bool) ((arg1)->acknowledged); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1shards_1acknowledged_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + ack_result *arg1 = (ack_result *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->shards_acknowledged = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1shards_1acknowledged_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + ack_result *arg1 = (ack_result *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + result = (bool) ((arg1)->shards_acknowledged); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ack_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + ack_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (ack_result *)new ack_result(); + *(ack_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ack_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + ack_result *arg1 = (ack_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(ack_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ShardsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + shards_result *arg1 = (shards_result *) 0 ; + shards *arg2 = (shards *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(shards_result **)&jarg1; + arg2 = *(shards **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ShardsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + shards_result *arg1 = (shards_result *) 0 ; + shards *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards_result **)&jarg1; + result = (shards *) ((arg1)->result); + *(shards **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ShardsResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + shards_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (shards_result *)new shards_result(); + *(shards_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ShardsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + shards_result *arg1 = (shards_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(shards_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1strict_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + specification *arg1 = (specification *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->strict = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1strict_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + specification *arg1 = (specification *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + result = (bool) ((arg1)->strict); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1fields_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification *arg1 = (specification *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->fields = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1fields_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification *arg1 = (specification *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + result = (json_object *) ((arg1)->fields); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1validators_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification *arg1 = (specification *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->validators = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1validators_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification *arg1 = (specification *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + result = (json_object *) ((arg1)->validators); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification *)new specification(); + *(specification **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification *arg1 = (specification *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1validation_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification_entry *arg1 = (specification_entry *) 0 ; + specification *arg2 = (specification *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification_entry **)&jarg1; + arg2 = *(specification **)&jarg2; + if (arg1) (arg1)->validation = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1validation_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_entry *arg1 = (specification_entry *) 0 ; + specification *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + result = (specification *) ((arg1)->validation); + *(specification **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + specification_entry *arg1 = (specification_entry *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->index; + if (arg2) { + arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->index, (const char *)arg2); + } else { + arg1->index = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + specification_entry *arg1 = (specification_entry *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + result = (char *) ((arg1)->index); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + specification_entry *arg1 = (specification_entry *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->collection; + if (arg2) { + arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->collection, (const char *)arg2); + } else { + arg1->collection = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + specification_entry *arg1 = (specification_entry *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + result = (char *) ((arg1)->collection); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1entry(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification_entry *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification_entry *)new specification_entry(); + *(specification_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification_entry *arg1 = (specification_entry *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification_entry **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification_result *arg1 = (specification_result *) 0 ; + specification *arg2 = (specification *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification_result **)&jarg1; + arg2 = *(specification **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_result *arg1 = (specification_result *) 0 ; + specification *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_result **)&jarg1; + result = (specification *) ((arg1)->result); + *(specification **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification_result *)new specification_result(); + *(specification_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification_result *arg1 = (specification_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->documents = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (json_object *) ((arg1)->documents); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1fetched_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + search_result *arg1 = (search_result *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->fetched = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1fetched_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (unsigned int) ((arg1)->fetched); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + search_result *arg1 = (search_result *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1aggregations_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->aggregations = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1aggregations_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (json_object *) ((arg1)->aggregations); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1filters_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(search_filters **)&jarg2; + if (arg1) (arg1)->filters = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1filters_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + search_filters *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (search_filters *) ((arg1)->filters); + *(search_filters **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + query_options *arg2 = (query_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(query_options **)&jarg2; + if (arg1) (arg1)->options = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + query_options *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (query_options *) ((arg1)->options); + *(query_options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_result *arg1 = (search_result *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_result **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->collection = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_result *arg1 = (search_result *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + result = (json_object *) ((arg1)->collection); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SearchResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_result *)new search_result(); + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SearchResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_result *arg1 = (search_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1profiles_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_profiles_result *arg1 = (search_profiles_result *) 0 ; + profile_search *arg2 = (profile_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_profiles_result **)&jarg1; + arg2 = *(profile_search **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1profiles_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_profiles_result *arg1 = (search_profiles_result *) 0 ; + profile_search *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_profiles_result **)&jarg1; + result = (profile_search *) ((arg1)->result); + *(profile_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1profiles_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_profiles_result *)new search_profiles_result(); + *(search_profiles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_profiles_result *arg1 = (search_profiles_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_profiles_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1roles_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_roles_result *arg1 = (search_roles_result *) 0 ; + role_search *arg2 = (role_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_roles_result **)&jarg1; + arg2 = *(role_search **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1roles_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_roles_result *arg1 = (search_roles_result *) 0 ; + role_search *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_roles_result **)&jarg1; + result = (role_search *) ((arg1)->result); + *(role_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1roles_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_roles_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_roles_result *)new search_roles_result(); + *(search_roles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1roles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_roles_result *arg1 = (search_roles_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_roles_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1users_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + search_users_result *arg1 = (search_users_result *) 0 ; + user_search *arg2 = (user_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(search_users_result **)&jarg1; + arg2 = *(user_search **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1users_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + search_users_result *arg1 = (search_users_result *) 0 ; + user_search *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_users_result **)&jarg1; + result = (user_search *) ((arg1)->result); + *(user_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1users_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + search_users_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (search_users_result *)new search_users_result(); + *(search_users_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1users_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + search_users_result *arg1 = (search_users_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(search_users_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification_search *arg1 = (specification_search *) 0 ; + specification_entry *arg2 = (specification_entry *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification_search **)&jarg1; + arg2 = *(specification_entry **)&jarg2; + if (arg1) (arg1)->hits = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_search *arg1 = (specification_search *) 0 ; + specification_entry *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + result = (specification_entry *) ((arg1)->hits); + *(specification_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + specification_search *arg1 = (specification_search *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->hits_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_search *arg1 = (specification_search *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + result = ((arg1)->hits_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + specification_search *arg1 = (specification_search *) 0 ; + unsigned int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + arg2 = (unsigned int)jarg2; + if (arg1) (arg1)->total = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_search *arg1 = (specification_search *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + result = (unsigned int) ((arg1)->total); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + specification_search *arg1 = (specification_search *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->scroll_id; + if (arg2) { + arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->scroll_id, (const char *)arg2); + } else { + arg1->scroll_id = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + specification_search *arg1 = (specification_search *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + result = (char *) ((arg1)->scroll_id); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1search(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification_search *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification_search *)new specification_search(); + *(specification_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification_search *arg1 = (specification_search *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification_search **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + specification_search_result *arg1 = (specification_search_result *) 0 ; + specification_search *arg2 = (specification_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(specification_search_result **)&jarg1; + arg2 = *(specification_search **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + specification_search_result *arg1 = (specification_search_result *) 0 ; + specification_search *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search_result **)&jarg1; + result = (specification_search *) ((arg1)->result); + *(specification_search **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1search_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + specification_search_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (specification_search_result *)new specification_search_result(); + *(specification_search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + specification_search_result *arg1 = (specification_search_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(specification_search_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1mapping_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + mapping *arg1 = (mapping *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping **)&jarg1; + arg2 = *(json_object **)&jarg2; + if (arg1) (arg1)->mapping = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1mapping_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + mapping *arg1 = (mapping *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping **)&jarg1; + result = (json_object *) ((arg1)->mapping); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + mapping *arg1 = (mapping *) 0 ; + collection *arg2 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping **)&jarg1; + arg2 = *(collection **)&jarg2; + if (arg1) (arg1)->collection = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + mapping *arg1 = (mapping *) 0 ; + collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping **)&jarg1; + result = (collection *) ((arg1)->collection); + *(collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1) { + mapping *arg1 = (mapping *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(mapping **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + mapping_result *arg1 = (mapping_result *) 0 ; + mapping *arg2 = (mapping *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(mapping_result **)&jarg1; + arg2 = *(mapping **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + mapping_result *arg1 = (mapping_result *) 0 ; + mapping *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping_result **)&jarg1; + result = (mapping *) ((arg1)->result); + *(mapping **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1mapping_1result(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + mapping_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (mapping_result *)new mapping_result(); + *(mapping_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1mapping_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { + mapping_result *arg1 = (mapping_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(mapping_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1persisted_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + collection_entry *arg1 = (collection_entry *) 0 ; + bool arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + arg2 = jarg2 ? true : false; + if (arg1) (arg1)->persisted = arg2; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1persisted_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + collection_entry *arg1 = (collection_entry *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + result = (bool) ((arg1)->persisted); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1name_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + collection_entry *arg1 = (collection_entry *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + delete [] arg1->name; + if (arg2) { + arg1->name = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->name, (const char *)arg2); + } else { + arg1->name = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1name_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + collection_entry *arg1 = (collection_entry *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + result = (char *) ((arg1)->name); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1CollectionsList(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + collection_entry *result = 0 ; + + (void)jenv; + (void)jcls; + result = (collection_entry *)new collection_entry(); + *(collection_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1CollectionsList(JNIEnv *jenv, jclass jcls, jlong jarg1) { + collection_entry *arg1 = (collection_entry *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(collection_entry **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + collection_entry *arg2 = (collection_entry *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection_entry_result **)&jarg1; + arg2 = *(collection_entry **)&jarg2; + if (arg1) (arg1)->result = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + collection_entry *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry_result **)&jarg1; + result = (collection_entry *) ((arg1)->result); + *(collection_entry **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry_result **)&jarg1; + arg2 = (size_t)jarg2; + if (arg1) (arg1)->result_length = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + size_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry_result **)&jarg1; + result = ((arg1)->result_length); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1CollectionsListResult(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + collection_entry_result *result = 0 ; + + (void)jenv; + (void)jcls; + result = (collection_entry_result *)new collection_entry_result(); + *(collection_entry_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1CollectionsListResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(collection_entry_result **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1p_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + _GoString_ *arg1 = (_GoString_ *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(_GoString_ **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + if (arg2) { + arg1->p = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->p, (const char *)arg2); + } else { + arg1->p = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1p_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + _GoString_ *arg1 = (_GoString_ *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(_GoString_ **)&jarg1; + result = (char *) ((arg1)->p); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1n_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + _GoString_ *arg1 = (_GoString_ *) 0 ; + ptrdiff_t arg2 ; + ptrdiff_t *argp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(_GoString_ **)&jarg1; + argp2 = *(ptrdiff_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null ptrdiff_t"); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->n = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1n_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + _GoString_ *arg1 = (_GoString_ *) 0 ; + ptrdiff_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(_GoString_ **)&jarg1; + result = ((arg1)->n); + *(ptrdiff_t **)&jresult = new ptrdiff_t((const ptrdiff_t &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1_1GoString_1(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + _GoString_ *result = 0 ; + + (void)jenv; + (void)jcls; + result = (_GoString_ *)new _GoString_(); + *(_GoString_ **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1_1GoString_1(JNIEnv *jenv, jclass jcls, jlong jarg1) { + _GoString_ *arg1 = (_GoString_ *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(_GoString_ **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_free_1char_1array(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) { + char **arg1 = (char **) 0 ; + size_t arg2 ; + + (void)jenv; + (void)jcls; + arg1 = *(char ***)&jarg1; + arg2 = (size_t)jarg2; + free_char_array(arg1,arg2); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_assign_1geopos(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jdouble jarg3, jdouble jarg4) { + double (*arg1)[2] = (double (*)[2]) 0 ; + int arg2 ; + double arg3 ; + double arg4 ; + + (void)jenv; + (void)jcls; + arg1 = *(double (**)[2])&jarg1; + arg2 = (int)jarg2; + arg3 = (double)jarg3; + arg4 = (double)jarg4; + assign_geopos((double (*)[2])arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1t_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoInterface *arg1 = (GoInterface *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoInterface **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->t = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1t_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoInterface *arg1 = (GoInterface *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoInterface **)&jarg1; + result = (void *) ((arg1)->t); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1v_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoInterface *arg1 = (GoInterface *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoInterface **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->v = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1v_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoInterface *arg1 = (GoInterface *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoInterface **)&jarg1; + result = (void *) ((arg1)->v); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GoInterface(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + GoInterface *result = 0 ; + + (void)jenv; + (void)jcls; + result = (GoInterface *)new GoInterface(); + *(GoInterface **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GoInterface(JNIEnv *jenv, jclass jcls, jlong jarg1) { + GoInterface *arg1 = (GoInterface *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(GoInterface **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoSlice *arg1 = (GoSlice *) 0 ; + void *arg2 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + arg2 = *(void **)&jarg2; + if (arg1) (arg1)->data = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoSlice *arg1 = (GoSlice *) 0 ; + void *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + result = (void *) ((arg1)->data); + *(void **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoSlice *arg1 = (GoSlice *) 0 ; + GoInt arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + arg2 = (GoInt)jarg2; + if (arg1) (arg1)->len = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoSlice *arg1 = (GoSlice *) 0 ; + GoInt result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + result = (GoInt) ((arg1)->len); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + GoSlice *arg1 = (GoSlice *) 0 ; + GoInt arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + arg2 = (GoInt)jarg2; + if (arg1) (arg1)->cap = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + GoSlice *arg1 = (GoSlice *) 0 ; + GoInt result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(GoSlice **)&jarg1; + result = (GoInt) ((arg1)->cap); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GoSlice(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + GoSlice *result = 0 ; + + (void)jenv; + (void)jcls; + result = (GoSlice *)new GoSlice(); + *(GoSlice **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GoSlice(JNIEnv *jenv, jclass jcls, jlong jarg1) { + GoSlice *arg1 = (GoSlice *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(GoSlice **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + kuzzle_set_jwt(arg1,arg2); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1unset_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_unset_jwt(arg1); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_get_jwt(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1login(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + int *arg4 = (int *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + arg4 = *(int **)&jarg4; + result = (string_result *)kuzzle_login(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_logout(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1check_1token(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + token_validity *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (token_validity *)kuzzle_check_token(arg1,arg2); + *(token_validity **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1create_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_create_my_credentials(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1delete_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_delete_my_credentials(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_get_my_credentials(arg1,arg2,arg3); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_update_my_credentials(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1validate_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_validate_my_credentials(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1my_1rights(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (json_result *)kuzzle_get_my_rights(arg1,arg2); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1self(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + user_data *arg2 = (user_data *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(user_data **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_update_self(arg1,arg2,arg3); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1who_1am_1i(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (user_result *)kuzzle_who_am_i(arg1); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterCollection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + collection *arg1 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + unregisterCollection(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + collection *arg1 = (collection *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + kuzzle_new_collection(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + result = (void_result *)kuzzle_collection_create(arg1,arg2,arg3); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1truncate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + result = (void_result *)kuzzle_collection_truncate(arg1,arg2,arg3); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + result = (bool_result *)kuzzle_collection_exists(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + collection_list_options *arg3 = (collection_list_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(collection_list_options **)&jarg3; + result = (string_result *)kuzzle_collection_list(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1get_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + result = (string_result *)kuzzle_collection_get_mapping(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1update_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + result = (void_result *)kuzzle_collection_update_mapping(arg1,arg2,arg3,arg4); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1delete_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + result = (void_result *)kuzzle_collection_delete_specifications(arg1,arg2,arg3); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1get_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + result = (string_result *)kuzzle_collection_get_specifications(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1search_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + search_options *arg2 = (search_options *) 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(collection **)&jarg1; + arg2 = *(search_options **)&jarg2; + result = (search_result *)kuzzle_collection_search_specifications(arg1,arg2); + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1update_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + result = (string_result *)kuzzle_collection_update_specifications(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1validate_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + collection *arg1 = (collection *) 0 ; + char *arg2 = (char *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (void_result *)kuzzle_collection_validate_specifications(arg1,arg2); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1kuzzle_1request(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle_request *arg1 = (kuzzle_request *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_request **)&jarg1; + kuzzle_free_kuzzle_request(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1query_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + query_object *arg1 = (query_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_object **)&jarg1; + kuzzle_free_query_object(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + offline_queue *arg1 = (offline_queue *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(offline_queue **)&jarg1; + kuzzle_free_offline_queue(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1query_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + query_options *arg1 = (query_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(query_options **)&jarg1; + kuzzle_free_query_options(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1room_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + room_options *arg1 = (room_options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(room_options **)&jarg1; + kuzzle_free_room_options(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + options *arg1 = (options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(options **)&jarg1; + kuzzle_free_options(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1meta(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + meta *arg1 = (meta *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(meta **)&jarg1; + kuzzle_free_meta(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1policy_1restriction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + policy_restriction *arg1 = (policy_restriction *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy_restriction **)&jarg1; + kuzzle_free_policy_restriction(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + policy *arg1 = (policy *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(policy **)&jarg1; + kuzzle_free_policy(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profile *arg1 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + kuzzle_free_profile(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + role *arg1 = (role *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + kuzzle_free_role(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user *arg1 = (user *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + kuzzle_free_user(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1data(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_data *arg1 = (user_data *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_data **)&jarg1; + kuzzle_free_user_data(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + collection *arg1 = (collection *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection **)&jarg1; + kuzzle_free_collection(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + document *arg1 = (document *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document **)&jarg1; + kuzzle_free_document(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + document_result *arg1 = (document_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_result **)&jarg1; + kuzzle_free_document_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1notification_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + notification_content *arg1 = (notification_content *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_content **)&jarg1; + kuzzle_free_notification_content(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1notification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + notification_result *arg1 = (notification_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(notification_result **)&jarg1; + kuzzle_free_notification_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profile_result *arg1 = (profile_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_result **)&jarg1; + kuzzle_free_profile_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profiles_result *arg1 = (profiles_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profiles_result **)&jarg1; + kuzzle_free_profiles_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + role_result *arg1 = (role_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_result **)&jarg1; + kuzzle_free_role_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1right(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_right *arg1 = (user_right *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_right **)&jarg1; + kuzzle_free_user_right(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1rights_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_rights_result *arg1 = (user_rights_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_rights_result **)&jarg1; + kuzzle_free_user_rights_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_result *arg1 = (user_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_result **)&jarg1; + kuzzle_free_user_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1statistics(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + statistics *arg1 = (statistics *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics **)&jarg1; + kuzzle_free_statistics(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1statistics_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + statistics_result *arg1 = (statistics_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(statistics_result **)&jarg1; + kuzzle_free_statistics_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1all_1statistics_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + all_statistics_result *arg1 = (all_statistics_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(all_statistics_result **)&jarg1; + kuzzle_free_all_statistics_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1geopos_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + geopos_result *arg1 = (geopos_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(geopos_result **)&jarg1; + kuzzle_free_geopos_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1token_1validity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + token_validity *arg1 = (token_validity *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(token_validity **)&jarg1; + kuzzle_free_token_validity(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1kuzzle_1response(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle_response *arg1 = (kuzzle_response *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle_response **)&jarg1; + kuzzle_free_kuzzle_response(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + json_result *arg1 = (json_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_result **)&jarg1; + kuzzle_free_json_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + json_array_result *arg1 = (json_array_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_array_result **)&jarg1; + kuzzle_free_json_array_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1bool_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + bool_result *arg1 = (bool_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(bool_result **)&jarg1; + kuzzle_free_bool_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1int_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + int_result *arg1 = (int_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_result **)&jarg1; + kuzzle_free_int_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1double_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + double_result *arg1 = (double_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(double_result **)&jarg1; + kuzzle_free_double_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1int_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + int_array_result *arg1 = (int_array_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(int_array_result **)&jarg1; + kuzzle_free_int_array_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1string_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + string_result *arg1 = (string_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_result **)&jarg1; + kuzzle_free_string_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1string_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + string_array_result *arg1 = (string_array_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(string_array_result **)&jarg1; + kuzzle_free_string_array_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1filters(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_filters *arg1 = (search_filters *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_filters **)&jarg1; + kuzzle_free_search_filters(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profile_search *arg1 = (profile_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile_search **)&jarg1; + kuzzle_free_profile_search(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + role_search *arg1 = (role_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role_search **)&jarg1; + kuzzle_free_role_search(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1ack_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + ack_result *arg1 = (ack_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(ack_result **)&jarg1; + kuzzle_free_ack_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1shards_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + shards_result *arg1 = (shards_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(shards_result **)&jarg1; + kuzzle_free_shards_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification *arg1 = (specification *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification **)&jarg1; + kuzzle_free_specification(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification_entry *arg1 = (specification_entry *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_entry **)&jarg1; + kuzzle_free_specification_entry(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification_result *arg1 = (specification_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_result **)&jarg1; + kuzzle_free_specification_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_result *arg1 = (search_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_result **)&jarg1; + kuzzle_free_search_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_profiles_result *arg1 = (search_profiles_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_profiles_result **)&jarg1; + kuzzle_free_search_profiles_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1roles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_roles_result *arg1 = (search_roles_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_roles_result **)&jarg1; + kuzzle_free_search_roles_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification_search *arg1 = (specification_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search **)&jarg1; + kuzzle_free_specification_search(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + specification_search_result *arg1 = (specification_search_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(specification_search_result **)&jarg1; + kuzzle_free_specification_search_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + mapping *arg1 = (mapping *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping **)&jarg1; + kuzzle_free_mapping(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1mapping_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + mapping_result *arg1 = (mapping_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(mapping_result **)&jarg1; + kuzzle_free_mapping_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1void_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + void_result *arg1 = (void_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(void_result **)&jarg1; + kuzzle_free_void_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + collection_entry *arg1 = (collection_entry *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry **)&jarg1; + kuzzle_free_collection_entry(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection_1entry_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + collection_entry_result *arg1 = (collection_entry_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(collection_entry_result **)&jarg1; + kuzzle_free_collection_entry_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user_search *arg1 = (user_search *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user_search **)&jarg1; + kuzzle_free_user_search(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1users_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + search_users_result *arg1 = (search_users_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(search_users_result **)&jarg1; + kuzzle_free_search_users_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + document_array_result *arg1 = (document_array_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(document_array_result **)&jarg1; + kuzzle_free_document_array_result(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1new(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + json_object *arg1 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + kuzzle_json_new(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1put(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jint jarg4) { + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + void *arg3 = (void *) 0 ; + int arg4 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + arg3 = *(void **)&jarg3; + arg4 = (int)jarg4; + kuzzle_json_put(arg1,arg2,arg3,arg4); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1string(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jstring jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (char *)kuzzle_json_get_string(arg1,arg2); + if (result) jresult = jenv->NewStringUTF((const char *)result); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1int(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jint jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (int)kuzzle_json_get_int(arg1,arg2); + jresult = (jint)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1double(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jdouble jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (double)kuzzle_json_get_double(arg1,arg2); + jresult = (jdouble)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1bool(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + json_bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = kuzzle_json_get_bool(arg1,arg2); + *(json_bool **)&jresult = new json_bool((const json_bool &)result); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (json_object *)kuzzle_json_get_json_object(arg1,arg2); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + json_object *arg1 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + kuzzle_free_json_object(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterKuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + unregisterKuzzle(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + options *arg4 = (options *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return ; + } + arg4 = *(options **)&jarg4; + kuzzle_new_kuzzle(arg1,arg2,arg3,arg4); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_connect(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_disconnect(arg1); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1default_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_get_default_index(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1default_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (int)kuzzle_set_default_index(arg1,arg2); + jresult = (jint)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + offline_queue *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (offline_queue *)kuzzle_get_offline_queue(arg1); + *(offline_queue **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1flush_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_flush_queue(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1replay_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_replay_queue(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1start_1queuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_start_queuing(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1stop_1queuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzle *arg1 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + kuzzle_stop_queuing(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1add_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jlong jarg4) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + kuzzle_event_listener arg3 = (kuzzle_event_listener) 0 ; + void *arg4 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + arg3 = *(kuzzle_event_listener *)&jarg3; + arg4 = *(void **)&jarg4; + kuzzle_add_listener(arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jlong jarg4) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + kuzzle_event_listener arg3 = (kuzzle_event_listener) 0 ; + void *arg4 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + arg3 = *(kuzzle_event_listener *)&jarg3; + arg4 = *(void **)&jarg4; + kuzzle_once(arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1listener_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + GoInt result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + result = (GoInt)kuzzle_listener_count(arg1,arg2); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1remove_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + void *arg3 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + arg3 = *(void **)&jarg3; + kuzzle_remove_listener(arg1,arg2,arg3); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1remove_1all_1listeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + kuzzle_remove_all_listeners(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_auto_queue(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool arg2 ; + _Bool *argp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + argp2 = *(_Bool **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); + return ; + } + arg2 = *argp2; + kuzzle_set_auto_queue(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1reconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_auto_reconnect(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1resubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_auto_resubscribe(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1replay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_auto_replay(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1replay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool arg2 ; + _Bool *argp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + argp2 = *(_Bool **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); + return ; + } + arg2 = *argp2; + kuzzle_set_auto_replay(arg1,arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1host(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (char *)kuzzle_get_host(arg1); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1offline_1queue_1loader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_offline_queue_loader result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (kuzzle_offline_queue_loader)kuzzle_get_offline_queue_loader(arg1); + *(kuzzle_offline_queue_loader *)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1offline_1queue_1loader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_offline_queue_loader arg2 = (kuzzle_offline_queue_loader) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_offline_queue_loader *)&jarg2; + kuzzle_set_offline_queue_loader(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1port(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_port(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_queue_filter result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (kuzzle_queue_filter)kuzzle_get_queue_filter(arg1); + *(kuzzle_queue_filter *)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_queue_filter arg2 = (kuzzle_queue_filter) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_queue_filter *)&jarg2; + kuzzle_set_queue_filter(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1max_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_queue_max_size(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1max_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + kuzzle_set_queue_max_size(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_queue_ttl(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + kuzzle_set_queue_ttl(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1replay_1interval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_replay_interval(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1replay_1interval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + kuzzle_set_replay_interval(arg1,arg2); +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1reconnection_1delay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jint jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (int)kuzzle_get_reconnection_delay(arg1); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1ssl_1connection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + _Bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = kuzzle_get_ssl_connection(arg1); + *(_Bool **)&jresult = new _Bool((const _Bool &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzle **)&jarg1; + result = (json_object *)kuzzle_get_volatile(arg1); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzle *arg1 = (kuzzle *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(json_object **)&jarg2; + kuzzle_set_volatile(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1append(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_append(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_bitcount(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jlong jarg6, jobject jarg6_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char **arg4 = (char **) 0 ; + size_t arg5 ; + query_options *arg6 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg6_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(char ***)&jarg4; + arg5 = (size_t)jarg5; + arg6 = *(query_options **)&jarg6; + result = (int_result *)kuzzle_ms_bitop(arg1,arg2,arg3,arg4,arg5,arg6); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitpos(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jshort jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned char arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (unsigned char)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_bitpos(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1dbsize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (int_result *)kuzzle_ms_dbsize(arg1,arg2); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1decr(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_decr(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1decrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_decrby(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1del(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_del(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_exists(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1expire(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned long arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (unsigned long)jarg3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_expire(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1expireat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jobject jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned long long arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return 0; + } + clazz = jenv->GetObjectClass(jarg3); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg3 = 0; + if (sz > 0) { + arg3 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_expireat(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1flushdb(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (void_result *)kuzzle_ms_flushdb(arg1,arg2); + *(void_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geoadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + json_object **arg3 = (json_object **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_geoadd(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geodist(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (double_result *)kuzzle_ms_geodist(arg1,arg2,arg3,arg4,arg5); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geohash(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_geohash(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geopos(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + geopos_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (geopos_result *)kuzzle_ms_geopos(arg1,arg2,arg3,arg4,arg5); + *(geopos_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1georadius(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jdouble jarg5, jstring jarg6, jlong jarg7, jobject jarg7_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + double arg4 ; + double arg5 ; + char *arg6 = (char *) 0 ; + query_options *arg7 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg7_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = (double)jarg4; + arg5 = (double)jarg5; + arg6 = 0; + if (jarg6) { + arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); + if (!arg6) return 0; + } + arg7 = *(query_options **)&jarg7; + result = (json_array_result *)kuzzle_ms_georadius(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1georadiusbymember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + double arg4 ; + char *arg5 = (char *) 0 ; + query_options *arg6 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg6_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (double)jarg4; + arg5 = 0; + if (jarg5) { + arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); + if (!arg5) return 0; + } + arg6 = *(query_options **)&jarg6; + result = (json_array_result *)kuzzle_ms_georadiusbymember(arg1,arg2,arg3,arg4,arg5,arg6); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_ms_get(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getbit(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_getbit(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + int arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = (int)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_result *)kuzzle_ms_getrange(arg1,arg2,arg3,arg4,arg5); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_getset(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hdel(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_hdel(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hexists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_hexists(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_hget(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hgetall(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_ms_hgetall(arg1,arg2,arg3); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hincrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_hincrby(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hincrbyfloat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (double_result *)kuzzle_ms_hincrbyfloat(arg1,arg2,arg3,arg4,arg5); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hkeys(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_hkeys(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_hlen(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_hmget(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + json_object **arg3 = (json_object **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_hmset(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_ms_hscan(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (bool_result *)kuzzle_ms_hset(arg1,arg2,arg3,arg4,arg5); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hsetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (bool_result *)kuzzle_ms_hsetnx(arg1,arg2,arg3,arg4,arg5); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hstrlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_hstrlen(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hvals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_hvals(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incr(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_incr(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_incrby(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incrbyfloat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + query_options *arg4 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = *(query_options **)&jarg4; + result = (double_result *)kuzzle_ms_incrbyfloat(arg1,arg2,arg3,arg4); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1keys(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_keys(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lindex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_lindex(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1linsert(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + char *arg5 = (char *) 0 ; + query_options *arg6 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg6_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = 0; + if (jarg5) { + arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); + if (!arg5) return 0; + } + arg6 = *(query_options **)&jarg6; + result = (int_result *)kuzzle_ms_linsert(arg1,arg2,arg3,arg4,arg5,arg6); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1llen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_llen(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_ms_lpop(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_lpush(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpushx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_lpushx(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_lrange(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lrem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_lrem(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_lset(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ltrim(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_ltrim(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_array_result *)kuzzle_ms_mget(arg1,arg2,arg3,arg4); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + json_object **arg2 = (json_object **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(json_object ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (void_result *)kuzzle_ms_mset(arg1,arg2,arg3,arg4); + *(void_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1msetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + json_object **arg2 = (json_object **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(json_object ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_msetnx(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_object(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1persist(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_ms_persist(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pexpire(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned long arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (unsigned long)jarg3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_pexpire(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pexpireat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jobject jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + unsigned long long arg3 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + { + jclass clazz; + jmethodID mid; + jbyteArray ba; + jbyte* bae; + jsize sz; + int i; + + if (!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); + return 0; + } + clazz = jenv->GetObjectClass(jarg3); + mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); + ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid); + bae = jenv->GetByteArrayElements(ba, 0); + sz = jenv->GetArrayLength(ba); + arg3 = 0; + if (sz > 0) { + arg3 = (unsigned long long)(signed char)bae[0]; + for(i=1; iReleaseByteArrayElements(ba, bae, 0); + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_pexpireat(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (bool_result *)kuzzle_ms_pfadd(arg1,arg2,arg3,arg4,arg5); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_pfcount(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfmerge(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_pfmerge(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_ms_ping(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1psetex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + unsigned long arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (unsigned long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_psetex(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_pttl(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1randomkey(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_ms_randomkey(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rename(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (void_result *)kuzzle_ms_rename(arg1,arg2,arg3,arg4); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1renamenx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_renamenx(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_ms_rpop(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpoplpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_ms_rpoplpush(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_rpush(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpushx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_rpushx(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_sadd(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1scan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + int arg2 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = (int)jarg2; + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_ms_scan(arg1,arg2,arg3); + *(json_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1scard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_scard(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sdiff(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_sdiff(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sdiffstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + char *arg5 = (char *) 0 ; + query_options *arg6 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg6_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = 0; + if (jarg5) { + arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); + if (!arg5) return 0; + } + arg6 = *(query_options **)&jarg6; + result = (int_result *)kuzzle_ms_sdiffstore(arg1,arg2,arg3,arg4,arg5,arg6); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (void_result *)kuzzle_ms_set(arg1,arg2,arg3,arg4); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1setex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + unsigned long arg4 ; + query_options *arg5 = (query_options *) 0 ; + void_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (unsigned long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (void_result *)kuzzle_ms_setex(arg1,arg2,arg3,arg4,arg5); + *(void_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1setnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_setnx(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sinter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_array_result *)kuzzle_ms_sinter(arg1,arg2,arg3,arg4); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sinterstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_sinterstore(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sismember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_ms_sismember(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1smembers(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_smembers(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1smove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (bool_result *)kuzzle_ms_smove(arg1,arg2,arg3,arg4,arg5); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sort(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_sort(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1spop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_spop(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1srandmember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_array_result *)kuzzle_ms_srandmember(arg1,arg2,arg3); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1srem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_srem(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_ms_sscan(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1strlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_strlen(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sunion(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (string_array_result *)kuzzle_ms_sunion(arg1,arg2,arg3,arg4); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sunionstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_sunionstore(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1time(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + int_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (int_array_result *)kuzzle_ms_time(arg1,arg2); + *(int_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1touch(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char **arg2 = (char **) 0 ; + size_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(char ***)&jarg2; + arg3 = (size_t)jarg3; + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_touch(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_ttl(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1type(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (string_result *)kuzzle_ms_type(arg1,arg2,arg3); + *(string_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + json_object **arg3 = (json_object **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zadd(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zcard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (int_result *)kuzzle_ms_zcard(arg1,arg2,arg3); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zcount(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zincrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (double_result *)kuzzle_ms_zincrby(arg1,arg2,arg3,arg4,arg5); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zinterstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zinterstore(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zlexcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zlexcount(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (json_array_result *)kuzzle_ms_zrange(arg1,arg2,arg3,arg4,arg5); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_zrangebylex(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (json_array_result *)kuzzle_ms_zrangebyscore(arg1,arg2,arg3,arg4,arg5); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_zrank(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char **arg3 = (char **) 0 ; + size_t arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(char ***)&jarg3; + arg4 = (size_t)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zrem(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zremrangebylex(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebyrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zremrangebyrank(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (int_result *)kuzzle_ms_zremrangebyscore(arg1,arg2,arg3,arg4,arg5); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + long arg3 ; + long arg4 ; + query_options *arg5 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (long)jarg3; + arg4 = (long)jarg4; + arg5 = *(query_options **)&jarg5; + result = (json_array_result *)kuzzle_ms_zrevrange(arg1,arg2,arg3,arg4,arg5); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + query_options *arg5 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = *(query_options **)&jarg5; + result = (string_array_result *)kuzzle_ms_zrevrangebylex(arg1,arg2,arg3,arg4,arg5); + *(string_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + double arg4 ; + query_options *arg5 = (query_options *) 0 ; + json_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg5_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + arg4 = (double)jarg4; + arg5 = *(query_options **)&jarg5; + result = (json_array_result *)kuzzle_ms_zrevrangebyscore(arg1,arg2,arg3,arg4,arg5); + *(json_array_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + int_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (int_result *)kuzzle_ms_zrevrank(arg1,arg2,arg3,arg4); + *(int_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_ms_zscan(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + query_options *arg4 = (query_options *) 0 ; + double_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = *(query_options **)&jarg4; + result = (double_result *)kuzzle_ms_zscore(arg1,arg2,arg3,arg4); + *(double_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1options(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + options *result = 0 ; + + (void)jenv; + (void)jcls; + result = (options *)kuzzle_new_options(); + *(options **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1query(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + kuzzle_request *arg2 = (kuzzle_request *) 0 ; + query_options *arg3 = (query_options *) 0 ; + kuzzle_response *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(kuzzle_request **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (kuzzle_response *)kuzzle_query(arg1,arg2,arg3); + *(kuzzle_response **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1list_1collections(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + collection_entry_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (collection_entry_result *)kuzzle_list_collections(arg1,arg2,arg3); + *(collection_entry_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1list_1indexes(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_array_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_array_result *)kuzzle_list_indexes(arg1,arg2); + *(string_array_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1create_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_create_index(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1refresh_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + shards_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (shards_result *)kuzzle_refresh_index(arg1,arg2,arg3); + *(shards_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + _Bool arg3 ; + query_options *arg4 = (query_options *) 0 ; + _Bool *argp3 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + argp3 = *(_Bool **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); + return 0; + } + arg3 = *argp3; + arg4 = *(query_options **)&jarg4; + result = (bool_result *)kuzzle_set_auto_refresh(arg1,arg2,arg3,arg4); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_get_auto_refresh(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + policy *arg3 = (policy *) 0 ; + size_t arg4 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(policy **)&jarg3; + arg4 = (size_t)jarg4; + result = (profile *)kuzzle_security_new_profile(arg1,arg2,arg3,arg4); + *(profile **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + profile *arg1 = (profile *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(profile **)&jarg1; + kuzzle_security_destroy_profile(arg1); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + profile_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (profile_result *)kuzzle_security_fetch_profile(arg1,arg2,arg3); + *(profile_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1scroll_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (search_profiles_result *)kuzzle_security_scroll_profiles(arg1,arg2,arg3); + *(search_profiles_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (search_profiles_result *)kuzzle_security_search_profiles(arg1,arg2,arg3); + *(search_profiles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1add_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + policy *arg2 = (policy *) 0 ; + profile *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(policy **)&jarg2; + result = (profile *)kuzzle_security_profile_add_policy(arg1,arg2); + *(profile **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_security_profile_delete(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + profile *arg1 = (profile *) 0 ; + query_options *arg2 = (query_options *) 0 ; + profile_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(profile **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (profile_result *)kuzzle_security_profile_save(arg1,arg2); + *(profile_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + role *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + result = (role *)kuzzle_security_new_role(arg1,arg2,arg3); + *(role **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + role *arg1 = (role *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(role **)&jarg1; + kuzzle_security_destroy_role(arg1); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + role_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (role_result *)kuzzle_security_fetch_role(arg1,arg2,arg3); + *(role_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1roles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_roles_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (search_roles_result *)kuzzle_security_search_roles(arg1,arg2,arg3); + *(search_roles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1role_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + role *arg1 = (role *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_security_role_delete(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1role_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + role *arg1 = (role *) 0 ; + query_options *arg2 = (query_options *) 0 ; + role_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(role **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (role_result *)kuzzle_security_role_save(arg1,arg2); + *(role_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + user_data *arg3 = (user_data *) 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(user_data **)&jarg3; + result = (user *)kuzzle_security_new_user(arg1,arg2,arg3); + *(user **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + user *arg1 = (user *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(user **)&jarg1; + kuzzle_security_destroy_user(arg1); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (user_result *)kuzzle_security_fetch_user(arg1,arg2,arg3); + *(user_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1scroll_1users(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_users_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (search_users_result *)kuzzle_security_scroll_users(arg1,arg2,arg3); + *(search_users_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1users(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzle *arg1 = (kuzzle *) 0 ; + search_filters *arg2 = (search_filters *) 0 ; + query_options *arg3 = (query_options *) 0 ; + search_users_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzle **)&jarg1; + arg2 = *(search_filters **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (search_users_result *)kuzzle_security_search_users(arg1,arg2,arg3); + *(search_users_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (user_result *)kuzzle_security_user_create(arg1,arg2); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_security_user_create_credentials(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1with_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + json_object *arg2 = (json_object *) 0 ; + query_options *arg3 = (query_options *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(user **)&jarg1; + arg2 = *(json_object **)&jarg2; + arg3 = *(query_options **)&jarg3; + result = (user_result *)kuzzle_security_user_create_with_credentials(arg1,arg2,arg3); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_security_user_delete(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1delete_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_security_user_delete_credentials(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1credentials_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (json_result *)kuzzle_security_user_get_credentials_info(arg1,arg2,arg3); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + profiles_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (profiles_result *)kuzzle_security_user_get_profiles(arg1,arg2); + *(profiles_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1rights(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + user_rights_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (user_rights_result *)kuzzle_security_user_get_rights(arg1,arg2); + *(user_rights_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1has_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + query_options *arg3 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(query_options **)&jarg3; + result = (bool_result *)kuzzle_security_user_has_credentials(arg1,arg2,arg3); + *(bool_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1replace(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + query_options *arg2 = (query_options *) 0 ; + user_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(user **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (user_result *)kuzzle_security_user_replace(arg1,arg2); + *(user_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1update_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + user *arg1 = (user *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(user **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + result = (json_result *)kuzzle_security_update_credentials(arg1,arg2,arg3,arg4); + *(json_result **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1is_1action_1allowed(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6) { + jlong jresult = 0 ; + user_right **arg1 = (user_right **) 0 ; + unsigned int arg2 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + char *arg5 = (char *) 0 ; + char *arg6 = (char *) 0 ; + unsigned int result; + + (void)jenv; + (void)jcls; + arg1 = *(user_right ***)&jarg1; + arg2 = (unsigned int)jarg2; + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = 0; + if (jarg4) { + arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4) return 0; + } + arg5 = 0; + if (jarg5) { + arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); + if (!arg5) return 0; + } + arg6 = 0; + if (jarg6) { + arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); + if (!arg6) return 0; + } + result = (unsigned int)kuzzle_security_is_action_allowed(arg1,arg2,arg3,arg4,arg5,arg6); + jresult = (jlong)result; + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); + if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); + if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterServer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + server *arg1 = (server *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(server **)&jarg1; + unregisterServer(arg1); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1server(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + server *arg1 = (server *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + kuzzle_new_server(arg1,arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1admin_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (bool_result *)kuzzle_admin_exists(arg1,arg2); + *(bool_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1all_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_get_all_stats(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + time_t arg2 ; + time_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + time_t *argp2 ; + time_t *argp3 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(server **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + arg4 = *(query_options **)&jarg4; + result = (string_result *)kuzzle_get_stats(arg1,arg2,arg3,arg4); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1last_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_get_last_stats(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1config(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_get_config(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + string_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (string_result *)kuzzle_info(arg1,arg2); + *(string_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1now(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + server *arg1 = (server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + date_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(server **)&jarg1; + arg2 = *(query_options **)&jarg2; + result = (date_result *)kuzzle_now(arg1,arg2); + *(date_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::NotificationListener **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1onMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; + notification_result *arg2 = (notification_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::NotificationListener **)&jarg1; + arg2 = *(notification_result **)&jarg2; + ((kuzzleio::NotificationListener const *)arg1)->onMessage(arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotificationListener(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::NotificationListener *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::NotificationListener *)new SwigDirector_NotificationListener(jenv); + *(kuzzleio::NotificationListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { + kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); + (void)jcls; + SwigDirector_NotificationListener *director = dynamic_cast(obj); + if (director) { + director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { + kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); + SwigDirector_NotificationListener *director = dynamic_cast(obj); + (void)jcls; + if (director) { + director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1EventListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::EventListener **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1trigger(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; + json_object *arg2 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::EventListener **)&jarg1; + arg2 = *(json_object **)&jarg2; + ((kuzzleio::EventListener const *)arg1)->trigger(arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1EventListener(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::EventListener *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::EventListener *)new SwigDirector_EventListener(jenv); + *(kuzzleio::EventListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { + kuzzleio::EventListener *obj = *((kuzzleio::EventListener **)&objarg); + (void)jcls; + SwigDirector_EventListener *director = dynamic_cast(obj); + if (director) { + director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { + kuzzleio::EventListener *obj = *((kuzzleio::EventListener **)&objarg); + SwigDirector_EventListener *director = dynamic_cast(obj); + (void)jcls; + if (director) { + director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SubscribeListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::SubscribeListener *arg1 = (kuzzleio::SubscribeListener *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::SubscribeListener **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1onSubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::SubscribeListener *arg1 = (kuzzleio::SubscribeListener *) 0 ; + room_result *arg2 = (room_result *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::SubscribeListener **)&jarg1; + arg2 = *(room_result **)&jarg2; + ((kuzzleio::SubscribeListener const *)arg1)->onSubscribe(arg2); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SubscribeListener(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::SubscribeListener *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::SubscribeListener *)new SwigDirector_SubscribeListener(jenv); + *(kuzzleio::SubscribeListener **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { + kuzzleio::SubscribeListener *obj = *((kuzzleio::SubscribeListener **)&objarg); + (void)jcls; + SwigDirector_SubscribeListener *director = dynamic_cast(obj); + if (director) { + director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); + } +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { + kuzzleio::SubscribeListener *obj = *((kuzzleio::SubscribeListener **)&objarg); + SwigDirector_SubscribeListener *director = dynamic_cast(obj); + (void)jcls; + if (director) { + director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); + } +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_PARTIAL_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(206); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_BAD_1REQUEST_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(400); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_UNAUTHORIZED_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(401); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_FORBIDDEN_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(403); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_NOT_1FOUND_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(404); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_PRECONDITION_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(412); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_SIZE_1LIMIT_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(413); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_INTERNAL_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(500); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_SERVICE_1UNAVAILABLE_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(503); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_GATEWAY_1TIMEOUT_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)(504); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jint jarg1, jstring jarg2) { + jlong jresult = 0 ; + int arg1 ; + std::string *arg2 = 0 ; + kuzzleio::KuzzleException *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = (int)jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(arg1,(std::string const &)*arg2); + *(kuzzleio::KuzzleException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jint jarg1) { + jlong jresult = 0 ; + int arg1 ; + kuzzleio::KuzzleException *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = (int)jarg1; + result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(arg1); + *(kuzzleio::KuzzleException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_12(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::KuzzleException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(); + *(kuzzleio::KuzzleException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::KuzzleException *arg1 = 0 ; + kuzzleio::KuzzleException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::KuzzleException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::KuzzleException const & reference is null"); + return 0; + } + result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException((kuzzleio::KuzzleException const &)*arg1); + *(kuzzleio::KuzzleException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::KuzzleException *arg1 = (kuzzleio::KuzzleException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::KuzzleException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleException_1getMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::KuzzleException *arg1 = (kuzzleio::KuzzleException *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::KuzzleException **)&jarg1; + result = ((kuzzleio::KuzzleException const *)arg1)->getMessage(); + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::BadRequestException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException((std::string const &)*arg1); + *(kuzzleio::BadRequestException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::BadRequestException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException(); + *(kuzzleio::BadRequestException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::BadRequestException *arg1 = 0 ; + kuzzleio::BadRequestException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::BadRequestException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::BadRequestException const & reference is null"); + return 0; + } + result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException((kuzzleio::BadRequestException const &)*arg1); + *(kuzzleio::BadRequestException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1BadRequestException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::BadRequestException *arg1 = (kuzzleio::BadRequestException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::BadRequestException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::ForbiddenException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException((std::string const &)*arg1); + *(kuzzleio::ForbiddenException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::ForbiddenException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException(); + *(kuzzleio::ForbiddenException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::ForbiddenException *arg1 = 0 ; + kuzzleio::ForbiddenException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::ForbiddenException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::ForbiddenException const & reference is null"); + return 0; + } + result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException((kuzzleio::ForbiddenException const &)*arg1); + *(kuzzleio::ForbiddenException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ForbiddenException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::ForbiddenException *arg1 = (kuzzleio::ForbiddenException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::ForbiddenException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::GatewayTimeoutException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException((std::string const &)*arg1); + *(kuzzleio::GatewayTimeoutException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::GatewayTimeoutException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException(); + *(kuzzleio::GatewayTimeoutException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::GatewayTimeoutException *arg1 = 0 ; + kuzzleio::GatewayTimeoutException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::GatewayTimeoutException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::GatewayTimeoutException const & reference is null"); + return 0; + } + result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException((kuzzleio::GatewayTimeoutException const &)*arg1); + *(kuzzleio::GatewayTimeoutException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GatewayTimeoutException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::GatewayTimeoutException *arg1 = (kuzzleio::GatewayTimeoutException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::GatewayTimeoutException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::InternalException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::InternalException *)new kuzzleio::InternalException((std::string const &)*arg1); + *(kuzzleio::InternalException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::InternalException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::InternalException *)new kuzzleio::InternalException(); + *(kuzzleio::InternalException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::InternalException *arg1 = 0 ; + kuzzleio::InternalException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::InternalException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::InternalException const & reference is null"); + return 0; + } + result = (kuzzleio::InternalException *)new kuzzleio::InternalException((kuzzleio::InternalException const &)*arg1); + *(kuzzleio::InternalException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1InternalException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::InternalException *arg1 = (kuzzleio::InternalException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::InternalException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::NotFoundException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException((std::string const &)*arg1); + *(kuzzleio::NotFoundException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::NotFoundException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException(); + *(kuzzleio::NotFoundException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::NotFoundException *arg1 = 0 ; + kuzzleio::NotFoundException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::NotFoundException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::NotFoundException const & reference is null"); + return 0; + } + result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException((kuzzleio::NotFoundException const &)*arg1); + *(kuzzleio::NotFoundException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotFoundException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::NotFoundException *arg1 = (kuzzleio::NotFoundException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::NotFoundException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::PartialException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::PartialException *)new kuzzleio::PartialException((std::string const &)*arg1); + *(kuzzleio::PartialException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::PartialException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::PartialException *)new kuzzleio::PartialException(); + *(kuzzleio::PartialException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::PartialException *arg1 = 0 ; + kuzzleio::PartialException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::PartialException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::PartialException const & reference is null"); + return 0; + } + result = (kuzzleio::PartialException *)new kuzzleio::PartialException((kuzzleio::PartialException const &)*arg1); + *(kuzzleio::PartialException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1PartialException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::PartialException *arg1 = (kuzzleio::PartialException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::PartialException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::PreconditionException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException((std::string const &)*arg1); + *(kuzzleio::PreconditionException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::PreconditionException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException(); + *(kuzzleio::PreconditionException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::PreconditionException *arg1 = 0 ; + kuzzleio::PreconditionException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::PreconditionException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::PreconditionException const & reference is null"); + return 0; + } + result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException((kuzzleio::PreconditionException const &)*arg1); + *(kuzzleio::PreconditionException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1PreconditionException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::PreconditionException *arg1 = (kuzzleio::PreconditionException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::PreconditionException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::ServiceUnavailableException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException((std::string const &)*arg1); + *(kuzzleio::ServiceUnavailableException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::ServiceUnavailableException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException(); + *(kuzzleio::ServiceUnavailableException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::ServiceUnavailableException *arg1 = 0 ; + kuzzleio::ServiceUnavailableException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::ServiceUnavailableException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::ServiceUnavailableException const & reference is null"); + return 0; + } + result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException((kuzzleio::ServiceUnavailableException const &)*arg1); + *(kuzzleio::ServiceUnavailableException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ServiceUnavailableException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::ServiceUnavailableException *arg1 = (kuzzleio::ServiceUnavailableException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::ServiceUnavailableException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::SizeLimitException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException((std::string const &)*arg1); + *(kuzzleio::SizeLimitException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::SizeLimitException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException(); + *(kuzzleio::SizeLimitException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::SizeLimitException *arg1 = 0 ; + kuzzleio::SizeLimitException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::SizeLimitException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::SizeLimitException const & reference is null"); + return 0; + } + result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException((kuzzleio::SizeLimitException const &)*arg1); + *(kuzzleio::SizeLimitException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SizeLimitException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::SizeLimitException *arg1 = (kuzzleio::SizeLimitException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::SizeLimitException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::UnauthorizedException *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException((std::string const &)*arg1); + *(kuzzleio::UnauthorizedException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + kuzzleio::UnauthorizedException *result = 0 ; + + (void)jenv; + (void)jcls; + result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException(); + *(kuzzleio::UnauthorizedException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::UnauthorizedException *arg1 = 0 ; + kuzzleio::UnauthorizedException *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::UnauthorizedException **)&jarg1; + if (!arg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::UnauthorizedException const & reference is null"); + return 0; + } + result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException((kuzzleio::UnauthorizedException const &)*arg1); + *(kuzzleio::UnauthorizedException **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1UnauthorizedException(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::UnauthorizedException *arg1 = (kuzzleio::UnauthorizedException *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::UnauthorizedException **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jint jresult = 0 ; + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + Event arg2 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + arg2 = (Event)jarg2; + result = (int)(arg1)->listenerCount(arg2); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleEventEmitter(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzle *arg2 = (kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(kuzzle **)&jarg2; + if (arg1) (arg1)->_kuzzle = arg2; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzle *) ((arg1)->_kuzzle); + *(kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Kuzzle_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + options *arg2 = (options *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg2_; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + arg2 = *(options **)&jarg2; + result = (kuzzleio::Kuzzle *)new kuzzleio::Kuzzle((std::string const &)*arg1,arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Kuzzle_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + std::string *arg1 = 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + if(!jarg1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1_pstr) return 0; + std::string arg1_str(arg1_pstr); + arg1 = &arg1_str; + jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); + result = (kuzzleio::Kuzzle *)new kuzzleio::Kuzzle((std::string const &)*arg1); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1checkToken(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + token_validity *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (token_validity *)(arg1)->checkToken((std::string const &)*arg2); + *(token_validity **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (char *)(arg1)->connect(); + if (result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createIndex_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (bool)(arg1)->createIndex((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createIndex_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (bool)(arg1)->createIndex((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + try { + result = (json_object *)(arg1)->createMyCredentials((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (json_object *)(arg1)->createMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1deleteMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (bool)(arg1)->deleteMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1deleteMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (bool)(arg1)->deleteMyCredentials((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (json_object *)(arg1)->getMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (json_object *)(arg1)->getMyCredentials((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + try { + result = (json_object *)(arg1)->updateMyCredentials((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (json_object *)(arg1)->updateMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1validateMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + query_options *arg4 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + (void)jarg4_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + arg4 = *(query_options **)&jarg4; + try { + result = (bool)(arg1)->validateMyCredentials((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1validateMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (bool)(arg1)->validateMyCredentials((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1login_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jint jarg4) { + jstring jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + int arg4 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + arg4 = (int)jarg4; + try { + result = (arg1)->login((std::string const &)*arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1login_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jstring jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + json_object *arg3 = (json_object *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(json_object **)&jarg3; + try { + result = (arg1)->login((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAllStatistics_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (statistics *)(arg1)->getAllStatistics(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAllStatistics_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (statistics *)(arg1)->getAllStatistics(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getStatistics_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + time_t arg2 ; + time_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + time_t *argp2 ; + time_t *argp3 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + arg4 = *(query_options **)&jarg4; + try { + result = (statistics *)(arg1)->getStatistics(arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getStatistics_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + time_t arg2 ; + time_t arg3 ; + time_t *argp2 ; + time_t *argp3 ; + statistics *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + try { + result = (statistics *)(arg1)->getStatistics(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(statistics **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAutoRefresh_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAutoRefresh_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (arg1)->getJwt(); + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (json_object *)(arg1)->getMyRights(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (json_object *)(arg1)->getMyRights(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::vector< std::string > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (arg1)->listIndexes(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::vector< std::string > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (arg1)->listIndexes(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + (arg1)->disconnect(); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + (arg1)->logout(); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzle_request *arg2 = (kuzzle_request *) 0 ; + query_options *arg3 = (query_options *) 0 ; + kuzzle_response *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(kuzzle_request **)&jarg2; + arg3 = *(query_options **)&jarg3; + try { + result = (kuzzle_response *)(arg1)->query(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzle_response **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzle_request *arg2 = (kuzzle_request *) 0 ; + kuzzle_response *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(kuzzle_request **)&jarg2; + try { + result = (kuzzle_response *)(arg1)->query(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(kuzzle_response **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1refreshIndex_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + query_options *arg3 = (query_options *) 0 ; + shards *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(query_options **)&jarg3; + try { + result = (shards *)(arg1)->refreshIndex((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(shards **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1refreshIndex_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + shards *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + result = (shards *)(arg1)->refreshIndex((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(shards **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1replayQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->replayQueue(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setAutoReplay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + bool arg2 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = jarg2 ? true : false; + result = (kuzzleio::Kuzzle *)(arg1)->setAutoReplay(arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setDefaultIndex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (kuzzleio::Kuzzle *)(arg1)->setDefaultIndex((std::string const &)*arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + std::string *arg2 = 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + result = (kuzzleio::Kuzzle *)(arg1)->setJwt((std::string const &)*arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1startQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->startQueuing(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1stopQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->stopQueuing(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1unsetJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->unsetJwt(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + user_data *arg2 = (user_data *) 0 ; + query_options *arg3 = (query_options *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(user_data **)&jarg2; + arg3 = *(query_options **)&jarg3; + try { + result = (json_object *)(arg1)->updateSelf(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + user_data *arg2 = (user_data *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(user_data **)&jarg2; + try { + result = (json_object *)(arg1)->updateSelf(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1whoAmI(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + user *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + try { + result = (user *)(arg1)->whoAmI(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(user **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1flushQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Kuzzle *)(arg1)->flushQueue(); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (json_object *)(arg1)->getVolatile(); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + json_object *arg2 = (json_object *) 0 ; + kuzzleio::Kuzzle *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = *(json_object **)&jarg2; + result = (kuzzleio::Kuzzle *)(arg1)->setVolatile(arg2); + *(kuzzleio::Kuzzle **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + SwigValueWrapper< std::map< int,kuzzleio::EventListener * > > result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (arg1)->getListeners(); + *(std::map< int,kuzzleio::EventListener * > **)&jresult = new std::map< int,kuzzleio::EventListener * >((const std::map< int,kuzzleio::EventListener * > &)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; + kuzzleio::KuzzleEventEmitter *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + arg3 = *(kuzzleio::EventListener **)&jarg3; + result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); + *(kuzzleio::KuzzleEventEmitter **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jint jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + Event arg2 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + arg2 = (Event)jarg2; + result = (int)(arg1)->listenerCount(arg2); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Collection *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Collection *)new kuzzleio::Collection(arg1); + *(kuzzleio::Collection **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Collection **)&jarg1; + delete arg1; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return ; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + (arg1)->create((std::string const &)*arg2,(std::string const &)*arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jboolean jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + result = (bool)(arg1)->exists((std::string const &)*arg2,(std::string const &)*arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jstring jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + collection_list_options *arg3 = (collection_list_options *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + arg3 = *(collection_list_options **)&jarg3; + try { + result = (arg1)->list((std::string const &)*arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1truncate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return ; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + (arg1)->truncate((std::string const &)*arg2,(std::string const &)*arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1getMapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jstring jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + result = (arg1)->getMapping((std::string const &)*arg2,(std::string const &)*arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateMapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + std::string *arg4 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return ; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + if(!jarg4) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg4_pstr = (const char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4_pstr) return ; + std::string arg4_str(arg4_pstr); + arg4 = &arg4_str; + jenv->ReleaseStringUTFChars(jarg4, arg4_pstr); + try { + (arg1)->updateMapping((std::string const &)*arg2,(std::string const &)*arg3,(std::string const &)*arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1getSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jstring jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + result = (arg1)->getSpecifications((std::string const &)*arg2,(std::string const &)*arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1searchSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + search_options *arg2 = (search_options *) 0 ; + search_result *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Collection **)&jarg1; + arg2 = *(search_options **)&jarg2; + try { + result = (search_result *)(arg1)->searchSpecifications(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + *(search_result **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) { + jstring jresult = 0 ; + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + std::string *arg4 = 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return 0; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return 0; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + if(!jarg4) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return 0; + } + const char *arg4_pstr = (const char *)jenv->GetStringUTFChars(jarg4, 0); + if (!arg4_pstr) return 0; + std::string arg4_str(arg4_pstr); + arg4 = &arg4_str; + jenv->ReleaseStringUTFChars(jarg4, arg4_pstr); + try { + result = (arg1)->updateSpecifications((std::string const &)*arg2,(std::string const &)*arg3,(std::string const &)*arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1validateSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + try { + (arg1)->validateSpecifications((std::string const &)*arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; + std::string *arg2 = 0 ; + std::string *arg3 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Collection **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::string arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return ; + std::string arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + (arg1)->deleteSpecifications((std::string const &)*arg2,(std::string const &)*arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return ; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return ; + } + } + +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Server(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; + kuzzleio::Server *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Kuzzle **)&jarg1; + result = (kuzzleio::Server *)new kuzzleio::Server(arg1); + *(kuzzleio::Server **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Server(JNIEnv *jenv, jclass jcls, jlong jarg1) { + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(kuzzleio::Server **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1adminExists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jboolean jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (bool)(arg1)->adminExists(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getAllStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (arg1)->getAllStats(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getAllStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Server **)&jarg1; + try { + result = (arg1)->getAllStats(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + time_t arg2 ; + time_t arg3 ; + query_options *arg4 = (query_options *) 0 ; + time_t *argp2 ; + time_t *argp3 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg4_; + arg1 = *(kuzzleio::Server **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + arg4 = *(query_options **)&jarg4; + try { + result = (arg1)->getStats(arg2,arg3,arg4); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + time_t arg2 ; + time_t arg3 ; + time_t *argp2 ; + time_t *argp3 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Server **)&jarg1; + argp2 = *(time_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg2 = *argp2; + argp3 = *(time_t **)&jarg3; + if (!argp3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); + return 0; + } + arg3 = *argp3; + try { + result = (arg1)->getStats(arg2,arg3); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getLastStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (arg1)->getLastStats(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getLastStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Server **)&jarg1; + try { + result = (arg1)->getLastStats(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getConfig_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (arg1)->getConfig(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getConfig_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Server **)&jarg1; + try { + result = (arg1)->getConfig(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1info_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (arg1)->info(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1info_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + std::string result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Server **)&jarg1; + try { + result = (arg1)->info(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = jenv->NewStringUTF((&result)->c_str()); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1_1now_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { + jlong jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + query_options *arg2 = (query_options *) 0 ; + long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg2_; + arg1 = *(kuzzleio::Server **)&jarg1; + arg2 = *(query_options **)&jarg2; + try { + result = (long long)(arg1)->now(arg2); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1_1now_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; + long long result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(kuzzleio::Server **)&jarg1; + try { + result = (long long)(arg1)->now(); + } + catch(kuzzleio::BadRequestException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ForbiddenException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::GatewayTimeoutException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::InternalException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::NotFoundException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PartialException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::PreconditionException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::ServiceUnavailableException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + catch(kuzzleio::SizeLimitException &_e) { + (void)_e; + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); + return 0; + } + catch(kuzzleio::UnauthorizedException &_e) { + { + (void)_e; + jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); + if (excpcls) { + jenv->ThrowNew(excpcls, (&_e)->what()); + } + return 0; + } + } + + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + std::vector< std::string > *result = 0 ; + + (void)jenv; + (void)jcls; + result = (std::vector< std::string > *)new std::vector< std::string >(); + *(std::vector< std::string > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong jresult = 0 ; + std::vector< std::string >::size_type arg1 ; + std::vector< std::string > *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = (std::vector< std::string >::size_type)jarg1; + result = (std::vector< std::string > *)new std::vector< std::string >(arg1); + *(std::vector< std::string > **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + result = ((std::vector< std::string > const *)arg1)->size(); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + result = ((std::vector< std::string > const *)arg1)->capacity(); + jresult = (jlong)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::size_type arg2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = (std::vector< std::string >::size_type)jarg2; + (arg1)->reserve(arg2); +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jboolean jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + result = (bool)((std::vector< std::string > const *)arg1)->empty(); + jresult = (jboolean)result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + (arg1)->clear(); +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1add(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + std::vector< std::string >::value_type *arg2 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + if(!jarg2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2_pstr) return ; + std::vector< std::string >::value_type arg2_str(arg2_pstr); + arg2 = &arg2_str; + jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); + (arg1)->push_back((std::vector< std::string >::value_type const &)*arg2); +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jstring jresult = 0 ; + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + int arg2 ; + std::vector< std::string >::value_type *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = (int)jarg2; + try { + result = (std::vector< std::string >::value_type *) &std_vector_Sl_std_string_Sg__get(arg1,arg2); + } + catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return 0; + } + + jresult = jenv->NewStringUTF(result->c_str()); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + int arg2 ; + std::vector< std::string >::value_type *arg3 = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(std::vector< std::string > **)&jarg1; + arg2 = (int)jarg2; + if(!jarg3) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + return ; + } + const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3_pstr) return ; + std::vector< std::string >::value_type arg3_str(arg3_pstr); + arg3 = &arg3_str; + jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); + try { + std_vector_Sl_std_string_Sg__set(arg1,arg2,(std::string const &)*arg3); + } + catch(std::out_of_range &_e) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); + return ; + } + +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StringVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { + std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(std::vector< std::string > **)&jarg1; + delete arg1; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1JsonObject(JNIEnv *jenv, jclass jcls) { + jlong jresult = 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + result = (json_object *)new_json_object(); + *(json_object **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1JsonObject(JNIEnv *jenv, jclass jcls, jlong jarg1) { + json_object *arg1 = (json_object *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(json_object **)&jarg1; + delete_json_object(arg1); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + result = (json_object *)json_object_put__SWIG_0(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (int)jarg3; + result = (json_object *)json_object_put__SWIG_1(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + double arg3 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = (double)jarg3; + result = (json_object *)json_object_put__SWIG_2(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jboolean jarg3) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + bool arg3 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = jarg3 ? true : false; + result = (json_object *)json_object_put__SWIG_3(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_14(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + json_object *arg3 = (json_object *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + (void)jarg3_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = *(json_object **)&jarg3; + result = (json_object *)json_object_put__SWIG_4(arg1,arg2,arg3); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jstring jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (char *)json_object_getString(arg1,arg2); + if (result) jresult = jenv->NewStringUTF((const char *)result); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getInt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jint jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (int)json_object_getInt(arg1,arg2); + jresult = (jint)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getDouble(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jdouble jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + double result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (double)json_object_getDouble(arg1,arg2); + jresult = (jdouble)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getBoolean(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jboolean jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + bool result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (bool)json_object_getBoolean(arg1,arg2); + jresult = (jboolean)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getJsonObject(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + jlong jresult = 0 ; + json_object *arg1 = (json_object *) 0 ; + char *arg2 = (char *) 0 ; + json_object *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(json_object **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + result = (json_object *)json_object_getJsonObject(arg1,arg2); + *(json_object **)&jresult = result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_trigger_1event_1listener(JNIEnv *jenv, jclass jcls, jint jarg1, jlong jarg2, jobject jarg2_, jlong jarg3) { + int arg1 ; + json_object *arg2 = (json_object *) 0 ; + void *arg3 = (void *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg2_; + arg1 = (int)jarg1; + arg2 = *(json_object **)&jarg2; + arg3 = *(void **)&jarg3; + kuzzleio::trigger_event_listener(arg1,arg2,arg3); +} + + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_BadRequestException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::BadRequestException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ForbiddenException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::ForbiddenException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GatewayTimeoutException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::GatewayTimeoutException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_InternalException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::InternalException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotFoundException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::NotFoundException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_PartialException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::PartialException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_PreconditionException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::PreconditionException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ServiceUnavailableException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::ServiceUnavailableException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SizeLimitException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::SizeLimitException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UnauthorizedException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::UnauthorizedException **)&jarg1; + return baseptr; +} + +SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong baseptr = 0; + (void)jenv; + (void)jcls; + *(kuzzleio::KuzzleEventEmitter **)&baseptr = *(kuzzleio::Kuzzle **)&jarg1; + return baseptr; +} + +SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_swig_1module_1init(JNIEnv *jenv, jclass jcls) { + int i; + + static struct { + const char *method; + const char *signature; + } methods[3] = { + { + "SwigDirector_NotificationListener_onMessage", "(Lio/kuzzle/sdk/NotificationListener;J)V" + }, + { + "SwigDirector_EventListener_trigger", "(Lio/kuzzle/sdk/EventListener;J)V" + }, + { + "SwigDirector_SubscribeListener_onSubscribe", "(Lio/kuzzle/sdk/SubscribeListener;J)V" + } + }; + Swig::jclass_kcoreJNI = (jclass) jenv->NewGlobalRef(jcls); + if (!Swig::jclass_kcoreJNI) return; + for (i = 0; i < (int) (sizeof(methods)/sizeof(methods[0])); ++i) { + Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature); + if (!Swig::director_method_ids[i]) return; + } +} + + +#ifdef __cplusplus +} +#endif + diff --git a/internal/wrappers/kcore_wrap.h b/internal/wrappers/kcore_wrap.h new file mode 100644 index 00000000..9b466232 --- /dev/null +++ b/internal/wrappers/kcore_wrap.h @@ -0,0 +1,60 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 3.0.12 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#ifndef SWIG_kcore_WRAP_H_ +#define SWIG_kcore_WRAP_H_ + +class SwigDirector_NotificationListener : public kuzzleio::NotificationListener, public Swig::Director { + +public: + void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); + SwigDirector_NotificationListener(JNIEnv *jenv); + virtual ~SwigDirector_NotificationListener(); + virtual void onMessage(notification_result *arg0) const; +public: + bool swig_overrides(int n) { + return (n < 1 ? swig_override[n] : false); + } +protected: + Swig::BoolArray<1> swig_override; +}; + +class SwigDirector_EventListener : public kuzzleio::EventListener, public Swig::Director { + +public: + void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); + SwigDirector_EventListener(JNIEnv *jenv); + virtual ~SwigDirector_EventListener(); + virtual void trigger(json_object *arg0) const; +public: + bool swig_overrides(int n) { + return (n < 1 ? swig_override[n] : false); + } +protected: + Swig::BoolArray<1> swig_override; +}; + +class SwigDirector_SubscribeListener : public kuzzleio::SubscribeListener, public Swig::Director { + +public: + void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); + SwigDirector_SubscribeListener(JNIEnv *jenv); + virtual ~SwigDirector_SubscribeListener(); + virtual void onSubscribe(room_result *arg0) const; +public: + bool swig_overrides(int n) { + return (n < 1 ? swig_override[n] : false); + } +protected: + Swig::BoolArray<1> swig_override; +}; + + +#endif diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 611343ba..73e20627 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -34,12 +34,7 @@ %{ #include "kuzzle.cpp" #include "collection.cpp" -<<<<<<< HEAD -======= -#include "room.cpp" -#include "document.cpp" #include "server.cpp" ->>>>>>> 1.x %} %include "exceptions.i" @@ -142,9 +137,4 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" -<<<<<<< HEAD -======= -%include "room.cpp" -%include "document.cpp" %include "server.cpp" ->>>>>>> 1.x From e6bdb7505d46d80869cf51243809a26cad5894c9 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 14:07:06 +0100 Subject: [PATCH 037/363] Fix stash mistake --- document/create_document.go | 50 ---- document/create_document_test.go | 128 -------- document/delete_document.go | 35 --- document/delete_document_test.go | 82 ------ document/document.go | 276 ------------------ document/document_exists.go | 34 --- document/document_exists_test.go | 80 ----- document/document_test.go | 466 ------------------------------ document/fetch_document.go | 35 --- document/fetch_document_test.go | 80 ----- document/replace_document.go | 36 --- document/replace_document_test.go | 89 ------ document/update_document.go | 36 --- document/update_document_test.go | 94 ------ 14 files changed, 1521 deletions(-) delete mode 100644 document/create_document.go delete mode 100644 document/create_document_test.go delete mode 100644 document/delete_document.go delete mode 100644 document/delete_document_test.go delete mode 100644 document/document.go delete mode 100644 document/document_exists.go delete mode 100644 document/document_exists_test.go delete mode 100644 document/document_test.go delete mode 100644 document/fetch_document.go delete mode 100644 document/fetch_document_test.go delete mode 100644 document/replace_document.go delete mode 100644 document/replace_document_test.go delete mode 100644 document/update_document.go delete mode 100644 document/update_document_test.go diff --git a/document/create_document.go b/document/create_document.go deleted file mode 100644 index cfb29125..00000000 --- a/document/create_document.go +++ /dev/null @@ -1,50 +0,0 @@ -package collection - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" -) - -// Create a new document in Kuzzle. -// Takes an optional argument object with the following properties: -// - volatile (object, default: null): -// Additional information passed to notifications to other users -// - ifExist (string, allowed values: "error" (default), "replace"): -// If the same document already exists: -// - resolves with an error if set to "error". -// - replaces the existing document if set to "replace" -func (dc *Collection) CreateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - ch := make(chan *types.KuzzleResponse) - - action := "create" - - if options != nil { - if options.IfExist() == "replace" { - action = "createOrReplace" - } else if options.IfExist() != "error" { - return nil, types.NewError(fmt.Sprintf("Invalid value for the 'ifExist' option: '%s'", options.IfExist()), 400) - } - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: action, - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - documentResponse := &Document{collection: dc} - json.Unmarshal(res.Result, documentResponse) - - return documentResponse, nil -} diff --git a/document/create_document_test.go b/document/create_document_test.go deleted file mode 100644 index 00a9a52b..00000000 --- a/document/create_document_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestCreateDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestCreateDocumentWrongOptionError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("unknown") - - _, err := newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, opts) - assert.Equal(t, "[400] Invalid value for the 'ifExist' option: 'unknown'", fmt.Sprint(err)) -} - -func TestCreateDocument(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "create", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - body := make(map[string]interface{}, 0) - body["title"] = "yolo" - - assert.Equal(t, body, parsedQuery.Body) - - res := collection.Document{Id: id, Content: []byte(`{"title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - assert.Equal(t, id, res.Id) -} - -func TestCreateDocumentReplace(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "createOrReplace", parsedQuery.Action) - - res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("replace") - newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) -} - -func TestCreateDocumentCreate(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "create", parsedQuery.Action) - - res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("error") - - newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) -} - -func ExampleCollection_CreateDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - id := "myId" - - res, err := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} diff --git a/document/delete_document.go b/document/delete_document.go deleted file mode 100644 index 198db81d..00000000 --- a/document/delete_document.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// DeleteDocument deletes the Document using its provided unique id. -func (dc *Collection) DeleteDocument(id string, options types.QueryOptions) (string, error) { - if id == "" { - return "", types.NewError("Collection.DeleteDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "delete", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", res.Error - } - - document := &Document{collection: dc} - json.Unmarshal(res.Result, document) - - return document.Id, nil -} diff --git a/document/delete_document_test.go b/document/delete_document_test.go deleted file mode 100644 index 3fbb904f..00000000 --- a/document/delete_document_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestDeleteDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("should have stopped before receiving a response")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("", nil) - assert.NotNil(t, err) - assert.Equal(t, "Collection.DeleteDocument: document id required", err.(*types.KuzzleError).Message) -} - -func TestDeleteDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("myId", nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestDeleteDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "delete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) - assert.Equal(t, id, res) -} - -func ExampleCollection_DeleteDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - id := "myId" - - res, err := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/document/document.go b/document/document.go deleted file mode 100644 index 38e7e174..00000000 --- a/document/document.go +++ /dev/null @@ -1,276 +0,0 @@ -package collection - -import ( - "encoding/json" - "strconv" - - "github.com/kuzzleio/sdk-go/types" -) - -type IDocument interface { - Save() - Refresh() - SetContent() - Publish() - Exists() - Delete() -} - -type Document struct { - Id string `json:"_id"` - Index string `json:"_index"` - Meta *types.Meta `json:"_meta"` - Shards *types.Shards `json:"_shards"` - Content json.RawMessage `json:"_source"` - Version int `json:"_version"` - Result string `json:"result"` - Created bool `json:"created"` - Collection string `json:"_collection"` - collection *Collection `json:"-"` -} - -type DocumentContent map[string]interface{} - -/* - * Instanciate a new document - */ -func NewDocument(col *Collection, id string) *Document { - return &Document{ - collection: col, - Id: id, - Collection: col.collection, - Index: col.index, - } -} - -func (documentContent *DocumentContent) ToString() string { - s, _ := json.Marshal(documentContent) - - return string(s) -} - -func (d *Document) SourceToMap() DocumentContent { - sourceMap := DocumentContent{} - - json.Unmarshal(d.Content, &sourceMap) - - return sourceMap -} - -// Subscribe listens to events concerning this document. Has no effect if the document does not have an ID -// (i.e. if the document has not yet been created as a persisted document). -func (d *Document) Subscribe(options types.RoomOptions, ch chan<- types.KuzzleNotification) (*Room, error) { - if d.Id == "" { - return nil, types.NewError("Document.Subscribe: cannot subscribe to a document if no ID has been provided", 400) - } - - filters := map[string]map[string][]string{ - "ids": { - "values": []string{d.Id}, - }, - } - - return d.collection.Subscribe(filters, options, ch), nil -} - -/* - Saves the document into Kuzzle. - - If this is a new document, will create it in Kuzzle and the id property will be made available. - Otherwise, will replace the latest version of the document in Kuzzle by the current content of this object. -*/ -func (d *Document) Save(options types.QueryOptions) (*Document, error) { - if d.Id == "" { - return d, types.NewError("Document.Save: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "createOrReplace", - Id: d.Id, - Body: d.Content, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return d, res.Error - } - - return d, nil -} - -/* - Replaces the document with the latest version stored in Kuzzle. -*/ -func (d *Document) Refresh(options types.QueryOptions) (*Document, error) { - if d.Id == "" { - return d, types.NewError("Document.Refresh: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "get", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - if res.Error != nil { - return d, res.Error - } - - json.Unmarshal(res.Result, d) - - return d, nil -} - -/* - Sets the document id. -*/ -func (d *Document) SetDocumentId(id string) *Document { - if id != "" { - d.Id = id - } - - return d -} - -/* - Replaces the current document content with provided data. - Changes made by this function won’t be applied until the save method is called. - If replace is set to true, the entire content will be replaced, otherwise, only existing and new fields will be impacted. -*/ -func (d *Document) SetContent(content DocumentContent, replace bool) *Document { - if replace { - d.Content, _ = json.Marshal(content) - } else { - source := DocumentContent{} - json.Unmarshal(d.Content, &source) - - for attr, value := range content { - if source[attr] == nil { - source[attr] = value - } - } - - d.Content, _ = json.Marshal(source) - } - - return d -} - -/* - Sends the content of the document as a realtime message. -*/ -func (d *Document) Publish(options types.QueryOptions) (bool, error) { - ch := make(chan *types.KuzzleResponse) - - type message struct { - Id string `json:"_id,omitempty"` - Version int `json:"_version,omitempty"` - Body json.RawMessage `json:"body"` - Meta *types.Meta `json:"meta"` - } - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "realtime", - Action: "publish", - Body: message{ - Id: d.Id, - Version: d.Version, - Body: d.Content, - Meta: d.Meta, - }, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - response := types.RealtimeResponse{} - - json.Unmarshal(res.Result, &response) - - return response.Published, nil -} - -/* - Checks if the document exists in Kuzzle. -*/ -func (d *Document) Exists(options types.QueryOptions) (bool, error) { - if d.Id == "" { - return false, types.NewError("Document.Exists: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "exists", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - exists, _ := strconv.ParseBool(string(res.Result)) - - return exists, nil -} - -/* - Deletes the document in Kuzzle. -*/ -func (d *Document) Delete(options types.QueryOptions) (string, error) { - if d.Id == "" { - return "", types.NewError("Document.Delete: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "delete", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", res.Error - } - - document := Document{collection: d.collection} - json.Unmarshal(res.Result, &document) - - return document.Id, nil -} diff --git a/document/document_exists.go b/document/document_exists.go deleted file mode 100644 index 27c8e204..00000000 --- a/document/document_exists.go +++ /dev/null @@ -1,34 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" - "strconv" -) - -// DocumentExists returns a boolean indicating whether or not a document with provided ID exists. -func (dc *Collection) DocumentExists(id string, options types.QueryOptions) (bool, error) { - if id == "" { - return false, types.NewError("Collection.DocumentExists: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "exists", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - exists, _ := strconv.ParseBool(string(res.Result)) - - return exists, nil -} diff --git a/document/document_exists_test.go b/document/document_exists_test.go deleted file mode 100644 index b41a98da..00000000 --- a/document/document_exists_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestDocumentExistsEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.DocumentExists: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DocumentExists("", nil) - assert.NotNil(t, err) -} - -func TestDocumentExistsError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DocumentExists("myId", nil) - assert.NotNil(t, err) -} - -func TestDocumentExists(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "exists", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) - assert.Equal(t, true, res) -} - -func ExampleCollection_DocumentExists() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/document/document_test.go b/document/document_test.go deleted file mode 100644 index 760845fc..00000000 --- a/document/document_test.go +++ /dev/null @@ -1,466 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestDocumentSetContent(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) - - assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - }, - }, false) - - assert.Equal(t, string(json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`))), string(d.Content)) -} - -func ExampleDocument_SetContent() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - }, - }, false) - - fmt.Println(d.Content) -} - -func TestDocumentSetContentReplace(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) - - assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - "subsubfield": collection.DocumentContent{ - "hi": "there", - }, - }, - }, true) - - assert.Equal(t, string(json.RawMessage([]byte(`{"subfield":{"john":"cena","subsubfield":{"hi":"there"}}}`))), string(d.Content)) -} - -func TestDocumentSubscribeEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - cd := dc.Document() - - ch := make(chan types.KuzzleNotification) - _, err := cd.Subscribe(types.NewRoomOptions(), ch) - - assert.Equal(t, "[400] Document.Subscribe: cannot subscribe to a document if no ID has been provided", err.Error()) -} - -func TestDocumentSubscribe(t *testing.T) { - id := "docId" - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - // Fetch query - if parsedQuery.Controller == "document" { - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} - r, _ := json.Marshal(res) - - return &types.KuzzleResponse{Result: r} - } - - // Subscribe query - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "subscribe", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, map[string]interface{}(map[string]interface{}{"ids": map[string]interface{}{"values": []interface{}{"docId"}}}), parsedQuery.Body) - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - dc := collection.NewCollection(k, "collection", "index") - d := dc.Document() - d.Id = id - - ch := make(chan types.KuzzleNotification) - room, _ := d.Subscribe(types.NewRoomOptions(), ch) - r := <-room.ResponseChannel() - - assert.Nil(t, r.Error) - assert.NotNil(t, r.Room) - assert.Equal(t, "42", r.Room.RoomId()) -} - -func ExampleDocument_Subscribe() { - id := "docId" - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{} - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - dc := collection.NewCollection(k, "collection", "index") - d := dc.Document() - d.Id = id - - ch := make(chan types.KuzzleNotification) - room, _ := d.Subscribe(types.NewRoomOptions(), ch) - - notification := <-room.ResponseChannel() - - fmt.Println(notification.Room.RoomId(), notification.Error) -} - -func TestDocumentSaveEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Save(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Save: missing document id", fmt.Sprint(err)) -} - -func TestDocumentSaveError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Save(nil) - - assert.NotNil(t, err) -} - -func TestDocumentSave(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "createOrReplace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{"foo": "bar"} - - d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) - - assert.Equal(t, id, d.Id) - assert.Equal(t, documentContent.ToString(), string(d.Content)) -} - -func ExampleDocument_Save() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{"foo": "bar"} - - res, err := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} - -func TestDocumentRefreshEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Refresh(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Refresh: missing document id", fmt.Sprint(err)) -} - -func TestDocumentRefreshError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Refresh(nil) - - assert.NotNil(t, err) -} - -func TestDocumentRefresh(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"name":"Anakin","function":"Jedi"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{ - "name": "Anakin", - "function": "Padawan", - } - - d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Refresh(nil) - - result := collection.Document{} - json.Unmarshal(d.Content, &result.Content) - - ic := collection.DocumentContent{} - json.Unmarshal(result.Content, &ic) - - assert.Equal(t, id, d.Id) - assert.Equal(t, "Padawan", documentContent["function"]) - assert.Equal(t, "Jedi", ic["function"]) - assert.NotEqual(t, documentContent["function"], ic["function"]) -} - -func ExampleDocument_Refresh() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId(id).Refresh(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} - -func TestCollectionDocumentExistsEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Exists(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Exists: missing document id", fmt.Sprint(err)) -} - -func TestCollectionDocumentExistsError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Exists(nil) - - assert.NotNil(t, err) -} - -func TestCollectionDocumentExists(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "exists", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - exists, _ := dc.Document().SetDocumentId(id).Exists(nil) - - assert.Equal(t, true, exists) -} - -func ExampleDocument_Exists() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId(id).Exists(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestDocumentPublishError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "realtime", "publish") - _, err := dc.Document().SetDocumentId("myId").Publish(nil) - - assert.NotNil(t, err) -} - -func TestDocumentPublish(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "publish", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - r, _ := json.Marshal(types.RealtimeResponse{Published: true}) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, _ := dc.Document().SetDocumentId("myId").Publish(nil) - - assert.Equal(t, true, res) -} - -func ExampleDocument_Publish() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId("myId").Publish(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestDocumentDeleteEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Delete(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Delete: missing document id", fmt.Sprint(err)) -} - -func TestDocumentDeleteError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Delete(nil) - - assert.NotNil(t, err) -} - -func TestDocumentDelete(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "delete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(collection.Document{Id: id}) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, _ := dc.Document().SetDocumentId("myId").Delete(nil) - - assert.Equal(t, id, res) -} - -func ExampleDocument_Delete() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId("myId").Delete(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/document/fetch_document.go b/document/fetch_document.go deleted file mode 100644 index 7f4fa8f7..00000000 --- a/document/fetch_document.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// FetchDocument retrieves a Document using its provided unique id. -func (dc *Collection) FetchDocument(id string, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.FetchDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "get", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - document := &Document{collection: dc} - json.Unmarshal(res.Result, document) - - return document, nil -} diff --git a/document/fetch_document_test.go b/document/fetch_document_test.go deleted file mode 100644 index 73d71c51..00000000 --- a/document/fetch_document_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestFetchDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.FetchDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").FetchDocument("", nil) - assert.NotNil(t, err) -} - -func TestFetchDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").FetchDocument("myId", nil) - assert.NotNil(t, err) -} - -func TestFetchDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo": "bar"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) - assert.Equal(t, id, res.Id) -} - -func ExampleCollection_FetchDocument() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} diff --git a/document/replace_document.go b/document/replace_document.go deleted file mode 100644 index 223a8848..00000000 --- a/document/replace_document.go +++ /dev/null @@ -1,36 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// ReplaceDocument replaces a document in Kuzzle. -func (dc *Collection) ReplaceDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.ReplaceDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "replace", - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - d := &Document{collection: dc} - json.Unmarshal(res.Result, d) - - return d, nil -} diff --git a/document/replace_document_test.go b/document/replace_document_test.go deleted file mode 100644 index e221bef6..00000000 --- a/document/replace_document_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestReplaceDocumentEmptyId(t *testing.T) { - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ReplaceDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestReplaceDocumentError(t *testing.T) { - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestReplaceDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "replace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) - - res := collection.Document{Id: id, Content: []byte(`{"title": "jonathan"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.Equal(t, id, res.Id) -} - -func ExampleCollection_ReplaceDocument() { - type Document struct { - Title string - } - - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} diff --git a/document/update_document.go b/document/update_document.go deleted file mode 100644 index 2fdc057e..00000000 --- a/document/update_document.go +++ /dev/null @@ -1,36 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// UpdateDocument updates a document in Kuzzle. -func (dc *Collection) UpdateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.UpdateDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "update", - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - documentResponse := &Document{collection: dc} - json.Unmarshal(res.Result, documentResponse) - - return documentResponse, nil -} diff --git a/document/update_document_test.go b/document/update_document_test.go deleted file mode 100644 index 5a2be52b..00000000 --- a/document/update_document_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestUpdateDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.UpdateDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestUpdateDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestUpdateDocument(t *testing.T) { - id := "myId" - - type Content struct { - Title string `json:"title"` - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "update", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, 10, options.RetryOnConflict()) - assert.Equal(t, id, parsedQuery.Id) - - assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) - - res := collection.Document{Id: id, Content: []byte(`{"title": "arthur"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - qo := types.NewQueryOptions() - qo.SetRetryOnConflict(10) - - res, _ := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) - - assert.Equal(t, id, res.Id) - - var result Content - - json.Unmarshal(res.Content, &result) - - assert.Equal(t, result.Title, "arthur") -} - -func ExampleCollection_UpdateDocument() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - qo := types.NewQueryOptions() - qo.SetRetryOnConflict(10) - - res, err := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} From 3109f0336a68431e2e443ab18d8a800434769be7 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 14:28:30 +0100 Subject: [PATCH 038/363] Delete unwanted files (kcore_wrapper*) --- internal/wrappers/kcore_wrap.cxx | 26859 ----------------------------- internal/wrappers/kcore_wrap.h | 60 - 2 files changed, 26919 deletions(-) delete mode 100644 internal/wrappers/kcore_wrap.cxx delete mode 100644 internal/wrappers/kcore_wrap.h diff --git a/internal/wrappers/kcore_wrap.cxx b/internal/wrappers/kcore_wrap.cxx deleted file mode 100644 index 906cdd00..00000000 --- a/internal/wrappers/kcore_wrap.cxx +++ /dev/null @@ -1,26859 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.12 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - - -#ifndef SWIGJAVA -#define SWIGJAVA -#endif - -#define SWIG_DIRECTORS - - -#ifdef __cplusplus -/* SwigValueWrapper is described in swig.swg */ -template class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper& rhs); - SwigValueWrapper(const SwigValueWrapper& rhs); -public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -}; - -template T SwigValueInit() { - return T(); -} -#endif - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if defined(__GNUC__) -# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - -/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ -#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) -# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 -#endif - -/* Intel's compiler complains if a variable which was never initialised is - * cast to void, which is a common idiom which we use to indicate that we - * are aware a variable isn't used. So we just silence that warning. - * See: https://github.com/swig/swig/issues/192 for more discussion. - */ -#ifdef __INTEL_COMPILER -# pragma warning disable 592 -#endif - - -/* Fix for jlong on some versions of gcc on Windows */ -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) - typedef long long __int64; -#endif - -/* Fix for jlong on 64-bit x86 Solaris */ -#if defined(__x86_64) -# ifdef _LP64 -# undef _LP64 -# endif -#endif - -#include -#include -#include - - -/* Support for throwing Java exceptions */ -typedef enum { - SWIG_JavaOutOfMemoryError = 1, - SWIG_JavaIOException, - SWIG_JavaRuntimeException, - SWIG_JavaIndexOutOfBoundsException, - SWIG_JavaArithmeticException, - SWIG_JavaIllegalArgumentException, - SWIG_JavaNullPointerException, - SWIG_JavaDirectorPureVirtual, - SWIG_JavaUnknownError -} SWIG_JavaExceptionCodes; - -typedef struct { - SWIG_JavaExceptionCodes code; - const char *java_exception; -} SWIG_JavaExceptions_t; - - -static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { - jclass excep; - static const SWIG_JavaExceptions_t java_exceptions[] = { - { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, - { SWIG_JavaIOException, "java/io/IOException" }, - { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, - { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, - { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, - { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, - { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, - { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, - { SWIG_JavaUnknownError, "java/lang/UnknownError" }, - { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } - }; - const SWIG_JavaExceptions_t *except_ptr = java_exceptions; - - while (except_ptr->code != code && except_ptr->code) - except_ptr++; - - jenv->ExceptionClear(); - excep = jenv->FindClass(except_ptr->java_exception); - if (excep) - jenv->ThrowNew(excep, msg); -} - - -/* Contract support */ - -#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else - -/* ----------------------------------------------------------------------------- - * director_common.swg - * - * This file contains support for director classes which is common between - * languages. - * ----------------------------------------------------------------------------- */ - -/* - Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the - 'Swig' namespace. This could be useful for multi-modules projects. -*/ -#ifdef SWIG_DIRECTOR_STATIC -/* Force anonymous (static) namespace */ -#define Swig -#endif -/* ----------------------------------------------------------------------------- - * director.swg - * - * This file contains support for director classes so that Java proxy - * methods can be called from C++. - * ----------------------------------------------------------------------------- */ - -#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) -#include -#endif - -#include - -namespace Swig { - - /* Java object wrapper */ - class JObjectWrapper { - public: - JObjectWrapper() : jthis_(NULL), weak_global_(true) { - } - - ~JObjectWrapper() { - jthis_ = NULL; - weak_global_ = true; - } - - bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) { - if (!jthis_) { - weak_global_ = weak_global || !mem_own; // hold as weak global if explicitly requested or not owned - if (jobj) - jthis_ = weak_global_ ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj); -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl; -#endif - return true; - } else { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl; -#endif - return false; - } - } - - jobject get(JNIEnv *jenv) const { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::get("; - if (jthis_) - std::cout << jthis_; - else - std::cout << "null"; - std::cout << ") -> return new local ref" << std::endl; -#endif - return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_); - } - - void release(JNIEnv *jenv) { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl; -#endif - if (jthis_) { - if (weak_global_) { - if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) - jenv->DeleteWeakGlobalRef((jweak)jthis_); - } else - jenv->DeleteGlobalRef(jthis_); - } - - jthis_ = NULL; - weak_global_ = true; - } - - /* Only call peek if you know what you are doing wrt to weak/global references */ - jobject peek() { - return jthis_; - } - - /* Java proxy releases ownership of C++ object, C++ object is now - responsible for destruction (creates NewGlobalRef to pin Java proxy) */ - void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { - if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */ - if (!weak_global_) { - jenv->DeleteGlobalRef(jthis_); - jthis_ = jenv->NewWeakGlobalRef(jself); - weak_global_ = true; - } - } else { - /* Java releases ownership of C++ object's lifetime */ - if (weak_global_) { - jenv->DeleteWeakGlobalRef((jweak)jthis_); - jthis_ = jenv->NewGlobalRef(jself); - weak_global_ = false; - } - } - } - - private: - /* pointer to Java object */ - jobject jthis_; - /* Local or global reference flag */ - bool weak_global_; - }; - - /* Local JNI reference deleter */ - class LocalRefGuard { - JNIEnv *jenv_; - jobject jobj_; - - // non-copyable - LocalRefGuard(const LocalRefGuard &); - LocalRefGuard &operator=(const LocalRefGuard &); - public: - LocalRefGuard(JNIEnv *jenv, jobject jobj): jenv_(jenv), jobj_(jobj) {} - ~LocalRefGuard() { - if (jobj_) - jenv_->DeleteLocalRef(jobj_); - } - }; - - /* director base class */ - class Director { - /* pointer to Java virtual machine */ - JavaVM *swig_jvm_; - - protected: -#if defined (_MSC_VER) && (_MSC_VER<1300) - class JNIEnvWrapper; - friend class JNIEnvWrapper; -#endif - /* Utility class for managing the JNI environment */ - class JNIEnvWrapper { - const Director *director_; - JNIEnv *jenv_; - int env_status; - public: - JNIEnvWrapper(const Director *director) : director_(director), jenv_(0), env_status(0) { -#if defined(__ANDROID__) - JNIEnv **jenv = &jenv_; -#else - void **jenv = (void **)&jenv_; -#endif - env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2); -#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON) - // Attach a daemon thread to the JVM. Useful when the JVM should not wait for - // the thread to exit upon shutdown. Only for jdk-1.4 and later. - director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, NULL); -#else - director_->swig_jvm_->AttachCurrentThread(jenv, NULL); -#endif - } - ~JNIEnvWrapper() { -#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) - // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. - // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. - if (env_status == JNI_EDETACHED) - director_->swig_jvm_->DetachCurrentThread(); -#endif - } - JNIEnv *getJNIEnv() const { - return jenv_; - } - }; - - /* Java object wrapper */ - JObjectWrapper swig_self_; - - /* Disconnect director from Java object */ - void swig_disconnect_director_self(const char *disconn_method) { - JNIEnvWrapper jnienv(this) ; - JNIEnv *jenv = jnienv.getJNIEnv() ; - jobject jobj = swig_self_.get(jenv); - LocalRefGuard ref_deleter(jenv, jobj); -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; -#endif - if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { - jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); - if (disconn_meth) { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl; -#endif - jenv->CallVoidMethod(jobj, disconn_meth); - } - } - } - - public: - Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() { - /* Acquire the Java VM pointer */ - jenv->GetJavaVM(&swig_jvm_); - } - - virtual ~Director() { - JNIEnvWrapper jnienv(this) ; - JNIEnv *jenv = jnienv.getJNIEnv() ; - swig_self_.release(jenv); - } - - bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global) { - return swig_self_.set(jenv, jself, mem_own, weak_global); - } - - jobject swig_get_self(JNIEnv *jenv) const { - return swig_self_.get(jenv); - } - - // Change C++ object's ownership, relative to Java - void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { - swig_self_.java_change_ownership(jenv, jself, take_or_release); - } - }; - - // Zero initialized bool array - template class BoolArray { - bool array_[N]; - public: - BoolArray() { - memset(array_, 0, sizeof(array_)); - } - bool& operator[](size_t n) { - return array_[n]; - } - bool operator[](size_t n) const { - return array_[n]; - } - }; - - // Utility classes and functions for exception handling. - - // Simple holder for a Java string during exception handling, providing access to a c-style string - class JavaString { - public: - JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) { - if (jenv_ && jstr_) - cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, NULL); - } - - ~JavaString() { - if (jenv_ && jstr_ && cstr_) - jenv_->ReleaseStringUTFChars(jstr_, cstr_); - } - - const char *c_str(const char *null_string = "null JavaString") const { - return cstr_ ? cstr_ : null_string; - } - - private: - // non-copyable - JavaString(const JavaString &); - JavaString &operator=(const JavaString &); - - JNIEnv *jenv_; - jstring jstr_; - const char *cstr_; - }; - - // Helper class to extract the exception message from a Java throwable - class JavaExceptionMessage { - public: - JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) { - } - - const char *message() const { - return message_.c_str("Could not get exception message in JavaExceptionMessage"); - } - - private: - // non-copyable - JavaExceptionMessage(const JavaExceptionMessage &); - JavaExceptionMessage &operator=(const JavaExceptionMessage &); - - // Get exception message by calling Java method Throwable.getMessage() - static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) { - jstring jmsg = NULL; - if (jenv && throwable) { - jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions - jclass throwclz = jenv->GetObjectClass(throwable); - if (throwclz) { - // All Throwable classes have a getMessage() method, so call it to extract the exception message - jmethodID getMessageMethodID = jenv->GetMethodID(throwclz, "getMessage", "()Ljava/lang/String;"); - if (getMessageMethodID) - jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID); - } - if (jmsg == NULL && jenv->ExceptionCheck()) - jenv->ExceptionClear(); - } - return jmsg; - } - - JavaString message_; - }; - - // C++ Exception class for handling Java exceptions thrown during a director method Java upcall - class DirectorException : public std::exception { - public: - - // Construct exception from a Java throwable - DirectorException(JNIEnv *jenv, jthrowable throwable) : classname_(0), msg_(0) { - - // Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/') - if (throwable) { - jclass throwclz = jenv->GetObjectClass(throwable); - if (throwclz) { - jclass clzclz = jenv->GetObjectClass(throwclz); - if (clzclz) { - jmethodID getNameMethodID = jenv->GetMethodID(clzclz, "getName", "()Ljava/lang/String;"); - if (getNameMethodID) { - jstring jstr_classname = (jstring)(jenv->CallObjectMethod(throwclz, getNameMethodID)); - // Copy strings, since there is no guarantee that jenv will be active when handled - if (jstr_classname) { - JavaString jsclassname(jenv, jstr_classname); - const char *classname = jsclassname.c_str(0); - if (classname) - classname_ = copypath(classname); - } - } - } - } - } - - JavaExceptionMessage exceptionmsg(jenv, throwable); - msg_ = copystr(exceptionmsg.message()); - } - - // More general constructor for handling as a java.lang.RuntimeException - DirectorException(const char *msg) : classname_(0), msg_(copystr(msg ? msg : "Unspecified DirectorException message")) { - } - - ~DirectorException() throw() { - delete[] classname_; - delete[] msg_; - } - - const char *what() const throw() { - return msg_; - } - - // Reconstruct and raise/throw the Java Exception that caused the DirectorException - // Note that any error in the JNI exception handling results in a Java RuntimeException - void raiseJavaException(JNIEnv *jenv) const { - if (jenv) { - jenv->ExceptionClear(); - - jmethodID ctorMethodID = 0; - jclass throwableclass = 0; - if (classname_) { - throwableclass = jenv->FindClass(classname_); - if (throwableclass) - ctorMethodID = jenv->GetMethodID(throwableclass, "", "(Ljava/lang/String;)V"); - } - - if (ctorMethodID) { - jenv->ThrowNew(throwableclass, what()); - } else { - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what()); - } - } - } - - private: - static char *copypath(const char *srcmsg) { - char *target = copystr(srcmsg); - for (char *c=target; *c; ++c) { - if ('.' == *c) - *c = '/'; - } - return target; - } - - static char *copystr(const char *srcmsg) { - char *target = 0; - if (srcmsg) { - size_t msglen = strlen(srcmsg) + 1; - target = new char[msglen]; - strncpy(target, srcmsg, msglen); - } - return target; - } - - const char *classname_; - const char *msg_; - }; - - // Helper method to determine if a Java throwable matches a particular Java class type - SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) { - bool matches = false; - - if (throwable && jenv && classname) { - // Exceptions need to be cleared for correct behavior. - // The caller of ExceptionMatches should restore pending exceptions if desired - - // the caller already has the throwable. - jenv->ExceptionClear(); - - jclass clz = jenv->FindClass(classname); - if (clz) { - jclass classclz = jenv->GetObjectClass(clz); - jmethodID isInstanceMethodID = jenv->GetMethodID(classclz, "isInstance", "(Ljava/lang/Object;)Z"); - if (isInstanceMethodID) { - matches = jenv->CallBooleanMethod(clz, isInstanceMethodID, throwable) != 0; - } - } - -#if defined(DEBUG_DIRECTOR_EXCEPTION) - if (jenv->ExceptionCheck()) { - // Typically occurs when an invalid classname argument is passed resulting in a ClassNotFoundException - JavaExceptionMessage exc(jenv, jenv->ExceptionOccurred()); - std::cout << "Error: ExceptionMatches: class '" << classname << "' : " << exc.message() << std::endl; - } -#endif - } - return matches; - } -} - -namespace Swig { - namespace { - jclass jclass_kcoreJNI = NULL; - jmethodID director_method_ids[3]; - } -} - -#include "kuzzle.cpp" -#include "collection.cpp" -#include "server.cpp" - - -#include - - -#include "listeners.hpp" -#include "exceptions.hpp" -#include "event_emitter.hpp" -#include "kuzzle.hpp" -#include "collection.hpp" -#include "server.hpp" -#include -#include - -SWIGINTERN options *new_options(){ - options *o = kuzzle_new_options(); - return o; - } -SWIGINTERN void delete_options(options *self){ - free(self); - } - -#include -#include - - -#include -#include - -SWIGINTERN std::vector< std::string >::const_reference std_vector_Sl_std_string_Sg__get(std::vector< std::string > *self,int i){ - int size = int(self->size()); - if (i>=0 && i *self,int i,std::vector< std::string >::value_type const &val){ - int size = int(self->size()); - if (i>=0 && iIsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((notification_result **)&jarg0) = (notification_result *) arg0; - jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[0], swigjobj, jarg0); - jthrowable swigerror = jenv->ExceptionOccurred(); - if (swigerror) { - jenv->ExceptionClear(); - throw Swig::DirectorException(jenv, swigerror); - } - - } else { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::NotificationListener::onMessage "); - } - if (swigjobj) jenv->DeleteLocalRef(swigjobj); -} - -void SwigDirector_NotificationListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { - static struct { - const char *mname; - const char *mdesc; - jmethodID base_methid; - } methods[] = { - { - "onMessage", "(Lio/kuzzle/sdk/notification_result;)V", NULL - } - }; - - static jclass baseclass = 0 ; - - if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { - if (!baseclass) { - baseclass = jenv->FindClass("io/kuzzle/sdk/NotificationListener"); - if (!baseclass) return; - baseclass = (jclass) jenv->NewGlobalRef(baseclass); - } - bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); - for (int i = 0; i < 1; ++i) { - if (!methods[i].base_methid) { - methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); - if (!methods[i].base_methid) return; - } - swig_override[i] = false; - if (derived) { - jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); - swig_override[i] = (methid != methods[i].base_methid); - jenv->ExceptionClear(); - } - } - } -} - - -SwigDirector_EventListener::SwigDirector_EventListener(JNIEnv *jenv) : kuzzleio::EventListener(), Swig::Director(jenv) { -} - -SwigDirector_EventListener::~SwigDirector_EventListener() { - swig_disconnect_director_self("swigDirectorDisconnect"); -} - - -void SwigDirector_EventListener::trigger(json_object *arg0) const { - JNIEnvWrapper swigjnienv(this) ; - JNIEnv * jenv = swigjnienv.getJNIEnv() ; - jobject swigjobj = (jobject) NULL ; - jlong jarg0 = 0 ; - - if (!swig_override[0]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method kuzzleio::EventListener::trigger."); - return; - } - swigjobj = swig_get_self(jenv); - if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((json_object **)&jarg0) = (json_object *) arg0; - jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[1], swigjobj, jarg0); - jthrowable swigerror = jenv->ExceptionOccurred(); - if (swigerror) { - jenv->ExceptionClear(); - throw Swig::DirectorException(jenv, swigerror); - } - - } else { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::EventListener::trigger "); - } - if (swigjobj) jenv->DeleteLocalRef(swigjobj); -} - -void SwigDirector_EventListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { - static struct { - const char *mname; - const char *mdesc; - jmethodID base_methid; - } methods[] = { - { - "trigger", "(Lio/kuzzle/sdk/JsonObject;)V", NULL - } - }; - - static jclass baseclass = 0 ; - - if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { - if (!baseclass) { - baseclass = jenv->FindClass("io/kuzzle/sdk/EventListener"); - if (!baseclass) return; - baseclass = (jclass) jenv->NewGlobalRef(baseclass); - } - bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); - for (int i = 0; i < 1; ++i) { - if (!methods[i].base_methid) { - methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); - if (!methods[i].base_methid) return; - } - swig_override[i] = false; - if (derived) { - jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); - swig_override[i] = (methid != methods[i].base_methid); - jenv->ExceptionClear(); - } - } - } -} - - -SwigDirector_SubscribeListener::SwigDirector_SubscribeListener(JNIEnv *jenv) : kuzzleio::SubscribeListener(), Swig::Director(jenv) { -} - -SwigDirector_SubscribeListener::~SwigDirector_SubscribeListener() { - swig_disconnect_director_self("swigDirectorDisconnect"); -} - - -void SwigDirector_SubscribeListener::onSubscribe(room_result *arg0) const { - JNIEnvWrapper swigjnienv(this) ; - JNIEnv * jenv = swigjnienv.getJNIEnv() ; - jobject swigjobj = (jobject) NULL ; - jlong jarg0 = 0 ; - - if (!swig_override[0]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method kuzzleio::SubscribeListener::onSubscribe."); - return; - } - swigjobj = swig_get_self(jenv); - if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((room_result **)&jarg0) = (room_result *) arg0; - jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[2], swigjobj, jarg0); - jthrowable swigerror = jenv->ExceptionOccurred(); - if (swigerror) { - jenv->ExceptionClear(); - throw Swig::DirectorException(jenv, swigerror); - } - - } else { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::SubscribeListener::onSubscribe "); - } - if (swigjobj) jenv->DeleteLocalRef(swigjobj); -} - -void SwigDirector_SubscribeListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { - static struct { - const char *mname; - const char *mdesc; - jmethodID base_methid; - } methods[] = { - { - "onSubscribe", "(Lio/kuzzle/sdk/room_result;)V", NULL - } - }; - - static jclass baseclass = 0 ; - - if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { - if (!baseclass) { - baseclass = jenv->FindClass("io/kuzzle/sdk/SubscribeListener"); - if (!baseclass) return; - baseclass = (jclass) jenv->NewGlobalRef(baseclass); - } - bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); - for (int i = 0; i < 1; ++i) { - if (!methods[i].base_methid) { - methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); - if (!methods[i].base_methid) return; - } - swig_override[i] = false; - if (derived) { - jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); - swig_override[i] = (methid != methods[i].base_methid); - jenv->ExceptionClear(); - } - } - } -} - - - -#ifdef __cplusplus -extern "C" { -#endif - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1query_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - query_object *arg1 = (query_object *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(query_object **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->query = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1query_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - query_object *arg1 = (query_object *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - result = (json_object *) ((arg1)->query); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - query_object *arg1 = (query_object *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->timestamp = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - query_object *arg1 = (query_object *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - result = (unsigned long long) ((arg1)->timestamp); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_object *arg1 = (query_object *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->request_id; - if (arg2) { - arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->request_id, (const char *)arg2); - } else { - arg1->request_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_object *arg1 = (query_object *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - result = (char *) ((arg1)->request_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1query_1object(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - query_object *result = 0 ; - - (void)jenv; - (void)jcls; - result = (query_object *)new query_object(); - *(query_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1query_1object(JNIEnv *jenv, jclass jcls, jlong jarg1) { - query_object *arg1 = (query_object *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(query_object **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - offline_queue *arg1 = (offline_queue *) 0 ; - query_object **arg2 = (query_object **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - arg2 = *(query_object ***)&jarg2; - if (arg1) (arg1)->queries = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - offline_queue *arg1 = (offline_queue *) 0 ; - query_object **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - result = (query_object **) ((arg1)->queries); - *(query_object ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - offline_queue *arg1 = (offline_queue *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->queries_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - offline_queue *arg1 = (offline_queue *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - result = ((arg1)->queries_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1offline_1queue(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - offline_queue *result = 0 ; - - (void)jenv; - (void)jcls; - result = (offline_queue *)new offline_queue(); - *(offline_queue **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1) { - offline_queue *arg1 = (offline_queue *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(offline_queue **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->request_id; - if (arg2) { - arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->request_id, (const char *)arg2); - } else { - arg1->request_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->request_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->controller; - if (arg2) { - arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->controller, (const char *)arg2); - } else { - arg1->controller = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->controller); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->action; - if (arg2) { - arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->action, (const char *)arg2); - } else { - arg1->action = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->action); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1body_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->body = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1body_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (json_object *) ((arg1)->body); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->from = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->from); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->size = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->size); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll; - if (arg2) { - arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll, (const char *)arg2); - } else { - arg1->scroll = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->scroll); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1strategy_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->strategy; - if (arg2) { - arg1->strategy = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->strategy, (const char *)arg2); - } else { - arg1->strategy = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1strategy_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->strategy); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1expires_1in_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->expires_in = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1expires_1in_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (unsigned long long) ((arg1)->expires_in); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scope; - if (arg2) { - arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scope, (const char *)arg2); - } else { - arg1->scope = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->scope); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->state; - if (arg2) { - arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->state, (const char *)arg2); - } else { - arg1->state = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->state); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->user; - if (arg2) { - arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->user, (const char *)arg2); - } else { - arg1->user = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->user); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1start_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->start = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1start_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->start); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1stop_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->stop = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1stop_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->stop); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1end_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->end = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1end_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->end); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1bit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jshort jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned char arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (unsigned char)jarg2; - if (arg1) (arg1)->bit = arg2; -} - - -SWIGEXPORT jshort JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1bit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jshort jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned char result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (unsigned char) ((arg1)->bit); - jresult = (jshort)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->member; - if (arg2) { - arg1->member = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->member, (const char *)arg2); - } else { - arg1->member = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->member); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member1_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->member1; - if (arg2) { - arg1->member1 = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->member1, (const char *)arg2); - } else { - arg1->member1 = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->member1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member2_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->member2; - if (arg2) { - arg1->member2 = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->member2, (const char *)arg2); - } else { - arg1->member2 = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member2_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->member2); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->members = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char **) ((arg1)->members); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->members_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = ((arg1)->members_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lon_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (double)jarg2; - if (arg1) (arg1)->lon = arg2; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lon_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jdouble jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (double) ((arg1)->lon); - jresult = (jdouble)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lat_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (double)jarg2; - if (arg1) (arg1)->lat = arg2; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lat_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jdouble jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (double) ((arg1)->lat); - jresult = (jdouble)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1distance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (double)jarg2; - if (arg1) (arg1)->distance = arg2; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1distance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jdouble jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (double) ((arg1)->distance); - jresult = (jdouble)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1unit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->unit; - if (arg2) { - arg1->unit = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->unit, (const char *)arg2); - } else { - arg1->unit = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1unit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->unit); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->options = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (json_object *) ((arg1)->options); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->keys = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char **) ((arg1)->keys); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->keys_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = ((arg1)->keys_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1cursor_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->cursor = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1cursor_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->cursor); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1offset_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->offset = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1offset_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->offset); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1field_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->field; - if (arg2) { - arg1->field = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->field, (const char *)arg2); - } else { - arg1->field = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1field_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->field); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->fields = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char **) ((arg1)->fields); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->fields_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = ((arg1)->fields_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1subcommand_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->subcommand; - if (arg2) { - arg1->subcommand = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->subcommand, (const char *)arg2); - } else { - arg1->subcommand = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1subcommand_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->subcommand); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1pattern_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->pattern; - if (arg2) { - arg1->pattern = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->pattern, (const char *)arg2); - } else { - arg1->pattern = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1pattern_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->pattern); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1idx_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->idx = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1idx_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->idx); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1min_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->min; - if (arg2) { - arg1->min = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->min, (const char *)arg2); - } else { - arg1->min = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1min_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->min); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1max_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->max; - if (arg2) { - arg1->max = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->max, (const char *)arg2); - } else { - arg1->max = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1max_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->max); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1limit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->limit; - if (arg2) { - arg1->limit = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->limit, (const char *)arg2); - } else { - arg1->limit = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1limit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->limit); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1count_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (unsigned long)jarg2; - if (arg1) (arg1)->count = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1count_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (unsigned long) ((arg1)->count); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1match_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->match; - if (arg2) { - arg1->match = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->match, (const char *)arg2); - } else { - arg1->match = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1match_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->match); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleRequest(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzle_request *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzle_request *)new kuzzle_request(); - *(kuzzle_request **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleRequest(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzle_request **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1filter_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_queue_filter arg2 = (kuzzle_queue_filter) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_queue_filter *)&jarg2; - if (arg1) (arg1)->filter = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1filter_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_queue_filter result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (kuzzle_queue_filter) ((arg1)->filter); - *(kuzzle_queue_filter *)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1loader_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_offline_queue_loader arg2 = (kuzzle_offline_queue_loader) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_offline_queue_loader *)&jarg2; - if (arg1) (arg1)->loader = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1loader_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_offline_queue_loader result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (kuzzle_offline_queue_loader) ((arg1)->loader); - *(kuzzle_offline_queue_loader *)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1kuzzle(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzle *)new kuzzle(); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzle **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1ALL_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)collection_list_options::ALL; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1STORED_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)collection_list_options::STORED; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1REALTIME_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)collection_list_options::REALTIME; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1type_1_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - collection_list_options *arg1 = (collection_list_options *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_list_options **)&jarg1; - arg2 = (int)jarg2; - if (arg1 && sizeof(int) == sizeof((arg1)->type_)) *(int*)(void*)&((arg1)->type_) = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1type_1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - collection_list_options *arg1 = (collection_list_options *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_list_options **)&jarg1; - result = (int) ((arg1)->type_); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - collection_list_options *arg1 = (collection_list_options *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_list_options **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->from = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - collection_list_options *arg1 = (collection_list_options *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_list_options **)&jarg1; - result = (int) ((arg1)->from); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - collection_list_options *arg1 = (collection_list_options *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_list_options **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->size = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1list_1options_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - collection_list_options *arg1 = (collection_list_options *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_list_options **)&jarg1; - result = (int) ((arg1)->size); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1collection_1list_1options(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - collection_list_options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (collection_list_options *)new collection_list_options(); - *(collection_list_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1collection_1list_1options(JNIEnv *jenv, jclass jcls, jlong jarg1) { - collection_list_options *arg1 = (collection_list_options *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(collection_list_options **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1type_1_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - search_options *arg1 = (search_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->type_; - if (arg2) { - arg1->type_ = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->type_, (const char *)arg2); - } else { - arg1->type_ = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1type_1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - search_options *arg1 = (search_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_options **)&jarg1; - result = (char *) ((arg1)->type_); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - search_options *arg1 = (search_options *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_options **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->from = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - search_options *arg1 = (search_options *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_options **)&jarg1; - result = (int) ((arg1)->from); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - search_options *arg1 = (search_options *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_options **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->size = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - search_options *arg1 = (search_options *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_options **)&jarg1; - result = (int) ((arg1)->size); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - search_options *arg1 = (search_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll; - if (arg2) { - arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll, (const char *)arg2); - } else { - arg1->scroll = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1options_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - search_options *arg1 = (search_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_options **)&jarg1; - result = (char *) ((arg1)->scroll); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1options(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_options *)new search_options(); - *(search_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1options(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_options *arg1 = (search_options *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_options **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - server *arg1 = (server *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(server **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(server **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - server *arg1 = (server *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(server **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1server(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - server *result = 0 ; - - (void)jenv; - (void)jcls; - result = (server *)new server(); - *(server **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1server(JNIEnv *jenv, jclass jcls, jlong jarg1) { - server *arg1 = (server *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(server **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_options *arg1 = (room_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scope; - if (arg2) { - arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scope, (const char *)arg2); - } else { - arg1->scope = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (char *) ((arg1)->scope); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_options *arg1 = (room_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->state; - if (arg2) { - arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->state, (const char *)arg2); - } else { - arg1->state = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (char *) ((arg1)->state); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_options *arg1 = (room_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->user; - if (arg2) { - arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->user, (const char *)arg2); - } else { - arg1->user = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (char *) ((arg1)->user); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1subscribe_1to_1self_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - room_options *arg1 = (room_options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->subscribe_to_self = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1subscribe_1to_1self_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (bool) ((arg1)->subscribe_to_self); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - room_options *arg1 = (room_options *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(room_options **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1RoomOptions(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - room_options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (room_options *)new room_options(); - *(room_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1RoomOptions(JNIEnv *jenv, jclass jcls, jlong jarg1) { - room_options *arg1 = (room_options *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(room_options **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - room *arg1 = (room *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1filters_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - room *arg1 = (room *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(room **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->filters = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1filters_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - result = (json_object *) ((arg1)->filters); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - room *arg1 = (room *) 0 ; - room_options *arg2 = (room_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(room **)&jarg1; - arg2 = *(room_options **)&jarg2; - if (arg1) (arg1)->options = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - room_options *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - result = (room_options *) ((arg1)->options); - *(room_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1room(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - room *result = 0 ; - - (void)jenv; - (void)jcls; - result = (room *)new room(); - *(room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1room(JNIEnv *jenv, jclass jcls, jlong jarg1) { - room *arg1 = (room *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(room **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - room_result *arg1 = (room_result *) 0 ; - room *arg2 = (room *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(room_result **)&jarg1; - arg2 = *(room **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room_result *arg1 = (room_result *) 0 ; - room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - result = (room *) ((arg1)->result); - *(room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - room_result *arg1 = (room_result *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->status = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - room_result *arg1 = (room_result *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - result = (int) ((arg1)->status); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_result *arg1 = (room_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->error; - if (arg2) { - arg1->error = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->error, (const char *)arg2); - } else { - arg1->error = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_result *arg1 = (room_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - result = (char *) ((arg1)->error); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1stack_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_result *arg1 = (room_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->stack; - if (arg2) { - arg1->stack = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->stack, (const char *)arg2); - } else { - arg1->stack = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1stack_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_result *arg1 = (room_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - result = (char *) ((arg1)->stack); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1room_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - room_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (room_result *)new room_result(); - *(room_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1room_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - room_result *arg1 = (room_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(room_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1queuable_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - query_options *arg1 = (query_options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->queuable = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1queuable_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (bool) ((arg1)->queuable); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withdist_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - query_options *arg1 = (query_options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->withdist = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withdist_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (bool) ((arg1)->withdist); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withcoord_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - query_options *arg1 = (query_options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->withcoord = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withcoord_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (bool) ((arg1)->withcoord); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - query_options *arg1 = (query_options *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->from = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (long) ((arg1)->from); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - query_options *arg1 = (query_options *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->size = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (long) ((arg1)->size); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_options *arg1 = (query_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll; - if (arg2) { - arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll, (const char *)arg2); - } else { - arg1->scroll = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (char *) ((arg1)->scroll); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_options *arg1 = (query_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1refresh_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_options *arg1 = (query_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->refresh; - if (arg2) { - arg1->refresh = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->refresh, (const char *)arg2); - } else { - arg1->refresh = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1refresh_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (char *) ((arg1)->refresh); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1if_1exist_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_options *arg1 = (query_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->if_exist; - if (arg2) { - arg1->if_exist = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->if_exist, (const char *)arg2); - } else { - arg1->if_exist = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1if_1exist_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (char *) ((arg1)->if_exist); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1retry_1on_1conflict_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - query_options *arg1 = (query_options *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->retry_on_conflict = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1retry_1on_1conflict_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (int) ((arg1)->retry_on_conflict); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - query_options *arg1 = (query_options *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(query_options **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1QueryOptions(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - query_options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (query_options *)new query_options(); - *(query_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1QueryOptions(JNIEnv *jenv, jclass jcls, jlong jarg1) { - query_options *arg1 = (query_options *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(query_options **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queueTTL_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - options *arg1 = (options *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->queue_ttl = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queueTTL_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned int) ((arg1)->queue_ttl); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queue_1max_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - options *arg1 = (options *) 0 ; - unsigned long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned long)jarg2; - if (arg1) (arg1)->queue_max_size = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queue_1max_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned long) ((arg1)->queue_max_size); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1offline_1mode_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jshort jarg2) { - options *arg1 = (options *) 0 ; - unsigned char arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned char)jarg2; - if (arg1) (arg1)->offline_mode = arg2; -} - - -SWIGEXPORT jshort JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1offline_1mode_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jshort jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned char result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned char) ((arg1)->offline_mode); - jresult = (jshort)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1queue_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - options *arg1 = (options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->auto_queue = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1queue_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - options *arg1 = (options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (bool) ((arg1)->auto_queue); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1reconnect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - options *arg1 = (options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->auto_reconnect = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1reconnect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - options *arg1 = (options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (bool) ((arg1)->auto_reconnect); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1replay_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - options *arg1 = (options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->auto_replay = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1replay_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - options *arg1 = (options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (bool) ((arg1)->auto_replay); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1resubscribe_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - options *arg1 = (options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->auto_resubscribe = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1resubscribe_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - options *arg1 = (options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (bool) ((arg1)->auto_resubscribe); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1reconnection_1delay_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - options *arg1 = (options *) 0 ; - unsigned long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned long)jarg2; - if (arg1) (arg1)->reconnection_delay = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1reconnection_1delay_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned long) ((arg1)->reconnection_delay); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1replay_1interval_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - options *arg1 = (options *) 0 ; - unsigned long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned long)jarg2; - if (arg1) (arg1)->replay_interval = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1replay_1interval_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned long) ((arg1)->replay_interval); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1connect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - options *arg1 = (options *) 0 ; - enum Mode arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (enum Mode)jarg2; - if (arg1) (arg1)->connect = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1connect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - options *arg1 = (options *) 0 ; - enum Mode result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (enum Mode) ((arg1)->connect); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1refresh_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - options *arg1 = (options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->refresh; - if (arg2) { - arg1->refresh = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->refresh, (const char *)arg2); - } else { - arg1->refresh = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1refresh_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - options *arg1 = (options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (char *) ((arg1)->refresh); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1default_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - options *arg1 = (options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->default_index; - if (arg2) { - arg1->default_index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->default_index, (const char *)arg2); - } else { - arg1->default_index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1default_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - options *arg1 = (options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (char *) ((arg1)->default_index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Options(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (options *)new_options(); - *(options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Options(JNIEnv *jenv, jclass jcls, jlong jarg1) { - options *arg1 = (options *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(options **)&jarg1; - delete_options(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1author_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - meta *arg1 = (meta *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->author; - if (arg2) { - arg1->author = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->author, (const char *)arg2); - } else { - arg1->author = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1author_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - meta *arg1 = (meta *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (char *) ((arg1)->author); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1created_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - meta *arg1 = (meta *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->created_at = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1created_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - meta *arg1 = (meta *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (unsigned long long) ((arg1)->created_at); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updated_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - meta *arg1 = (meta *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->updated_at = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updated_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - meta *arg1 = (meta *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (unsigned long long) ((arg1)->updated_at); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updater_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - meta *arg1 = (meta *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->updater; - if (arg2) { - arg1->updater = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->updater, (const char *)arg2); - } else { - arg1->updater = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updater_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - meta *arg1 = (meta *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (char *) ((arg1)->updater); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1active_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - meta *arg1 = (meta *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->active = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1active_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - meta *arg1 = (meta *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (bool) ((arg1)->active); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1deleted_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - meta *arg1 = (meta *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->deleted_at = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1deleted_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - meta *arg1 = (meta *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (unsigned long long) ((arg1)->deleted_at); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1meta(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - meta *result = 0 ; - - (void)jenv; - (void)jcls; - result = (meta *)new meta(); - *(meta **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1meta(JNIEnv *jenv, jclass jcls, jlong jarg1) { - meta *arg1 = (meta *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(meta **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - policy_restriction *arg1 = (policy_restriction *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->collections = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - policy_restriction *arg1 = (policy_restriction *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - result = (char **) ((arg1)->collections); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->collections_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - policy_restriction *arg1 = (policy_restriction *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - result = ((arg1)->collections_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1policy_1restriction(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - policy_restriction *result = 0 ; - - (void)jenv; - (void)jcls; - result = (policy_restriction *)new policy_restriction(); - *(policy_restriction **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1policy_1restriction(JNIEnv *jenv, jclass jcls, jlong jarg1) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(policy_restriction **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1role_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - policy *arg1 = (policy *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->role_id; - if (arg2) { - arg1->role_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->role_id, (const char *)arg2); - } else { - arg1->role_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1role_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - policy *arg1 = (policy *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - result = (char *) ((arg1)->role_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - policy *arg1 = (policy *) 0 ; - policy_restriction *arg2 = (policy_restriction *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(policy **)&jarg1; - arg2 = *(policy_restriction **)&jarg2; - if (arg1) (arg1)->restricted_to = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - policy *arg1 = (policy *) 0 ; - policy_restriction *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - result = (policy_restriction *) ((arg1)->restricted_to); - *(policy_restriction **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - policy *arg1 = (policy *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->restricted_to_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - policy *arg1 = (policy *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - result = ((arg1)->restricted_to_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1policy(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - policy *result = 0 ; - - (void)jenv; - (void)jcls; - result = (policy *)new policy(); - *(policy **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1) { - policy *arg1 = (policy *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(policy **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - profile *arg1 = (profile *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - profile *arg1 = (profile *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profile *arg1 = (profile *) 0 ; - policy *arg2 = (policy *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(policy **)&jarg2; - if (arg1) (arg1)->policies = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - policy *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - result = (policy *) ((arg1)->policies); - *(policy **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - profile *arg1 = (profile *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->policies_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - result = ((arg1)->policies_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profile *arg1 = (profile *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - result = (profile *)new profile(); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1) { - profile *arg1 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(profile **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - role *arg1 = (role *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - role *arg1 = (role *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1controllers_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - role *arg1 = (role *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->controllers = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1controllers_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role *arg1 = (role *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - result = (json_object *) ((arg1)->controllers); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - role *arg1 = (role *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role *arg1 = (role *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - role *result = 0 ; - - (void)jenv; - (void)jcls; - result = (role *)new role(); - *(role **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role(JNIEnv *jenv, jclass jcls, jlong jarg1) { - role *arg1 = (role *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(role **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user *arg1 = (user *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user *arg1 = (user *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->content = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = (json_object *) ((arg1)->content); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user *arg1 = (user *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->profile_ids = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = (char **) ((arg1)->profile_ids); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user *arg1 = (user *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->profile_ids_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = ((arg1)->profile_ids_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user *arg1 = (user *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1User(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user *)new user(); - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1User(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user *arg1 = (user *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user_data *arg1 = (user_data *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user_data **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->content = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_data *arg1 = (user_data *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - result = (json_object *) ((arg1)->content); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_data *arg1 = (user_data *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->profile_ids = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_data *arg1 = (user_data *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - result = (char **) ((arg1)->profile_ids); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_data *arg1 = (user_data *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->profile_ids_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_data *arg1 = (user_data *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - result = ((arg1)->profile_ids_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UserData(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_data *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_data *)new user_data(); - *(user_data **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1UserData(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_data *arg1 = (user_data *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_data **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1failed_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - shards *arg1 = (shards *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->failed = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1failed_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - shards *arg1 = (shards *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - result = (int) ((arg1)->failed); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1successful_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - shards *arg1 = (shards *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->successful = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1successful_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - shards *arg1 = (shards *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - result = (int) ((arg1)->successful); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - shards *arg1 = (shards *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - shards *arg1 = (shards *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - result = (int) ((arg1)->total); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1shards(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - shards *result = 0 ; - - (void)jenv; - (void)jcls; - result = (shards *)new shards(); - *(shards **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1shards(JNIEnv *jenv, jclass jcls, jlong jarg1) { - shards *arg1 = (shards *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(shards **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - collection *arg1 = (collection *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - collection *arg1 = (collection *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1collection(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - collection *result = 0 ; - - (void)jenv; - (void)jcls; - result = (collection *)new collection(); - *(collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { - collection *arg1 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(collection **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - document *arg1 = (document *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document *arg1 = (document *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document *arg1 = (document *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document *arg1 = (document *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document *arg1 = (document *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1meta_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document *arg1 = (document *) 0 ; - meta *arg2 = (meta *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(meta **)&jarg2; - if (arg1) (arg1)->meta = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1meta_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - meta *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (meta *) ((arg1)->meta); - *(meta **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1shards_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document *arg1 = (document *) 0 ; - shards *arg2 = (shards *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(shards **)&jarg2; - if (arg1) (arg1)->shards = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1shards_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - shards *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (shards *) ((arg1)->shards); - *(shards **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document *arg1 = (document *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->content = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (json_object *) ((arg1)->content); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1version_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - document *arg1 = (document *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->version = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1version_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - document *arg1 = (document *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (int) ((arg1)->version); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document *arg1 = (document *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->result; - if (arg2) { - arg1->result = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->result, (const char *)arg2); - } else { - arg1->result = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document *arg1 = (document *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (char *) ((arg1)->result); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1created_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - document *arg1 = (document *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->created = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1created_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - document *arg1 = (document *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (bool) ((arg1)->created); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document *arg1 = (document *) 0 ; - collection *arg2 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(collection **)&jarg2; - if (arg1) (arg1)->_collection = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (collection *) ((arg1)->_collection); - *(collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document *arg1 = (document *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document *arg1 = (document *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - document *result = 0 ; - - (void)jenv; - (void)jcls; - result = (document *)new document(); - *(document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document(JNIEnv *jenv, jclass jcls, jlong jarg1) { - document *arg1 = (document *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(document **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document_result *arg1 = (document_result *) 0 ; - document *arg2 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document_result **)&jarg1; - arg2 = *(document **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document_result *arg1 = (document_result *) 0 ; - document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_result **)&jarg1; - result = (document *) ((arg1)->result); - *(document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - document_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (document_result *)new document_result(); - *(document_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - document_result *arg1 = (document_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(document_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document_array_result *arg1 = (document_array_result *) 0 ; - document *arg2 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document_array_result **)&jarg1; - arg2 = *(document **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = (document *) ((arg1)->result); - *(document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - document_array_result *arg1 = (document_array_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - document_array_result *arg1 = (document_array_result *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->status = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = (int) ((arg1)->status); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document_array_result *arg1 = (document_array_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->error; - if (arg2) { - arg1->error = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->error, (const char *)arg2); - } else { - arg1->error = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = (char *) ((arg1)->error); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1stack_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document_array_result *arg1 = (document_array_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->stack; - if (arg2) { - arg1->stack = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->stack, (const char *)arg2); - } else { - arg1->stack = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1stack_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = (char *) ((arg1)->stack); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document_1array_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - document_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (document_array_result *)new document_array_result(); - *(document_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - document_array_result *arg1 = (document_array_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(document_array_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_content *arg1 = (notification_content *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_content *arg1 = (notification_content *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1meta_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - notification_content *arg1 = (notification_content *) 0 ; - meta *arg2 = (meta *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(notification_content **)&jarg1; - arg2 = *(meta **)&jarg2; - if (arg1) (arg1)->meta = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1meta_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - notification_content *arg1 = (notification_content *) 0 ; - meta *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - result = (meta *) ((arg1)->meta); - *(meta **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - notification_content *arg1 = (notification_content *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(notification_content **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->content = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - notification_content *arg1 = (notification_content *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - result = (json_object *) ((arg1)->content); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1count_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - notification_content *arg1 = (notification_content *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->count = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1count_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - notification_content *arg1 = (notification_content *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - result = (int) ((arg1)->count); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1notification_1content(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - notification_content *result = 0 ; - - (void)jenv; - (void)jcls; - result = (notification_content *)new notification_content(); - *(notification_content **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1notification_1content(JNIEnv *jenv, jclass jcls, jlong jarg1) { - notification_content *arg1 = (notification_content *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(notification_content **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->request_id; - if (arg2) { - arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->request_id, (const char *)arg2); - } else { - arg1->request_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->request_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - notification_result *arg1 = (notification_result *) 0 ; - notification_content *arg2 = (notification_content *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(notification_result **)&jarg1; - arg2 = *(notification_content **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - notification_content *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (notification_content *) ((arg1)->result); - *(notification_content **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - notification_result *arg1 = (notification_result *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(notification_result **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->controller; - if (arg2) { - arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->controller, (const char *)arg2); - } else { - arg1->controller = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->controller); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->action; - if (arg2) { - arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->action, (const char *)arg2); - } else { - arg1->action = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->action); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1protocol_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->protocol; - if (arg2) { - arg1->protocol = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->protocol, (const char *)arg2); - } else { - arg1->protocol = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1protocol_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->protocol); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scope; - if (arg2) { - arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scope, (const char *)arg2); - } else { - arg1->scope = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->scope); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->state; - if (arg2) { - arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->state, (const char *)arg2); - } else { - arg1->state = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->state); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->user; - if (arg2) { - arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->user, (const char *)arg2); - } else { - arg1->user = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->user); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1n_1type_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->n_type; - if (arg2) { - arg1->n_type = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->n_type, (const char *)arg2); - } else { - arg1->n_type = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1n_1type_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->n_type); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1room_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->room_id; - if (arg2) { - arg1->room_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->room_id, (const char *)arg2); - } else { - arg1->room_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1room_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->room_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->timestamp = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (unsigned long long) ((arg1)->timestamp); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1notification_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - notification_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (notification_result *)new notification_result(); - *(notification_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1notification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - notification_result *arg1 = (notification_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(notification_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1result_1profile_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profile_result *arg1 = (profile_result *) 0 ; - profile *arg2 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile_result **)&jarg1; - arg2 = *(profile **)&jarg2; - if (arg1) (arg1)->profile = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1result_1profile_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile_result *arg1 = (profile_result *) 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_result **)&jarg1; - result = (profile *) ((arg1)->profile); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - profile_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (profile_result *)new profile_result(); - *(profile_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - profile_result *arg1 = (profile_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(profile_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profiles_result *arg1 = (profiles_result *) 0 ; - profile *arg2 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profiles_result **)&jarg1; - arg2 = *(profile **)&jarg2; - if (arg1) (arg1)->profiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profiles_result *arg1 = (profiles_result *) 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profiles_result **)&jarg1; - result = (profile *) ((arg1)->profiles); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - profiles_result *arg1 = (profiles_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profiles_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->profiles_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profiles_result *arg1 = (profiles_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profiles_result **)&jarg1; - result = ((arg1)->profiles_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profiles_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (profiles_result *)new profiles_result(); - *(profiles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - profiles_result *arg1 = (profiles_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(profiles_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1result_1role_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - role_result *arg1 = (role_result *) 0 ; - role *arg2 = (role *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role_result **)&jarg1; - arg2 = *(role **)&jarg2; - if (arg1) (arg1)->role = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1result_1role_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role_result *arg1 = (role_result *) 0 ; - role *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_result **)&jarg1; - result = (role *) ((arg1)->role); - *(role **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - role_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (role_result *)new role_result(); - *(role_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - role_result *arg1 = (role_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(role_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->controller; - if (arg2) { - arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->controller, (const char *)arg2); - } else { - arg1->controller = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->controller); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->action; - if (arg2) { - arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->action, (const char *)arg2); - } else { - arg1->action = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->action); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1value_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->value; - if (arg2) { - arg1->value = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->value, (const char *)arg2); - } else { - arg1->value = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1value_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->value); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1right(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_right *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_right *)new user_right(); - *(user_right **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1right(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_right *arg1 = (user_right *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_right **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user_rights_result *arg1 = (user_rights_result *) 0 ; - user_right *arg2 = (user_right *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user_rights_result **)&jarg1; - arg2 = *(user_right **)&jarg2; - if (arg1) (arg1)->user_rights = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_rights_result *arg1 = (user_rights_result *) 0 ; - user_right *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_rights_result **)&jarg1; - result = (user_right *) ((arg1)->user_rights); - *(user_right **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_rights_result *arg1 = (user_rights_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_rights_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->user_rights_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_rights_result *arg1 = (user_rights_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_rights_result **)&jarg1; - result = ((arg1)->user_rights_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1rights_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_rights_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_rights_result *)new user_rights_result(); - *(user_rights_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1rights_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_rights_result *arg1 = (user_rights_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_rights_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1result_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user_result *arg1 = (user_result *) 0 ; - user *arg2 = (user *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user_result **)&jarg1; - arg2 = *(user **)&jarg2; - if (arg1) (arg1)->user = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1result_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_result *arg1 = (user_result *) 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_result **)&jarg1; - result = (user *) ((arg1)->user); - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_result *)new user_result(); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_result *arg1 = (user_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_ALLOWED_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - is_action_allowed result; - - (void)jenv; - (void)jcls; - result = (is_action_allowed)ALLOWED; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_CONDITIONNAL_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - is_action_allowed result; - - (void)jenv; - (void)jcls; - result = (is_action_allowed)CONDITIONNAL; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_DENIED_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - is_action_allowed result; - - (void)jenv; - (void)jcls; - result = (is_action_allowed)DENIED; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1completed_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics *arg1 = (statistics *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->completed_requests = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1completed_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (json_object *) ((arg1)->completed_requests); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1connections_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics *arg1 = (statistics *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->connections = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1connections_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (json_object *) ((arg1)->connections); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1failed_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics *arg1 = (statistics *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->failed_requests = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1failed_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (json_object *) ((arg1)->failed_requests); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1ongoing_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics *arg1 = (statistics *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->ongoing_requests = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1ongoing_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (json_object *) ((arg1)->ongoing_requests); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - statistics *arg1 = (statistics *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->timestamp = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (unsigned long long) ((arg1)->timestamp); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Statistics(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - result = (statistics *)new statistics(); - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Statistics(JNIEnv *jenv, jclass jcls, jlong jarg1) { - statistics *arg1 = (statistics *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(statistics **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StatisticsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics_result *arg1 = (statistics_result *) 0 ; - statistics *arg2 = (statistics *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics_result **)&jarg1; - arg2 = *(statistics **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StatisticsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics_result *arg1 = (statistics_result *) 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics_result **)&jarg1; - result = (statistics *) ((arg1)->result); - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StatisticsResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - statistics_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (statistics_result *)new statistics_result(); - *(statistics_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StatisticsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - statistics_result *arg1 = (statistics_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(statistics_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - statistics *arg2 = (statistics *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(all_statistics_result **)&jarg1; - arg2 = *(statistics **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(all_statistics_result **)&jarg1; - result = (statistics *) ((arg1)->result); - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(all_statistics_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(all_statistics_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1AllStatisticsResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - all_statistics_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (all_statistics_result *)new all_statistics_result(); - *(all_statistics_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1AllStatisticsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(all_statistics_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - geopos_result *arg1 = (geopos_result *) 0 ; - double (*arg2)[2] = (double (*)[2]) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - arg2 = *(double (**)[2])&jarg2; - if (arg1) (arg1)->result = (double (*)[2])arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - geopos_result *arg1 = (geopos_result *) 0 ; - double (*result)[2] = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - result = (double (*)[2]) ((arg1)->result); - *(double (**)[2])&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - geopos_result *arg1 = (geopos_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - geopos_result *arg1 = (geopos_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1geopos_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - geopos_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (geopos_result *)new geopos_result(); - *(geopos_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1geopos_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - geopos_result *arg1 = (geopos_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(geopos_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1valid_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - token_validity *arg1 = (token_validity *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->valid = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1valid_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - token_validity *arg1 = (token_validity *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - result = (bool) ((arg1)->valid); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - token_validity *arg1 = (token_validity *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->state; - if (arg2) { - arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->state, (const char *)arg2); - } else { - arg1->state = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - token_validity *arg1 = (token_validity *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - result = (char *) ((arg1)->state); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1expires_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - token_validity *arg1 = (token_validity *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->expires_at = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1expires_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - token_validity *arg1 = (token_validity *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - result = (unsigned long long) ((arg1)->expires_at); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1TokenValidity(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - token_validity *result = 0 ; - - (void)jenv; - (void)jcls; - result = (token_validity *)new token_validity(); - *(token_validity **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1TokenValidity(JNIEnv *jenv, jclass jcls, jlong jarg1) { - token_validity *arg1 = (token_validity *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(token_validity **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->request_id; - if (arg2) { - arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->request_id, (const char *)arg2); - } else { - arg1->request_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->request_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (json_object *) ((arg1)->result); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->controller; - if (arg2) { - arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->controller, (const char *)arg2); - } else { - arg1->controller = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->controller); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->action; - if (arg2) { - arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->action, (const char *)arg2); - } else { - arg1->action = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->action); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1room_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->room_id; - if (arg2) { - arg1->room_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->room_id, (const char *)arg2); - } else { - arg1->room_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1room_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->room_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1channel_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->channel; - if (arg2) { - arg1->channel = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->channel, (const char *)arg2); - } else { - arg1->channel = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1channel_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->channel); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleResponse(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzle_response *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzle_response *)new kuzzle_response(); - *(kuzzle_response **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleResponse(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzle_response **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1void_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (void_result *)new void_result(); - *(void_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1void_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - void_result *arg1 = (void_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(void_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - json_result *arg1 = (json_result *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(json_result **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - json_result *arg1 = (json_result *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_result **)&jarg1; - result = (json_object *) ((arg1)->result); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1JsonResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (json_result *)new json_result(); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1JsonResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - json_result *arg1 = (json_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(json_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - json_array_result *arg1 = (json_array_result *) 0 ; - json_object **arg2 = (json_object **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - arg2 = *(json_object ***)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - json_array_result *arg1 = (json_array_result *) 0 ; - json_object **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - result = (json_object **) ((arg1)->result); - *(json_object ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - json_array_result *arg1 = (json_array_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - json_array_result *arg1 = (json_array_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1json_1array_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (json_array_result *)new json_array_result(); - *(json_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1json_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - json_array_result *arg1 = (json_array_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(json_array_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_BoolResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - bool_result *arg1 = (bool_result *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(bool_result **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_BoolResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - bool_result *arg1 = (bool_result *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(bool_result **)&jarg1; - result = (bool) ((arg1)->result); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BoolResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (bool_result *)new bool_result(); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1BoolResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - bool_result *arg1 = (bool_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(bool_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - int_result *arg1 = (int_result *) 0 ; - long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_result **)&jarg1; - arg2 = (long long)jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - int_result *arg1 = (int_result *) 0 ; - long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_result **)&jarg1; - result = (long long) ((arg1)->result); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1int_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (int_result *)new int_result(); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1int_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - int_result *arg1 = (int_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(int_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DateResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - date_result *arg1 = (date_result *) 0 ; - long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(date_result **)&jarg1; - arg2 = (long long)jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DateResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - date_result *arg1 = (date_result *) 0 ; - long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(date_result **)&jarg1; - result = (long long) ((arg1)->result); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1DateResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - date_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (date_result *)new date_result(); - *(date_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1DateResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - date_result *arg1 = (date_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(date_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_double_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - double_result *arg1 = (double_result *) 0 ; - double arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(double_result **)&jarg1; - arg2 = (double)jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_double_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jdouble jresult = 0 ; - double_result *arg1 = (double_result *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(double_result **)&jarg1; - result = (double) ((arg1)->result); - jresult = (jdouble)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1double_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (double_result *)new double_result(); - *(double_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1double_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - double_result *arg1 = (double_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(double_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - int_array_result *arg1 = (int_array_result *) 0 ; - long long *arg2 = (long long *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - arg2 = *(long long **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - int_array_result *arg1 = (int_array_result *) 0 ; - long long *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - result = (long long *) ((arg1)->result); - *(long long **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - int_array_result *arg1 = (int_array_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - int_array_result *arg1 = (int_array_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1int_1array_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - int_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (int_array_result *)new int_array_result(); - *(int_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1int_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - int_array_result *arg1 = (int_array_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(int_array_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_string_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - string_result *arg1 = (string_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->result; - if (arg2) { - arg1->result = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->result, (const char *)arg2); - } else { - arg1->result = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_string_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - string_result *arg1 = (string_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_result **)&jarg1; - result = (char *) ((arg1)->result); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1string_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (string_result *)new string_result(); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1string_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - string_result *arg1 = (string_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(string_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - string_array_result *arg1 = (string_array_result *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - string_array_result *arg1 = (string_array_result *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - result = (char **) ((arg1)->result); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - string_array_result *arg1 = (string_array_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - string_array_result *arg1 = (string_array_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringArrayResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (string_array_result *)new string_array_result(); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StringArrayResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - string_array_result *arg1 = (string_array_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(string_array_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1query_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_filters *arg1 = (search_filters *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_filters **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->query = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1query_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_filters *arg1 = (search_filters *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - result = (json_object *) ((arg1)->query); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1sort_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_filters *arg1 = (search_filters *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_filters **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->sort = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1sort_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_filters *arg1 = (search_filters *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - result = (json_object *) ((arg1)->sort); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1aggregations_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_filters *arg1 = (search_filters *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_filters **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->aggregations = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1aggregations_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_filters *arg1 = (search_filters *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - result = (json_object *) ((arg1)->aggregations); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1search_1after_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_filters *arg1 = (search_filters *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_filters **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->search_after = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1search_1after_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_filters *arg1 = (search_filters *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - result = (json_object *) ((arg1)->search_after); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SearchFilters(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_filters *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_filters *)new search_filters(); - *(search_filters **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SearchFilters(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_filters *arg1 = (search_filters *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_filters **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profile_search *arg1 = (profile_search *) 0 ; - profile *arg2 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile_search **)&jarg1; - arg2 = *(profile **)&jarg2; - if (arg1) (arg1)->hits = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile_search *arg1 = (profile_search *) 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - result = (profile *) ((arg1)->hits); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - profile_search *arg1 = (profile_search *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->hits_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile_search *arg1 = (profile_search *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - result = ((arg1)->hits_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - profile_search *arg1 = (profile_search *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile_search *arg1 = (profile_search *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - profile_search *arg1 = (profile_search *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - profile_search *arg1 = (profile_search *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile_1search(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - profile_search *result = 0 ; - - (void)jenv; - (void)jcls; - result = (profile_search *)new profile_search(); - *(profile_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { - profile_search *arg1 = (profile_search *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(profile_search **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - role_search *arg1 = (role_search *) 0 ; - role *arg2 = (role *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role_search **)&jarg1; - arg2 = *(role **)&jarg2; - if (arg1) (arg1)->hits = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role_search *arg1 = (role_search *) 0 ; - role *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - result = (role *) ((arg1)->hits); - *(role **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - role_search *arg1 = (role_search *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->hits_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role_search *arg1 = (role_search *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - result = ((arg1)->hits_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - role_search *arg1 = (role_search *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role_search *arg1 = (role_search *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role_1search(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - role_search *result = 0 ; - - (void)jenv; - (void)jcls; - result = (role_search *)new role_search(); - *(role_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { - role_search *arg1 = (role_search *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(role_search **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user_search *arg1 = (user_search *) 0 ; - user *arg2 = (user *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user_search **)&jarg1; - arg2 = *(user **)&jarg2; - if (arg1) (arg1)->hits = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_search *arg1 = (user_search *) 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - result = (user *) ((arg1)->hits); - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_search *arg1 = (user_search *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->hits_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_search *arg1 = (user_search *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - result = ((arg1)->hits_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_search *arg1 = (user_search *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_search *arg1 = (user_search *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_search *arg1 = (user_search *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_search *arg1 = (user_search *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1search(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_search *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_search *)new user_search(); - *(user_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_search *arg1 = (user_search *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_search **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1acknowledged_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - ack_result *arg1 = (ack_result *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->acknowledged = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1acknowledged_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - ack_result *arg1 = (ack_result *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - result = (bool) ((arg1)->acknowledged); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1shards_1acknowledged_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - ack_result *arg1 = (ack_result *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->shards_acknowledged = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1shards_1acknowledged_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - ack_result *arg1 = (ack_result *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - result = (bool) ((arg1)->shards_acknowledged); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ack_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - ack_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (ack_result *)new ack_result(); - *(ack_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ack_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - ack_result *arg1 = (ack_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(ack_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ShardsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - shards_result *arg1 = (shards_result *) 0 ; - shards *arg2 = (shards *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(shards_result **)&jarg1; - arg2 = *(shards **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ShardsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - shards_result *arg1 = (shards_result *) 0 ; - shards *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards_result **)&jarg1; - result = (shards *) ((arg1)->result); - *(shards **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ShardsResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - shards_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (shards_result *)new shards_result(); - *(shards_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ShardsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - shards_result *arg1 = (shards_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(shards_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1strict_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - specification *arg1 = (specification *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->strict = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1strict_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - specification *arg1 = (specification *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - result = (bool) ((arg1)->strict); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1fields_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification *arg1 = (specification *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->fields = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1fields_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification *arg1 = (specification *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - result = (json_object *) ((arg1)->fields); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1validators_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification *arg1 = (specification *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->validators = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1validators_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification *arg1 = (specification *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - result = (json_object *) ((arg1)->validators); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification *)new specification(); - *(specification **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification *arg1 = (specification *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1validation_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification_entry *arg1 = (specification_entry *) 0 ; - specification *arg2 = (specification *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification_entry **)&jarg1; - arg2 = *(specification **)&jarg2; - if (arg1) (arg1)->validation = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1validation_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_entry *arg1 = (specification_entry *) 0 ; - specification *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - result = (specification *) ((arg1)->validation); - *(specification **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - specification_entry *arg1 = (specification_entry *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - specification_entry *arg1 = (specification_entry *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - specification_entry *arg1 = (specification_entry *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - specification_entry *arg1 = (specification_entry *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1entry(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification_entry *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification_entry *)new specification_entry(); - *(specification_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification_entry *arg1 = (specification_entry *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification_entry **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification_result *arg1 = (specification_result *) 0 ; - specification *arg2 = (specification *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification_result **)&jarg1; - arg2 = *(specification **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_result *arg1 = (specification_result *) 0 ; - specification *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_result **)&jarg1; - result = (specification *) ((arg1)->result); - *(specification **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification_result *)new specification_result(); - *(specification_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification_result *arg1 = (specification_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->documents = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (json_object *) ((arg1)->documents); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1fetched_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - search_result *arg1 = (search_result *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->fetched = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1fetched_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (unsigned int) ((arg1)->fetched); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - search_result *arg1 = (search_result *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1aggregations_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->aggregations = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1aggregations_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (json_object *) ((arg1)->aggregations); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1filters_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(search_filters **)&jarg2; - if (arg1) (arg1)->filters = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1filters_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - search_filters *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (search_filters *) ((arg1)->filters); - *(search_filters **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - query_options *arg2 = (query_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(query_options **)&jarg2; - if (arg1) (arg1)->options = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - query_options *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (query_options *) ((arg1)->options); - *(query_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->collection = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (json_object *) ((arg1)->collection); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SearchResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_result *)new search_result(); - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SearchResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_result *arg1 = (search_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1profiles_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_profiles_result *arg1 = (search_profiles_result *) 0 ; - profile_search *arg2 = (profile_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_profiles_result **)&jarg1; - arg2 = *(profile_search **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1profiles_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_profiles_result *arg1 = (search_profiles_result *) 0 ; - profile_search *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_profiles_result **)&jarg1; - result = (profile_search *) ((arg1)->result); - *(profile_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1profiles_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_profiles_result *)new search_profiles_result(); - *(search_profiles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_profiles_result *arg1 = (search_profiles_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_profiles_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1roles_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_roles_result *arg1 = (search_roles_result *) 0 ; - role_search *arg2 = (role_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_roles_result **)&jarg1; - arg2 = *(role_search **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1roles_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_roles_result *arg1 = (search_roles_result *) 0 ; - role_search *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_roles_result **)&jarg1; - result = (role_search *) ((arg1)->result); - *(role_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1roles_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_roles_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_roles_result *)new search_roles_result(); - *(search_roles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1roles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_roles_result *arg1 = (search_roles_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_roles_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1users_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_users_result *arg1 = (search_users_result *) 0 ; - user_search *arg2 = (user_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_users_result **)&jarg1; - arg2 = *(user_search **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1users_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_users_result *arg1 = (search_users_result *) 0 ; - user_search *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_users_result **)&jarg1; - result = (user_search *) ((arg1)->result); - *(user_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1users_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_users_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_users_result *)new search_users_result(); - *(search_users_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1users_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_users_result *arg1 = (search_users_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_users_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification_search *arg1 = (specification_search *) 0 ; - specification_entry *arg2 = (specification_entry *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification_search **)&jarg1; - arg2 = *(specification_entry **)&jarg2; - if (arg1) (arg1)->hits = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_search *arg1 = (specification_search *) 0 ; - specification_entry *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - result = (specification_entry *) ((arg1)->hits); - *(specification_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - specification_search *arg1 = (specification_search *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->hits_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_search *arg1 = (specification_search *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - result = ((arg1)->hits_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - specification_search *arg1 = (specification_search *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_search *arg1 = (specification_search *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - specification_search *arg1 = (specification_search *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - specification_search *arg1 = (specification_search *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1search(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification_search *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification_search *)new specification_search(); - *(specification_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification_search *arg1 = (specification_search *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification_search **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification_search_result *arg1 = (specification_search_result *) 0 ; - specification_search *arg2 = (specification_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification_search_result **)&jarg1; - arg2 = *(specification_search **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_search_result *arg1 = (specification_search_result *) 0 ; - specification_search *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search_result **)&jarg1; - result = (specification_search *) ((arg1)->result); - *(specification_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1search_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification_search_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification_search_result *)new specification_search_result(); - *(specification_search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification_search_result *arg1 = (specification_search_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification_search_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1mapping_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - mapping *arg1 = (mapping *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->mapping = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1mapping_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - mapping *arg1 = (mapping *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping **)&jarg1; - result = (json_object *) ((arg1)->mapping); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - mapping *arg1 = (mapping *) 0 ; - collection *arg2 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping **)&jarg1; - arg2 = *(collection **)&jarg2; - if (arg1) (arg1)->collection = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - mapping *arg1 = (mapping *) 0 ; - collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping **)&jarg1; - result = (collection *) ((arg1)->collection); - *(collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1) { - mapping *arg1 = (mapping *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(mapping **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - mapping_result *arg1 = (mapping_result *) 0 ; - mapping *arg2 = (mapping *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping_result **)&jarg1; - arg2 = *(mapping **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - mapping_result *arg1 = (mapping_result *) 0 ; - mapping *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping_result **)&jarg1; - result = (mapping *) ((arg1)->result); - *(mapping **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1mapping_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - mapping_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (mapping_result *)new mapping_result(); - *(mapping_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1mapping_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - mapping_result *arg1 = (mapping_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(mapping_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1persisted_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - collection_entry *arg1 = (collection_entry *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->persisted = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1persisted_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - collection_entry *arg1 = (collection_entry *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - result = (bool) ((arg1)->persisted); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1name_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - collection_entry *arg1 = (collection_entry *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->name; - if (arg2) { - arg1->name = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->name, (const char *)arg2); - } else { - arg1->name = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1name_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - collection_entry *arg1 = (collection_entry *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - result = (char *) ((arg1)->name); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1CollectionsList(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - collection_entry *result = 0 ; - - (void)jenv; - (void)jcls; - result = (collection_entry *)new collection_entry(); - *(collection_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1CollectionsList(JNIEnv *jenv, jclass jcls, jlong jarg1) { - collection_entry *arg1 = (collection_entry *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(collection_entry **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - collection_entry *arg2 = (collection_entry *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection_entry_result **)&jarg1; - arg2 = *(collection_entry **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - collection_entry *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry_result **)&jarg1; - result = (collection_entry *) ((arg1)->result); - *(collection_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1CollectionsListResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - collection_entry_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (collection_entry_result *)new collection_entry_result(); - *(collection_entry_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1CollectionsListResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(collection_entry_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1p_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - _GoString_ *arg1 = (_GoString_ *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(_GoString_ **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - if (arg2) { - arg1->p = (char const *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->p, (const char *)arg2); - } else { - arg1->p = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1p_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - _GoString_ *arg1 = (_GoString_ *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(_GoString_ **)&jarg1; - result = (char *) ((arg1)->p); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1n_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - _GoString_ *arg1 = (_GoString_ *) 0 ; - ptrdiff_t arg2 ; - ptrdiff_t *argp2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(_GoString_ **)&jarg1; - argp2 = *(ptrdiff_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null ptrdiff_t"); - return ; - } - arg2 = *argp2; - if (arg1) (arg1)->n = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1n_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - _GoString_ *arg1 = (_GoString_ *) 0 ; - ptrdiff_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(_GoString_ **)&jarg1; - result = ((arg1)->n); - *(ptrdiff_t **)&jresult = new ptrdiff_t((const ptrdiff_t &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1_1GoString_1(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - _GoString_ *result = 0 ; - - (void)jenv; - (void)jcls; - result = (_GoString_ *)new _GoString_(); - *(_GoString_ **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1_1GoString_1(JNIEnv *jenv, jclass jcls, jlong jarg1) { - _GoString_ *arg1 = (_GoString_ *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(_GoString_ **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_free_1char_1array(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) { - char **arg1 = (char **) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - arg1 = *(char ***)&jarg1; - arg2 = (size_t)jarg2; - free_char_array(arg1,arg2); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_assign_1geopos(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jdouble jarg3, jdouble jarg4) { - double (*arg1)[2] = (double (*)[2]) 0 ; - int arg2 ; - double arg3 ; - double arg4 ; - - (void)jenv; - (void)jcls; - arg1 = *(double (**)[2])&jarg1; - arg2 = (int)jarg2; - arg3 = (double)jarg3; - arg4 = (double)jarg4; - assign_geopos((double (*)[2])arg1,arg2,arg3,arg4); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1t_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoInterface *arg1 = (GoInterface *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoInterface **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->t = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1t_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoInterface *arg1 = (GoInterface *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoInterface **)&jarg1; - result = (void *) ((arg1)->t); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1v_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoInterface *arg1 = (GoInterface *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoInterface **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->v = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1v_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoInterface *arg1 = (GoInterface *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoInterface **)&jarg1; - result = (void *) ((arg1)->v); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GoInterface(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - GoInterface *result = 0 ; - - (void)jenv; - (void)jcls; - result = (GoInterface *)new GoInterface(); - *(GoInterface **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GoInterface(JNIEnv *jenv, jclass jcls, jlong jarg1) { - GoInterface *arg1 = (GoInterface *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(GoInterface **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoSlice *arg1 = (GoSlice *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->data = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoSlice *arg1 = (GoSlice *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - result = (void *) ((arg1)->data); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoSlice *arg1 = (GoSlice *) 0 ; - GoInt arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - arg2 = (GoInt)jarg2; - if (arg1) (arg1)->len = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoSlice *arg1 = (GoSlice *) 0 ; - GoInt result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - result = (GoInt) ((arg1)->len); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoSlice *arg1 = (GoSlice *) 0 ; - GoInt arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - arg2 = (GoInt)jarg2; - if (arg1) (arg1)->cap = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoSlice *arg1 = (GoSlice *) 0 ; - GoInt result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - result = (GoInt) ((arg1)->cap); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GoSlice(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - GoSlice *result = 0 ; - - (void)jenv; - (void)jcls; - result = (GoSlice *)new GoSlice(); - *(GoSlice **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GoSlice(JNIEnv *jenv, jclass jcls, jlong jarg1) { - GoSlice *arg1 = (GoSlice *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(GoSlice **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - kuzzle_set_jwt(arg1,arg2); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1unset_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_unset_jwt(arg1); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_get_jwt(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1login(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - int *arg4 = (int *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(int **)&jarg4; - result = (string_result *)kuzzle_login(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_logout(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1check_1token(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - token_validity *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (token_validity *)kuzzle_check_token(arg1,arg2); - *(token_validity **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1create_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_create_my_credentials(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1delete_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_delete_my_credentials(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_get_my_credentials(arg1,arg2,arg3); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_update_my_credentials(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1validate_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_validate_my_credentials(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1my_1rights(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (json_result *)kuzzle_get_my_rights(arg1,arg2); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1self(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - user_data *arg2 = (user_data *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(user_data **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_update_self(arg1,arg2,arg3); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1who_1am_1i(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (user_result *)kuzzle_who_am_i(arg1); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterCollection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - collection *arg1 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - unregisterCollection(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - collection *arg1 = (collection *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - kuzzle_new_collection(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - result = (void_result *)kuzzle_collection_create(arg1,arg2,arg3); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1truncate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - result = (void_result *)kuzzle_collection_truncate(arg1,arg2,arg3); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - result = (bool_result *)kuzzle_collection_exists(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - collection_list_options *arg3 = (collection_list_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(collection_list_options **)&jarg3; - result = (string_result *)kuzzle_collection_list(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1get_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - result = (string_result *)kuzzle_collection_get_mapping(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1update_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - result = (void_result *)kuzzle_collection_update_mapping(arg1,arg2,arg3,arg4); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1delete_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - result = (void_result *)kuzzle_collection_delete_specifications(arg1,arg2,arg3); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1get_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - result = (string_result *)kuzzle_collection_get_specifications(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1search_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - search_options *arg2 = (search_options *) 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(search_options **)&jarg2; - result = (search_result *)kuzzle_collection_search_specifications(arg1,arg2); - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1update_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - result = (string_result *)kuzzle_collection_update_specifications(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1validate_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (void_result *)kuzzle_collection_validate_specifications(arg1,arg2); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1kuzzle_1request(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - kuzzle_free_kuzzle_request(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1query_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - query_object *arg1 = (query_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - kuzzle_free_query_object(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - offline_queue *arg1 = (offline_queue *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - kuzzle_free_offline_queue(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1query_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - query_options *arg1 = (query_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - kuzzle_free_query_options(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1room_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - room_options *arg1 = (room_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - kuzzle_free_room_options(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - options *arg1 = (options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - kuzzle_free_options(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1meta(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - meta *arg1 = (meta *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - kuzzle_free_meta(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1policy_1restriction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - kuzzle_free_policy_restriction(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - policy *arg1 = (policy *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - kuzzle_free_policy(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profile *arg1 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - kuzzle_free_profile(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - role *arg1 = (role *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - kuzzle_free_role(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user *arg1 = (user *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - kuzzle_free_user(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1data(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_data *arg1 = (user_data *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - kuzzle_free_user_data(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - collection *arg1 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - kuzzle_free_collection(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - document *arg1 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - kuzzle_free_document(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - document_result *arg1 = (document_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_result **)&jarg1; - kuzzle_free_document_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1notification_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - notification_content *arg1 = (notification_content *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - kuzzle_free_notification_content(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1notification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - notification_result *arg1 = (notification_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - kuzzle_free_notification_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profile_result *arg1 = (profile_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_result **)&jarg1; - kuzzle_free_profile_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profiles_result *arg1 = (profiles_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profiles_result **)&jarg1; - kuzzle_free_profiles_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - role_result *arg1 = (role_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_result **)&jarg1; - kuzzle_free_role_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1right(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_right *arg1 = (user_right *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - kuzzle_free_user_right(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1rights_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_rights_result *arg1 = (user_rights_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_rights_result **)&jarg1; - kuzzle_free_user_rights_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_result *arg1 = (user_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_result **)&jarg1; - kuzzle_free_user_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1statistics(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - statistics *arg1 = (statistics *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - kuzzle_free_statistics(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1statistics_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - statistics_result *arg1 = (statistics_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics_result **)&jarg1; - kuzzle_free_statistics_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1all_1statistics_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(all_statistics_result **)&jarg1; - kuzzle_free_all_statistics_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1geopos_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - geopos_result *arg1 = (geopos_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - kuzzle_free_geopos_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1token_1validity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - token_validity *arg1 = (token_validity *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - kuzzle_free_token_validity(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1kuzzle_1response(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - kuzzle_free_kuzzle_response(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - json_result *arg1 = (json_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_result **)&jarg1; - kuzzle_free_json_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - json_array_result *arg1 = (json_array_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - kuzzle_free_json_array_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1bool_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - bool_result *arg1 = (bool_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(bool_result **)&jarg1; - kuzzle_free_bool_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1int_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - int_result *arg1 = (int_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_result **)&jarg1; - kuzzle_free_int_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1double_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - double_result *arg1 = (double_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(double_result **)&jarg1; - kuzzle_free_double_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1int_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - int_array_result *arg1 = (int_array_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - kuzzle_free_int_array_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1string_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - string_result *arg1 = (string_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_result **)&jarg1; - kuzzle_free_string_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1string_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - string_array_result *arg1 = (string_array_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - kuzzle_free_string_array_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1filters(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_filters *arg1 = (search_filters *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - kuzzle_free_search_filters(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profile_search *arg1 = (profile_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - kuzzle_free_profile_search(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - role_search *arg1 = (role_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - kuzzle_free_role_search(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1ack_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - ack_result *arg1 = (ack_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - kuzzle_free_ack_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1shards_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - shards_result *arg1 = (shards_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards_result **)&jarg1; - kuzzle_free_shards_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification *arg1 = (specification *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - kuzzle_free_specification(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification_entry *arg1 = (specification_entry *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - kuzzle_free_specification_entry(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification_result *arg1 = (specification_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_result **)&jarg1; - kuzzle_free_specification_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_result *arg1 = (search_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - kuzzle_free_search_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_profiles_result *arg1 = (search_profiles_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_profiles_result **)&jarg1; - kuzzle_free_search_profiles_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1roles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_roles_result *arg1 = (search_roles_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_roles_result **)&jarg1; - kuzzle_free_search_roles_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification_search *arg1 = (specification_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - kuzzle_free_specification_search(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification_search_result *arg1 = (specification_search_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search_result **)&jarg1; - kuzzle_free_specification_search_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - mapping *arg1 = (mapping *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping **)&jarg1; - kuzzle_free_mapping(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1mapping_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - mapping_result *arg1 = (mapping_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping_result **)&jarg1; - kuzzle_free_mapping_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1void_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - void_result *arg1 = (void_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(void_result **)&jarg1; - kuzzle_free_void_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - collection_entry *arg1 = (collection_entry *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - kuzzle_free_collection_entry(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection_1entry_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry_result **)&jarg1; - kuzzle_free_collection_entry_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_search *arg1 = (user_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - kuzzle_free_user_search(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1users_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_users_result *arg1 = (search_users_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_users_result **)&jarg1; - kuzzle_free_search_users_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - document_array_result *arg1 = (document_array_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - kuzzle_free_document_array_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1new(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - json_object *arg1 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - kuzzle_json_new(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1put(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jint jarg4) { - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - void *arg3 = (void *) 0 ; - int arg4 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - arg3 = *(void **)&jarg3; - arg4 = (int)jarg4; - kuzzle_json_put(arg1,arg2,arg3,arg4); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1string(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jstring jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (char *)kuzzle_json_get_string(arg1,arg2); - if (result) jresult = jenv->NewStringUTF((const char *)result); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1int(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jint jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (int)kuzzle_json_get_int(arg1,arg2); - jresult = (jint)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1double(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jdouble jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (double)kuzzle_json_get_double(arg1,arg2); - jresult = (jdouble)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1bool(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - json_bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = kuzzle_json_get_bool(arg1,arg2); - *(json_bool **)&jresult = new json_bool((const json_bool &)result); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (json_object *)kuzzle_json_get_json_object(arg1,arg2); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - json_object *arg1 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - kuzzle_free_json_object(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterKuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - unregisterKuzzle(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - options *arg4 = (options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return ; - } - arg4 = *(options **)&jarg4; - kuzzle_new_kuzzle(arg1,arg2,arg3,arg4); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_connect(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_disconnect(arg1); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1default_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_get_default_index(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1default_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (int)kuzzle_set_default_index(arg1,arg2); - jresult = (jint)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - offline_queue *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (offline_queue *)kuzzle_get_offline_queue(arg1); - *(offline_queue **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1flush_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_flush_queue(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1replay_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_replay_queue(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1start_1queuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_start_queuing(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1stop_1queuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_stop_queuing(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1add_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jlong jarg4) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - kuzzle_event_listener arg3 = (kuzzle_event_listener) 0 ; - void *arg4 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - arg3 = *(kuzzle_event_listener *)&jarg3; - arg4 = *(void **)&jarg4; - kuzzle_add_listener(arg1,arg2,arg3,arg4); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jlong jarg4) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - kuzzle_event_listener arg3 = (kuzzle_event_listener) 0 ; - void *arg4 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - arg3 = *(kuzzle_event_listener *)&jarg3; - arg4 = *(void **)&jarg4; - kuzzle_once(arg1,arg2,arg3,arg4); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1listener_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - GoInt result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - result = (GoInt)kuzzle_listener_count(arg1,arg2); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1remove_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - void *arg3 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - arg3 = *(void **)&jarg3; - kuzzle_remove_listener(arg1,arg2,arg3); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1remove_1all_1listeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - kuzzle_remove_all_listeners(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_auto_queue(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool arg2 ; - _Bool *argp2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - argp2 = *(_Bool **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); - return ; - } - arg2 = *argp2; - kuzzle_set_auto_queue(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1reconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_auto_reconnect(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1resubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_auto_resubscribe(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1replay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_auto_replay(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1replay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool arg2 ; - _Bool *argp2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - argp2 = *(_Bool **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); - return ; - } - arg2 = *argp2; - kuzzle_set_auto_replay(arg1,arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1host(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_get_host(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1offline_1queue_1loader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_offline_queue_loader result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (kuzzle_offline_queue_loader)kuzzle_get_offline_queue_loader(arg1); - *(kuzzle_offline_queue_loader *)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1offline_1queue_1loader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_offline_queue_loader arg2 = (kuzzle_offline_queue_loader) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_offline_queue_loader *)&jarg2; - kuzzle_set_offline_queue_loader(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1port(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_port(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_queue_filter result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (kuzzle_queue_filter)kuzzle_get_queue_filter(arg1); - *(kuzzle_queue_filter *)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_queue_filter arg2 = (kuzzle_queue_filter) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_queue_filter *)&jarg2; - kuzzle_set_queue_filter(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1max_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_queue_max_size(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1max_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - kuzzle_set_queue_max_size(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_queue_ttl(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - kuzzle_set_queue_ttl(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1replay_1interval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_replay_interval(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1replay_1interval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - kuzzle_set_replay_interval(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1reconnection_1delay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_reconnection_delay(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1ssl_1connection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_ssl_connection(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (json_object *)kuzzle_get_volatile(arg1); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle *arg1 = (kuzzle *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(json_object **)&jarg2; - kuzzle_set_volatile(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1append(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_append(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_bitcount(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jlong jarg6, jobject jarg6_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char **arg4 = (char **) 0 ; - size_t arg5 ; - query_options *arg6 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg6_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(char ***)&jarg4; - arg5 = (size_t)jarg5; - arg6 = *(query_options **)&jarg6; - result = (int_result *)kuzzle_ms_bitop(arg1,arg2,arg3,arg4,arg5,arg6); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitpos(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jshort jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned char arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (unsigned char)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_bitpos(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1dbsize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (int_result *)kuzzle_ms_dbsize(arg1,arg2); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1decr(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_decr(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1decrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_decrby(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1del(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_del(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_exists(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1expire(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned long arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (unsigned long)jarg3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_expire(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1expireat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jobject jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned long long arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return 0; - } - clazz = jenv->GetObjectClass(jarg3); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg3 = 0; - if (sz > 0) { - arg3 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_expireat(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1flushdb(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (void_result *)kuzzle_ms_flushdb(arg1,arg2); - *(void_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geoadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object **arg3 = (json_object **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_geoadd(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geodist(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (double_result *)kuzzle_ms_geodist(arg1,arg2,arg3,arg4,arg5); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geohash(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_geohash(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geopos(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - geopos_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (geopos_result *)kuzzle_ms_geopos(arg1,arg2,arg3,arg4,arg5); - *(geopos_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1georadius(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jdouble jarg5, jstring jarg6, jlong jarg7, jobject jarg7_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - double arg4 ; - double arg5 ; - char *arg6 = (char *) 0 ; - query_options *arg7 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg7_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = (double)jarg4; - arg5 = (double)jarg5; - arg6 = 0; - if (jarg6) { - arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); - if (!arg6) return 0; - } - arg7 = *(query_options **)&jarg7; - result = (json_array_result *)kuzzle_ms_georadius(arg1,arg2,arg3,arg4,arg5,arg6,arg7); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1georadiusbymember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - double arg4 ; - char *arg5 = (char *) 0 ; - query_options *arg6 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg6_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (double)jarg4; - arg5 = 0; - if (jarg5) { - arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); - if (!arg5) return 0; - } - arg6 = *(query_options **)&jarg6; - result = (json_array_result *)kuzzle_ms_georadiusbymember(arg1,arg2,arg3,arg4,arg5,arg6); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_ms_get(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getbit(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_getbit(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - int arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = (int)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_result *)kuzzle_ms_getrange(arg1,arg2,arg3,arg4,arg5); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_getset(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hdel(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_hdel(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hexists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_hexists(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_hget(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hgetall(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_ms_hgetall(arg1,arg2,arg3); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hincrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_hincrby(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hincrbyfloat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (double_result *)kuzzle_ms_hincrbyfloat(arg1,arg2,arg3,arg4,arg5); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hkeys(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_hkeys(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_hlen(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_hmget(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object **arg3 = (json_object **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_hmset(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_ms_hscan(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (bool_result *)kuzzle_ms_hset(arg1,arg2,arg3,arg4,arg5); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hsetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (bool_result *)kuzzle_ms_hsetnx(arg1,arg2,arg3,arg4,arg5); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hstrlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_hstrlen(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hvals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_hvals(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incr(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_incr(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_incrby(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incrbyfloat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - query_options *arg4 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = *(query_options **)&jarg4; - result = (double_result *)kuzzle_ms_incrbyfloat(arg1,arg2,arg3,arg4); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1keys(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_keys(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lindex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_lindex(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1linsert(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - char *arg5 = (char *) 0 ; - query_options *arg6 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg6_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = 0; - if (jarg5) { - arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); - if (!arg5) return 0; - } - arg6 = *(query_options **)&jarg6; - result = (int_result *)kuzzle_ms_linsert(arg1,arg2,arg3,arg4,arg5,arg6); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1llen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_llen(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_ms_lpop(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_lpush(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpushx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_lpushx(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_lrange(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lrem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_lrem(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_lset(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ltrim(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_ltrim(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_array_result *)kuzzle_ms_mget(arg1,arg2,arg3,arg4); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - json_object **arg2 = (json_object **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(json_object ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (void_result *)kuzzle_ms_mset(arg1,arg2,arg3,arg4); - *(void_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1msetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - json_object **arg2 = (json_object **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(json_object ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_msetnx(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_object(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1persist(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_ms_persist(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pexpire(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned long arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (unsigned long)jarg3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_pexpire(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pexpireat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jobject jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned long long arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return 0; - } - clazz = jenv->GetObjectClass(jarg3); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg3 = 0; - if (sz > 0) { - arg3 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_pexpireat(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (bool_result *)kuzzle_ms_pfadd(arg1,arg2,arg3,arg4,arg5); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_pfcount(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfmerge(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_pfmerge(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_ms_ping(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1psetex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - unsigned long arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (unsigned long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_psetex(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_pttl(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1randomkey(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_ms_randomkey(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rename(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (void_result *)kuzzle_ms_rename(arg1,arg2,arg3,arg4); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1renamenx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_renamenx(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_ms_rpop(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpoplpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_rpoplpush(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_rpush(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpushx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_rpushx(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_sadd(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1scan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_ms_scan(arg1,arg2,arg3); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1scard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_scard(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sdiff(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_sdiff(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sdiffstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - char *arg5 = (char *) 0 ; - query_options *arg6 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg6_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = 0; - if (jarg5) { - arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); - if (!arg5) return 0; - } - arg6 = *(query_options **)&jarg6; - result = (int_result *)kuzzle_ms_sdiffstore(arg1,arg2,arg3,arg4,arg5,arg6); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (void_result *)kuzzle_ms_set(arg1,arg2,arg3,arg4); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1setex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - unsigned long arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (unsigned long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_setex(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1setnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_setnx(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sinter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_array_result *)kuzzle_ms_sinter(arg1,arg2,arg3,arg4); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sinterstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_sinterstore(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sismember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_sismember(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1smembers(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_smembers(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1smove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (bool_result *)kuzzle_ms_smove(arg1,arg2,arg3,arg4,arg5); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sort(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_sort(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1spop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_spop(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1srandmember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_srandmember(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1srem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_srem(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_ms_sscan(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1strlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_strlen(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sunion(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_array_result *)kuzzle_ms_sunion(arg1,arg2,arg3,arg4); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sunionstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_sunionstore(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1time(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - int_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (int_array_result *)kuzzle_ms_time(arg1,arg2); - *(int_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1touch(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_touch(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_ttl(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1type(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_ms_type(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object **arg3 = (json_object **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zadd(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zcard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_zcard(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zcount(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zincrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (double_result *)kuzzle_ms_zincrby(arg1,arg2,arg3,arg4,arg5); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zinterstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zinterstore(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zlexcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zlexcount(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (json_array_result *)kuzzle_ms_zrange(arg1,arg2,arg3,arg4,arg5); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_zrangebylex(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (json_array_result *)kuzzle_ms_zrangebyscore(arg1,arg2,arg3,arg4,arg5); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_zrank(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zrem(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zremrangebylex(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebyrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zremrangebyrank(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zremrangebyscore(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (json_array_result *)kuzzle_ms_zrevrange(arg1,arg2,arg3,arg4,arg5); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_zrevrangebylex(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (json_array_result *)kuzzle_ms_zrevrangebyscore(arg1,arg2,arg3,arg4,arg5); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_zrevrank(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_ms_zscan(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (double_result *)kuzzle_ms_zscore(arg1,arg2,arg3,arg4); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1options(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (options *)kuzzle_new_options(); - *(options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1query(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_request *arg2 = (kuzzle_request *) 0 ; - query_options *arg3 = (query_options *) 0 ; - kuzzle_response *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_request **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (kuzzle_response *)kuzzle_query(arg1,arg2,arg3); - *(kuzzle_response **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1list_1collections(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - collection_entry_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (collection_entry_result *)kuzzle_list_collections(arg1,arg2,arg3); - *(collection_entry_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1list_1indexes(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_array_result *)kuzzle_list_indexes(arg1,arg2); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1create_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_create_index(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1refresh_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - shards_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (shards_result *)kuzzle_refresh_index(arg1,arg2,arg3); - *(shards_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - _Bool arg3 ; - query_options *arg4 = (query_options *) 0 ; - _Bool *argp3 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - argp3 = *(_Bool **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); - return 0; - } - arg3 = *argp3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_set_auto_refresh(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_get_auto_refresh(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - policy *arg3 = (policy *) 0 ; - size_t arg4 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(policy **)&jarg3; - arg4 = (size_t)jarg4; - result = (profile *)kuzzle_security_new_profile(arg1,arg2,arg3,arg4); - *(profile **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profile *arg1 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - kuzzle_security_destroy_profile(arg1); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - profile_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (profile_result *)kuzzle_security_fetch_profile(arg1,arg2,arg3); - *(profile_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1scroll_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (search_profiles_result *)kuzzle_security_scroll_profiles(arg1,arg2,arg3); - *(search_profiles_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (search_profiles_result *)kuzzle_security_search_profiles(arg1,arg2,arg3); - *(search_profiles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1add_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - policy *arg2 = (policy *) 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(policy **)&jarg2; - result = (profile *)kuzzle_security_profile_add_policy(arg1,arg2); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_security_profile_delete(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - query_options *arg2 = (query_options *) 0 ; - profile_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (profile_result *)kuzzle_security_profile_save(arg1,arg2); - *(profile_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - role *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - result = (role *)kuzzle_security_new_role(arg1,arg2,arg3); - *(role **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - role *arg1 = (role *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - kuzzle_security_destroy_role(arg1); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - role_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (role_result *)kuzzle_security_fetch_role(arg1,arg2,arg3); - *(role_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1roles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_roles_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (search_roles_result *)kuzzle_security_search_roles(arg1,arg2,arg3); - *(search_roles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1role_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - role *arg1 = (role *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_security_role_delete(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1role_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - role *arg1 = (role *) 0 ; - query_options *arg2 = (query_options *) 0 ; - role_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (role_result *)kuzzle_security_role_save(arg1,arg2); - *(role_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - user_data *arg3 = (user_data *) 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(user_data **)&jarg3; - result = (user *)kuzzle_security_new_user(arg1,arg2,arg3); - *(user **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user *arg1 = (user *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - kuzzle_security_destroy_user(arg1); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (user_result *)kuzzle_security_fetch_user(arg1,arg2,arg3); - *(user_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1scroll_1users(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_users_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (search_users_result *)kuzzle_security_scroll_users(arg1,arg2,arg3); - *(search_users_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1users(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_users_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (search_users_result *)kuzzle_security_search_users(arg1,arg2,arg3); - *(search_users_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (user_result *)kuzzle_security_user_create(arg1,arg2); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_security_user_create_credentials(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1with_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - json_object *arg2 = (json_object *) 0 ; - query_options *arg3 = (query_options *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(user **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (user_result *)kuzzle_security_user_create_with_credentials(arg1,arg2,arg3); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_security_user_delete(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1delete_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_security_user_delete_credentials(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1credentials_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_security_user_get_credentials_info(arg1,arg2,arg3); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (profiles_result *)kuzzle_security_user_get_profiles(arg1,arg2); - *(profiles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1rights(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - user_rights_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (user_rights_result *)kuzzle_security_user_get_rights(arg1,arg2); - *(user_rights_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1has_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_security_user_has_credentials(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1replace(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (user_result *)kuzzle_security_user_replace(arg1,arg2); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1update_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_security_update_credentials(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1is_1action_1allowed(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6) { - jlong jresult = 0 ; - user_right **arg1 = (user_right **) 0 ; - unsigned int arg2 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - char *arg5 = (char *) 0 ; - char *arg6 = (char *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - arg1 = *(user_right ***)&jarg1; - arg2 = (unsigned int)jarg2; - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = 0; - if (jarg5) { - arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); - if (!arg5) return 0; - } - arg6 = 0; - if (jarg6) { - arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); - if (!arg6) return 0; - } - result = (unsigned int)kuzzle_security_is_action_allowed(arg1,arg2,arg3,arg4,arg5,arg6); - jresult = (jlong)result; - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); - if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterServer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - server *arg1 = (server *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(server **)&jarg1; - unregisterServer(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1server(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - server *arg1 = (server *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - kuzzle_new_server(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1admin_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_admin_exists(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1all_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_get_all_stats(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - time_t arg2 ; - time_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - time_t *argp2 ; - time_t *argp3 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(server **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_get_stats(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1last_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_get_last_stats(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1config(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_get_config(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_info(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1now(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - date_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (date_result *)kuzzle_now(arg1,arg2); - *(date_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::NotificationListener **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1onMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; - notification_result *arg2 = (notification_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::NotificationListener **)&jarg1; - arg2 = *(notification_result **)&jarg2; - ((kuzzleio::NotificationListener const *)arg1)->onMessage(arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotificationListener(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::NotificationListener *)new SwigDirector_NotificationListener(jenv); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); - (void)jcls; - SwigDirector_NotificationListener *director = dynamic_cast(obj); - if (director) { - director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); - SwigDirector_NotificationListener *director = dynamic_cast(obj); - (void)jcls; - if (director) { - director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1EventListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::EventListener **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1trigger(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::EventListener **)&jarg1; - arg2 = *(json_object **)&jarg2; - ((kuzzleio::EventListener const *)arg1)->trigger(arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1EventListener(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::EventListener *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::EventListener *)new SwigDirector_EventListener(jenv); - *(kuzzleio::EventListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - kuzzleio::EventListener *obj = *((kuzzleio::EventListener **)&objarg); - (void)jcls; - SwigDirector_EventListener *director = dynamic_cast(obj); - if (director) { - director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - kuzzleio::EventListener *obj = *((kuzzleio::EventListener **)&objarg); - SwigDirector_EventListener *director = dynamic_cast(obj); - (void)jcls; - if (director) { - director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SubscribeListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::SubscribeListener *arg1 = (kuzzleio::SubscribeListener *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::SubscribeListener **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1onSubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::SubscribeListener *arg1 = (kuzzleio::SubscribeListener *) 0 ; - room_result *arg2 = (room_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::SubscribeListener **)&jarg1; - arg2 = *(room_result **)&jarg2; - ((kuzzleio::SubscribeListener const *)arg1)->onSubscribe(arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SubscribeListener(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::SubscribeListener *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::SubscribeListener *)new SwigDirector_SubscribeListener(jenv); - *(kuzzleio::SubscribeListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - kuzzleio::SubscribeListener *obj = *((kuzzleio::SubscribeListener **)&objarg); - (void)jcls; - SwigDirector_SubscribeListener *director = dynamic_cast(obj); - if (director) { - director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - kuzzleio::SubscribeListener *obj = *((kuzzleio::SubscribeListener **)&objarg); - SwigDirector_SubscribeListener *director = dynamic_cast(obj); - (void)jcls; - if (director) { - director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); - } -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_PARTIAL_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(206); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_BAD_1REQUEST_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(400); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_UNAUTHORIZED_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(401); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_FORBIDDEN_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(403); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_NOT_1FOUND_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(404); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_PRECONDITION_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(412); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_SIZE_1LIMIT_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(413); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_INTERNAL_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(500); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_SERVICE_1UNAVAILABLE_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(503); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_GATEWAY_1TIMEOUT_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(504); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jint jarg1, jstring jarg2) { - jlong jresult = 0 ; - int arg1 ; - std::string *arg2 = 0 ; - kuzzleio::KuzzleException *result = 0 ; - - (void)jenv; - (void)jcls; - arg1 = (int)jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(arg1,(std::string const &)*arg2); - *(kuzzleio::KuzzleException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jint jarg1) { - jlong jresult = 0 ; - int arg1 ; - kuzzleio::KuzzleException *result = 0 ; - - (void)jenv; - (void)jcls; - arg1 = (int)jarg1; - result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(arg1); - *(kuzzleio::KuzzleException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_12(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::KuzzleException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(); - *(kuzzleio::KuzzleException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::KuzzleException *arg1 = 0 ; - kuzzleio::KuzzleException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::KuzzleException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::KuzzleException const & reference is null"); - return 0; - } - result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException((kuzzleio::KuzzleException const &)*arg1); - *(kuzzleio::KuzzleException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::KuzzleException *arg1 = (kuzzleio::KuzzleException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::KuzzleException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleException_1getMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::KuzzleException *arg1 = (kuzzleio::KuzzleException *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::KuzzleException **)&jarg1; - result = ((kuzzleio::KuzzleException const *)arg1)->getMessage(); - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::BadRequestException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException((std::string const &)*arg1); - *(kuzzleio::BadRequestException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::BadRequestException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException(); - *(kuzzleio::BadRequestException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::BadRequestException *arg1 = 0 ; - kuzzleio::BadRequestException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::BadRequestException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::BadRequestException const & reference is null"); - return 0; - } - result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException((kuzzleio::BadRequestException const &)*arg1); - *(kuzzleio::BadRequestException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1BadRequestException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::BadRequestException *arg1 = (kuzzleio::BadRequestException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::BadRequestException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::ForbiddenException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException((std::string const &)*arg1); - *(kuzzleio::ForbiddenException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::ForbiddenException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException(); - *(kuzzleio::ForbiddenException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::ForbiddenException *arg1 = 0 ; - kuzzleio::ForbiddenException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::ForbiddenException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::ForbiddenException const & reference is null"); - return 0; - } - result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException((kuzzleio::ForbiddenException const &)*arg1); - *(kuzzleio::ForbiddenException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ForbiddenException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::ForbiddenException *arg1 = (kuzzleio::ForbiddenException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::ForbiddenException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::GatewayTimeoutException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException((std::string const &)*arg1); - *(kuzzleio::GatewayTimeoutException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::GatewayTimeoutException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException(); - *(kuzzleio::GatewayTimeoutException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::GatewayTimeoutException *arg1 = 0 ; - kuzzleio::GatewayTimeoutException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::GatewayTimeoutException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::GatewayTimeoutException const & reference is null"); - return 0; - } - result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException((kuzzleio::GatewayTimeoutException const &)*arg1); - *(kuzzleio::GatewayTimeoutException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GatewayTimeoutException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::GatewayTimeoutException *arg1 = (kuzzleio::GatewayTimeoutException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::GatewayTimeoutException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::InternalException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::InternalException *)new kuzzleio::InternalException((std::string const &)*arg1); - *(kuzzleio::InternalException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::InternalException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::InternalException *)new kuzzleio::InternalException(); - *(kuzzleio::InternalException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::InternalException *arg1 = 0 ; - kuzzleio::InternalException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::InternalException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::InternalException const & reference is null"); - return 0; - } - result = (kuzzleio::InternalException *)new kuzzleio::InternalException((kuzzleio::InternalException const &)*arg1); - *(kuzzleio::InternalException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1InternalException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::InternalException *arg1 = (kuzzleio::InternalException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::InternalException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::NotFoundException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException((std::string const &)*arg1); - *(kuzzleio::NotFoundException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::NotFoundException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException(); - *(kuzzleio::NotFoundException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::NotFoundException *arg1 = 0 ; - kuzzleio::NotFoundException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::NotFoundException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::NotFoundException const & reference is null"); - return 0; - } - result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException((kuzzleio::NotFoundException const &)*arg1); - *(kuzzleio::NotFoundException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotFoundException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::NotFoundException *arg1 = (kuzzleio::NotFoundException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::NotFoundException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::PartialException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::PartialException *)new kuzzleio::PartialException((std::string const &)*arg1); - *(kuzzleio::PartialException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::PartialException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::PartialException *)new kuzzleio::PartialException(); - *(kuzzleio::PartialException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::PartialException *arg1 = 0 ; - kuzzleio::PartialException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::PartialException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::PartialException const & reference is null"); - return 0; - } - result = (kuzzleio::PartialException *)new kuzzleio::PartialException((kuzzleio::PartialException const &)*arg1); - *(kuzzleio::PartialException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1PartialException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::PartialException *arg1 = (kuzzleio::PartialException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::PartialException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::PreconditionException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException((std::string const &)*arg1); - *(kuzzleio::PreconditionException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::PreconditionException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException(); - *(kuzzleio::PreconditionException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::PreconditionException *arg1 = 0 ; - kuzzleio::PreconditionException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::PreconditionException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::PreconditionException const & reference is null"); - return 0; - } - result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException((kuzzleio::PreconditionException const &)*arg1); - *(kuzzleio::PreconditionException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1PreconditionException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::PreconditionException *arg1 = (kuzzleio::PreconditionException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::PreconditionException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::ServiceUnavailableException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException((std::string const &)*arg1); - *(kuzzleio::ServiceUnavailableException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::ServiceUnavailableException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException(); - *(kuzzleio::ServiceUnavailableException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::ServiceUnavailableException *arg1 = 0 ; - kuzzleio::ServiceUnavailableException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::ServiceUnavailableException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::ServiceUnavailableException const & reference is null"); - return 0; - } - result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException((kuzzleio::ServiceUnavailableException const &)*arg1); - *(kuzzleio::ServiceUnavailableException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ServiceUnavailableException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::ServiceUnavailableException *arg1 = (kuzzleio::ServiceUnavailableException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::ServiceUnavailableException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::SizeLimitException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException((std::string const &)*arg1); - *(kuzzleio::SizeLimitException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::SizeLimitException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException(); - *(kuzzleio::SizeLimitException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::SizeLimitException *arg1 = 0 ; - kuzzleio::SizeLimitException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::SizeLimitException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::SizeLimitException const & reference is null"); - return 0; - } - result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException((kuzzleio::SizeLimitException const &)*arg1); - *(kuzzleio::SizeLimitException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SizeLimitException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::SizeLimitException *arg1 = (kuzzleio::SizeLimitException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::SizeLimitException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::UnauthorizedException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException((std::string const &)*arg1); - *(kuzzleio::UnauthorizedException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::UnauthorizedException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException(); - *(kuzzleio::UnauthorizedException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::UnauthorizedException *arg1 = 0 ; - kuzzleio::UnauthorizedException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::UnauthorizedException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::UnauthorizedException const & reference is null"); - return 0; - } - result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException((kuzzleio::UnauthorizedException const &)*arg1); - *(kuzzleio::UnauthorizedException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1UnauthorizedException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::UnauthorizedException *arg1 = (kuzzleio::UnauthorizedException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::UnauthorizedException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jlong jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jint jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - result = (int)(arg1)->listenerCount(arg2); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleEventEmitter(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->_kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzle *) ((arg1)->_kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Kuzzle_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - options *arg2 = (options *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg2_; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - arg2 = *(options **)&jarg2; - result = (kuzzleio::Kuzzle *)new kuzzleio::Kuzzle((std::string const &)*arg1,arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Kuzzle_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::Kuzzle *)new kuzzleio::Kuzzle((std::string const &)*arg1); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1checkToken(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - token_validity *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (token_validity *)(arg1)->checkToken((std::string const &)*arg2); - *(token_validity **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (char *)(arg1)->connect(); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createIndex_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (bool)(arg1)->createIndex((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createIndex_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (bool)(arg1)->createIndex((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - try { - result = (json_object *)(arg1)->createMyCredentials((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (json_object *)(arg1)->createMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1deleteMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (bool)(arg1)->deleteMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1deleteMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (bool)(arg1)->deleteMyCredentials((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (json_object *)(arg1)->getMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (json_object *)(arg1)->getMyCredentials((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - try { - result = (json_object *)(arg1)->updateMyCredentials((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (json_object *)(arg1)->updateMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1validateMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - try { - result = (bool)(arg1)->validateMyCredentials((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1validateMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (bool)(arg1)->validateMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1login_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jint jarg4) { - jstring jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - int arg4 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - arg4 = (int)jarg4; - try { - result = (arg1)->login((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1login_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jstring jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (arg1)->login((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAllStatistics_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (statistics *)(arg1)->getAllStatistics(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAllStatistics_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - try { - result = (statistics *)(arg1)->getAllStatistics(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getStatistics_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - time_t arg2 ; - time_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - time_t *argp2 ; - time_t *argp3 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - arg4 = *(query_options **)&jarg4; - try { - result = (statistics *)(arg1)->getStatistics(arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getStatistics_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - time_t arg2 ; - time_t arg3 ; - time_t *argp2 ; - time_t *argp3 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - try { - result = (statistics *)(arg1)->getStatistics(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAutoRefresh_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAutoRefresh_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (arg1)->getJwt(); - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (json_object *)(arg1)->getMyRights(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - try { - result = (json_object *)(arg1)->getMyRights(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::vector< std::string > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->listIndexes(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::vector< std::string > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - try { - result = (arg1)->listIndexes(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - (arg1)->disconnect(); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - (arg1)->logout(); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle_request *arg2 = (kuzzle_request *) 0 ; - query_options *arg3 = (query_options *) 0 ; - kuzzle_response *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(kuzzle_request **)&jarg2; - arg3 = *(query_options **)&jarg3; - try { - result = (kuzzle_response *)(arg1)->query(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzle_response **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle_request *arg2 = (kuzzle_request *) 0 ; - kuzzle_response *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(kuzzle_request **)&jarg2; - try { - result = (kuzzle_response *)(arg1)->query(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzle_response **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1refreshIndex_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - shards *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (shards *)(arg1)->refreshIndex((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(shards **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1refreshIndex_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - shards *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (shards *)(arg1)->refreshIndex((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(shards **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1replayQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->replayQueue(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setAutoReplay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - bool arg2 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = jarg2 ? true : false; - result = (kuzzleio::Kuzzle *)(arg1)->setAutoReplay(arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setDefaultIndex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (kuzzleio::Kuzzle *)(arg1)->setDefaultIndex((std::string const &)*arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (kuzzleio::Kuzzle *)(arg1)->setJwt((std::string const &)*arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1startQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->startQueuing(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1stopQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->stopQueuing(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1unsetJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->unsetJwt(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user_data *arg2 = (user_data *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(user_data **)&jarg2; - arg3 = *(query_options **)&jarg3; - try { - result = (json_object *)(arg1)->updateSelf(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user_data *arg2 = (user_data *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(user_data **)&jarg2; - try { - result = (json_object *)(arg1)->updateSelf(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1whoAmI(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - try { - result = (user *)(arg1)->whoAmI(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1flushQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->flushQueue(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (json_object *)(arg1)->getVolatile(); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *arg2 = (json_object *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(json_object **)&jarg2; - result = (kuzzleio::Kuzzle *)(arg1)->setVolatile(arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - SwigValueWrapper< std::map< int,kuzzleio::EventListener * > > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (arg1)->getListeners(); - *(std::map< int,kuzzleio::EventListener * > **)&jresult = new std::map< int,kuzzleio::EventListener * >((const std::map< int,kuzzleio::EventListener * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jint jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - result = (int)(arg1)->listenerCount(arg2); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Collection *)new kuzzleio::Collection(arg1); - *(kuzzleio::Collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Collection **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return ; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - (arg1)->create((std::string const &)*arg2,(std::string const &)*arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jboolean jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - result = (bool)(arg1)->exists((std::string const &)*arg2,(std::string const &)*arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jstring jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - collection_list_options *arg3 = (collection_list_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(collection_list_options **)&jarg3; - try { - result = (arg1)->list((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1truncate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return ; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - (arg1)->truncate((std::string const &)*arg2,(std::string const &)*arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1getMapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jstring jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - result = (arg1)->getMapping((std::string const &)*arg2,(std::string const &)*arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateMapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - std::string *arg4 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return ; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - if(!jarg4) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg4_pstr = (const char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4_pstr) return ; - std::string arg4_str(arg4_pstr); - arg4 = &arg4_str; - jenv->ReleaseStringUTFChars(jarg4, arg4_pstr); - try { - (arg1)->updateMapping((std::string const &)*arg2,(std::string const &)*arg3,(std::string const &)*arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1getSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jstring jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - result = (arg1)->getSpecifications((std::string const &)*arg2,(std::string const &)*arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1searchSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_options *arg2 = (search_options *) 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_options **)&jarg2; - try { - result = (search_result *)(arg1)->searchSpecifications(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) { - jstring jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - std::string *arg4 = 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - if(!jarg4) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg4_pstr = (const char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4_pstr) return 0; - std::string arg4_str(arg4_pstr); - arg4 = &arg4_str; - jenv->ReleaseStringUTFChars(jarg4, arg4_pstr); - try { - result = (arg1)->updateSpecifications((std::string const &)*arg2,(std::string const &)*arg3,(std::string const &)*arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1validateSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - (arg1)->validateSpecifications((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteSpecifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return ; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - (arg1)->deleteSpecifications((std::string const &)*arg2,(std::string const &)*arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Server(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Server *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Server *)new kuzzleio::Server(arg1); - *(kuzzleio::Server **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Server(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Server **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1adminExists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jboolean jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (bool)(arg1)->adminExists(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getAllStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->getAllStats(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getAllStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (arg1)->getAllStats(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - time_t arg2 ; - time_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - time_t *argp2 ; - time_t *argp3 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzleio::Server **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - arg4 = *(query_options **)&jarg4; - try { - result = (arg1)->getStats(arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - time_t arg2 ; - time_t arg3 ; - time_t *argp2 ; - time_t *argp3 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - try { - result = (arg1)->getStats(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getLastStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->getLastStats(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getLastStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (arg1)->getLastStats(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getConfig_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->getConfig(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getConfig_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (arg1)->getConfig(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1info_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->info(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1info_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (arg1)->info(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1_1now_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (long long)(arg1)->now(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1_1now_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (long long)(arg1)->now(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - std::vector< std::string > *result = 0 ; - - (void)jenv; - (void)jcls; - result = (std::vector< std::string > *)new std::vector< std::string >(); - *(std::vector< std::string > **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong jresult = 0 ; - std::vector< std::string >::size_type arg1 ; - std::vector< std::string > *result = 0 ; - - (void)jenv; - (void)jcls; - arg1 = (std::vector< std::string >::size_type)jarg1; - result = (std::vector< std::string > *)new std::vector< std::string >(arg1); - *(std::vector< std::string > **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - result = ((std::vector< std::string > const *)arg1)->size(); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - result = ((std::vector< std::string > const *)arg1)->capacity(); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - arg2 = (std::vector< std::string >::size_type)jarg2; - (arg1)->reserve(arg2); -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - result = (bool)((std::vector< std::string > const *)arg1)->empty(); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - (arg1)->clear(); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1add(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::value_type *arg2 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::vector< std::string >::value_type arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - (arg1)->push_back((std::vector< std::string >::value_type const &)*arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jstring jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - int arg2 ; - std::vector< std::string >::value_type *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - arg2 = (int)jarg2; - try { - result = (std::vector< std::string >::value_type *) &std_vector_Sl_std_string_Sg__get(arg1,arg2); - } - catch(std::out_of_range &_e) { - SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); - return 0; - } - - jresult = jenv->NewStringUTF(result->c_str()); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - int arg2 ; - std::vector< std::string >::value_type *arg3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - arg2 = (int)jarg2; - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return ; - std::vector< std::string >::value_type arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - std_vector_Sl_std_string_Sg__set(arg1,arg2,(std::string const &)*arg3); - } - catch(std::out_of_range &_e) { - SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); - return ; - } - -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StringVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(std::vector< std::string > **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1JsonObject(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - result = (json_object *)new_json_object(); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1JsonObject(JNIEnv *jenv, jclass jcls, jlong jarg1) { - json_object *arg1 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(json_object **)&jarg1; - delete_json_object(arg1); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - result = (json_object *)json_object_put__SWIG_0(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - result = (json_object *)json_object_put__SWIG_1(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - result = (json_object *)json_object_put__SWIG_2(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jboolean jarg3) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - bool arg3 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = jarg3 ? true : false; - result = (json_object *)json_object_put__SWIG_3(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_14(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - result = (json_object *)json_object_put__SWIG_4(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jstring jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (char *)json_object_getString(arg1,arg2); - if (result) jresult = jenv->NewStringUTF((const char *)result); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getInt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jint jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (int)json_object_getInt(arg1,arg2); - jresult = (jint)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getDouble(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jdouble jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (double)json_object_getDouble(arg1,arg2); - jresult = (jdouble)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getBoolean(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (bool)json_object_getBoolean(arg1,arg2); - jresult = (jboolean)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getJsonObject(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (json_object *)json_object_getJsonObject(arg1,arg2); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_trigger_1event_1listener(JNIEnv *jenv, jclass jcls, jint jarg1, jlong jarg2, jobject jarg2_, jlong jarg3) { - int arg1 ; - json_object *arg2 = (json_object *) 0 ; - void *arg3 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg2_; - arg1 = (int)jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(void **)&jarg3; - kuzzleio::trigger_event_listener(arg1,arg2,arg3); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_BadRequestException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::BadRequestException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ForbiddenException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::ForbiddenException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GatewayTimeoutException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::GatewayTimeoutException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_InternalException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::InternalException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotFoundException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::NotFoundException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_PartialException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::PartialException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_PreconditionException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::PreconditionException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ServiceUnavailableException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::ServiceUnavailableException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SizeLimitException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::SizeLimitException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UnauthorizedException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::UnauthorizedException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleEventEmitter **)&baseptr = *(kuzzleio::Kuzzle **)&jarg1; - return baseptr; -} - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_swig_1module_1init(JNIEnv *jenv, jclass jcls) { - int i; - - static struct { - const char *method; - const char *signature; - } methods[3] = { - { - "SwigDirector_NotificationListener_onMessage", "(Lio/kuzzle/sdk/NotificationListener;J)V" - }, - { - "SwigDirector_EventListener_trigger", "(Lio/kuzzle/sdk/EventListener;J)V" - }, - { - "SwigDirector_SubscribeListener_onSubscribe", "(Lio/kuzzle/sdk/SubscribeListener;J)V" - } - }; - Swig::jclass_kcoreJNI = (jclass) jenv->NewGlobalRef(jcls); - if (!Swig::jclass_kcoreJNI) return; - for (i = 0; i < (int) (sizeof(methods)/sizeof(methods[0])); ++i) { - Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature); - if (!Swig::director_method_ids[i]) return; - } -} - - -#ifdef __cplusplus -} -#endif - diff --git a/internal/wrappers/kcore_wrap.h b/internal/wrappers/kcore_wrap.h deleted file mode 100644 index 9b466232..00000000 --- a/internal/wrappers/kcore_wrap.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.12 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - -#ifndef SWIG_kcore_WRAP_H_ -#define SWIG_kcore_WRAP_H_ - -class SwigDirector_NotificationListener : public kuzzleio::NotificationListener, public Swig::Director { - -public: - void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); - SwigDirector_NotificationListener(JNIEnv *jenv); - virtual ~SwigDirector_NotificationListener(); - virtual void onMessage(notification_result *arg0) const; -public: - bool swig_overrides(int n) { - return (n < 1 ? swig_override[n] : false); - } -protected: - Swig::BoolArray<1> swig_override; -}; - -class SwigDirector_EventListener : public kuzzleio::EventListener, public Swig::Director { - -public: - void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); - SwigDirector_EventListener(JNIEnv *jenv); - virtual ~SwigDirector_EventListener(); - virtual void trigger(json_object *arg0) const; -public: - bool swig_overrides(int n) { - return (n < 1 ? swig_override[n] : false); - } -protected: - Swig::BoolArray<1> swig_override; -}; - -class SwigDirector_SubscribeListener : public kuzzleio::SubscribeListener, public Swig::Director { - -public: - void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); - SwigDirector_SubscribeListener(JNIEnv *jenv); - virtual ~SwigDirector_SubscribeListener(); - virtual void onSubscribe(room_result *arg0) const; -public: - bool swig_overrides(int n) { - return (n < 1 ? swig_override[n] : false); - } -protected: - Swig::BoolArray<1> swig_override; -}; - - -#endif From 7db7481bcfac16737dd84ce58af13b1bfabda623 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 14:58:00 +0100 Subject: [PATCH 039/363] Refactoring skeleton --- collection/create_document.go | 50 --- collection/create_document_test.go | 128 -------- collection/delete_document.go | 35 -- collection/delete_document_test.go | 82 ----- collection/document_exists.go | 34 -- collection/document_exists_test.go | 80 ----- collection/document_test.go | 466 --------------------------- collection/fetch_document.go | 35 -- collection/fetch_document_test.go | 80 ----- collection/replace_document.go | 36 --- collection/replace_document_test.go | 89 ----- collection/update_document.go | 36 --- collection/update_document_test.go | 94 ------ document/count.go | 0 document/count_test.go | 0 document/create.go | 0 document/createOrReplace.go | 0 document/createOrReplace_test.go | 0 document/create_test.go | 0 document/delete.go | 0 document/deleteByQuery.go | 0 document/deleteByQuery_test.go | 0 document/delete_test.go | 0 {collection => document}/document.go | 2 +- document/exists.go | 0 document/exists_test.go | 0 document/get.go | 0 document/get_test.go | 0 document/mCreate.go | 0 document/mCreateOrReplace.go | 0 document/mCreateOrReplace_test.go | 0 document/mCreate_test.go | 0 document/mDelete.go | 0 document/mDelete_test.go | 0 document/mGet.go | 0 document/mGet_test.go | 0 document/mReplace.go | 0 document/mReplace_test.go | 0 document/mUpdate.go | 0 document/mUpdate_test.go | 0 document/replace.go | 0 document/replace_test.go | 0 document/search.go | 0 document/search_test.go | 0 document/update.go | 0 document/update_test.go | 0 document/validate.go | 0 document/validate_test.go | 0 48 files changed, 1 insertion(+), 1246 deletions(-) delete mode 100644 collection/create_document.go delete mode 100644 collection/create_document_test.go delete mode 100644 collection/delete_document.go delete mode 100644 collection/delete_document_test.go delete mode 100644 collection/document_exists.go delete mode 100644 collection/document_exists_test.go delete mode 100644 collection/document_test.go delete mode 100644 collection/fetch_document.go delete mode 100644 collection/fetch_document_test.go delete mode 100644 collection/replace_document.go delete mode 100644 collection/replace_document_test.go delete mode 100644 collection/update_document.go delete mode 100644 collection/update_document_test.go create mode 100644 document/count.go create mode 100644 document/count_test.go create mode 100644 document/create.go create mode 100644 document/createOrReplace.go create mode 100644 document/createOrReplace_test.go create mode 100644 document/create_test.go create mode 100644 document/delete.go create mode 100644 document/deleteByQuery.go create mode 100644 document/deleteByQuery_test.go create mode 100644 document/delete_test.go rename {collection => document}/document.go (99%) create mode 100644 document/exists.go create mode 100644 document/exists_test.go create mode 100644 document/get.go create mode 100644 document/get_test.go create mode 100644 document/mCreate.go create mode 100644 document/mCreateOrReplace.go create mode 100644 document/mCreateOrReplace_test.go create mode 100644 document/mCreate_test.go create mode 100644 document/mDelete.go create mode 100644 document/mDelete_test.go create mode 100644 document/mGet.go create mode 100644 document/mGet_test.go create mode 100644 document/mReplace.go create mode 100644 document/mReplace_test.go create mode 100644 document/mUpdate.go create mode 100644 document/mUpdate_test.go create mode 100644 document/replace.go create mode 100644 document/replace_test.go create mode 100644 document/search.go create mode 100644 document/search_test.go create mode 100644 document/update.go create mode 100644 document/update_test.go create mode 100644 document/validate.go create mode 100644 document/validate_test.go diff --git a/collection/create_document.go b/collection/create_document.go deleted file mode 100644 index cfb29125..00000000 --- a/collection/create_document.go +++ /dev/null @@ -1,50 +0,0 @@ -package collection - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" -) - -// Create a new document in Kuzzle. -// Takes an optional argument object with the following properties: -// - volatile (object, default: null): -// Additional information passed to notifications to other users -// - ifExist (string, allowed values: "error" (default), "replace"): -// If the same document already exists: -// - resolves with an error if set to "error". -// - replaces the existing document if set to "replace" -func (dc *Collection) CreateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - ch := make(chan *types.KuzzleResponse) - - action := "create" - - if options != nil { - if options.IfExist() == "replace" { - action = "createOrReplace" - } else if options.IfExist() != "error" { - return nil, types.NewError(fmt.Sprintf("Invalid value for the 'ifExist' option: '%s'", options.IfExist()), 400) - } - } - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: action, - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - documentResponse := &Document{collection: dc} - json.Unmarshal(res.Result, documentResponse) - - return documentResponse, nil -} diff --git a/collection/create_document_test.go b/collection/create_document_test.go deleted file mode 100644 index 00a9a52b..00000000 --- a/collection/create_document_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestCreateDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestCreateDocumentWrongOptionError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("unknown") - - _, err := newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"title":"yolo"}`)}, opts) - assert.Equal(t, "[400] Invalid value for the 'ifExist' option: 'unknown'", fmt.Sprint(err)) -} - -func TestCreateDocument(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "create", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - body := make(map[string]interface{}, 0) - body["title"] = "yolo" - - assert.Equal(t, body, parsedQuery.Body) - - res := collection.Document{Id: id, Content: []byte(`{"title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - assert.Equal(t, id, res.Id) -} - -func TestCreateDocumentReplace(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "createOrReplace", parsedQuery.Action) - - res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("replace") - newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) -} - -func TestCreateDocumentCreate(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "create", parsedQuery.Action) - - res := collection.Document{Id: "id", Content: []byte(`{"Title":"yolo"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - newCollection := collection.NewCollection(k, "collection", "index") - opts := types.NewQueryOptions() - opts.SetIfExist("error") - - newCollection.CreateDocument("id", &collection.Document{Content: []byte(`{"Title":"yolo"}`)}, opts) -} - -func ExampleCollection_CreateDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - id := "myId" - - res, err := collection.NewCollection(k, "collection", "index").CreateDocument(id, &collection.Document{Content: []byte(`{"title":"yolo"}`)}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} diff --git a/collection/delete_document.go b/collection/delete_document.go deleted file mode 100644 index 198db81d..00000000 --- a/collection/delete_document.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// DeleteDocument deletes the Document using its provided unique id. -func (dc *Collection) DeleteDocument(id string, options types.QueryOptions) (string, error) { - if id == "" { - return "", types.NewError("Collection.DeleteDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "delete", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", res.Error - } - - document := &Document{collection: dc} - json.Unmarshal(res.Result, document) - - return document.Id, nil -} diff --git a/collection/delete_document_test.go b/collection/delete_document_test.go deleted file mode 100644 index 3fbb904f..00000000 --- a/collection/delete_document_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestDeleteDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("should have stopped before receiving a response")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("", nil) - assert.NotNil(t, err) - assert.Equal(t, "Collection.DeleteDocument: document id required", err.(*types.KuzzleError).Message) -} - -func TestDeleteDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: types.NewError("Unit test error")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DeleteDocument("myId", nil) - assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) -} - -func TestDeleteDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "delete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) - assert.Equal(t, id, res) -} - -func ExampleCollection_DeleteDocument() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - id := "myId" - - res, err := collection.NewCollection(k, "collection", "index").DeleteDocument(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/document_exists.go b/collection/document_exists.go deleted file mode 100644 index 27c8e204..00000000 --- a/collection/document_exists.go +++ /dev/null @@ -1,34 +0,0 @@ -package collection - -import ( - "github.com/kuzzleio/sdk-go/types" - "strconv" -) - -// DocumentExists returns a boolean indicating whether or not a document with provided ID exists. -func (dc *Collection) DocumentExists(id string, options types.QueryOptions) (bool, error) { - if id == "" { - return false, types.NewError("Collection.DocumentExists: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "exists", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - exists, _ := strconv.ParseBool(string(res.Result)) - - return exists, nil -} diff --git a/collection/document_exists_test.go b/collection/document_exists_test.go deleted file mode 100644 index b41a98da..00000000 --- a/collection/document_exists_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestDocumentExistsEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.DocumentExists: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DocumentExists("", nil) - assert.NotNil(t, err) -} - -func TestDocumentExistsError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").DocumentExists("myId", nil) - assert.NotNil(t, err) -} - -func TestDocumentExists(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "exists", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) - assert.Equal(t, true, res) -} - -func ExampleCollection_DocumentExists() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").DocumentExists(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/document_test.go b/collection/document_test.go deleted file mode 100644 index 760845fc..00000000 --- a/collection/document_test.go +++ /dev/null @@ -1,466 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/state" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestDocumentSetContent(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) - - assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - }, - }, false) - - assert.Equal(t, string(json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`))), string(d.Content)) -} - -func ExampleDocument_SetContent() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - }, - }, false) - - fmt.Println(d.Content) -} - -func TestDocumentSetContentReplace(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - - d := dc.Document() - d.Content = []byte(`{"foo":"bar","subfield":{"john":"smith"}}`) - - assert.Equal(t, json.RawMessage([]byte(`{"foo":"bar","subfield":{"john":"smith"}}`)), d.Content) - - d = d.SetContent(collection.DocumentContent{ - "subfield": collection.DocumentContent{ - "john": "cena", - "subsubfield": collection.DocumentContent{ - "hi": "there", - }, - }, - }, true) - - assert.Equal(t, string(json.RawMessage([]byte(`{"subfield":{"john":"cena","subsubfield":{"hi":"there"}}}`))), string(d.Content)) -} - -func TestDocumentSubscribeEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - cd := dc.Document() - - ch := make(chan types.KuzzleNotification) - _, err := cd.Subscribe(types.NewRoomOptions(), ch) - - assert.Equal(t, "[400] Document.Subscribe: cannot subscribe to a document if no ID has been provided", err.Error()) -} - -func TestDocumentSubscribe(t *testing.T) { - id := "docId" - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - // Fetch query - if parsedQuery.Controller == "document" { - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} - r, _ := json.Marshal(res) - - return &types.KuzzleResponse{Result: r} - } - - // Subscribe query - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "subscribe", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, map[string]interface{}(map[string]interface{}{"ids": map[string]interface{}{"values": []interface{}{"docId"}}}), parsedQuery.Body) - roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) - return &types.KuzzleResponse{Result: roomRaw} - }, - } - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - dc := collection.NewCollection(k, "collection", "index") - d := dc.Document() - d.Id = id - - ch := make(chan types.KuzzleNotification) - room, _ := d.Subscribe(types.NewRoomOptions(), ch) - r := <-room.ResponseChannel() - - assert.Nil(t, r.Error) - assert.NotNil(t, r.Room) - assert.Equal(t, "42", r.Room.RoomId()) -} - -func ExampleDocument_Subscribe() { - id := "docId" - var k *kuzzle.Kuzzle - - c := &internal.MockedConnection{} - k, _ = kuzzle.NewKuzzle(c, nil) - c.SetState(state.Connected) - dc := collection.NewCollection(k, "collection", "index") - d := dc.Document() - d.Id = id - - ch := make(chan types.KuzzleNotification) - room, _ := d.Subscribe(types.NewRoomOptions(), ch) - - notification := <-room.ResponseChannel() - - fmt.Println(notification.Room.RoomId(), notification.Error) -} - -func TestDocumentSaveEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Save(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Save: missing document id", fmt.Sprint(err)) -} - -func TestDocumentSaveError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Save(nil) - - assert.NotNil(t, err) -} - -func TestDocumentSave(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "createOrReplace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo":"bar"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{"foo": "bar"} - - d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) - - assert.Equal(t, id, d.Id) - assert.Equal(t, documentContent.ToString(), string(d.Content)) -} - -func ExampleDocument_Save() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{"foo": "bar"} - - res, err := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Save(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} - -func TestDocumentRefreshEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Refresh(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Refresh: missing document id", fmt.Sprint(err)) -} - -func TestDocumentRefreshError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Refresh(nil) - - assert.NotNil(t, err) -} - -func TestDocumentRefresh(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"name":"Anakin","function":"Jedi"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - - documentContent := collection.DocumentContent{ - "name": "Anakin", - "function": "Padawan", - } - - d, _ := dc.Document().SetDocumentId(id).SetContent(documentContent, true).Refresh(nil) - - result := collection.Document{} - json.Unmarshal(d.Content, &result.Content) - - ic := collection.DocumentContent{} - json.Unmarshal(result.Content, &ic) - - assert.Equal(t, id, d.Id) - assert.Equal(t, "Padawan", documentContent["function"]) - assert.Equal(t, "Jedi", ic["function"]) - assert.NotEqual(t, documentContent["function"], ic["function"]) -} - -func ExampleDocument_Refresh() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId(id).Refresh(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} - -func TestCollectionDocumentExistsEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Exists(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Exists: missing document id", fmt.Sprint(err)) -} - -func TestCollectionDocumentExistsError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Exists(nil) - - assert.NotNil(t, err) -} - -func TestCollectionDocumentExists(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "exists", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - exists, _ := dc.Document().SetDocumentId(id).Exists(nil) - - assert.Equal(t, true, exists) -} - -func ExampleDocument_Exists() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId(id).Exists(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestDocumentPublishError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "realtime", "publish") - _, err := dc.Document().SetDocumentId("myId").Publish(nil) - - assert.NotNil(t, err) -} - -func TestDocumentPublish(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "realtime", parsedQuery.Controller) - assert.Equal(t, "publish", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - - r, _ := json.Marshal(types.RealtimeResponse{Published: true}) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, _ := dc.Document().SetDocumentId("myId").Publish(nil) - - assert.Equal(t, true, res) -} - -func ExampleDocument_Publish() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId("myId").Publish(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestDocumentDeleteEmptyId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().Delete(nil) - - assert.NotNil(t, err) - assert.Equal(t, "[400] Document.Delete: missing document id", fmt.Sprint(err)) -} - -func TestDocumentDeleteError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - _, err := dc.Document().SetDocumentId("myId").Delete(nil) - - assert.NotNil(t, err) -} - -func TestDocumentDelete(t *testing.T) { - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "delete", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - r, _ := json.Marshal(collection.Document{Id: id}) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, _ := dc.Document().SetDocumentId("myId").Delete(nil) - - assert.Equal(t, id, res) -} - -func ExampleDocument_Delete() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - dc := collection.NewCollection(k, "collection", "index") - res, err := dc.Document().SetDocumentId("myId").Delete(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/collection/fetch_document.go b/collection/fetch_document.go deleted file mode 100644 index 7f4fa8f7..00000000 --- a/collection/fetch_document.go +++ /dev/null @@ -1,35 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// FetchDocument retrieves a Document using its provided unique id. -func (dc *Collection) FetchDocument(id string, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.FetchDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "get", - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - document := &Document{collection: dc} - json.Unmarshal(res.Result, document) - - return document, nil -} diff --git a/collection/fetch_document_test.go b/collection/fetch_document_test.go deleted file mode 100644 index 73d71c51..00000000 --- a/collection/fetch_document_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestFetchDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.FetchDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").FetchDocument("", nil) - assert.NotNil(t, err) -} - -func TestFetchDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").FetchDocument("myId", nil) - assert.NotNil(t, err) -} - -func TestFetchDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "get", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - res := collection.Document{Id: id, Content: []byte(`{"foo": "bar"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) - assert.Equal(t, id, res.Id) -} - -func ExampleCollection_FetchDocument() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").FetchDocument(id, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} diff --git a/collection/replace_document.go b/collection/replace_document.go deleted file mode 100644 index 223a8848..00000000 --- a/collection/replace_document.go +++ /dev/null @@ -1,36 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// ReplaceDocument replaces a document in Kuzzle. -func (dc *Collection) ReplaceDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.ReplaceDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "replace", - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - d := &Document{collection: dc} - json.Unmarshal(res.Result, d) - - return d, nil -} diff --git a/collection/replace_document_test.go b/collection/replace_document_test.go deleted file mode 100644 index e221bef6..00000000 --- a/collection/replace_document_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestReplaceDocumentEmptyId(t *testing.T) { - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.ReplaceDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestReplaceDocumentError(t *testing.T) { - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").ReplaceDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestReplaceDocument(t *testing.T) { - type Document struct { - Title string - } - - id := "myId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "replace", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, id, parsedQuery.Id) - - assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) - - res := collection.Document{Id: id, Content: []byte(`{"title": "jonathan"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.Equal(t, id, res.Id) -} - -func ExampleCollection_ReplaceDocument() { - type Document struct { - Title string - } - - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := collection.NewCollection(k, "collection", "index").ReplaceDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Collection) -} diff --git a/collection/update_document.go b/collection/update_document.go deleted file mode 100644 index 2fdc057e..00000000 --- a/collection/update_document.go +++ /dev/null @@ -1,36 +0,0 @@ -package collection - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// UpdateDocument updates a document in Kuzzle. -func (dc *Collection) UpdateDocument(id string, document *Document, options types.QueryOptions) (*Document, error) { - if id == "" { - return nil, types.NewError("Collection.UpdateDocument: document id required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Collection: dc.collection, - Index: dc.index, - Controller: "document", - Action: "update", - Body: document.Content, - Id: id, - } - go dc.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - documentResponse := &Document{collection: dc} - json.Unmarshal(res.Result, documentResponse) - - return documentResponse, nil -} diff --git a/collection/update_document_test.go b/collection/update_document_test.go deleted file mode 100644 index 5a2be52b..00000000 --- a/collection/update_document_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package collection_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestUpdateDocumentEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Collection.UpdateDocument: document id required"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestUpdateDocumentError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - _, err := collection.NewCollection(k, "collection", "index").UpdateDocument("id", &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, nil) - assert.NotNil(t, err) -} - -func TestUpdateDocument(t *testing.T) { - id := "myId" - - type Content struct { - Title string `json:"title"` - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "document", parsedQuery.Controller) - assert.Equal(t, "update", parsedQuery.Action) - assert.Equal(t, "index", parsedQuery.Index) - assert.Equal(t, "collection", parsedQuery.Collection) - assert.Equal(t, 10, options.RetryOnConflict()) - assert.Equal(t, id, parsedQuery.Id) - - assert.Equal(t, "jonathan", parsedQuery.Body.(map[string]interface{})["title"]) - - res := collection.Document{Id: id, Content: []byte(`{"title": "arthur"}`)} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - qo := types.NewQueryOptions() - qo.SetRetryOnConflict(10) - - res, _ := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) - - assert.Equal(t, id, res.Id) - - var result Content - - json.Unmarshal(res.Content, &result) - - assert.Equal(t, result.Title, "arthur") -} - -func ExampleCollection_UpdateDocument() { - id := "myId" - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - qo := types.NewQueryOptions() - qo.SetRetryOnConflict(10) - - res, err := collection.NewCollection(k, "collection", "index").UpdateDocument(id, &collection.Document{Content: []byte(`{"title": "jonathan"}`)}, qo) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} diff --git a/document/count.go b/document/count.go new file mode 100644 index 00000000..e69de29b diff --git a/document/count_test.go b/document/count_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/create.go b/document/create.go new file mode 100644 index 00000000..e69de29b diff --git a/document/createOrReplace.go b/document/createOrReplace.go new file mode 100644 index 00000000..e69de29b diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/create_test.go b/document/create_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/delete.go b/document/delete.go new file mode 100644 index 00000000..e69de29b diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go new file mode 100644 index 00000000..e69de29b diff --git a/document/deleteByQuery_test.go b/document/deleteByQuery_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/delete_test.go b/document/delete_test.go new file mode 100644 index 00000000..e69de29b diff --git a/collection/document.go b/document/document.go similarity index 99% rename from collection/document.go rename to document/document.go index 38e7e174..34226ace 100644 --- a/collection/document.go +++ b/document/document.go @@ -1,4 +1,4 @@ -package collection +package document import ( "encoding/json" diff --git a/document/exists.go b/document/exists.go new file mode 100644 index 00000000..e69de29b diff --git a/document/exists_test.go b/document/exists_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/get.go b/document/get.go new file mode 100644 index 00000000..e69de29b diff --git a/document/get_test.go b/document/get_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mCreate.go b/document/mCreate.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mCreate_test.go b/document/mCreate_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mDelete.go b/document/mDelete.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mDelete_test.go b/document/mDelete_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mGet.go b/document/mGet.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mGet_test.go b/document/mGet_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mReplace.go b/document/mReplace.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mReplace_test.go b/document/mReplace_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mUpdate.go b/document/mUpdate.go new file mode 100644 index 00000000..e69de29b diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/replace.go b/document/replace.go new file mode 100644 index 00000000..e69de29b diff --git a/document/replace_test.go b/document/replace_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/search.go b/document/search.go new file mode 100644 index 00000000..e69de29b diff --git a/document/search_test.go b/document/search_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/update.go b/document/update.go new file mode 100644 index 00000000..e69de29b diff --git a/document/update_test.go b/document/update_test.go new file mode 100644 index 00000000..e69de29b diff --git a/document/validate.go b/document/validate.go new file mode 100644 index 00000000..e69de29b diff --git a/document/validate_test.go b/document/validate_test.go new file mode 100644 index 00000000..e69de29b From e885782f813e67ecb5a60e667403ad4de0b3e52a Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 6 Mar 2018 15:05:28 +0100 Subject: [PATCH 040/363] auth.Login && auth.Logout --- auth/checkToken_test.go | 2 +- auth/createMyCredentials_test.go | 2 +- auth/deleteMyCredentials_test.go | 2 +- auth/getCurrentUser_test.go | 2 +- auth/getMyCredentials_test.go | 2 +- auth/getMyRights_test.go | 2 +- internal/wrappers/cgo/kuzzle/auth.go | 36 +++++----- internal/wrappers/cpp/auth.cpp | 22 +++++++ internal/wrappers/cpp/kuzzle.cpp | 23 +------ internal/wrappers/headers/auth.hpp | 3 + internal/wrappers/headers/kuzzle.hpp | 4 +- kuzzle/kuzzle.go | 8 +-- kuzzle/kuzzle_test.go | 4 +- kuzzle/login.go | 54 --------------- kuzzle/login_test.go | 91 -------------------------- kuzzle/logout.go | 26 -------- kuzzle/logout_test.go | 70 -------------------- kuzzle/update_my_credentials_test.go | 5 +- kuzzle/validate_my_credentials_test.go | 5 +- security/update_self_test.go | 2 +- types/ikuzzle.go | 2 + 21 files changed, 66 insertions(+), 301 deletions(-) delete mode 100644 kuzzle/login.go delete mode 100644 kuzzle/login_test.go delete mode 100644 kuzzle/logout.go delete mode 100644 kuzzle/logout_test.go diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go index 9121f276..e1552c4a 100644 --- a/auth/checkToken_test.go +++ b/auth/checkToken_test.go @@ -57,7 +57,7 @@ func ExampleKuzzle_CheckToken() { myCredentials := credentials{"foo", "bar"} - jwt, err := k.Login("local", myCredentials, nil) + jwt, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/createMyCredentials_test.go b/auth/createMyCredentials_test.go index 9ceb861a..0bb24323 100644 --- a/auth/createMyCredentials_test.go +++ b/auth/createMyCredentials_test.go @@ -79,7 +79,7 @@ func ExampleKuzzle_CreateMyCredentials() { myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/deleteMyCredentials_test.go b/auth/deleteMyCredentials_test.go index c9ad175d..642b026c 100644 --- a/auth/deleteMyCredentials_test.go +++ b/auth/deleteMyCredentials_test.go @@ -73,7 +73,7 @@ func ExampleKuzzle_DeleteMyCredentials() { myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/getCurrentUser_test.go b/auth/getCurrentUser_test.go index 032ee5bb..3d653c72 100644 --- a/auth/getCurrentUser_test.go +++ b/auth/getCurrentUser_test.go @@ -60,7 +60,7 @@ func ExampleKuzzle_GetCurrentUser() { myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/getMyCredentials_test.go b/auth/getMyCredentials_test.go index f45dd818..0b2a1643 100644 --- a/auth/getMyCredentials_test.go +++ b/auth/getMyCredentials_test.go @@ -83,7 +83,7 @@ func ExampleKuzzle_GetMyCredentials() { myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/getMyRights_test.go b/auth/getMyRights_test.go index 63ee5ba2..cd38a43d 100644 --- a/auth/getMyRights_test.go +++ b/auth/getMyRights_test.go @@ -84,7 +84,7 @@ func ExampleKuzzle_GetMyRights() { myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index c456c70a..d8bbb111 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -124,35 +124,21 @@ func kuzzle_get_strategies(a *C.auth, options *C.query_options) *C.string_array_ return goToCStringArrayResult(res, err) } -//export kuzzle_update_self -func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options) *C.json_result { - userData, err := cToGoUserData(data) - if err != nil { - return goToCJsonResult(nil, err) - } - - res, err := (*kuzzle.Kuzzle)(k.instance).UpdateSelf( - userData, - SetQueryOptions(options)) - - return goToCJsonResult(res, err) -} - //export kuzzle_login -func kuzzle_login(k *C.kuzzle, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { +func kuzzle_login(a *C.auth, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { var expire int if expires_in != nil { expire = int(*expires_in) } - res, err := (*kuzzle.Kuzzle)(k.instance).Login(C.GoString(strategy), JsonCConvert(credentials).(map[string]interface{}), &expire) + res, err := (*auth.Auth)(a.instance).Login(C.GoString(strategy), JsonCConvert(credentials).(map[string]interface{}), &expire) return goToCStringResult(&res, err) } //export kuzzle_logout -func kuzzle_logout(k *C.kuzzle) *C.char { - err := (*kuzzle.Kuzzle)(k.instance).Logout() +func kuzzle_logout(a *C.auth) *C.char { + err := (*auth.Auth)(a.instance).Logout() if err != nil { return C.CString(err.Error()) } @@ -160,6 +146,20 @@ func kuzzle_logout(k *C.kuzzle) *C.char { return nil } +//export kuzzle_update_self +func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options) *C.json_result { + userData, err := cToGoUserData(data) + if err != nil { + return goToCJsonResult(nil, err) + } + + res, err := (*kuzzle.Kuzzle)(k.instance).UpdateSelf( + userData, + SetQueryOptions(options)) + + return goToCJsonResult(res, err) +} + //export kuzzle_update_my_credentials func kuzzle_update_my_credentials(k *C.kuzzle, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.json_result { res, err := (*kuzzle.Kuzzle)(k.instance).UpdateMyCredentials( diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 172fbbf8..733f8011 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -78,5 +78,27 @@ namespace kuzzleio { return v; } + std::string Auth::login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_login(_auth, const_cast(strategy.c_str()), credentials, NULL); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + delete(r); + return ret; + } + + std::string Auth::login(const std::string& strategy, json_object* credentials, int expires_in) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_login(_auth, const_cast(strategy.c_str()), credentials, &expires_in); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + delete(r); + return ret; + } + + void Auth::logout() { + kuzzle_logout(_auth); + } + } \ No newline at end of file diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 3546f5a9..fcb63ee9 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -55,23 +55,6 @@ namespace kuzzleio { return ret; } - std::string Kuzzle::login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException { - string_result* r = kuzzle_login(_kuzzle, const_cast(strategy.c_str()), credentials, NULL); - if (r->error != NULL) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - std::string Kuzzle::login(const std::string& strategy, json_object* credentials, int expires_in) Kuz_Throw_KuzzleException { - string_result* r = kuzzle_login(_kuzzle, const_cast(strategy.c_str()), credentials, &expires_in); - if (r->error != NULL) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - bool Kuzzle::getAutoRefresh(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_get_auto_refresh(_kuzzle, const_cast(index.c_str()), options); if (r->error != NULL) @@ -80,7 +63,7 @@ namespace kuzzleio { delete(r); return ret; } - + collection_entry* Kuzzle::listCollections(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { collection_entry_result *r = kuzzle_list_collections(_kuzzle, const_cast(index.c_str()), options); if (r->error != NULL) @@ -107,10 +90,6 @@ namespace kuzzleio { kuzzle_disconnect(_kuzzle); } - void Kuzzle::logout() { - kuzzle_logout(_kuzzle); - } - kuzzle_response* Kuzzle::query(kuzzle_request* query, query_options* options) Kuz_Throw_KuzzleException { kuzzle_response *r = kuzzle_query(_kuzzle, query, options); if (r->error != NULL) diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index 11a427a6..df3a5e95 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -20,6 +20,9 @@ namespace kuzzleio { std::string getMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; user_right* getMyRights(query_options *options=NULL) Kuz_Throw_KuzzleException; std::vector getStrategies(query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string login(const std::string& strategy, json_object* credentials, int expiresIn) Kuz_Throw_KuzzleException; + std::string login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException; + void logout(); }; } diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index c3e66046..df425880 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -27,8 +27,7 @@ namespace kuzzleio { json_object* updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options=NULL) Kuz_Throw_KuzzleException; bool validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::string login(const std::string& strategy, json_object* credentials, int expiresIn) Kuz_Throw_KuzzleException; - std::string login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException; + statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; bool getAutoRefresh(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; @@ -36,7 +35,6 @@ namespace kuzzleio { collection_entry* listCollections(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; std::vector listIndexes(query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); - void logout(); kuzzle_response* query(kuzzle_request* query, query_options* options=NULL) Kuz_Throw_KuzzleException; shards* refreshIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; Kuzzle* replayQueue(); diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index cfd2a741..dd615aba 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -16,10 +16,6 @@ import ( const version = "1.0.0" -type IKuzzle interface { - Query(*types.KuzzleRequest, chan<- *types.KuzzleResponse, types.QueryOptions) -} - type Kuzzle struct { socket connection.Connection @@ -254,3 +250,7 @@ func (k *Kuzzle) Volatile() types.VolatileData { func (k *Kuzzle) SetVolatile(v types.VolatileData) { k.volatile = v } + +func (k *Kuzzle) EmitEvent(e int, arg interface{}) { + k.socket.EmitEvent(e, arg) +} diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index 93f6f59c..c0a702f6 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -69,7 +69,7 @@ func TestUnsetJwt(t *testing.T) { k, _ = kuzzle.NewKuzzle(c, nil) - res, _ := k.Login("local", nil, nil) + res, _ := k.Auth.Login("local", nil, nil) assert.Equal(t, "token", res) assert.Equal(t, "token", k.Jwt()) k.UnsetJwt() @@ -87,7 +87,7 @@ func ExampleKuzzle_UnsetJwt() { myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/kuzzle/login.go b/kuzzle/login.go deleted file mode 100644 index 42d5c39c..00000000 --- a/kuzzle/login.go +++ /dev/null @@ -1,54 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/event" - "github.com/kuzzleio/sdk-go/types" -) - -// Login send login request to kuzzle with credentials. -// If login success, store the jwtToken into kuzzle object. -func (k *Kuzzle) Login(strategy string, credentials interface{}, expiresIn *int) (string, error) { - if strategy == "" { - return "", types.NewError("Kuzzle.Login: cannot authenticate to Kuzzle without an authentication strategy", 400) - } - - type loginResult struct { - Jwt string `json:"jwt"` - } - - var token loginResult - var body interface{} - - if credentials != nil { - body = credentials - } - - q := &types.KuzzleRequest{ - Controller: "auth", - Action: "login", - Body: body, - Strategy: strategy, - } - - if expiresIn != nil { - q.ExpiresIn = *expiresIn - } - - result := make(chan *types.KuzzleResponse) - - go k.Query(q, nil, result) - - res := <-result - - json.Unmarshal(res.Result, &token) - - if res.Error != nil { - k.socket.EmitEvent(event.LoginAttempt, &types.LoginAttempt{Success: false, Error: res.Error}) - return "", res.Error - } - - k.SetJwt(token.Jwt) - - return token.Jwt, nil -} diff --git a/kuzzle/login_test.go b/kuzzle/login_test.go deleted file mode 100644 index 8054cc35..00000000 --- a/kuzzle/login_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/event" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestLoginNoStrategy(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Login("", struct{}{}, nil) - assert.NotNil(t, err) -} - -func TestLoginError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "login", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - MockEmitEvent: func(e int, arg interface{}) { - assert.Equal(t, event.LoginAttempt, e) - assert.Equal(t, "error", arg.(*types.LoginAttempt).Error.Error()) - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - k.Login("local", struct{}{}, nil) -} - -func TestLogin(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "login", request.Action) - assert.Equal(t, 42, request.ExpiresIn) - - type loginResult struct { - Jwt string `json:"jwt"` - } - - loginRes := loginResult{"token"} - marsh, _ := json.Marshal(loginRes) - - return &types.KuzzleResponse{Result: marsh} - }, - MockEmitEvent: func(e int, arg interface{}) { - assert.Equal(t, event.LoginAttempt, e) - assert.Equal(t, true, arg.(*types.LoginAttempt).Success) - assert.Nil(t, arg.(*types.LoginAttempt).Error) - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - expiresIn := 42 - token, _ := k.Login("local", struct{}{}, &expiresIn) - assert.Equal(t, "token", token) -} - -func ExampleKuzzle_Login() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - type credentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - myCredentials := credentials{"foo", "bar"} - - jwt, err := k.Login("local", myCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(jwt) -} diff --git a/kuzzle/logout.go b/kuzzle/logout.go deleted file mode 100644 index 0cfbf8ab..00000000 --- a/kuzzle/logout.go +++ /dev/null @@ -1,26 +0,0 @@ -package kuzzle - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// Logout logs the user out. -func (k *Kuzzle) Logout() error { - q := &types.KuzzleRequest{ - Controller: "auth", - Action: "logout", - } - result := make(chan *types.KuzzleResponse) - - go k.Query(q, nil, result) - - res := <-result - - if res.Error != nil { - return res.Error - } - - k.jwt = "" - - return nil -} diff --git a/kuzzle/logout_test.go b/kuzzle/logout_test.go deleted file mode 100644 index 80e3639b..00000000 --- a/kuzzle/logout_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestLogoutError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "logout", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - error := k.Logout() - assert.NotNil(t, error) -} - -func TestLogout(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "logout", request.Action) - - return &types.KuzzleResponse{} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - error := k.Logout() - assert.Nil(t, error) -} - -func ExampleKuzzle_Logout() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - type credentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - myCredentials := credentials{"foo", "bar"} - - _, err := k.Login("local", myCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - err = k.Logout() - if err != nil { - fmt.Println(err) - } -} diff --git a/kuzzle/update_my_credentials_test.go b/kuzzle/update_my_credentials_test.go index ef365ef0..edfe9bda 100644 --- a/kuzzle/update_my_credentials_test.go +++ b/kuzzle/update_my_credentials_test.go @@ -3,12 +3,13 @@ package kuzzle_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestUpdateMyCredentialsQueryError(t *testing.T) { @@ -75,7 +76,7 @@ func ExampleKuzzle_UpdateMyCredentials() { myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/kuzzle/validate_my_credentials_test.go b/kuzzle/validate_my_credentials_test.go index 81ffd166..c7939414 100644 --- a/kuzzle/validate_my_credentials_test.go +++ b/kuzzle/validate_my_credentials_test.go @@ -3,12 +3,13 @@ package kuzzle_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestValidateMyCredentialsQueryError(t *testing.T) { @@ -64,7 +65,7 @@ func ExampleKuzzle_ValidateMyCredentials() { myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/security/update_self_test.go b/security/update_self_test.go index 61c0cba6..56f32a26 100644 --- a/security/update_self_test.go +++ b/security/update_self_test.go @@ -61,7 +61,7 @@ func ExampleKuzzle_UpdateSelf() { } myCredentials := credentials{"foo", "bar"} - _, err := k.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", myCredentials, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/types/ikuzzle.go b/types/ikuzzle.go index ef3c639b..cae3f6ea 100644 --- a/types/ikuzzle.go +++ b/types/ikuzzle.go @@ -2,4 +2,6 @@ package types type IKuzzle interface { Query(query *KuzzleRequest, options QueryOptions, responseChannel chan<- *KuzzleResponse) + EmitEvent(int, interface{}) + SetJwt(string) } From f3a1e76c2f19e6f414502b5b1db6f1cbea2decce Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 6 Mar 2018 16:11:50 +0100 Subject: [PATCH 041/363] auth.UpdateMyCredentials && auth.ValidateMyCredentials --- internal/wrappers/cgo/kuzzle/auth.go | 25 +++---- internal/wrappers/cpp/auth.cpp | 21 +++++- internal/wrappers/cpp/kuzzle.cpp | 18 ----- internal/wrappers/headers/auth.hpp | 2 + internal/wrappers/headers/kuzzle.hpp | 2 - kuzzle/update_my_credentials.go | 35 ---------- kuzzle/update_my_credentials_test.go | 93 -------------------------- kuzzle/validate_my_credentials.go | 31 --------- kuzzle/validate_my_credentials_test.go | 81 ---------------------- 9 files changed, 34 insertions(+), 274 deletions(-) delete mode 100644 kuzzle/update_my_credentials.go delete mode 100644 kuzzle/update_my_credentials_test.go delete mode 100644 kuzzle/validate_my_credentials.go delete mode 100644 kuzzle/validate_my_credentials_test.go diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index d8bbb111..d3654ecd 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -146,6 +146,17 @@ func kuzzle_logout(a *C.auth) *C.char { return nil } +//export kuzzle_update_my_credentials +func kuzzle_update_my_credentials(a *C.auth, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.string_result { + res, err := (*auth.Auth)(a.instance).UpdateMyCredentials( + C.GoString(strategy), + JsonCConvert(credentials).(map[string]interface{}), + SetQueryOptions(options)) + + str := string(res) + return goToCStringResult(&str, err) +} + //export kuzzle_update_self func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options) *C.json_result { userData, err := cToGoUserData(data) @@ -160,19 +171,9 @@ func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options return goToCJsonResult(res, err) } -//export kuzzle_update_my_credentials -func kuzzle_update_my_credentials(k *C.kuzzle, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).UpdateMyCredentials( - C.GoString(strategy), - JsonCConvert(credentials).(map[string]interface{}), - SetQueryOptions(options)) - - return goToCJsonResult(res, err) -} - //export kuzzle_validate_my_credentials -func kuzzle_validate_my_credentials(k *C.kuzzle, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).ValidateMyCredentials( +func kuzzle_validate_my_credentials(a *C.auth, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.bool_result { + res, err := (*auth.Auth)(a.instance).ValidateMyCredentials( C.GoString(strategy), JsonCConvert(credentials).(map[string]interface{}), SetQueryOptions(options)) diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 733f8011..0b8fa017 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -83,7 +83,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; - delete(r); + kuzzle_free_string_result(r); return ret; } @@ -92,7 +92,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; - delete(r); + kuzzle_free_string_result(r); return ret; } @@ -100,5 +100,22 @@ namespace kuzzleio { kuzzle_logout(_auth); } + std::string Auth::updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_update_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + bool Auth::validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_validate_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + bool ret = r->result; + kuzzle_free_bool_result(r); + return ret; + } } \ No newline at end of file diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index fcb63ee9..4684cce4 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -37,24 +37,6 @@ namespace kuzzleio { return ret; } - json_object* Kuzzle::updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options) Kuz_Throw_KuzzleException { - json_result *r = kuzzle_update_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - json_object *ret = r->result; - delete(r); - return ret; - } - - bool Kuzzle::validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_validate_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - bool Kuzzle::getAutoRefresh(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_get_auto_refresh(_kuzzle, const_cast(index.c_str()), options); if (r->error != NULL) diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index df3a5e95..8426195e 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -23,6 +23,8 @@ namespace kuzzleio { std::string login(const std::string& strategy, json_object* credentials, int expiresIn) Kuz_Throw_KuzzleException; std::string login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException; void logout(); + std::string updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options=NULL) Kuz_Throw_KuzzleException; + bool validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index df425880..9e88be56 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -25,8 +25,6 @@ namespace kuzzleio { char* connect(); bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - json_object* updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options=NULL) Kuz_Throw_KuzzleException; - bool validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; diff --git a/kuzzle/update_my_credentials.go b/kuzzle/update_my_credentials.go deleted file mode 100644 index 984ce8ce..00000000 --- a/kuzzle/update_my_credentials.go +++ /dev/null @@ -1,35 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" - "reflect" -) - -// UpdateMyCredentials update credentials of the specified strategy for the current user. -func (k *Kuzzle) UpdateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (map[string]interface{}, error) { - if strategy == "" { - return nil, types.NewError("Kuzzle.UpdateMyCredentials: strategy is required", 400) - } - - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "auth", - Action: "updateMyCredentials", - Body: credentials, - Strategy: strategy, - } - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - ref := reflect.New(reflect.TypeOf(credentials)).Elem().Interface() - json.Unmarshal(res.Result, &ref) - - return ref.(map[string]interface{}), nil -} diff --git a/kuzzle/update_my_credentials_test.go b/kuzzle/update_my_credentials_test.go deleted file mode 100644 index edfe9bda..00000000 --- a/kuzzle/update_my_credentials_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestUpdateMyCredentialsQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "updateMyCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.UpdateMyCredentials("local", nil, nil) - assert.NotNil(t, err) -} - -func TestUpdateMyCredentialsEmptyStrategy(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.UpdateMyCredentials("", nil, nil) - assert.NotNil(t, err) -} - -func TestUpdateMyCredentials(t *testing.T) { - type myCredentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - ack := myCredentials{Username: "foo", Password: "bar"} - r, _ := json.Marshal(ack) - - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "updateMyCredentials", request.Action) - assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.UpdateMyCredentials("local", myCredentials{"foo", "bar"}, nil) - - assert.Equal(t, "foo", res["username"]) - assert.Equal(t, "bar", res["password"]) -} - -func ExampleKuzzle_UpdateMyCredentials() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - type credentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - myCredentials := credentials{"foo", "bar"} - - _, err := k.Auth.Login("local", myCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - newCredentials := credentials{"foo", "new"} - res, err := k.UpdateMyCredentials("local", newCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/kuzzle/validate_my_credentials.go b/kuzzle/validate_my_credentials.go deleted file mode 100644 index a68d7639..00000000 --- a/kuzzle/validate_my_credentials.go +++ /dev/null @@ -1,31 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// ValidateMyCredentials validate credentials of the specified strategy for the current user. -func (k *Kuzzle) ValidateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (bool, error) { - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "auth", - Action: "validateMyCredentials", - Strategy: strategy, - Body: credentials, - } - - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return false, res.Error - } - - var r bool - json.Unmarshal(res.Result, &r) - - return r, nil -} diff --git a/kuzzle/validate_my_credentials_test.go b/kuzzle/validate_my_credentials_test.go deleted file mode 100644 index c7939414..00000000 --- a/kuzzle/validate_my_credentials_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestValidateMyCredentialsQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "validateMyCredentials", request.Action) - assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.ValidateMyCredentials("local", nil, nil) - assert.NotNil(t, err) -} - -func TestValidateMyCredentials(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "auth", request.Controller) - assert.Equal(t, "validateMyCredentials", request.Action) - assert.Equal(t, "local", request.Strategy) - assert.Equal(t, "foo", request.Body.(map[string]interface{})["username"]) - assert.Equal(t, "bar", request.Body.(map[string]interface{})["password"]) - - ret, _ := json.Marshal(true) - return &types.KuzzleResponse{Result: ret} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.ValidateMyCredentials("local", struct { - Username string `json:"username"` - Password string `json:"password"` - }{"foo", "bar"}, nil) - assert.Nil(t, err) - - assert.Equal(t, true, res) -} - -func ExampleKuzzle_ValidateMyCredentials() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - type credentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - - myCredentials := credentials{"foo", "bar"} - - _, err := k.Auth.Login("local", myCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - res, err := k.ValidateMyCredentials("local", myCredentials, nil) - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} From 9641e05b257e4cf9c2e84346fd6389eb13765863 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 6 Mar 2018 16:12:17 +0100 Subject: [PATCH 042/363] added missing files --- auth/login.go | 55 ++++++++++++++++ auth/login_test.go | 92 +++++++++++++++++++++++++++ auth/update_my_credentials.go | 32 ++++++++++ auth/update_my_credentials_test.go | 95 ++++++++++++++++++++++++++++ auth/validate_my_credentials.go | 32 ++++++++++ auth/validate_my_credentials_test.go | 81 ++++++++++++++++++++++++ 6 files changed, 387 insertions(+) create mode 100644 auth/login.go create mode 100644 auth/login_test.go create mode 100644 auth/update_my_credentials.go create mode 100644 auth/update_my_credentials_test.go create mode 100644 auth/validate_my_credentials.go create mode 100644 auth/validate_my_credentials_test.go diff --git a/auth/login.go b/auth/login.go new file mode 100644 index 00000000..a0836376 --- /dev/null +++ b/auth/login.go @@ -0,0 +1,55 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/event" + "github.com/kuzzleio/sdk-go/types" +) + +// Login send login request to kuzzle with credentials. +// If login success, store the jwtToken into kuzzle object. +func (a *Auth) Login(strategy string, credentials interface{}, expiresIn *int) (string, error) { + if strategy == "" { + return "", types.NewError("Kuzzle.Login: cannot authenticate to Kuzzle without an authentication strategy", 400) + } + + type loginResult struct { + Jwt string `json:"jwt"` + } + + var token loginResult + var body interface{} + + if credentials != nil { + body = credentials + } + + q := &types.KuzzleRequest{ + Controller: "auth", + Action: "login", + Body: body, + Strategy: strategy, + } + + if expiresIn != nil { + q.ExpiresIn = *expiresIn + } + + result := make(chan *types.KuzzleResponse) + + go a.k.Query(q, nil, result) + + res := <-result + + json.Unmarshal(res.Result, &token) + + if res.Error != nil { + a.k.EmitEvent(event.LoginAttempt, &types.LoginAttempt{Success: false, Error: res.Error}) + return "", res.Error + } + + a.k.SetJwt(token.Jwt) + + return token.Jwt, nil +} diff --git a/auth/login_test.go b/auth/login_test.go new file mode 100644 index 00000000..23ad1ee3 --- /dev/null +++ b/auth/login_test.go @@ -0,0 +1,92 @@ +package auth_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/event" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestLoginNoStrategy(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Auth.Login("", struct{}{}, nil) + assert.NotNil(t, err) +} + +func TestLoginError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "login", request.Action) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + MockEmitEvent: func(e int, arg interface{}) { + assert.Equal(t, event.LoginAttempt, e) + assert.Equal(t, "error", arg.(*types.LoginAttempt).Error.Error()) + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + k.Auth.Login("local", struct{}{}, nil) +} + +func TestLogin(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "login", request.Action) + assert.Equal(t, 42, request.ExpiresIn) + + type loginResult struct { + Jwt string `json:"jwt"` + } + + loginRes := loginResult{"token"} + marsh, _ := json.Marshal(loginRes) + + return &types.KuzzleResponse{Result: marsh} + }, + MockEmitEvent: func(e int, arg interface{}) { + assert.Equal(t, event.LoginAttempt, e) + assert.Equal(t, true, arg.(*types.LoginAttempt).Success) + assert.Nil(t, arg.(*types.LoginAttempt).Error) + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + expiresIn := 42 + token, _ := k.Auth.Login("local", struct{}{}, &expiresIn) + assert.Equal(t, "token", token) +} + +func ExampleKuzzle_Login() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + type credentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + myCredentials := credentials{"foo", "bar"} + + jwt, err := k.Auth.Login("local", myCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(jwt) +} diff --git a/auth/update_my_credentials.go b/auth/update_my_credentials.go new file mode 100644 index 00000000..941c233f --- /dev/null +++ b/auth/update_my_credentials.go @@ -0,0 +1,32 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// UpdateMyCredentials update credentials of the specified strategy for the current user. +func (a *Auth) UpdateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (json.RawMessage, error) { + if strategy == "" { + return nil, types.NewError("Kuzzle.UpdateMyCredentials: strategy is required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "updateMyCredentials", + Body: credentials, + Strategy: strategy, + } + go a.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/auth/update_my_credentials_test.go b/auth/update_my_credentials_test.go new file mode 100644 index 00000000..8b76bda2 --- /dev/null +++ b/auth/update_my_credentials_test.go @@ -0,0 +1,95 @@ +package auth_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateMyCredentialsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "updateMyCredentials", request.Action) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Auth.UpdateMyCredentials("local", nil, nil) + assert.NotNil(t, err) +} + +func TestUpdateMyCredentialsEmptyStrategy(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Auth.UpdateMyCredentials("", nil, nil) + assert.NotNil(t, err) +} + +func TestUpdateMyCredentials(t *testing.T) { + type myCredentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + ack := myCredentials{Username: "foo", Password: "bar"} + r, _ := json.Marshal(ack) + + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "updateMyCredentials", request.Action) + assert.Equal(t, "local", request.Strategy) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, _ := k.Auth.UpdateMyCredentials("local", myCredentials{"foo", "bar"}, nil) + creds := myCredentials{} + json.Unmarshal(res, &creds) + + assert.Equal(t, "foo", creds.Username) + assert.Equal(t, "bar", creds.Password) +} + +func ExampleKuzzle_UpdateMyCredentials() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + type credentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + myCredentials := credentials{"foo", "bar"} + + _, err := k.Auth.Login("local", myCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + newCredentials := credentials{"foo", "new"} + res, err := k.Auth.UpdateMyCredentials("local", newCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} diff --git a/auth/validate_my_credentials.go b/auth/validate_my_credentials.go new file mode 100644 index 00000000..0d7efb9a --- /dev/null +++ b/auth/validate_my_credentials.go @@ -0,0 +1,32 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// ValidateMyCredentials validate credentials of the specified strategy for the current user. +func (a *Auth) ValidateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (bool, error) { + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "validateMyCredentials", + Strategy: strategy, + Body: credentials, + } + + go a.k.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return false, res.Error + } + + var r bool + json.Unmarshal(res.Result, &r) + + return r, nil +} diff --git a/auth/validate_my_credentials_test.go b/auth/validate_my_credentials_test.go new file mode 100644 index 00000000..9b7962dc --- /dev/null +++ b/auth/validate_my_credentials_test.go @@ -0,0 +1,81 @@ +package auth_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestValidateMyCredentialsQueryError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "validateMyCredentials", request.Action) + assert.Equal(t, "local", request.Strategy) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Auth.ValidateMyCredentials("local", nil, nil) + assert.NotNil(t, err) +} + +func TestValidateMyCredentials(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "validateMyCredentials", request.Action) + assert.Equal(t, "local", request.Strategy) + assert.Equal(t, "foo", request.Body.(map[string]interface{})["username"]) + assert.Equal(t, "bar", request.Body.(map[string]interface{})["password"]) + + ret, _ := json.Marshal(true) + return &types.KuzzleResponse{Result: ret} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Auth.ValidateMyCredentials("local", struct { + Username string `json:"username"` + Password string `json:"password"` + }{"foo", "bar"}, nil) + assert.Nil(t, err) + + assert.Equal(t, true, res) +} + +func ExampleKuzzle_ValidateMyCredentials() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + type credentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + myCredentials := credentials{"foo", "bar"} + + _, err := k.Auth.Login("local", myCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + res, err := k.Auth.ValidateMyCredentials("local", myCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res) +} From db1f2f5f5983ee2ead305e8d9d713d72d20cda7b Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 6 Mar 2018 17:04:13 +0100 Subject: [PATCH 043/363] auth.UpdateSelf --- auth/logout.go | 26 ++++++++ auth/logout_test.go | 71 +++++++++++++++++++++ auth/update_self.go | 47 ++++++++++++++ {security => auth}/update_self_test.go | 18 ++---- internal/wrappers/cgo/kuzzle/auth.go | 14 ++-- internal/wrappers/cgo/kuzzle/destructors.go | 2 +- internal/wrappers/cgo/kuzzle/go_to_c.go | 2 +- internal/wrappers/cpp/auth.cpp | 9 +++ internal/wrappers/cpp/kuzzle.cpp | 9 --- internal/wrappers/headers/auth.hpp | 1 + internal/wrappers/headers/kuzzle.hpp | 1 - internal/wrappers/headers/kuzzlesdk.h | 2 +- kuzzle/update_self.go | 11 ---- security/update_self.go | 50 --------------- security/user.go | 1 + 15 files changed, 168 insertions(+), 96 deletions(-) create mode 100644 auth/logout.go create mode 100644 auth/logout_test.go create mode 100644 auth/update_self.go rename {security => auth}/update_self_test.go (81%) delete mode 100644 kuzzle/update_self.go delete mode 100644 security/update_self.go diff --git a/auth/logout.go b/auth/logout.go new file mode 100644 index 00000000..aa6936f3 --- /dev/null +++ b/auth/logout.go @@ -0,0 +1,26 @@ +package auth + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// Logout logs the user out. +func (a *Auth) Logout() error { + q := &types.KuzzleRequest{ + Controller: "auth", + Action: "logout", + } + result := make(chan *types.KuzzleResponse) + + go a.k.Query(q, nil, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + + a.k.SetJwt("") + + return nil +} diff --git a/auth/logout_test.go b/auth/logout_test.go new file mode 100644 index 00000000..6243dc2d --- /dev/null +++ b/auth/logout_test.go @@ -0,0 +1,71 @@ +package auth_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestLogoutError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "logout", request.Action) + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + error := k.Auth.Logout() + assert.NotNil(t, error) +} + +func TestLogout(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + + assert.Equal(t, "auth", request.Controller) + assert.Equal(t, "logout", request.Action) + + return &types.KuzzleResponse{} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + error := k.Auth.Logout() + assert.Nil(t, error) +} + +func ExampleKuzzle_Logout() { + conn := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + + type credentials struct { + Username string `json:"username"` + Password string `json:"password"` + } + + myCredentials := credentials{"foo", "bar"} + + _, err := k.Auth.Login("local", myCredentials, nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + err = k.Auth.Logout() + if err != nil { + fmt.Println(err) + } +} diff --git a/auth/update_self.go b/auth/update_self.go new file mode 100644 index 00000000..13c5840f --- /dev/null +++ b/auth/update_self.go @@ -0,0 +1,47 @@ +package auth + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/security" + "github.com/kuzzleio/sdk-go/types" +) + +//UpdateSelf updates the current User object in Kuzzle's database layer. +func (a *Auth) UpdateSelf(data json.RawMessage, options types.QueryOptions) (*security.User, error) { + if options == nil { + options = types.NewQueryOptions() + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "auth", + Action: "updateSelf", + Body: data, + } + go a.k.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + type jsonUser struct { + Id string `json:"_id"` + Source json.RawMessage `json:"_source"` + ProfileIds []string `json:"profileIds"` + } + u := &jsonUser{} + json.Unmarshal(res.Result, u) + + var content map[string]interface{} + json.Unmarshal(u.Source, &content) + user := &security.User{ + Id: u.Id, + Content: content, + ProfileIds: u.ProfileIds, + } + return user, nil +} diff --git a/security/update_self_test.go b/auth/update_self_test.go similarity index 81% rename from security/update_self_test.go rename to auth/update_self_test.go index 56f32a26..b70b9c29 100644 --- a/security/update_self_test.go +++ b/auth/update_self_test.go @@ -1,4 +1,4 @@ -package security_test +package auth_test import ( "encoding/json" @@ -19,7 +19,7 @@ func TestUpdateSelfQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.UpdateSelf(nil, nil) + _, err := k.Auth.UpdateSelf(nil, nil) assert.NotNil(t, err) } @@ -31,8 +31,6 @@ func TestUpdateSelf(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "updateSelf", request.Action) - assert.Equal(t, "foo", request.Body.(map[string]interface{})["username"]) - return &types.KuzzleResponse{Result: []byte(`{ "_id": "login", "_source": { @@ -42,11 +40,7 @@ func TestUpdateSelf(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.UpdateSelf(&types.UserData{ - Content: map[string]interface{}{ - "username": "foo", - }, - }, nil) + res, _ := k.Auth.UpdateSelf(json.RawMessage("{\"foo\":\"bar\"}"), nil) assert.Equal(t, "login", res.Id) } @@ -67,11 +61,7 @@ func ExampleKuzzle_UpdateSelf() { return } - res, err := k.UpdateSelf(&types.UserData{ - Content: map[string]interface{}{ - "foo": "bar", - }, - }, nil) + res, _ := k.Auth.UpdateSelf(json.RawMessage("{\"foo\":\"bar\"}"), nil) if err != nil { fmt.Println(err.Error()) return diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index d3654ecd..bdcfe220 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -11,6 +11,7 @@ package main */ import "C" import ( + "encoding/json" "unsafe" "github.com/kuzzleio/sdk-go/auth" @@ -158,17 +159,14 @@ func kuzzle_update_my_credentials(a *C.auth, strategy *C.char, credentials *C.js } //export kuzzle_update_self -func kuzzle_update_self(k *C.kuzzle, data *C.user_data, options *C.query_options) *C.json_result { - userData, err := cToGoUserData(data) - if err != nil { - return goToCJsonResult(nil, err) - } +func kuzzle_update_self(a *C.auth, data *C.char, options *C.query_options) *C.user_result { + marshed, _ := json.Marshal(C.GoString(data)) - res, err := (*kuzzle.Kuzzle)(k.instance).UpdateSelf( - userData, + res, err := (*auth.Auth)(a.instance).UpdateSelf( + marshed, SetQueryOptions(options)) - return goToCJsonResult(res, err) + return goToCUserResult(a.kuzzle, res, err) } //export kuzzle_validate_my_credentials diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 4d8779c8..2f770926 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -386,7 +386,7 @@ func kuzzle_free_user_rights_result(st *C.user_rights_result) { //export kuzzle_free_user_result func kuzzle_free_user_result(st *C.user_result) { if st != nil { - kuzzle_free_user(st.user) + kuzzle_free_user(st.result) C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) C.free(unsafe.Pointer(st)) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 1cad648e..e63c3f6e 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -733,7 +733,7 @@ func goToCUserResult(k *C.kuzzle, user *security.User, err error) *C.user_result return result } - result.user = cuser + result.result = cuser return result } diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 0b8fa017..0eea920a 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -109,6 +109,15 @@ namespace kuzzleio { return ret; } + user* Auth::updateSelf(const std::string& content, query_options* options) Kuz_Throw_KuzzleException { + user_result *r = kuzzle_update_self(_auth, const_cast(content.c_str()), options); + if (r->error != NULL) + throwExceptionFromStatus(r); + user *ret = r->result; + kuzzle_free_user_result(r); + return ret; + } + bool Auth::validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_validate_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); if (r->error != NULL) diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 4684cce4..517d5401 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -113,15 +113,6 @@ namespace kuzzleio { return this; } - json_object* Kuzzle::updateSelf(user_data* content, query_options* options) Kuz_Throw_KuzzleException { - json_result *r = kuzzle_update_self(_kuzzle, content, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - json_object* ret = r->result; - delete(r); - return ret; - } - Kuzzle* Kuzzle::flushQueue() { kuzzle_flush_queue(_kuzzle); return this; diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index 8426195e..5e25a996 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -24,6 +24,7 @@ namespace kuzzleio { std::string login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException; void logout(); std::string updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options=NULL) Kuz_Throw_KuzzleException; + user* updateSelf(const std::string& content, query_options* options=NULL) Kuz_Throw_KuzzleException; bool validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 9e88be56..24fee8bd 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -40,7 +40,6 @@ namespace kuzzleio { Kuzzle* setDefaultIndex(const std::string& index); Kuzzle* startQueuing(); Kuzzle* stopQueuing(); - json_object* updateSelf(user_data* content, query_options* options=NULL) Kuz_Throw_KuzzleException; Kuzzle* flushQueue(); json_object* getVolatile(); Kuzzle* setVolatile(json_object* volatiles); diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 12edf3e5..e9d9699a 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -322,7 +322,7 @@ typedef struct user_rights_result { } user_rights_result; typedef struct user_result { - user *user; + user *result; int status; char *error; char *stack; diff --git a/kuzzle/update_self.go b/kuzzle/update_self.go deleted file mode 100644 index 15da6857..00000000 --- a/kuzzle/update_self.go +++ /dev/null @@ -1,11 +0,0 @@ -package kuzzle - -import ( - "github.com/kuzzleio/sdk-go/security" - "github.com/kuzzleio/sdk-go/types" -) - -// UpdateSelf update the currently authenticated user information. -func (k *Kuzzle) UpdateSelf(content *types.UserData, options types.QueryOptions) (*security.User, error) { - return k.Security.UpdateSelf(content, options) -} diff --git a/security/update_self.go b/security/update_self.go deleted file mode 100644 index 1b669b68..00000000 --- a/security/update_self.go +++ /dev/null @@ -1,50 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) UpdateSelf(data *types.UserData, options types.QueryOptions) (*User, error) { - // using a dummy user is marginally helpful - u := &User{ - Security: s, - } - - if data != nil { - u.Content = data.Content - u.ProfileIds = data.ProfileIds - } - - body := u.getFlatBody() - - if options == nil { - options = types.NewQueryOptions() - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "auth", - Action: "updateSelf", - Body: body, - } - go s.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - jsonUser := &jsonUser{} - json.Unmarshal(res.Result, jsonUser) - - updatedUser := u.Security.jsonUserToUser(jsonUser) - - u.Id = updatedUser.Id - u.Content = updatedUser.Content - u.ProfileIds = updatedUser.ProfileIds - - return u, nil -} diff --git a/security/user.go b/security/user.go index a89dbe98..78a3e440 100644 --- a/security/user.go +++ b/security/user.go @@ -3,6 +3,7 @@ package security import ( "encoding/json" "errors" + "github.com/kuzzleio/sdk-go/types" ) From 3d4011c8f611eefd1457e6a6a3333e9195603a0b Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 6 Mar 2018 18:12:10 +0100 Subject: [PATCH 044/363] Functions refactored --- document/count.go | 43 +++++ document/count_test.go | 1 + document/create.go | 56 +++++++ document/createOrReplace.go | 56 +++++++ document/createOrReplace_test.go | 1 + document/create_test.go | 86 ++++++++++ document/delete.go | 51 ++++++ document/deleteByQuery.go | 52 ++++++ document/deleteByQuery_test.go | 1 + document/delete_test.go | 1 + document/document.go | 270 +----------------------------- document/exists.go | 44 +++++ document/exists_test.go | 1 + document/get.go | 44 +++++ document/get_test.go | 1 + document/mCreate.go | 51 ++++++ document/mCreateOrReplace.go | 51 ++++++ document/mCreateOrReplace_test.go | 1 + document/mCreate_test.go | 1 + document/mDelete.go | 51 ++++++ document/mDelete_test.go | 1 + document/mGet.go | 49 ++++++ document/mGet_test.go | 1 + document/mReplace.go | 52 ++++++ document/mReplace_test.go | 1 + document/mUpdate.go | 52 ++++++ document/mUpdate_test.go | 1 + document/replace.go | 57 +++++++ document/replace_test.go | 1 + document/search.go | 55 ++++++ document/search_test.go | 1 + document/update.go | 57 +++++++ document/update_test.go | 1 + document/validate.go | 44 +++++ document/validate_test.go | 1 + 35 files changed, 974 insertions(+), 263 deletions(-) diff --git a/document/count.go b/document/count.go index e69de29b..e34c2b39 100644 --- a/document/count.go +++ b/document/count.go @@ -0,0 +1,43 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) Count(index string, collection string, body string) (int, error) { + if index == "" { + return 0, types.NewError("Document.Count: index required", 400) + } + + if collection == "" { + return 0, types.NewError("Document.Count: collection required", 400) + } + + if body == "" { + return 0, types.NewError("Document.Count: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "document", + Action: "count", + Body: body, + } + go d.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return 0, res.Error + } + + var count int + json.Unmarshal(res.Result, &count) + + return count, nil +} diff --git a/document/count_test.go b/document/count_test.go index e69de29b..f2a4ffe5 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/create.go b/document/create.go index e69de29b..8c6575c9 100644 --- a/document/create.go +++ b/document/create.go @@ -0,0 +1,56 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) Create(index string, collection string, _id string, body string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.Create: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.Create: collection required", 400) + } + + if _id == "" { + return "", types.NewError("Document.Create: id required", 400) + } + + if body == "" { + return "", types.NewError("Document.Create: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "create", + Id: _id, + Body: body, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(&options.Volatile) + queryOpts.SetRefresh(&options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var created string + json.Unmarshal(res.Result, &created) + + return created, nil +} diff --git a/document/createOrReplace.go b/document/createOrReplace.go index e69de29b..605798e4 100644 --- a/document/createOrReplace.go +++ b/document/createOrReplace.go @@ -0,0 +1,56 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) CreateOrReplace(index string, collection string, _id string, body string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.CreateOrReplace: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.CreateOrReplace: collection required", 400) + } + + if _id == "" { + return "", types.NewError("Document.CreateOrReplace: id required", 400) + } + + if body == "" { + return "", types.NewError("Document.CreateOrReplace: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "createOrReplace", + Id: _id, + Body: body, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var created string + json.Unmarshal(res.Result, &created) + + return created, nil +} diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go index e69de29b..f2a4ffe5 100644 --- a/document/createOrReplace_test.go +++ b/document/createOrReplace_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/create_test.go b/document/create_test.go index e69de29b..78b80fef 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -0,0 +1,86 @@ +package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + d.Create("", "collection", "id1", "body", opts) + assert.NotNil(t, err) +} + +func TestCreateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + d.Create("index", "", "id1", "body", opts) + assert.NotNil(t, err) +} + +func TestCreateIdNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + d.Create("index", "collection", "", "body", opts) + assert.NotNil(t, err) +} + +func TestCreateBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + d.Create("index", "collection", "id1", "", opts) + assert.NotNil(t, err) +} + +func TestCreateDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + d.Create("index", "collection", "id1", "", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestCreateDocument(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "create", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "myId", + "_version": 1, + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + d.Create("index", "collection", id, "body", opts) + assert.Equal(t, id, res.Id) +} diff --git a/document/delete.go b/document/delete.go index e69de29b..9d6cb683 100644 --- a/document/delete.go +++ b/document/delete.go @@ -0,0 +1,51 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) Delete(index string, collection string, _id string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.Delete: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.Delete: collection required", 400) + } + + if _id == "" { + return "", types.NewError("Document.Delete: id required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "delete", + Id: _id, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var deleted string + json.Unmarshal(res.Result, &deleted) + + return deleted, nil +} diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go index e69de29b..055ffb0f 100644 --- a/document/deleteByQuery.go +++ b/document/deleteByQuery.go @@ -0,0 +1,52 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) DeleteByQuery(index string, collection string, body string, options *DocumentOptions) ([]string, error) { + if index == "" { + return nil, types.NewError("Document.MCreate: index required", 400) + } + + if collection == "" { + return nil, types.NewError("Document.MCreate: collection required", 400) + } + + if body == "" { + return nil, types.NewError("Document.MCreate: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "deleteByQuery", + Body: body, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var deleted []string + json.Unmarshal(res.Result, &deleted) + + return deleted, nil + +} diff --git a/document/deleteByQuery_test.go b/document/deleteByQuery_test.go index e69de29b..f2a4ffe5 100644 --- a/document/deleteByQuery_test.go +++ b/document/deleteByQuery_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/delete_test.go b/document/delete_test.go index e69de29b..f2a4ffe5 100644 --- a/document/delete_test.go +++ b/document/delete_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/document.go b/document/document.go index 34226ace..3f27b7f5 100644 --- a/document/document.go +++ b/document/document.go @@ -1,276 +1,20 @@ package document import ( - "encoding/json" - "strconv" - - "github.com/kuzzleio/sdk-go/types" + "github.com/kuzzleio/sdk-go/kuzzle" ) -type IDocument interface { - Save() - Refresh() - SetContent() - Publish() - Exists() - Delete() -} - type Document struct { - Id string `json:"_id"` - Index string `json:"_index"` - Meta *types.Meta `json:"_meta"` - Shards *types.Shards `json:"_shards"` - Content json.RawMessage `json:"_source"` - Version int `json:"_version"` - Result string `json:"result"` - Created bool `json:"created"` - Collection string `json:"_collection"` - collection *Collection `json:"-"` + Kuzzle *kuzzle.Kuzzle } -type DocumentContent map[string]interface{} - -/* - * Instanciate a new document - */ -func NewDocument(col *Collection, id string) *Document { +func NewDocument(kuzzle *kuzzle.Kuzzle) *Document { return &Document{ - collection: col, - Id: id, - Collection: col.collection, - Index: col.index, - } -} - -func (documentContent *DocumentContent) ToString() string { - s, _ := json.Marshal(documentContent) - - return string(s) -} - -func (d *Document) SourceToMap() DocumentContent { - sourceMap := DocumentContent{} - - json.Unmarshal(d.Content, &sourceMap) - - return sourceMap -} - -// Subscribe listens to events concerning this document. Has no effect if the document does not have an ID -// (i.e. if the document has not yet been created as a persisted document). -func (d *Document) Subscribe(options types.RoomOptions, ch chan<- types.KuzzleNotification) (*Room, error) { - if d.Id == "" { - return nil, types.NewError("Document.Subscribe: cannot subscribe to a document if no ID has been provided", 400) + Kuzzle: kuzzle, } - - filters := map[string]map[string][]string{ - "ids": { - "values": []string{d.Id}, - }, - } - - return d.collection.Subscribe(filters, options, ch), nil } -/* - Saves the document into Kuzzle. - - If this is a new document, will create it in Kuzzle and the id property will be made available. - Otherwise, will replace the latest version of the document in Kuzzle by the current content of this object. -*/ -func (d *Document) Save(options types.QueryOptions) (*Document, error) { - if d.Id == "" { - return d, types.NewError("Document.Save: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "createOrReplace", - Id: d.Id, - Body: d.Content, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return d, res.Error - } - - return d, nil -} - -/* - Replaces the document with the latest version stored in Kuzzle. -*/ -func (d *Document) Refresh(options types.QueryOptions) (*Document, error) { - if d.Id == "" { - return d, types.NewError("Document.Refresh: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "get", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - if res.Error != nil { - return d, res.Error - } - - json.Unmarshal(res.Result, d) - - return d, nil -} - -/* - Sets the document id. -*/ -func (d *Document) SetDocumentId(id string) *Document { - if id != "" { - d.Id = id - } - - return d -} - -/* - Replaces the current document content with provided data. - Changes made by this function won’t be applied until the save method is called. - If replace is set to true, the entire content will be replaced, otherwise, only existing and new fields will be impacted. -*/ -func (d *Document) SetContent(content DocumentContent, replace bool) *Document { - if replace { - d.Content, _ = json.Marshal(content) - } else { - source := DocumentContent{} - json.Unmarshal(d.Content, &source) - - for attr, value := range content { - if source[attr] == nil { - source[attr] = value - } - } - - d.Content, _ = json.Marshal(source) - } - - return d -} - -/* - Sends the content of the document as a realtime message. -*/ -func (d *Document) Publish(options types.QueryOptions) (bool, error) { - ch := make(chan *types.KuzzleResponse) - - type message struct { - Id string `json:"_id,omitempty"` - Version int `json:"_version,omitempty"` - Body json.RawMessage `json:"body"` - Meta *types.Meta `json:"meta"` - } - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "realtime", - Action: "publish", - Body: message{ - Id: d.Id, - Version: d.Version, - Body: d.Content, - Meta: d.Meta, - }, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - response := types.RealtimeResponse{} - - json.Unmarshal(res.Result, &response) - - return response.Published, nil -} - -/* - Checks if the document exists in Kuzzle. -*/ -func (d *Document) Exists(options types.QueryOptions) (bool, error) { - if d.Id == "" { - return false, types.NewError("Document.Exists: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "exists", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return false, res.Error - } - - exists, _ := strconv.ParseBool(string(res.Result)) - - return exists, nil -} - -/* - Deletes the document in Kuzzle. -*/ -func (d *Document) Delete(options types.QueryOptions) (string, error) { - if d.Id == "" { - return "", types.NewError("Document.Delete: missing document id", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Index: d.collection.index, - Collection: d.collection.collection, - Controller: "document", - Action: "delete", - Id: d.Id, - } - - go d.collection.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", res.Error - } - - document := Document{collection: d.collection} - json.Unmarshal(res.Result, &document) - - return document.Id, nil +type DocumentOptions struct { + Volatile string + WaitFor bool } diff --git a/document/exists.go b/document/exists.go index e69de29b..486e5554 100644 --- a/document/exists.go +++ b/document/exists.go @@ -0,0 +1,44 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) Exists(index string, collection string, _id string) (bool, error) { + if index == "" { + return false, types.NewError("Document.Exists: index required", 400) + } + + if collection == "" { + return false, types.NewError("Document.Exists: collection required", 400) + } + + if _id == "" { + return false, types.NewError("Document.Exists: id required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "exists", + Id: _id, + } + + go d.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return false, res.Error + } + + var exists bool + json.Unmarshal(res.Result, &exists) + + return exists, nil +} diff --git a/document/exists_test.go b/document/exists_test.go index e69de29b..f2a4ffe5 100644 --- a/document/exists_test.go +++ b/document/exists_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/get.go b/document/get.go index e69de29b..4a23eaf5 100644 --- a/document/get.go +++ b/document/get.go @@ -0,0 +1,44 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) Get(index string, collection string, _id string) (string, error) { + if index == "" { + return "", types.NewError("Document.Get: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.Get: collection required", 400) + } + + if _id == "" { + return "", types.NewError("Document.Get: id required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "get", + Id: _id, + } + + go d.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var doc string + json.Unmarshal(res.Result, &doc) + + return doc, nil +} diff --git a/document/get_test.go b/document/get_test.go index e69de29b..f2a4ffe5 100644 --- a/document/get_test.go +++ b/document/get_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/mCreate.go b/document/mCreate.go index e69de29b..de1e31e7 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -0,0 +1,51 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) MCreate(index string, collection string, body string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.MCreate: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.MCreate: collection required", 400) + } + + if body == "" { + return "", types.NewError("Document.MCreate: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "mCreate", + Body: body, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var mCreated string + json.Unmarshal(res.Result, &mCreated) + + return mCreated, nil +} diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index e69de29b..64042794 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -0,0 +1,51 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) MCreateOrReplace(index string, collection string, body string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.MCreateOrReplace: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.MCreateOrReplace: collection required", 400) + } + + if body == "" { + return "", types.NewError("Document.MCreateOrReplace: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "mCreateOrReplace", + Body: body, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var mCreated string + json.Unmarshal(res.Result, &mCreated) + + return mCreated, nil +} diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index e69de29b..f2a4ffe5 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/mCreate_test.go b/document/mCreate_test.go index e69de29b..f2a4ffe5 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/mDelete.go b/document/mDelete.go index e69de29b..c826ad25 100644 --- a/document/mDelete.go +++ b/document/mDelete.go @@ -0,0 +1,51 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) MDelete(index string, collection string, ids []string, options *DocumentOptions) ([]string, error) { + if index == "" { + return nil, types.NewError("Document.MDelete: index required", 400) + } + + if collection == "" { + return nil, types.NewError("Document.MDelete: collection required", 400) + } + + if len(ids) == 0 { + return nil, types.NewError("Document.MDelete: ids filled array required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "mDelete", + Body: ids, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var mDeleted []string + json.Unmarshal(res.Result, &mDeleted) + + return mDeleted, nil +} diff --git a/document/mDelete_test.go b/document/mDelete_test.go index e69de29b..f2a4ffe5 100644 --- a/document/mDelete_test.go +++ b/document/mDelete_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/mGet.go b/document/mGet.go index e69de29b..99b86913 100644 --- a/document/mGet.go +++ b/document/mGet.go @@ -0,0 +1,49 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) MGet(index string, collection string, ids []string, includeTrash bool) (string, error) { + if index == "" { + return "", types.NewError("Document.MGet: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.MGet: collection required", 400) + } + + if len(ids) == 0 { + return "", types.NewError("Document.MGet: ids filled array required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + type body struct { + Ids []string `json:"ids"` + IncludeTrash bool `json:"includeTrash"` + } + + query := &types.KuzzleRequest{ + Index: index, + Collection: collection, + Controller: "document", + Action: "mGet", + Body: &body{Ids: ids, IncludeTrash: includeTrash}, + } + + go d.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var docs string + json.Unmarshal(res.Result, &docs) + + return docs, nil +} diff --git a/document/mGet_test.go b/document/mGet_test.go index e69de29b..f2a4ffe5 100644 --- a/document/mGet_test.go +++ b/document/mGet_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/mReplace.go b/document/mReplace.go index e69de29b..08826fbb 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -0,0 +1,52 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// MReplaceDocument mReplaces a document in Kuzzle. +func (d *Document) MReplace(index string, collection string, body string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.MReplace: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.MReplace: collection required", 400) + } + + if body == "" { + return "", types.NewError("Document.MReplace: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "document", + Action: "mReplace", + Body: body, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var mReplaced string + json.Unmarshal(res.Result, &mReplaced) + + return mReplaced, nil +} diff --git a/document/mReplace_test.go b/document/mReplace_test.go index e69de29b..f2a4ffe5 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/mUpdate.go b/document/mUpdate.go index e69de29b..82231f5e 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -0,0 +1,52 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// MUpdateDocument mUpdates a document in Kuzzle. +func (d *Document) MUpdate(index string, collection string, body string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.MUpdate: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.MUpdate: collection required", 400) + } + + if body == "" { + return "", types.NewError("Document.MUpdate: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "document", + Action: "mUpdate", + Body: body, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var mUpdated string + json.Unmarshal(res.Result, &mUpdated) + + return mUpdated, nil +} diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index e69de29b..f2a4ffe5 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/replace.go b/document/replace.go index e69de29b..03b703fd 100644 --- a/document/replace.go +++ b/document/replace.go @@ -0,0 +1,57 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// ReplaceDocument replaces a document in Kuzzle. +func (d *Document) Replace(index string, collection string, _id string, body string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.Replace: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.Replace: collection required", 400) + } + + if _id == "" { + return "", types.NewError("Document.Replace: id required", 400) + } + + if body == "" { + return "", types.NewError("Document.Replace: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "document", + Action: "replace", + Body: body, + Id: _id, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var replaced string + json.Unmarshal(res.Result, &replaced) + + return replaced, nil +} diff --git a/document/replace_test.go b/document/replace_test.go index e69de29b..f2a4ffe5 100644 --- a/document/replace_test.go +++ b/document/replace_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/search.go b/document/search.go index e69de29b..b61ca40f 100644 --- a/document/search.go +++ b/document/search.go @@ -0,0 +1,55 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// Search documents in the given Collection, using provided filters and option. +func (d *Document) Search(index string, collection string, body string, options *types.SearchOptions) (*types.SearchResult, error) { + if index == "" { + return nil, types.NewError("Document.Search: index required", 400) + } + + if collection == "" { + return nil, types.NewError("Document.Search: collection required", 400) + } + + if body == "" { + return nil, types.NewError("Document.Search: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "document", + Action: "search", + Body: body, + } + + if options != nil { + query.From = options.From() + query.Size = options.Size() + + scroll := options.Scroll() + if scroll != "" { + query.Scroll = scroll + } + } + + go d.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + sr := &types.SearchResult{} + json.Unmarshal(res.Result, &sr) + + return sr, nil +} diff --git a/document/search_test.go b/document/search_test.go index e69de29b..f2a4ffe5 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/update.go b/document/update.go index e69de29b..cf9b194a 100644 --- a/document/update.go +++ b/document/update.go @@ -0,0 +1,57 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// UpdateDocument updates a document in Kuzzle. +func (d *Document) Update(index string, collection string, _id string, body string, options *DocumentOptions) (string, error) { + if index == "" { + return "", types.NewError("Document.Update: index required", 400) + } + + if collection == "" { + return "", types.NewError("Document.Update: collection required", 400) + } + + if _id == "" { + return "", types.NewError("Document.Update: id required", 400) + } + + if body == "" { + return "", types.NewError("Document.Update: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "document", + Action: "update", + Body: body, + Id: _id, + } + + queryOpts := types.NewQueryOptions() + + if options != nil { + queryOpts.SetVolatile(options.Volatile) + queryOpts.SetRefresh(options.WaitFor) + } + + go d.Kuzzle.Query(query, queryOpts, ch) + + res := <-ch + + if res.Error != nil { + return "", res.Error + } + + var updated string + json.Unmarshal(res.Result, &updated) + + return updated, nil +} diff --git a/document/update_test.go b/document/update_test.go index e69de29b..f2a4ffe5 100644 --- a/document/update_test.go +++ b/document/update_test.go @@ -0,0 +1 @@ +package document_test diff --git a/document/validate.go b/document/validate.go index e69de29b..1b7e4e79 100644 --- a/document/validate.go +++ b/document/validate.go @@ -0,0 +1,44 @@ +package document + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (d *Document) Validate(index string, collection string, body string) (bool, error) { + if index == "" { + return false, types.NewError("Document.Validate: index required", 400) + } + + if collection == "" { + return false, types.NewError("Document.Validate: collection required", 400) + } + + if body == "" { + return false, types.NewError("Document.Validate: body required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Collection: collection, + Index: index, + Controller: "document", + Action: "validate", + Body: body, + } + + go d.Kuzzle.Query(query, nil, ch) + + res := <-ch + + if res.Error != nil { + return false, res.Error + } + + var valid bool + json.Unmarshal(res.Result.valid, &valid) + + return valid, nil +} diff --git a/document/validate_test.go b/document/validate_test.go index e69de29b..f2a4ffe5 100644 --- a/document/validate_test.go +++ b/document/validate_test.go @@ -0,0 +1 @@ +package document_test From eccbc623b817bcf26f73abdbce5200932565db79 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 7 Mar 2018 12:50:20 +0100 Subject: [PATCH 045/363] All tests Ok --- document/count.go | 7 +- document/count_test.go | 66 +++++++++++++++++++ document/create.go | 4 +- document/createOrReplace.go | 4 +- document/createOrReplace_test.go | 86 ++++++++++++++++++++++++ document/create_test.go | 25 +++---- document/delete.go | 4 +- document/deleteByQuery.go | 4 +- document/deleteByQuery_test.go | 75 +++++++++++++++++++++ document/delete_test.go | 77 ++++++++++++++++++++++ document/exists_test.go | 69 ++++++++++++++++++++ document/get_test.go | 84 ++++++++++++++++++++++++ document/mCreate.go | 4 +- document/mCreateOrReplace.go | 4 +- document/mCreateOrReplace_test.go | 100 ++++++++++++++++++++++++++++ document/mCreate_test.go | 100 ++++++++++++++++++++++++++++ document/mDelete.go | 6 +- document/mDelete_test.go | 84 ++++++++++++++++++++++++ document/mGet_test.go | 105 ++++++++++++++++++++++++++++++ document/mReplace.go | 4 +- document/mReplace_test.go | 101 ++++++++++++++++++++++++++++ document/mUpdate.go | 4 +- document/mUpdate_test.go | 101 ++++++++++++++++++++++++++++ document/replace.go | 4 +- document/replace_test.go | 87 +++++++++++++++++++++++++ document/search.go | 9 ++- document/search_test.go | 75 +++++++++++++++++++++ document/update.go | 4 +- document/update_test.go | 87 +++++++++++++++++++++++++ document/validate.go | 2 +- document/validate_test.go | 66 +++++++++++++++++++ 31 files changed, 1410 insertions(+), 42 deletions(-) diff --git a/document/count.go b/document/count.go index e34c2b39..ee1fbbe4 100644 --- a/document/count.go +++ b/document/count.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "fmt" "github.com/kuzzleio/sdk-go/types" ) @@ -37,7 +38,11 @@ func (d *Document) Count(index string, collection string, body string) (int, err } var count int - json.Unmarshal(res.Result, &count) + err := json.Unmarshal(res.Result, &count) + + if err != nil { + return 0, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + } return count, nil } diff --git a/document/count_test.go b/document/count_test.go index f2a4ffe5..5fd55c1f 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -1 +1,67 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCountIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Count("", "collection", "body") + assert.NotNil(t, err) +} + +func TestCountCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Count("index", "", "body") + assert.NotNil(t, err) +} + +func TestCountBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Count("index", "collection", "") + assert.NotNil(t, err) +} + +func TestCountDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + _, err := d.Count("index", "collection", "body") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestCountDocument(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "count", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(`1`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + res, err := d.Count("index", "collection", "body") + assert.Nil(t, err) + assert.Equal(t, 1, res) +} diff --git a/document/create.go b/document/create.go index 8c6575c9..4be08653 100644 --- a/document/create.go +++ b/document/create.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -37,8 +38,7 @@ func (d *Document) Create(index string, collection string, _id string, body stri queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(&options.Volatile) - queryOpts.SetRefresh(&options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/createOrReplace.go b/document/createOrReplace.go index 605798e4..add0089f 100644 --- a/document/createOrReplace.go +++ b/document/createOrReplace.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -37,8 +38,7 @@ func (d *Document) CreateOrReplace(index string, collection string, _id string, queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go index f2a4ffe5..1f3a94c6 100644 --- a/document/createOrReplace_test.go +++ b/document/createOrReplace_test.go @@ -1 +1,87 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateOrReplaceIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.CreateOrReplace("", "collection", "id1", "body", opts) + assert.NotNil(t, err) +} + +func TestCreateOrReplaceCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.CreateOrReplace("index", "", "id1", "body", opts) + assert.NotNil(t, err) +} + +func TestCreateOrReplaceIdNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.CreateOrReplace("index", "collection", "", "body", opts) + assert.NotNil(t, err) +} + +func TestCreateOrReplaceBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.CreateOrReplace("index", "collection", "id1", "", opts) + assert.NotNil(t, err) +} + +func TestCreateOrReplaceDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.CreateOrReplace("index", "collection", "id1", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestCreateOrReplaceDocument(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "createOrReplace", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(` + { + "_id": "myId", + "_version": 1, + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.CreateOrReplace("index", "collection", id, "body", opts) + assert.Nil(t, err) +} diff --git a/document/create_test.go b/document/create_test.go index 78b80fef..073c7f33 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -12,34 +12,34 @@ import ( ) func TestCreateIndexNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(c, nil) + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - d.Create("", "collection", "id1", "body", opts) + _, err := d.Create("", "collection", "id1", "body", opts) assert.NotNil(t, err) } func TestCreateCollectionNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(c, nil) + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - d.Create("index", "", "id1", "body", opts) + _, err := d.Create("index", "", "id1", "body", opts) assert.NotNil(t, err) } func TestCreateIdNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(c, nil) + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - d.Create("index", "collection", "", "body", opts) + _, err := d.Create("index", "collection", "", "body", opts) assert.NotNil(t, err) } func TestCreateBodyNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(c, nil) + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - d.Create("index", "collection", "id1", "", opts) + _, err := d.Create("index", "collection", "id1", "", opts) assert.NotNil(t, err) } @@ -52,7 +52,7 @@ func TestCreateDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - d.Create("index", "collection", "id1", "", opts) + _, err := d.Create("index", "collection", "id1", "body", opts) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -71,7 +71,8 @@ func TestCreateDocument(t *testing.T) { assert.Equal(t, "collection", parsedQuery.Collection) assert.Equal(t, id, parsedQuery.Id) - return &types.KuzzleResponse{Result: []byte(`{ + return &types.KuzzleResponse{Result: []byte(` + { "_id": "myId", "_version": 1, }`), @@ -81,6 +82,6 @@ func TestCreateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - d.Create("index", "collection", id, "body", opts) - assert.Equal(t, id, res.Id) + _, err := d.Create("index", "collection", id, "body", opts) + assert.Nil(t, err) } diff --git a/document/delete.go b/document/delete.go index 9d6cb683..6e54e23e 100644 --- a/document/delete.go +++ b/document/delete.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -32,8 +33,7 @@ func (d *Document) Delete(index string, collection string, _id string, options * queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go index 055ffb0f..285e8241 100644 --- a/document/deleteByQuery.go +++ b/document/deleteByQuery.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -32,8 +33,7 @@ func (d *Document) DeleteByQuery(index string, collection string, body string, o queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/deleteByQuery_test.go b/document/deleteByQuery_test.go index f2a4ffe5..3e132a7b 100644 --- a/document/deleteByQuery_test.go +++ b/document/deleteByQuery_test.go @@ -1 +1,76 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestDeleteByQueryIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.DeleteByQuery("", "collection", "body", opts) + assert.NotNil(t, err) +} + +func TestDeleteByQueryCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.DeleteByQuery("index", "", "body", opts) + assert.NotNil(t, err) +} + +func TestDeleteByQueryBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.DeleteByQuery("index", "collection", "", opts) + assert.NotNil(t, err) +} + +func TestDeleteByQueryDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.DeleteByQuery("index", "collection", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestDeleteByQueryDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "deleteByQuery", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(` + { + "hits": ["id1", "id2"] + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.DeleteByQuery("index", "collection", "body", opts) + assert.Nil(t, err) +} diff --git a/document/delete_test.go b/document/delete_test.go index f2a4ffe5..f9665cbf 100644 --- a/document/delete_test.go +++ b/document/delete_test.go @@ -1 +1,78 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestDeleteIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Delete("", "collection", "id1", opts) + assert.NotNil(t, err) +} + +func TestDeleteCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Delete("index", "", "id1", opts) + assert.NotNil(t, err) +} + +func TestDeleteIdNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Delete("index", "collection", "", opts) + assert.NotNil(t, err) +} + +func TestDeleteDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Delete("index", "collection", "id1", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestDeleteDocument(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "delete", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(` + { + "_id": "myId", + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Delete("index", "collection", id, opts) + assert.Nil(t, err) +} diff --git a/document/exists_test.go b/document/exists_test.go index f2a4ffe5..33e3632e 100644 --- a/document/exists_test.go +++ b/document/exists_test.go @@ -1 +1,70 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestExistsIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Exists("", "collection", "id1") + assert.NotNil(t, err) +} + +func TestExistsCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Exists("index", "", "id1") + assert.NotNil(t, err) +} + +func TestExistsIdNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Exists("index", "collection", "") + assert.NotNil(t, err) +} + +func TestExistsDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + _, err := d.Exists("index", "collection", "id1") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestExistsDocument(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "exists", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(`true`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + res, err := d.Exists("index", "collection", id) + assert.Nil(t, err) + assert.Equal(t, true, res) +} diff --git a/document/get_test.go b/document/get_test.go index f2a4ffe5..1c44faa8 100644 --- a/document/get_test.go +++ b/document/get_test.go @@ -1 +1,85 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Get("", "collection", "id1") + assert.NotNil(t, err) +} + +func TestGetCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Get("index", "", "id1") + assert.NotNil(t, err) +} + +func TestGetIdNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Get("index", "collection", "") + assert.NotNil(t, err) +} + +func TestGetDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + _, err := d.Get("index", "collection", "id1") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestGetDocument(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "get", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "myId", + "_index": "index", + "_type": "collection", + "_version": 1, + "_source": { + "name": { + "first": "Steve", + "last": "Wozniak" + }, + "hobby": "Segway polo", + }, + "_meta": { + "author": "Bob", + } + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + _, err := d.Get("index", "collection", id) + assert.Nil(t, err) +} diff --git a/document/mCreate.go b/document/mCreate.go index de1e31e7..414a639b 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -32,8 +33,7 @@ func (d *Document) MCreate(index string, collection string, body string, options queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index 64042794..5b66af12 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -32,8 +33,7 @@ func (d *Document) MCreateOrReplace(index string, collection string, body string queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index f2a4ffe5..4e9afb14 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -1 +1,101 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMCreateOrReplaceIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreateOrReplace("", "collection", "body", opts) + assert.NotNil(t, err) +} + +func TestMCreateOrReplaceCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreateOrReplace("index", "", "body", opts) + assert.NotNil(t, err) +} + +func TestMCreateOrReplaceBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreateOrReplace("index", "collection", "", opts) + assert.NotNil(t, err) +} + +func TestMCreateOrReplaceDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreateOrReplace("index", "collection", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestMCreateOrReplaceDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "mCreateOrReplace", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(`{ + "hits": [ + { + "_id": "id1", + "_index": "index", + "_shards": { + "failed": 0, + "successful": 1, + "total": 2 + }, + "_source": { + "document": "body" + }, + "_meta": { + "active": true, + "author": "-1", + "createdAt": 1484225532686, + "deletedAt": null, + "updatedAt": null, + "updater": null + }, + "_type": "collection", + "_version": 1, + "created": true, + "result": "created" + } + ], + "total": "1" + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreateOrReplace("index", "collection", "body", opts) + assert.Nil(t, err) +} diff --git a/document/mCreate_test.go b/document/mCreate_test.go index f2a4ffe5..40e4dc32 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -1 +1,101 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMCreateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreate("", "collection", "body", opts) + assert.NotNil(t, err) +} + +func TestMCreateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreate("index", "", "body", opts) + assert.NotNil(t, err) +} + +func TestMCreateBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreate("index", "collection", "", opts) + assert.NotNil(t, err) +} + +func TestMCreateDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreate("index", "collection", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestMCreateDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "mCreate", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(`{ + "hits": [ + { + "_id": "id1", + "_index": "index", + "_shards": { + "failed": 0, + "successful": 1, + "total": 2 + }, + "_source": { + "document": "body" + }, + "_meta": { + "active": true, + "author": "-1", + "createdAt": 1484225532686, + "deletedAt": null, + "updatedAt": null, + "updater": null + }, + "_type": "collection", + "_version": 1, + "created": true, + "result": "created" + } + ], + "total": "1" + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MCreate("index", "collection", "body", opts) + assert.Nil(t, err) +} diff --git a/document/mDelete.go b/document/mDelete.go index c826ad25..15e395f6 100644 --- a/document/mDelete.go +++ b/document/mDelete.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -32,8 +33,7 @@ func (d *Document) MDelete(index string, collection string, ids []string, option queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) @@ -41,7 +41,7 @@ func (d *Document) MDelete(index string, collection string, ids []string, option res := <-ch if res.Error != nil { - return "", res.Error + return nil, res.Error } var mDeleted []string diff --git a/document/mDelete_test.go b/document/mDelete_test.go index f2a4ffe5..c3f0a886 100644 --- a/document/mDelete_test.go +++ b/document/mDelete_test.go @@ -1 +1,85 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMDeleteIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string + ids = append(ids, "id1") + _, err := d.MDelete("", "collection", ids, opts) + assert.NotNil(t, err) +} + +func TestMDeleteCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string + ids = append(ids, "id1") + _, err := d.MDelete("index", "", ids, opts) + assert.NotNil(t, err) +} + +func TestMDeleteIdsNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string + _, err := d.MDelete("index", "collection", ids, opts) + assert.NotNil(t, err) +} + +func TestMDeleteDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string + ids = append(ids, "id1") + _, err := d.MDelete("index", "collection", ids, opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestMDeleteDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "mDelete", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(` + { + "ids": ["id1", "id2"] + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string + ids = append(ids, "id1") + _, err := d.MDelete("index", "collection", ids, opts) + assert.Nil(t, err) +} diff --git a/document/mGet_test.go b/document/mGet_test.go index f2a4ffe5..d6ac0536 100644 --- a/document/mGet_test.go +++ b/document/mGet_test.go @@ -1 +1,106 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMGetIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + var ids []string + ids = append(ids, "id1") + _, err := d.MGet("", "collection", ids, true) + assert.NotNil(t, err) +} + +func TestMGetCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + var ids []string + ids = append(ids, "id1") + _, err := d.MGet("index", "", ids, true) + assert.NotNil(t, err) +} + +func TestMGetIdsNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + var ids []string + _, err := d.MGet("index", "collection", ids, true) + assert.NotNil(t, err) +} + +func TestMGetDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + var ids []string + ids = append(ids, "id1") + _, err := d.MGet("index", "collection", ids, true) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestMGetDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "mGet", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(` + { + "hits": [ + { + "_id": "id1", + "_index": "index", + "_shards": { + "failed": 0, + "successful": 1, + "total": 2 + }, + "_source": { + "document": "body" + }, + "_meta": { + "active": true, + "author": "-1", + "createdAt": 1484225532686, + "deletedAt": null, + "updatedAt": null, + "updater": null + }, + "_type": "collection", + "_version": 1, + "created": true, + "result": "created" + } + ], + "total": "1" + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + var ids []string + ids = append(ids, "id1") + _, err := d.MGet("index", "collection", ids, true) + assert.Nil(t, err) +} diff --git a/document/mReplace.go b/document/mReplace.go index 08826fbb..53f4cb90 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -33,8 +34,7 @@ func (d *Document) MReplace(index string, collection string, body string, option queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/mReplace_test.go b/document/mReplace_test.go index f2a4ffe5..4fa83306 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -1 +1,102 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMReplaceIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MReplace("", "collection", "body", opts) + assert.NotNil(t, err) +} + +func TestMReplaceCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MReplace("index", "", "body", opts) + assert.NotNil(t, err) +} + +func TestMReplaceBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MReplace("index", "collection", "", opts) + assert.NotNil(t, err) +} + +func TestMReplaceDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MReplace("index", "collection", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestMReplaceDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "mReplace", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(` + { + "hits": [ + { + "_id": "id1", + "_index": "index", + "_shards": { + "failed": 0, + "successful": 1, + "total": 2 + }, + "_source": { + "document": "body" + }, + "_meta": { + "active": true, + "author": "-1", + "createdAt": 1484225532686, + "deletedAt": null, + "updatedAt": null, + "updater": null + }, + "_type": "collection", + "_version": 1, + "created": true, + "result": "created" + } + ], + "total": "1" + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MReplace("index", "collection", "body", opts) + assert.Nil(t, err) +} diff --git a/document/mUpdate.go b/document/mUpdate.go index 82231f5e..60c52a8b 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -33,8 +34,7 @@ func (d *Document) MUpdate(index string, collection string, body string, options queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index f2a4ffe5..fd713202 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -1 +1,102 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMUpdateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MUpdate("", "collection", "body", opts) + assert.NotNil(t, err) +} + +func TestMUpdateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MUpdate("index", "", "body", opts) + assert.NotNil(t, err) +} + +func TestMUpdateBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MUpdate("index", "collection", "", opts) + assert.NotNil(t, err) +} + +func TestMUpdateDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MUpdate("index", "collection", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestMUpdateDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "mUpdate", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(` + { + "hits": [ + { + "_id": "id1", + "_index": "index", + "_shards": { + "failed": 0, + "successful": 1, + "total": 2 + }, + "_source": { + "document": "body" + }, + "_meta": { + "active": true, + "author": "-1", + "createdAt": 1484225532686, + "deletedAt": null, + "updatedAt": null, + "updater": null + }, + "_type": "collection", + "_version": 1, + "created": true, + "result": "created" + } + ], + "total": "1" + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.MUpdate("index", "collection", "body", opts) + assert.Nil(t, err) +} diff --git a/document/replace.go b/document/replace.go index 03b703fd..30a6e325 100644 --- a/document/replace.go +++ b/document/replace.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -38,8 +39,7 @@ func (d *Document) Replace(index string, collection string, _id string, body str queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/replace_test.go b/document/replace_test.go index f2a4ffe5..8b0843e3 100644 --- a/document/replace_test.go +++ b/document/replace_test.go @@ -1 +1,88 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestReplaceIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Replace("", "collection", "id1", "body", opts) + assert.NotNil(t, err) +} + +func TestReplaceCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Replace("index", "", "id1", "body", opts) + assert.NotNil(t, err) +} + +func TestReplaceIdNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Replace("index", "collection", "", "body", opts) + assert.NotNil(t, err) +} + +func TestReplaceBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Replace("index", "collection", "id1", "", opts) + assert.NotNil(t, err) +} + +func TestReplaceDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Replace("index", "collection", "id1", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestReplaceDocument(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "replace", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(` + { + "_id": "", + "_version": "",// The new version number of this document + "created": false + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Replace("index", "collection", id, "body", opts) + assert.Nil(t, err) +} diff --git a/document/search.go b/document/search.go index b61ca40f..bcb34c46 100644 --- a/document/search.go +++ b/document/search.go @@ -31,16 +31,15 @@ func (d *Document) Search(index string, collection string, body string, options } if options != nil { - query.From = options.From() - query.Size = options.Size() - - scroll := options.Scroll() + query.From = options.From + query.Size = options.Size + scroll := options.Scroll if scroll != "" { query.Scroll = scroll } } - go d.Kuzzle.Query(query, options, ch) + go d.Kuzzle.Query(query, nil, ch) res := <-ch diff --git a/document/search_test.go b/document/search_test.go index f2a4ffe5..69705db6 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -1 +1,76 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestSearchIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := types.NewSearchOptions("all", 2, 4, "1m") + _, err := d.Search("", "collection", "body", opts) + assert.NotNil(t, err) +} + +func TestSearchCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := types.NewSearchOptions("all", 2, 4, "1m") + _, err := d.Search("index", "", "body", opts) + assert.NotNil(t, err) +} + +func TestSearchBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := types.NewSearchOptions("all", 2, 4, "1m") + _, err := d.Search("index", "collection", "", opts) + assert.NotNil(t, err) +} + +func TestSearchDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := types.NewSearchOptions("all", 2, 4, "1m") + _, err := d.Search("index", "collection", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestSearchDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "search", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(` + { + "hits": ["id1", "id2"] + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := types.NewSearchOptions("all", 2, 4, "1m") + _, err := d.Search("index", "collection", "body", opts) + assert.Nil(t, err) +} diff --git a/document/update.go b/document/update.go index cf9b194a..828cee55 100644 --- a/document/update.go +++ b/document/update.go @@ -2,6 +2,7 @@ package document import ( "encoding/json" + "strconv" "github.com/kuzzleio/sdk-go/types" ) @@ -38,8 +39,7 @@ func (d *Document) Update(index string, collection string, _id string, body stri queryOpts := types.NewQueryOptions() if options != nil { - queryOpts.SetVolatile(options.Volatile) - queryOpts.SetRefresh(options.WaitFor) + queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) } go d.Kuzzle.Query(query, queryOpts, ch) diff --git a/document/update_test.go b/document/update_test.go index f2a4ffe5..272bf055 100644 --- a/document/update_test.go +++ b/document/update_test.go @@ -1 +1,88 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Update("", "collection", "id1", "body", opts) + assert.NotNil(t, err) +} + +func TestUpdateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Update("index", "", "id1", "body", opts) + assert.NotNil(t, err) +} + +func TestUpdateIdNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Update("index", "collection", "", "body", opts) + assert.NotNil(t, err) +} + +func TestUpdateBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Update("index", "collection", "id1", "", opts) + assert.NotNil(t, err) +} + +func TestUpdateDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Update("index", "collection", "id1", "body", opts) + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestUpdateDocument(t *testing.T) { + id := "myId" + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "update", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.Equal(t, id, parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(` + { + "_id": "", + "_version": "",// The new version number of this document + "created": false + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + _, err := d.Update("index", "collection", id, "body", opts) + assert.Nil(t, err) +} diff --git a/document/validate.go b/document/validate.go index 1b7e4e79..75e0f19d 100644 --- a/document/validate.go +++ b/document/validate.go @@ -38,7 +38,7 @@ func (d *Document) Validate(index string, collection string, body string) (bool, } var valid bool - json.Unmarshal(res.Result.valid, &valid) + json.Unmarshal(res.Result, &valid) return valid, nil } diff --git a/document/validate_test.go b/document/validate_test.go index f2a4ffe5..45f1ff16 100644 --- a/document/validate_test.go +++ b/document/validate_test.go @@ -1 +1,67 @@ package document_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestValidateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Validate("", "collection", "body") + assert.NotNil(t, err) +} + +func TestValidateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Validate("index", "", "body") + assert.NotNil(t, err) +} + +func TestValidateBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + d := document.NewDocument(k) + _, err := d.Validate("index", "collection", "") + assert.NotNil(t, err) +} + +func TestValidateDocumentError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + _, err := d.Validate("index", "collection", "body") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestValidateDocument(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "document", parsedQuery.Controller) + assert.Equal(t, "validate", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + return &types.KuzzleResponse{Result: []byte(`true`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + d := document.NewDocument(k) + _, err := d.Validate("index", "collection", "body") + assert.Nil(t, err) +} From 2e523a340db87a8ce8cdc1097bb9284afd48148b Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 7 Mar 2018 14:54:09 +0100 Subject: [PATCH 046/363] CGO Done --- internal/wrappers/cgo/kuzzle/c_to_go.go | 8 ++ internal/wrappers/cgo/kuzzle/destructors.go | 47 +------ internal/wrappers/cgo/kuzzle/document.go | 144 ++++++++++++++++++++ internal/wrappers/cgo/kuzzle/errors.go | 9 -- internal/wrappers/headers/kuzzlesdk.h | 27 +--- 5 files changed, 158 insertions(+), 77 deletions(-) create mode 100644 internal/wrappers/cgo/kuzzle/document.go diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index c99f37e9..6e9d75fb 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -11,6 +11,7 @@ import ( "unsafe" "github.com/kuzzleio/sdk-go/collection" + "github.com/kuzzleio/sdk-go/document" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" @@ -274,3 +275,10 @@ func cToGoCollectionListOptions(clo *C.collection_list_options) *collection.List Size: int(clo.size), } } + +func cToGoDocumentOptions(d *C.document_options) *document.DocumentOptions { + return &document.DocumentOptions{ + Volatile: C.GoString(d.volatile_), + WaitFor: bool(d.waitFor), + } +} diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 2331c8ed..18a02c82 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -240,38 +240,13 @@ func kuzzle_free_collection(st *C.collection) { } } -//do not export -func _free_document(st *C.document) { - if st != nil { - C.free(unsafe.Pointer(st.id)) - C.free(unsafe.Pointer(st.index)) - C.free(unsafe.Pointer(st.shards)) - C.free(unsafe.Pointer(st.result)) - C.free(unsafe.Pointer(st.collection)) - - kuzzle_free_json_object(st.content) - - kuzzle_free_meta(st.meta) - kuzzle_free_collection(st._collection) - } -} - //export kuzzle_free_document func kuzzle_free_document(st *C.document) { - _free_document(st) + C.free(unsafe.Pointer(st.instance)) + C.free(unsafe.Pointer(st.kuzzle)) C.free(unsafe.Pointer(st)) } -//export kuzzle_free_document_result -func kuzzle_free_document_result(st *C.document_result) { - if st != nil { - kuzzle_free_document(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - //export kuzzle_free_notification_content func kuzzle_free_notification_content(st *C.notification_content) { if st != nil { @@ -812,21 +787,3 @@ func kuzzle_free_search_users_result(st *C.search_users_result) { C.free(unsafe.Pointer(st)) } } - -//export kuzzle_free_document_array_result -func kuzzle_free_document_array_result(st *C.document_array_result) { - if st != nil { - if st.result != nil { - documents := (*[1<<30 - 1]C.document)(unsafe.Pointer(st.result))[:int(st.result_length):int(st.result_length)] - - for _, document := range documents { - _free_document(&document) - } - - C.free(unsafe.Pointer(st.result)) - } - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st)) - } -} diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go new file mode 100644 index 00000000..fe7822b5 --- /dev/null +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -0,0 +1,144 @@ +package main + +/* + #cgo CFLAGS: -I../../headers + #include "kuzzlesdk.h" + #include "sdk_wrappers_internal.h" +*/ +import "C" +import ( + "unsafe" + + "github.com/kuzzleio/sdk-go/document" + "github.com/kuzzleio/sdk-go/kuzzle" +) + +// map which stores instances to keep references in case the gc passes +var documentInstances map[interface{}]bool + +// register new instance to the instances map +func registerDocument(instance interface{}) { + documentInstances[instance] = true +} + +// unregister an instance from the instances map +//export unregisterDocument +func unregisterDocument(d *C.document) { + delete(documentInstances, (*document.Document)(d.instance)) +} + +//export kuzzle_new_document +func kuzzle_new_document(d *C.document, k *C.kuzzle) { + kuz := (*kuzzle.Kuzzle)(k.instance) + doc := document.NewDocument(kuz) + + if documentInstances == nil { + documentInstances = make(map[interface{}]bool) + } + + d.instance = unsafe.Pointer(doc) + d.kuzzle = k + registerDocument(doc) +} + +//export kuzzle_document_count +func kuzzle_document_count(d *C.document, index *C.char, collection *C.char, body *C.char) *C.int_result { + res, err := (*document.Document)(d.instance).Count(C.GoString(index), C.GoString(collection), C.GoString(body)) + return goToCIntResult(res, err) +} + +//export kuzzle_document_exists +func kuzzle_document_exists(d *C.document, index *C.char, collection *C.char, id *C.char) *C.bool_result { + res, err := (*document.Document)(d.instance).Exists(C.GoString(index), C.GoString(collection), C.GoString(id)) + return goToCBoolResult(res, err) +} + +//export kuzzle_document_create +func kuzzle_document_create(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).Create(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_create_or_replace +func kuzzle_document_create_or_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).CreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_delete +func kuzzle_document_delete(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).Delete(C.GoString(index), C.GoString(collection), C.GoString(id), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_delete_by_query +func kuzzle_document_delete_by_query(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_array_result { + res, err := (*document.Document)(d.instance).DeleteByQuery(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringArrayResult(res, err) +} + +//export kuzzle_document_get +func kuzzle_document_get(d *C.document, index *C.char, collection *C.char, id *C.char) *C.string_result { + res, err := (*document.Document)(d.instance).Get(C.GoString(index), C.GoString(collection), C.GoString(id)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_replace +func kuzzle_document_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).Replace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_update +func kuzzle_document_update(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).Update(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_validate +func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, body *C.char) *C.bool_result { + res, err := (*document.Document)(d.instance).Validate(C.GoString(index), C.GoString(collection), C.GoString(body)) + return goToCBoolResult(res, err) +} + +//export kuzzle_document_search +func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.search_options) *C.search_result { + res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoSearchOptions(options)) + return goToCSearchResult(res, err) +} + +//export kuzzle_document_mcreate +func kuzzle_document_mcreate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).MCreate(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_mcreate_or_replace +func kuzzle_document_mcreate_or_replace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).MCreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_mdelete +func kuzzle_document_mdelete(d *C.document, index *C.char, collection *C.char, ids **C.char, l C.size_t, options *C.document_options) *C.string_array_result { + res, err := (*document.Document)(d.instance).MDelete(C.GoString(index), C.GoString(collection), cToGoStrings(ids, l), cToGoDocumentOptions(options)) + return goToCStringArrayResult(res, err) +} + +//export kuzzle_document_mget +func kuzzle_document_mget(d *C.document, index *C.char, collection *C.char, ids **C.char, l C.size_t, includeTrash C.bool) *C.string_result { + res, err := (*document.Document)(d.instance).MGet(C.GoString(index), C.GoString(collection), cToGoStrings(ids, l), bool(includeTrash)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_mreplace +func kuzzle_document_mreplace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).MReplace(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_document_mupdate +func kuzzle_document_mupdate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_result { + res, err := (*document.Document)(d.instance).MUpdate(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) + return goToCStringResult(&res, err) +} diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index 11d22cf1..f4b9dacd 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -72,11 +72,6 @@ func Set_shards_result_error(s *C.shards_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } -// apply a types.KuzzleError on a document* C struct -func Set_document_error(s *C.document_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - // apply a types.KuzzleError on a search_result* C struct func Set_search_result_error(s *C.search_result, err error) { setErr(&s.status, &s.error, &s.stack, err) @@ -152,10 +147,6 @@ func Set_void_result_error(s *C.void_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } -func Set_document_array_result_error(s *C.document_array_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - func Set_room_result_error(s *C.room_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 49545d02..04f634d4 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -239,32 +239,13 @@ typedef struct { typedef struct { void *instance; - char *id; - char *index; - meta *meta; - shards *shards; - json_object *content; - int version; - char *result; - bool created; - collection *_collection; - char *collection; + kuzzle *kuzzle; } document; -typedef struct document_result { - document *result; - int status; - char *error; - char *stack; -} document_result; - typedef struct { - document *result; - size_t result_length; - int status; - char *error; - char *stack; -} document_array_result; + char *volatile_; + bool waitFor; +} document_options; typedef struct { char *id; From d26b922f177d9a4b237e9ff9cf3139813ca4422d Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 7 Mar 2018 16:04:13 +0100 Subject: [PATCH 047/363] Final commit (#98) --- internal/wrappers/cpp/document.cpp | 207 ++++++++++++++++++++++++ internal/wrappers/headers/document.hpp | 36 +++++ internal/wrappers/kcore.i | 2 + internal/wrappers/templates/java/core.i | 2 + test.sh | 2 +- 5 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 internal/wrappers/cpp/document.cpp create mode 100644 internal/wrappers/headers/document.hpp diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp new file mode 100644 index 00000000..bea75fa5 --- /dev/null +++ b/internal/wrappers/cpp/document.cpp @@ -0,0 +1,207 @@ +#include "kuzzle.hpp" +#include "document.hpp" + +namespace kuzzleio { + Document::Document(Kuzzle* kuzzle) { + _document = new document(); + kuzzle_new_document(_document, kuzzle->_kuzzle); + } + + Document::~Document() { + unregisterDocument(_document); + kuzzle_free_document(_document); + } + + int Document::count_(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { + int_result *r = kuzzle_document_count(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + int ret = r->result; + kuzzle_free_int_result(r); + return ret; + } + + bool Document::exists(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_document_exists(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + + bool ret = r->result; + kuzzle_free_bool_result(r); + return ret; + } + + std::string Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_create(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + std::string Document::createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_create_or_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + std::string Document::delete_(const std::string& index, const std::string& collection, const std::string& id, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_delete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + std::vector Document::deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_array_result *r = kuzzle_document_delete_by_query(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::vector v; + for (int i = 0; i < r->result_length; i++) + v.push_back(r->result[i]); + + kuzzle_free_string_array_result(r); + return v; + } + + std::string Document::get(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_get(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + std::string Document::replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + std::string Document::update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_update(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + bool Document::validate(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_document_validate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + + bool ret = r->result; + kuzzle_free_bool_result(r); + return ret; + } + + search_result* Document::search(const std::string& index, const std::string& collection, const std::string& body, search_options *opts) Kuz_Throw_KuzzleException { + search_result *r = kuzzle_document_search(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), opts); + if (r->error != NULL) + throwExceptionFromStatus(r); + + search_result *ret = r; + kuzzle_free_search_result(r); + return ret; + } + + std::string Document::mCreate(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_mcreate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + std::string Document::mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_mcreate_or_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + std::vector Document::mDelete(const std::string& index, const std::string& collection, const std::vector& ids, document_options *doc_ops) Kuz_Throw_KuzzleException { + char **idsArray = new char *[ids.size()]; + int i = 0; + for (auto const& id : ids) { + idsArray[i] = const_cast(id.c_str()); + i++; + } + + string_array_result *r = kuzzle_document_mdelete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), doc_ops); + delete[] idsArray; + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::vector v; + for (int i = 0; i < r->result_length; i++) + v.push_back(r->result[i]); + + kuzzle_free_string_array_result(r); + return v; + } + + std::string Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash) Kuz_Throw_KuzzleException { + char **idsArray = new char *[ids.size()]; + int i = 0; + for (auto const& id : ids) { + idsArray[i] = const_cast(id.c_str()); + i++; + } + + string_result *r = kuzzle_document_mget(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), includeTrash); + delete[] idsArray; + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + + } + std::string Document::mReplace(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_mreplace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + std::string Document::mUpdate(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_mupdate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + if (r->error != NULL) + throwExceptionFromStatus(r); + + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + +} diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp new file mode 100644 index 00000000..6d7a613d --- /dev/null +++ b/internal/wrappers/headers/document.hpp @@ -0,0 +1,36 @@ +#ifndef _DOCUMENT_HPP_ +#define _DOCUMENT_HPP_ + +#include "exceptions.hpp" +#include "core.hpp" + +namespace kuzzleio { + + class Document { + document* _document; + Document(); + + public: + Document(Kuzzle* kuzzle); + virtual ~Document(); + int count_(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException; + std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::string createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::string delete_(const std::string& index, const std::string& collection, const std::string& id, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::vector deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::string get(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException; + std::string replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::string update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + bool validate(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; + search_result* search(const std::string& index, const std::string& collection, const std::string& body, search_options *opts) Kuz_Throw_KuzzleException; + std::string mCreate(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::string mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::vector mDelete(const std::string& index, const std::string& collection, const std::vector& ids, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::string mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash) Kuz_Throw_KuzzleException; + std::string mReplace(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + std::string mUpdate(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + }; +} + +#endif diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index 2e557188..431d070f 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -8,6 +8,7 @@ #include "kuzzle.hpp" #include "collection.hpp" #include "server.hpp" +#include "document.hpp" #include #include %} @@ -23,3 +24,4 @@ %include "kuzzle.hpp" %include "collection.hpp" %include "server.hpp" +%include "document.hpp" diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 73e20627..4110bef8 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -35,6 +35,7 @@ #include "kuzzle.cpp" #include "collection.cpp" #include "server.cpp" +#include "document.cpp" %} %include "exceptions.i" @@ -138,3 +139,4 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" %include "server.cpp" +%include "document.cpp" diff --git a/test.sh b/test.sh index 41ab1395..5a369000 100755 --- a/test.sh +++ b/test.sh @@ -5,7 +5,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" workdir=$dir/.cover profile="$workdir/cover.out" mode=count -dirs=(kuzzle connection/websocket collection security ms server) +dirs=(kuzzle connection/websocket collection security ms server document) timeout=${TIMEOUT:=1m} generate_cover_data() { From 5436c5422b34d2bbdc83a7094a99a6f68c38b6bd Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 7 Mar 2018 16:18:51 +0100 Subject: [PATCH 048/363] Delete unwanted files (kcore_wrapper*) --- internal/wrappers/kcore_wrap.cxx | 33311 ----------------------------- internal/wrappers/kcore_wrap.h | 60 - 2 files changed, 33371 deletions(-) delete mode 100644 internal/wrappers/kcore_wrap.cxx delete mode 100644 internal/wrappers/kcore_wrap.h diff --git a/internal/wrappers/kcore_wrap.cxx b/internal/wrappers/kcore_wrap.cxx deleted file mode 100644 index 34a257b1..00000000 --- a/internal/wrappers/kcore_wrap.cxx +++ /dev/null @@ -1,33311 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.12 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - - -#ifndef SWIGJAVA -#define SWIGJAVA -#endif - -#define SWIG_DIRECTORS - - -#ifdef __cplusplus -/* SwigValueWrapper is described in swig.swg */ -template class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper& rhs); - SwigValueWrapper(const SwigValueWrapper& rhs); -public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -}; - -template T SwigValueInit() { - return T(); -} -#endif - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if defined(__GNUC__) -# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - -/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ -#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) -# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 -#endif - -/* Intel's compiler complains if a variable which was never initialised is - * cast to void, which is a common idiom which we use to indicate that we - * are aware a variable isn't used. So we just silence that warning. - * See: https://github.com/swig/swig/issues/192 for more discussion. - */ -#ifdef __INTEL_COMPILER -# pragma warning disable 592 -#endif - - -/* Fix for jlong on some versions of gcc on Windows */ -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) - typedef long long __int64; -#endif - -/* Fix for jlong on 64-bit x86 Solaris */ -#if defined(__x86_64) -# ifdef _LP64 -# undef _LP64 -# endif -#endif - -#include -#include -#include - - -/* Support for throwing Java exceptions */ -typedef enum { - SWIG_JavaOutOfMemoryError = 1, - SWIG_JavaIOException, - SWIG_JavaRuntimeException, - SWIG_JavaIndexOutOfBoundsException, - SWIG_JavaArithmeticException, - SWIG_JavaIllegalArgumentException, - SWIG_JavaNullPointerException, - SWIG_JavaDirectorPureVirtual, - SWIG_JavaUnknownError -} SWIG_JavaExceptionCodes; - -typedef struct { - SWIG_JavaExceptionCodes code; - const char *java_exception; -} SWIG_JavaExceptions_t; - - -static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { - jclass excep; - static const SWIG_JavaExceptions_t java_exceptions[] = { - { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, - { SWIG_JavaIOException, "java/io/IOException" }, - { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, - { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, - { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, - { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, - { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, - { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, - { SWIG_JavaUnknownError, "java/lang/UnknownError" }, - { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } - }; - const SWIG_JavaExceptions_t *except_ptr = java_exceptions; - - while (except_ptr->code != code && except_ptr->code) - except_ptr++; - - jenv->ExceptionClear(); - excep = jenv->FindClass(except_ptr->java_exception); - if (excep) - jenv->ThrowNew(excep, msg); -} - - -/* Contract support */ - -#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else - -/* ----------------------------------------------------------------------------- - * director_common.swg - * - * This file contains support for director classes which is common between - * languages. - * ----------------------------------------------------------------------------- */ - -/* - Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the - 'Swig' namespace. This could be useful for multi-modules projects. -*/ -#ifdef SWIG_DIRECTOR_STATIC -/* Force anonymous (static) namespace */ -#define Swig -#endif -/* ----------------------------------------------------------------------------- - * director.swg - * - * This file contains support for director classes so that Java proxy - * methods can be called from C++. - * ----------------------------------------------------------------------------- */ - -#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) -#include -#endif - -#include - -namespace Swig { - - /* Java object wrapper */ - class JObjectWrapper { - public: - JObjectWrapper() : jthis_(NULL), weak_global_(true) { - } - - ~JObjectWrapper() { - jthis_ = NULL; - weak_global_ = true; - } - - bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) { - if (!jthis_) { - weak_global_ = weak_global || !mem_own; // hold as weak global if explicitly requested or not owned - if (jobj) - jthis_ = weak_global_ ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj); -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl; -#endif - return true; - } else { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl; -#endif - return false; - } - } - - jobject get(JNIEnv *jenv) const { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::get("; - if (jthis_) - std::cout << jthis_; - else - std::cout << "null"; - std::cout << ") -> return new local ref" << std::endl; -#endif - return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_); - } - - void release(JNIEnv *jenv) { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl; -#endif - if (jthis_) { - if (weak_global_) { - if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) - jenv->DeleteWeakGlobalRef((jweak)jthis_); - } else - jenv->DeleteGlobalRef(jthis_); - } - - jthis_ = NULL; - weak_global_ = true; - } - - /* Only call peek if you know what you are doing wrt to weak/global references */ - jobject peek() { - return jthis_; - } - - /* Java proxy releases ownership of C++ object, C++ object is now - responsible for destruction (creates NewGlobalRef to pin Java proxy) */ - void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { - if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */ - if (!weak_global_) { - jenv->DeleteGlobalRef(jthis_); - jthis_ = jenv->NewWeakGlobalRef(jself); - weak_global_ = true; - } - } else { - /* Java releases ownership of C++ object's lifetime */ - if (weak_global_) { - jenv->DeleteWeakGlobalRef((jweak)jthis_); - jthis_ = jenv->NewGlobalRef(jself); - weak_global_ = false; - } - } - } - - private: - /* pointer to Java object */ - jobject jthis_; - /* Local or global reference flag */ - bool weak_global_; - }; - - /* Local JNI reference deleter */ - class LocalRefGuard { - JNIEnv *jenv_; - jobject jobj_; - - // non-copyable - LocalRefGuard(const LocalRefGuard &); - LocalRefGuard &operator=(const LocalRefGuard &); - public: - LocalRefGuard(JNIEnv *jenv, jobject jobj): jenv_(jenv), jobj_(jobj) {} - ~LocalRefGuard() { - if (jobj_) - jenv_->DeleteLocalRef(jobj_); - } - }; - - /* director base class */ - class Director { - /* pointer to Java virtual machine */ - JavaVM *swig_jvm_; - - protected: -#if defined (_MSC_VER) && (_MSC_VER<1300) - class JNIEnvWrapper; - friend class JNIEnvWrapper; -#endif - /* Utility class for managing the JNI environment */ - class JNIEnvWrapper { - const Director *director_; - JNIEnv *jenv_; - int env_status; - public: - JNIEnvWrapper(const Director *director) : director_(director), jenv_(0), env_status(0) { -#if defined(__ANDROID__) - JNIEnv **jenv = &jenv_; -#else - void **jenv = (void **)&jenv_; -#endif - env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2); -#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON) - // Attach a daemon thread to the JVM. Useful when the JVM should not wait for - // the thread to exit upon shutdown. Only for jdk-1.4 and later. - director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, NULL); -#else - director_->swig_jvm_->AttachCurrentThread(jenv, NULL); -#endif - } - ~JNIEnvWrapper() { -#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) - // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. - // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. - if (env_status == JNI_EDETACHED) - director_->swig_jvm_->DetachCurrentThread(); -#endif - } - JNIEnv *getJNIEnv() const { - return jenv_; - } - }; - - /* Java object wrapper */ - JObjectWrapper swig_self_; - - /* Disconnect director from Java object */ - void swig_disconnect_director_self(const char *disconn_method) { - JNIEnvWrapper jnienv(this) ; - JNIEnv *jenv = jnienv.getJNIEnv() ; - jobject jobj = swig_self_.get(jenv); - LocalRefGuard ref_deleter(jenv, jobj); -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; -#endif - if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { - jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); - if (disconn_meth) { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl; -#endif - jenv->CallVoidMethod(jobj, disconn_meth); - } - } - } - - public: - Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() { - /* Acquire the Java VM pointer */ - jenv->GetJavaVM(&swig_jvm_); - } - - virtual ~Director() { - JNIEnvWrapper jnienv(this) ; - JNIEnv *jenv = jnienv.getJNIEnv() ; - swig_self_.release(jenv); - } - - bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global) { - return swig_self_.set(jenv, jself, mem_own, weak_global); - } - - jobject swig_get_self(JNIEnv *jenv) const { - return swig_self_.get(jenv); - } - - // Change C++ object's ownership, relative to Java - void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { - swig_self_.java_change_ownership(jenv, jself, take_or_release); - } - }; - - // Zero initialized bool array - template class BoolArray { - bool array_[N]; - public: - BoolArray() { - memset(array_, 0, sizeof(array_)); - } - bool& operator[](size_t n) { - return array_[n]; - } - bool operator[](size_t n) const { - return array_[n]; - } - }; - - // Utility classes and functions for exception handling. - - // Simple holder for a Java string during exception handling, providing access to a c-style string - class JavaString { - public: - JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) { - if (jenv_ && jstr_) - cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, NULL); - } - - ~JavaString() { - if (jenv_ && jstr_ && cstr_) - jenv_->ReleaseStringUTFChars(jstr_, cstr_); - } - - const char *c_str(const char *null_string = "null JavaString") const { - return cstr_ ? cstr_ : null_string; - } - - private: - // non-copyable - JavaString(const JavaString &); - JavaString &operator=(const JavaString &); - - JNIEnv *jenv_; - jstring jstr_; - const char *cstr_; - }; - - // Helper class to extract the exception message from a Java throwable - class JavaExceptionMessage { - public: - JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) { - } - - const char *message() const { - return message_.c_str("Could not get exception message in JavaExceptionMessage"); - } - - private: - // non-copyable - JavaExceptionMessage(const JavaExceptionMessage &); - JavaExceptionMessage &operator=(const JavaExceptionMessage &); - - // Get exception message by calling Java method Throwable.getMessage() - static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) { - jstring jmsg = NULL; - if (jenv && throwable) { - jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions - jclass throwclz = jenv->GetObjectClass(throwable); - if (throwclz) { - // All Throwable classes have a getMessage() method, so call it to extract the exception message - jmethodID getMessageMethodID = jenv->GetMethodID(throwclz, "getMessage", "()Ljava/lang/String;"); - if (getMessageMethodID) - jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID); - } - if (jmsg == NULL && jenv->ExceptionCheck()) - jenv->ExceptionClear(); - } - return jmsg; - } - - JavaString message_; - }; - - // C++ Exception class for handling Java exceptions thrown during a director method Java upcall - class DirectorException : public std::exception { - public: - - // Construct exception from a Java throwable - DirectorException(JNIEnv *jenv, jthrowable throwable) : classname_(0), msg_(0) { - - // Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/') - if (throwable) { - jclass throwclz = jenv->GetObjectClass(throwable); - if (throwclz) { - jclass clzclz = jenv->GetObjectClass(throwclz); - if (clzclz) { - jmethodID getNameMethodID = jenv->GetMethodID(clzclz, "getName", "()Ljava/lang/String;"); - if (getNameMethodID) { - jstring jstr_classname = (jstring)(jenv->CallObjectMethod(throwclz, getNameMethodID)); - // Copy strings, since there is no guarantee that jenv will be active when handled - if (jstr_classname) { - JavaString jsclassname(jenv, jstr_classname); - const char *classname = jsclassname.c_str(0); - if (classname) - classname_ = copypath(classname); - } - } - } - } - } - - JavaExceptionMessage exceptionmsg(jenv, throwable); - msg_ = copystr(exceptionmsg.message()); - } - - // More general constructor for handling as a java.lang.RuntimeException - DirectorException(const char *msg) : classname_(0), msg_(copystr(msg ? msg : "Unspecified DirectorException message")) { - } - - ~DirectorException() throw() { - delete[] classname_; - delete[] msg_; - } - - const char *what() const throw() { - return msg_; - } - - // Reconstruct and raise/throw the Java Exception that caused the DirectorException - // Note that any error in the JNI exception handling results in a Java RuntimeException - void raiseJavaException(JNIEnv *jenv) const { - if (jenv) { - jenv->ExceptionClear(); - - jmethodID ctorMethodID = 0; - jclass throwableclass = 0; - if (classname_) { - throwableclass = jenv->FindClass(classname_); - if (throwableclass) - ctorMethodID = jenv->GetMethodID(throwableclass, "", "(Ljava/lang/String;)V"); - } - - if (ctorMethodID) { - jenv->ThrowNew(throwableclass, what()); - } else { - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what()); - } - } - } - - private: - static char *copypath(const char *srcmsg) { - char *target = copystr(srcmsg); - for (char *c=target; *c; ++c) { - if ('.' == *c) - *c = '/'; - } - return target; - } - - static char *copystr(const char *srcmsg) { - char *target = 0; - if (srcmsg) { - size_t msglen = strlen(srcmsg) + 1; - target = new char[msglen]; - strncpy(target, srcmsg, msglen); - } - return target; - } - - const char *classname_; - const char *msg_; - }; - - // Helper method to determine if a Java throwable matches a particular Java class type - SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) { - bool matches = false; - - if (throwable && jenv && classname) { - // Exceptions need to be cleared for correct behavior. - // The caller of ExceptionMatches should restore pending exceptions if desired - - // the caller already has the throwable. - jenv->ExceptionClear(); - - jclass clz = jenv->FindClass(classname); - if (clz) { - jclass classclz = jenv->GetObjectClass(clz); - jmethodID isInstanceMethodID = jenv->GetMethodID(classclz, "isInstance", "(Ljava/lang/Object;)Z"); - if (isInstanceMethodID) { - matches = jenv->CallBooleanMethod(clz, isInstanceMethodID, throwable) != 0; - } - } - -#if defined(DEBUG_DIRECTOR_EXCEPTION) - if (jenv->ExceptionCheck()) { - // Typically occurs when an invalid classname argument is passed resulting in a ClassNotFoundException - JavaExceptionMessage exc(jenv, jenv->ExceptionOccurred()); - std::cout << "Error: ExceptionMatches: class '" << classname << "' : " << exc.message() << std::endl; - } -#endif - } - return matches; - } -} - -namespace Swig { - namespace { - jclass jclass_kcoreJNI = NULL; - jmethodID director_method_ids[3]; - } -} - -#include "kuzzle.cpp" -#include "collection.cpp" -#include "room.cpp" -#include "document.cpp" -#include "index.cpp" -#include "server.cpp" - - -#include - - -#include "listeners.hpp" -#include "exceptions.hpp" -#include "event_emitter.hpp" -#include "kuzzle.hpp" -#include "collection.hpp" -#include "room.hpp" -#include "document.hpp" -#include "index.hpp" -#include "server.hpp" -#include -#include - -SWIGINTERN options *new_options(){ - options *o = kuzzle_new_options(); - return o; - } -SWIGINTERN void delete_options(options *self){ - free(self); - } - -#include -#include - - -#include -#include - -SWIGINTERN std::vector< std::string >::const_reference std_vector_Sl_std_string_Sg__get(std::vector< std::string > *self,int i){ - int size = int(self->size()); - if (i>=0 && i *self,int i,std::vector< std::string >::value_type const &val){ - int size = int(self->size()); - if (i>=0 && i::const_reference std_vector_Sl_kuzzleio_Document_Sm__Sg__get(std::vector< kuzzleio::Document * > *self,int i){ - int size = int(self->size()); - if (i>=0 && i *self,int i,std::vector< kuzzleio::Document * >::value_type const &val){ - int size = int(self->size()); - if (i>=0 && iIsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((notification_result **)&jarg0) = (notification_result *) arg0; - jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[0], swigjobj, jarg0); - jthrowable swigerror = jenv->ExceptionOccurred(); - if (swigerror) { - jenv->ExceptionClear(); - throw Swig::DirectorException(jenv, swigerror); - } - - } else { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::NotificationListener::onMessage "); - } - if (swigjobj) jenv->DeleteLocalRef(swigjobj); -} - -void SwigDirector_NotificationListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { - static struct { - const char *mname; - const char *mdesc; - jmethodID base_methid; - } methods[] = { - { - "onMessage", "(Lio/kuzzle/sdk/notification_result;)V", NULL - } - }; - - static jclass baseclass = 0 ; - - if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { - if (!baseclass) { - baseclass = jenv->FindClass("io/kuzzle/sdk/NotificationListener"); - if (!baseclass) return; - baseclass = (jclass) jenv->NewGlobalRef(baseclass); - } - bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); - for (int i = 0; i < 1; ++i) { - if (!methods[i].base_methid) { - methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); - if (!methods[i].base_methid) return; - } - swig_override[i] = false; - if (derived) { - jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); - swig_override[i] = (methid != methods[i].base_methid); - jenv->ExceptionClear(); - } - } - } -} - - -SwigDirector_EventListener::SwigDirector_EventListener(JNIEnv *jenv) : kuzzleio::EventListener(), Swig::Director(jenv) { -} - -SwigDirector_EventListener::~SwigDirector_EventListener() { - swig_disconnect_director_self("swigDirectorDisconnect"); -} - - -void SwigDirector_EventListener::trigger(json_object *arg0) const { - JNIEnvWrapper swigjnienv(this) ; - JNIEnv * jenv = swigjnienv.getJNIEnv() ; - jobject swigjobj = (jobject) NULL ; - jlong jarg0 = 0 ; - - if (!swig_override[0]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method kuzzleio::EventListener::trigger."); - return; - } - swigjobj = swig_get_self(jenv); - if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((json_object **)&jarg0) = (json_object *) arg0; - jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[1], swigjobj, jarg0); - jthrowable swigerror = jenv->ExceptionOccurred(); - if (swigerror) { - jenv->ExceptionClear(); - throw Swig::DirectorException(jenv, swigerror); - } - - } else { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::EventListener::trigger "); - } - if (swigjobj) jenv->DeleteLocalRef(swigjobj); -} - -void SwigDirector_EventListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { - static struct { - const char *mname; - const char *mdesc; - jmethodID base_methid; - } methods[] = { - { - "trigger", "(Lio/kuzzle/sdk/JsonObject;)V", NULL - } - }; - - static jclass baseclass = 0 ; - - if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { - if (!baseclass) { - baseclass = jenv->FindClass("io/kuzzle/sdk/EventListener"); - if (!baseclass) return; - baseclass = (jclass) jenv->NewGlobalRef(baseclass); - } - bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); - for (int i = 0; i < 1; ++i) { - if (!methods[i].base_methid) { - methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); - if (!methods[i].base_methid) return; - } - swig_override[i] = false; - if (derived) { - jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); - swig_override[i] = (methid != methods[i].base_methid); - jenv->ExceptionClear(); - } - } - } -} - - -SwigDirector_SubscribeListener::SwigDirector_SubscribeListener(JNIEnv *jenv) : kuzzleio::SubscribeListener(), Swig::Director(jenv) { -} - -SwigDirector_SubscribeListener::~SwigDirector_SubscribeListener() { - swig_disconnect_director_self("swigDirectorDisconnect"); -} - - -void SwigDirector_SubscribeListener::onSubscribe(room_result *arg0) const { - JNIEnvWrapper swigjnienv(this) ; - JNIEnv * jenv = swigjnienv.getJNIEnv() ; - jobject swigjobj = (jobject) NULL ; - jlong jarg0 = 0 ; - - if (!swig_override[0]) { - SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, "Attempted to invoke pure virtual method kuzzleio::SubscribeListener::onSubscribe."); - return; - } - swigjobj = swig_get_self(jenv); - if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) { - *((room_result **)&jarg0) = (room_result *) arg0; - jenv->CallStaticVoidMethod(Swig::jclass_kcoreJNI, Swig::director_method_ids[2], swigjobj, jarg0); - jthrowable swigerror = jenv->ExceptionOccurred(); - if (swigerror) { - jenv->ExceptionClear(); - throw Swig::DirectorException(jenv, swigerror); - } - - } else { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null upcall object in kuzzleio::SubscribeListener::onSubscribe "); - } - if (swigjobj) jenv->DeleteLocalRef(swigjobj); -} - -void SwigDirector_SubscribeListener::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) { - static struct { - const char *mname; - const char *mdesc; - jmethodID base_methid; - } methods[] = { - { - "onSubscribe", "(Lio/kuzzle/sdk/room_result;)V", NULL - } - }; - - static jclass baseclass = 0 ; - - if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) { - if (!baseclass) { - baseclass = jenv->FindClass("io/kuzzle/sdk/SubscribeListener"); - if (!baseclass) return; - baseclass = (jclass) jenv->NewGlobalRef(baseclass); - } - bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true); - for (int i = 0; i < 1; ++i) { - if (!methods[i].base_methid) { - methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc); - if (!methods[i].base_methid) return; - } - swig_override[i] = false; - if (derived) { - jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc); - swig_override[i] = (methid != methods[i].base_methid); - jenv->ExceptionClear(); - } - } - } -} - - - -#ifdef __cplusplus -extern "C" { -#endif - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1query_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - query_object *arg1 = (query_object *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(query_object **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->query = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1query_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - query_object *arg1 = (query_object *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - result = (json_object *) ((arg1)->query); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - query_object *arg1 = (query_object *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->timestamp = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - query_object *arg1 = (query_object *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - result = (unsigned long long) ((arg1)->timestamp); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_object *arg1 = (query_object *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->request_id; - if (arg2) { - arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->request_id, (const char *)arg2); - } else { - arg1->request_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_query_1object_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_object *arg1 = (query_object *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - result = (char *) ((arg1)->request_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1query_1object(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - query_object *result = 0 ; - - (void)jenv; - (void)jcls; - result = (query_object *)new query_object(); - *(query_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1query_1object(JNIEnv *jenv, jclass jcls, jlong jarg1) { - query_object *arg1 = (query_object *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(query_object **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - offline_queue *arg1 = (offline_queue *) 0 ; - query_object **arg2 = (query_object **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - arg2 = *(query_object ***)&jarg2; - if (arg1) (arg1)->queries = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - offline_queue *arg1 = (offline_queue *) 0 ; - query_object **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - result = (query_object **) ((arg1)->queries); - *(query_object ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - offline_queue *arg1 = (offline_queue *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->queries_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_offline_1queue_1queries_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - offline_queue *arg1 = (offline_queue *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - result = ((arg1)->queries_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1offline_1queue(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - offline_queue *result = 0 ; - - (void)jenv; - (void)jcls; - result = (offline_queue *)new offline_queue(); - *(offline_queue **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1) { - offline_queue *arg1 = (offline_queue *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(offline_queue **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->request_id; - if (arg2) { - arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->request_id, (const char *)arg2); - } else { - arg1->request_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->request_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->controller; - if (arg2) { - arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->controller, (const char *)arg2); - } else { - arg1->controller = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->controller); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->action; - if (arg2) { - arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->action, (const char *)arg2); - } else { - arg1->action = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->action); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1body_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->body = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1body_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (json_object *) ((arg1)->body); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->from = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->from); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->size = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->size); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll; - if (arg2) { - arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll, (const char *)arg2); - } else { - arg1->scroll = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->scroll); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1strategy_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->strategy; - if (arg2) { - arg1->strategy = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->strategy, (const char *)arg2); - } else { - arg1->strategy = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1strategy_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->strategy); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1expires_1in_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->expires_in = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1expires_1in_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (unsigned long long) ((arg1)->expires_in); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scope; - if (arg2) { - arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scope, (const char *)arg2); - } else { - arg1->scope = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->scope); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->state; - if (arg2) { - arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->state, (const char *)arg2); - } else { - arg1->state = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->state); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->user; - if (arg2) { - arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->user, (const char *)arg2); - } else { - arg1->user = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->user); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1start_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->start = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1start_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->start); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1stop_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->stop = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1stop_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->stop); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1end_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->end = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1end_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->end); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1bit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jshort jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned char arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (unsigned char)jarg2; - if (arg1) (arg1)->bit = arg2; -} - - -SWIGEXPORT jshort JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1bit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jshort jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned char result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (unsigned char) ((arg1)->bit); - jresult = (jshort)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->member; - if (arg2) { - arg1->member = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->member, (const char *)arg2); - } else { - arg1->member = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->member); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member1_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->member1; - if (arg2) { - arg1->member1 = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->member1, (const char *)arg2); - } else { - arg1->member1 = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->member1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member2_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->member2; - if (arg2) { - arg1->member2 = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->member2, (const char *)arg2); - } else { - arg1->member2 = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1member2_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->member2); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->members = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char **) ((arg1)->members); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->members_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1members_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = ((arg1)->members_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lon_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (double)jarg2; - if (arg1) (arg1)->lon = arg2; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lon_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jdouble jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (double) ((arg1)->lon); - jresult = (jdouble)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lat_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (double)jarg2; - if (arg1) (arg1)->lat = arg2; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1lat_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jdouble jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (double) ((arg1)->lat); - jresult = (jdouble)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1distance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (double)jarg2; - if (arg1) (arg1)->distance = arg2; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1distance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jdouble jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (double) ((arg1)->distance); - jresult = (jdouble)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1unit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->unit; - if (arg2) { - arg1->unit = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->unit, (const char *)arg2); - } else { - arg1->unit = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1unit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->unit); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->options = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (json_object *) ((arg1)->options); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->keys = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char **) ((arg1)->keys); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->keys_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1keys_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = ((arg1)->keys_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1cursor_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->cursor = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1cursor_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->cursor); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1offset_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->offset = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1offset_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->offset); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1field_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->field; - if (arg2) { - arg1->field = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->field, (const char *)arg2); - } else { - arg1->field = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1field_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->field); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->fields = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char **) ((arg1)->fields); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->fields_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1fields_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = ((arg1)->fields_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1subcommand_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->subcommand; - if (arg2) { - arg1->subcommand = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->subcommand, (const char *)arg2); - } else { - arg1->subcommand = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1subcommand_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->subcommand); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1pattern_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->pattern; - if (arg2) { - arg1->pattern = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->pattern, (const char *)arg2); - } else { - arg1->pattern = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1pattern_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->pattern); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1idx_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->idx = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1idx_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (long) ((arg1)->idx); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1min_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->min; - if (arg2) { - arg1->min = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->min, (const char *)arg2); - } else { - arg1->min = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1min_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->min); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1max_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->max; - if (arg2) { - arg1->max = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->max, (const char *)arg2); - } else { - arg1->max = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1max_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->max); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1limit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->limit; - if (arg2) { - arg1->limit = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->limit, (const char *)arg2); - } else { - arg1->limit = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1limit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->limit); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1count_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = (unsigned long)jarg2; - if (arg1) (arg1)->count = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1count_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - unsigned long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (unsigned long) ((arg1)->count); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1match_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->match; - if (arg2) { - arg1->match = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->match, (const char *)arg2); - } else { - arg1->match = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleRequest_1match_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - result = (char *) ((arg1)->match); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleRequest(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzle_request *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzle_request *)new kuzzle_request(); - *(kuzzle_request **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleRequest(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzle_request **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1filter_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_queue_filter arg2 = (kuzzle_queue_filter) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_queue_filter *)&jarg2; - if (arg1) (arg1)->filter = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1filter_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_queue_filter result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (kuzzle_queue_filter) ((arg1)->filter); - *(kuzzle_queue_filter *)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1loader_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_offline_queue_loader arg2 = (kuzzle_offline_queue_loader) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_offline_queue_loader *)&jarg2; - if (arg1) (arg1)->loader = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1loader_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_offline_queue_loader result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (kuzzle_offline_queue_loader) ((arg1)->loader); - *(kuzzle_offline_queue_loader *)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1kuzzle(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzle *)new kuzzle(); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzle **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1kuzzle_1index(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzle_index *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzle_index *)new kuzzle_index(); - *(kuzzle_index **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1kuzzle_1index(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzle_index **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - server *arg1 = (server *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(server **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(server **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - server *arg1 = (server *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_server_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(server **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1server(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - server *result = 0 ; - - (void)jenv; - (void)jcls; - result = (server *)new server(); - *(server **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1server(JNIEnv *jenv, jclass jcls, jlong jarg1) { - server *arg1 = (server *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(server **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_options *arg1 = (room_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scope; - if (arg2) { - arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scope, (const char *)arg2); - } else { - arg1->scope = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (char *) ((arg1)->scope); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_options *arg1 = (room_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->state; - if (arg2) { - arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->state, (const char *)arg2); - } else { - arg1->state = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (char *) ((arg1)->state); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_options *arg1 = (room_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->user; - if (arg2) { - arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->user, (const char *)arg2); - } else { - arg1->user = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (char *) ((arg1)->user); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1subscribe_1to_1self_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - room_options *arg1 = (room_options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->subscribe_to_self = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1subscribe_1to_1self_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (bool) ((arg1)->subscribe_to_self); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - room_options *arg1 = (room_options *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(room_options **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_RoomOptions_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room_options *arg1 = (room_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1RoomOptions(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - room_options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (room_options *)new room_options(); - *(room_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1RoomOptions(JNIEnv *jenv, jclass jcls, jlong jarg1) { - room_options *arg1 = (room_options *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(room_options **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - room *arg1 = (room *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1filters_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - room *arg1 = (room *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(room **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->filters = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1filters_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - result = (json_object *) ((arg1)->filters); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - room *arg1 = (room *) 0 ; - room_options *arg2 = (room_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(room **)&jarg1; - arg2 = *(room_options **)&jarg2; - if (arg1) (arg1)->options = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - room_options *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - result = (room_options *) ((arg1)->options); - *(room_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1room(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - room *result = 0 ; - - (void)jenv; - (void)jcls; - result = (room *)new room(); - *(room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1room(JNIEnv *jenv, jclass jcls, jlong jarg1) { - room *arg1 = (room *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(room **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - room_result *arg1 = (room_result *) 0 ; - room *arg2 = (room *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(room_result **)&jarg1; - arg2 = *(room **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room_result *arg1 = (room_result *) 0 ; - room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - result = (room *) ((arg1)->result); - *(room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - room_result *arg1 = (room_result *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->status = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - room_result *arg1 = (room_result *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - result = (int) ((arg1)->status); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_result *arg1 = (room_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->error; - if (arg2) { - arg1->error = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->error, (const char *)arg2); - } else { - arg1->error = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_result *arg1 = (room_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - result = (char *) ((arg1)->error); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1stack_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - room_result *arg1 = (room_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->stack; - if (arg2) { - arg1->stack = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->stack, (const char *)arg2); - } else { - arg1->stack = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1result_1stack_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - room_result *arg1 = (room_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - result = (char *) ((arg1)->stack); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1room_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - room_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (room_result *)new room_result(); - *(room_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1room_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - room_result *arg1 = (room_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(room_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1queuable_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - query_options *arg1 = (query_options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->queuable = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1queuable_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (bool) ((arg1)->queuable); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withdist_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - query_options *arg1 = (query_options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->withdist = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withdist_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (bool) ((arg1)->withdist); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withcoord_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - query_options *arg1 = (query_options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->withcoord = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1withcoord_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (bool) ((arg1)->withcoord); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1from_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - query_options *arg1 = (query_options *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->from = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1from_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (long) ((arg1)->from); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - query_options *arg1 = (query_options *) 0 ; - long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = (long)jarg2; - if (arg1) (arg1)->size = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (long) ((arg1)->size); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_options *arg1 = (query_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll; - if (arg2) { - arg1->scroll = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll, (const char *)arg2); - } else { - arg1->scroll = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (char *) ((arg1)->scroll); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_options *arg1 = (query_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1refresh_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_options *arg1 = (query_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->refresh; - if (arg2) { - arg1->refresh = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->refresh, (const char *)arg2); - } else { - arg1->refresh = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1refresh_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (char *) ((arg1)->refresh); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1if_1exist_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - query_options *arg1 = (query_options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->if_exist; - if (arg2) { - arg1->if_exist = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->if_exist, (const char *)arg2); - } else { - arg1->if_exist = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1if_1exist_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (char *) ((arg1)->if_exist); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1retry_1on_1conflict_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - query_options *arg1 = (query_options *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->retry_on_conflict = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1retry_1on_1conflict_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (int) ((arg1)->retry_on_conflict); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - query_options *arg1 = (query_options *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(query_options **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_QueryOptions_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - query_options *arg1 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1QueryOptions(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - query_options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (query_options *)new query_options(); - *(query_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1QueryOptions(JNIEnv *jenv, jclass jcls, jlong jarg1) { - query_options *arg1 = (query_options *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(query_options **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queueTTL_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - options *arg1 = (options *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->queue_ttl = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queueTTL_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned int) ((arg1)->queue_ttl); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queue_1max_1size_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - options *arg1 = (options *) 0 ; - unsigned long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned long)jarg2; - if (arg1) (arg1)->queue_max_size = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1queue_1max_1size_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned long) ((arg1)->queue_max_size); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1offline_1mode_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jshort jarg2) { - options *arg1 = (options *) 0 ; - unsigned char arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned char)jarg2; - if (arg1) (arg1)->offline_mode = arg2; -} - - -SWIGEXPORT jshort JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1offline_1mode_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jshort jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned char result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned char) ((arg1)->offline_mode); - jresult = (jshort)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1queue_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - options *arg1 = (options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->auto_queue = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1queue_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - options *arg1 = (options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (bool) ((arg1)->auto_queue); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1reconnect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - options *arg1 = (options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->auto_reconnect = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1reconnect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - options *arg1 = (options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (bool) ((arg1)->auto_reconnect); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1replay_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - options *arg1 = (options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->auto_replay = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1replay_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - options *arg1 = (options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (bool) ((arg1)->auto_replay); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1resubscribe_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - options *arg1 = (options *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->auto_resubscribe = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1auto_1resubscribe_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - options *arg1 = (options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (bool) ((arg1)->auto_resubscribe); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1reconnection_1delay_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - options *arg1 = (options *) 0 ; - unsigned long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned long)jarg2; - if (arg1) (arg1)->reconnection_delay = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1reconnection_1delay_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned long) ((arg1)->reconnection_delay); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1replay_1interval_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - options *arg1 = (options *) 0 ; - unsigned long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (unsigned long)jarg2; - if (arg1) (arg1)->replay_interval = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1replay_1interval_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - options *arg1 = (options *) 0 ; - unsigned long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (unsigned long) ((arg1)->replay_interval); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1connect_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - options *arg1 = (options *) 0 ; - enum Mode arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = (enum Mode)jarg2; - if (arg1) (arg1)->connect = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1connect_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - options *arg1 = (options *) 0 ; - enum Mode result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (enum Mode) ((arg1)->connect); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1refresh_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - options *arg1 = (options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->refresh; - if (arg2) { - arg1->refresh = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->refresh, (const char *)arg2); - } else { - arg1->refresh = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1refresh_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - options *arg1 = (options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (char *) ((arg1)->refresh); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1default_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - options *arg1 = (options *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->default_index; - if (arg2) { - arg1->default_index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->default_index, (const char *)arg2); - } else { - arg1->default_index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Options_1default_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - options *arg1 = (options *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - result = (char *) ((arg1)->default_index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Options(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (options *)new_options(); - *(options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Options(JNIEnv *jenv, jclass jcls, jlong jarg1) { - options *arg1 = (options *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(options **)&jarg1; - delete_options(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1author_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - meta *arg1 = (meta *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->author; - if (arg2) { - arg1->author = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->author, (const char *)arg2); - } else { - arg1->author = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1author_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - meta *arg1 = (meta *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (char *) ((arg1)->author); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1created_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - meta *arg1 = (meta *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->created_at = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1created_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - meta *arg1 = (meta *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (unsigned long long) ((arg1)->created_at); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updated_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - meta *arg1 = (meta *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->updated_at = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updated_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - meta *arg1 = (meta *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (unsigned long long) ((arg1)->updated_at); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updater_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - meta *arg1 = (meta *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->updater; - if (arg2) { - arg1->updater = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->updater, (const char *)arg2); - } else { - arg1->updater = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1updater_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - meta *arg1 = (meta *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (char *) ((arg1)->updater); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1active_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - meta *arg1 = (meta *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->active = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1active_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - meta *arg1 = (meta *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (bool) ((arg1)->active); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1deleted_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - meta *arg1 = (meta *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->deleted_at = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_meta_1deleted_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - meta *arg1 = (meta *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - result = (unsigned long long) ((arg1)->deleted_at); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1meta(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - meta *result = 0 ; - - (void)jenv; - (void)jcls; - result = (meta *)new meta(); - *(meta **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1meta(JNIEnv *jenv, jclass jcls, jlong jarg1) { - meta *arg1 = (meta *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(meta **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - policy_restriction *arg1 = (policy_restriction *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->collections = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - policy_restriction *arg1 = (policy_restriction *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - result = (char **) ((arg1)->collections); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->collections_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restriction_1collections_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - policy_restriction *arg1 = (policy_restriction *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - result = ((arg1)->collections_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1policy_1restriction(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - policy_restriction *result = 0 ; - - (void)jenv; - (void)jcls; - result = (policy_restriction *)new policy_restriction(); - *(policy_restriction **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1policy_1restriction(JNIEnv *jenv, jclass jcls, jlong jarg1) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(policy_restriction **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1role_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - policy *arg1 = (policy *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->role_id; - if (arg2) { - arg1->role_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->role_id, (const char *)arg2); - } else { - arg1->role_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1role_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - policy *arg1 = (policy *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - result = (char *) ((arg1)->role_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - policy *arg1 = (policy *) 0 ; - policy_restriction *arg2 = (policy_restriction *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(policy **)&jarg1; - arg2 = *(policy_restriction **)&jarg2; - if (arg1) (arg1)->restricted_to = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - policy *arg1 = (policy *) 0 ; - policy_restriction *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - result = (policy_restriction *) ((arg1)->restricted_to); - *(policy_restriction **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - policy *arg1 = (policy *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->restricted_to_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_policy_1restricted_1to_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - policy *arg1 = (policy *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - result = ((arg1)->restricted_to_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1policy(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - policy *result = 0 ; - - (void)jenv; - (void)jcls; - result = (policy *)new policy(); - *(policy **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1) { - policy *arg1 = (policy *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(policy **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - profile *arg1 = (profile *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - profile *arg1 = (profile *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profile *arg1 = (profile *) 0 ; - policy *arg2 = (policy *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(policy **)&jarg2; - if (arg1) (arg1)->policies = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - policy *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - result = (policy *) ((arg1)->policies); - *(policy **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - profile *arg1 = (profile *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->policies_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1policies_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - result = ((arg1)->policies_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profile *arg1 = (profile *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - result = (profile *)new profile(); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1) { - profile *arg1 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(profile **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - role *arg1 = (role *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - role *arg1 = (role *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1controllers_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - role *arg1 = (role *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->controllers = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1controllers_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role *arg1 = (role *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - result = (json_object *) ((arg1)->controllers); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - role *arg1 = (role *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role *arg1 = (role *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - role *result = 0 ; - - (void)jenv; - (void)jcls; - result = (role *)new role(); - *(role **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role(JNIEnv *jenv, jclass jcls, jlong jarg1) { - role *arg1 = (role *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(role **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user *arg1 = (user *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user *arg1 = (user *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->content = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = (json_object *) ((arg1)->content); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user *arg1 = (user *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->profile_ids = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = (char **) ((arg1)->profile_ids); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user *arg1 = (user *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->profile_ids_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1profile_1ids_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = ((arg1)->profile_ids_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user *arg1 = (user *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_User_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1User(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user *)new user(); - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1User(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user *arg1 = (user *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user_data *arg1 = (user_data *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user_data **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->content = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_data *arg1 = (user_data *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - result = (json_object *) ((arg1)->content); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_data *arg1 = (user_data *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->profile_ids = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_data *arg1 = (user_data *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - result = (char **) ((arg1)->profile_ids); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_data *arg1 = (user_data *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->profile_ids_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UserData_1profile_1ids_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_data *arg1 = (user_data *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - result = ((arg1)->profile_ids_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UserData(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_data *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_data *)new user_data(); - *(user_data **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1UserData(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_data *arg1 = (user_data *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_data **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1failed_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - shards *arg1 = (shards *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->failed = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1failed_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - shards *arg1 = (shards *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - result = (int) ((arg1)->failed); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1successful_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - shards *arg1 = (shards *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->successful = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1successful_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - shards *arg1 = (shards *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - result = (int) ((arg1)->successful); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - shards *arg1 = (shards *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_shards_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - shards *arg1 = (shards *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards **)&jarg1; - result = (int) ((arg1)->total); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1shards(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - shards *result = 0 ; - - (void)jenv; - (void)jcls; - result = (shards *)new shards(); - *(shards **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1shards(JNIEnv *jenv, jclass jcls, jlong jarg1) { - shards *arg1 = (shards *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(shards **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - collection *arg1 = (collection *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - collection *arg1 = (collection *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_collection_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - result = (kuzzle *) ((arg1)->kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { - collection *arg1 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(collection **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - document *arg1 = (document *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (void *) ((arg1)->instance); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document *arg1 = (document *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document *arg1 = (document *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document *arg1 = (document *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document *arg1 = (document *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1meta_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document *arg1 = (document *) 0 ; - meta *arg2 = (meta *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(meta **)&jarg2; - if (arg1) (arg1)->meta = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1meta_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - meta *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (meta *) ((arg1)->meta); - *(meta **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1shards_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document *arg1 = (document *) 0 ; - shards *arg2 = (shards *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(shards **)&jarg2; - if (arg1) (arg1)->shards = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1shards_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - shards *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (shards *) ((arg1)->shards); - *(shards **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document *arg1 = (document *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->content = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (json_object *) ((arg1)->content); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1version_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - document *arg1 = (document *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->version = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1version_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - document *arg1 = (document *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (int) ((arg1)->version); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document *arg1 = (document *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->result; - if (arg2) { - arg1->result = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->result, (const char *)arg2); - } else { - arg1->result = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document *arg1 = (document *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (char *) ((arg1)->result); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1created_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - document *arg1 = (document *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->created = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1created_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - document *arg1 = (document *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (bool) ((arg1)->created); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document *arg1 = (document *) 0 ; - collection *arg2 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(collection **)&jarg2; - if (arg1) (arg1)->_collection = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (collection *) ((arg1)->_collection); - *(collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document *arg1 = (document *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document *arg1 = (document *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - document *result = 0 ; - - (void)jenv; - (void)jcls; - result = (document *)new document(); - *(document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document(JNIEnv *jenv, jclass jcls, jlong jarg1) { - document *arg1 = (document *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(document **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document_result *arg1 = (document_result *) 0 ; - document *arg2 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document_result **)&jarg1; - arg2 = *(document **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document_result *arg1 = (document_result *) 0 ; - document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_result **)&jarg1; - result = (document *) ((arg1)->result); - *(document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - document_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (document_result *)new document_result(); - *(document_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - document_result *arg1 = (document_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(document_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - document_array_result *arg1 = (document_array_result *) 0 ; - document *arg2 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document_array_result **)&jarg1; - arg2 = *(document **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = (document *) ((arg1)->result); - *(document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - document_array_result *arg1 = (document_array_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1status_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - document_array_result *arg1 = (document_array_result *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->status = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1status_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = (int) ((arg1)->status); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1error_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document_array_result *arg1 = (document_array_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->error; - if (arg2) { - arg1->error = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->error, (const char *)arg2); - } else { - arg1->error = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1error_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = (char *) ((arg1)->error); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1stack_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - document_array_result *arg1 = (document_array_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->stack; - if (arg2) { - arg1->stack = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->stack, (const char *)arg2); - } else { - arg1->stack = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_document_1array_1result_1stack_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - document_array_result *arg1 = (document_array_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - result = (char *) ((arg1)->stack); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1document_1array_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - document_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (document_array_result *)new document_array_result(); - *(document_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1document_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - document_array_result *arg1 = (document_array_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(document_array_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_content *arg1 = (notification_content *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->id; - if (arg2) { - arg1->id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->id, (const char *)arg2); - } else { - arg1->id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_content *arg1 = (notification_content *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - result = (char *) ((arg1)->id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1meta_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - notification_content *arg1 = (notification_content *) 0 ; - meta *arg2 = (meta *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(notification_content **)&jarg1; - arg2 = *(meta **)&jarg2; - if (arg1) (arg1)->meta = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1meta_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - notification_content *arg1 = (notification_content *) 0 ; - meta *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - result = (meta *) ((arg1)->meta); - *(meta **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1content_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - notification_content *arg1 = (notification_content *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(notification_content **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->content = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1content_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - notification_content *arg1 = (notification_content *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - result = (json_object *) ((arg1)->content); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1count_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - notification_content *arg1 = (notification_content *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->count = arg2; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1content_1count_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - notification_content *arg1 = (notification_content *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - result = (int) ((arg1)->count); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1notification_1content(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - notification_content *result = 0 ; - - (void)jenv; - (void)jcls; - result = (notification_content *)new notification_content(); - *(notification_content **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1notification_1content(JNIEnv *jenv, jclass jcls, jlong jarg1) { - notification_content *arg1 = (notification_content *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(notification_content **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->request_id; - if (arg2) { - arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->request_id, (const char *)arg2); - } else { - arg1->request_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->request_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - notification_result *arg1 = (notification_result *) 0 ; - notification_content *arg2 = (notification_content *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(notification_result **)&jarg1; - arg2 = *(notification_content **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - notification_content *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (notification_content *) ((arg1)->result); - *(notification_content **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - notification_result *arg1 = (notification_result *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(notification_result **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->controller; - if (arg2) { - arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->controller, (const char *)arg2); - } else { - arg1->controller = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->controller); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->action; - if (arg2) { - arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->action, (const char *)arg2); - } else { - arg1->action = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->action); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1protocol_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->protocol; - if (arg2) { - arg1->protocol = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->protocol, (const char *)arg2); - } else { - arg1->protocol = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1protocol_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->protocol); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1scope_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scope; - if (arg2) { - arg1->scope = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scope, (const char *)arg2); - } else { - arg1->scope = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1scope_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->scope); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->state; - if (arg2) { - arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->state, (const char *)arg2); - } else { - arg1->state = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->state); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->user; - if (arg2) { - arg1->user = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->user, (const char *)arg2); - } else { - arg1->user = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->user); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1n_1type_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->n_type; - if (arg2) { - arg1->n_type = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->n_type, (const char *)arg2); - } else { - arg1->n_type = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1n_1type_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->n_type); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1room_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->room_id; - if (arg2) { - arg1->room_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->room_id, (const char *)arg2); - } else { - arg1->room_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1room_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (char *) ((arg1)->room_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->timestamp = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_notification_1result_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - notification_result *arg1 = (notification_result *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - result = (unsigned long long) ((arg1)->timestamp); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1notification_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - notification_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (notification_result *)new notification_result(); - *(notification_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1notification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - notification_result *arg1 = (notification_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(notification_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1result_1profile_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profile_result *arg1 = (profile_result *) 0 ; - profile *arg2 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile_result **)&jarg1; - arg2 = *(profile **)&jarg2; - if (arg1) (arg1)->profile = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1result_1profile_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile_result *arg1 = (profile_result *) 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_result **)&jarg1; - result = (profile *) ((arg1)->profile); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - profile_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (profile_result *)new profile_result(); - *(profile_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - profile_result *arg1 = (profile_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(profile_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profiles_result *arg1 = (profiles_result *) 0 ; - profile *arg2 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profiles_result **)&jarg1; - arg2 = *(profile **)&jarg2; - if (arg1) (arg1)->profiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profiles_result *arg1 = (profiles_result *) 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profiles_result **)&jarg1; - result = (profile *) ((arg1)->profiles); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - profiles_result *arg1 = (profiles_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profiles_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->profiles_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profiles_1result_1profiles_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profiles_result *arg1 = (profiles_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profiles_result **)&jarg1; - result = ((arg1)->profiles_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profiles_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (profiles_result *)new profiles_result(); - *(profiles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - profiles_result *arg1 = (profiles_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(profiles_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1result_1role_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - role_result *arg1 = (role_result *) 0 ; - role *arg2 = (role *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role_result **)&jarg1; - arg2 = *(role **)&jarg2; - if (arg1) (arg1)->role = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1result_1role_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role_result *arg1 = (role_result *) 0 ; - role *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_result **)&jarg1; - result = (role *) ((arg1)->role); - *(role **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - role_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (role_result *)new role_result(); - *(role_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - role_result *arg1 = (role_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(role_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->controller; - if (arg2) { - arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->controller, (const char *)arg2); - } else { - arg1->controller = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->controller); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->action; - if (arg2) { - arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->action, (const char *)arg2); - } else { - arg1->action = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->action); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1value_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_right *arg1 = (user_right *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->value; - if (arg2) { - arg1->value = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->value, (const char *)arg2); - } else { - arg1->value = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1right_1value_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_right *arg1 = (user_right *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - result = (char *) ((arg1)->value); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1right(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_right *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_right *)new user_right(); - *(user_right **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1right(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_right *arg1 = (user_right *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_right **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user_rights_result *arg1 = (user_rights_result *) 0 ; - user_right *arg2 = (user_right *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user_rights_result **)&jarg1; - arg2 = *(user_right **)&jarg2; - if (arg1) (arg1)->user_rights = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_rights_result *arg1 = (user_rights_result *) 0 ; - user_right *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_rights_result **)&jarg1; - result = (user_right *) ((arg1)->user_rights); - *(user_right **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_rights_result *arg1 = (user_rights_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_rights_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->user_rights_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1rights_1result_1user_1rights_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_rights_result *arg1 = (user_rights_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_rights_result **)&jarg1; - result = ((arg1)->user_rights_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1rights_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_rights_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_rights_result *)new user_rights_result(); - *(user_rights_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1rights_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_rights_result *arg1 = (user_rights_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_rights_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1result_1user_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user_result *arg1 = (user_result *) 0 ; - user *arg2 = (user *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user_result **)&jarg1; - arg2 = *(user **)&jarg2; - if (arg1) (arg1)->user = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1result_1user_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_result *arg1 = (user_result *) 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_result **)&jarg1; - result = (user *) ((arg1)->user); - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_result *)new user_result(); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_result *arg1 = (user_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_ALLOWED_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - is_action_allowed result; - - (void)jenv; - (void)jcls; - result = (is_action_allowed)ALLOWED; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_CONDITIONNAL_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - is_action_allowed result; - - (void)jenv; - (void)jcls; - result = (is_action_allowed)CONDITIONNAL; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_DENIED_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - is_action_allowed result; - - (void)jenv; - (void)jcls; - result = (is_action_allowed)DENIED; - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1completed_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics *arg1 = (statistics *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->completed_requests = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1completed_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (json_object *) ((arg1)->completed_requests); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1connections_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics *arg1 = (statistics *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->connections = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1connections_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (json_object *) ((arg1)->connections); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1failed_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics *arg1 = (statistics *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->failed_requests = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1failed_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (json_object *) ((arg1)->failed_requests); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1ongoing_1requests_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics *arg1 = (statistics *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->ongoing_requests = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1ongoing_1requests_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (json_object *) ((arg1)->ongoing_requests); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1timestamp_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - statistics *arg1 = (statistics *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->timestamp = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_Statistics_1timestamp_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - statistics *arg1 = (statistics *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - result = (unsigned long long) ((arg1)->timestamp); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Statistics(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - result = (statistics *)new statistics(); - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Statistics(JNIEnv *jenv, jclass jcls, jlong jarg1) { - statistics *arg1 = (statistics *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(statistics **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StatisticsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - statistics_result *arg1 = (statistics_result *) 0 ; - statistics *arg2 = (statistics *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(statistics_result **)&jarg1; - arg2 = *(statistics **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StatisticsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - statistics_result *arg1 = (statistics_result *) 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics_result **)&jarg1; - result = (statistics *) ((arg1)->result); - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StatisticsResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - statistics_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (statistics_result *)new statistics_result(); - *(statistics_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StatisticsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - statistics_result *arg1 = (statistics_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(statistics_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - statistics *arg2 = (statistics *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(all_statistics_result **)&jarg1; - arg2 = *(statistics **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(all_statistics_result **)&jarg1; - result = (statistics *) ((arg1)->result); - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(all_statistics_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_AllStatisticsResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(all_statistics_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1AllStatisticsResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - all_statistics_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (all_statistics_result *)new all_statistics_result(); - *(all_statistics_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1AllStatisticsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(all_statistics_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - geopos_result *arg1 = (geopos_result *) 0 ; - double (*arg2)[2] = (double (*)[2]) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - arg2 = *(double (**)[2])&jarg2; - if (arg1) (arg1)->result = (double (*)[2])arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - geopos_result *arg1 = (geopos_result *) 0 ; - double (*result)[2] = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - result = (double (*)[2]) ((arg1)->result); - *(double (**)[2])&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - geopos_result *arg1 = (geopos_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_geopos_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - geopos_result *arg1 = (geopos_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1geopos_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - geopos_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (geopos_result *)new geopos_result(); - *(geopos_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1geopos_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - geopos_result *arg1 = (geopos_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(geopos_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1valid_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - token_validity *arg1 = (token_validity *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->valid = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1valid_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - token_validity *arg1 = (token_validity *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - result = (bool) ((arg1)->valid); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - token_validity *arg1 = (token_validity *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->state; - if (arg2) { - arg1->state = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->state, (const char *)arg2); - } else { - arg1->state = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - token_validity *arg1 = (token_validity *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - result = (char *) ((arg1)->state); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1expires_1at_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) { - token_validity *arg1 = (token_validity *) 0 ; - unsigned long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return ; - } - clazz = jenv->GetObjectClass(jarg2); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg2, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg2 = 0; - if (sz > 0) { - arg2 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - if (arg1) (arg1)->expires_at = arg2; -} - - -SWIGEXPORT jobject JNICALL Java_io_kuzzle_sdk_kcoreJNI_TokenValidity_1expires_1at_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jobject jresult = 0 ; - token_validity *arg1 = (token_validity *) 0 ; - unsigned long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - result = (unsigned long long) ((arg1)->expires_at); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); - } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jenv->DeleteLocalRef(ba); - jresult = bigint; - } - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1TokenValidity(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - token_validity *result = 0 ; - - (void)jenv; - (void)jcls; - result = (token_validity *)new token_validity(); - *(token_validity **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1TokenValidity(JNIEnv *jenv, jclass jcls, jlong jarg1) { - token_validity *arg1 = (token_validity *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(token_validity **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1request_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->request_id; - if (arg2) { - arg1->request_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->request_id, (const char *)arg2); - } else { - arg1->request_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1request_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->request_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (json_object *) ((arg1)->result); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1volatiles_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->volatiles = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1volatiles_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (json_object *) ((arg1)->volatiles); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1controller_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->controller; - if (arg2) { - arg1->controller = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->controller, (const char *)arg2); - } else { - arg1->controller = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1controller_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->controller); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1action_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->action; - if (arg2) { - arg1->action = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->action, (const char *)arg2); - } else { - arg1->action = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1action_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->action); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1room_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->room_id; - if (arg2) { - arg1->room_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->room_id, (const char *)arg2); - } else { - arg1->room_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1room_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->room_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1channel_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->channel; - if (arg2) { - arg1->channel = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->channel, (const char *)arg2); - } else { - arg1->channel = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleResponse_1channel_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - result = (char *) ((arg1)->channel); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleResponse(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzle_response *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzle_response *)new kuzzle_response(); - *(kuzzle_response **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleResponse(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzle_response **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1void_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (void_result *)new void_result(); - *(void_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1void_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - void_result *arg1 = (void_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(void_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - json_result *arg1 = (json_result *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(json_result **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - json_result *arg1 = (json_result *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_result **)&jarg1; - result = (json_object *) ((arg1)->result); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1JsonResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (json_result *)new json_result(); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1JsonResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - json_result *arg1 = (json_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(json_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - json_array_result *arg1 = (json_array_result *) 0 ; - json_object **arg2 = (json_object **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - arg2 = *(json_object ***)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - json_array_result *arg1 = (json_array_result *) 0 ; - json_object **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - result = (json_object **) ((arg1)->result); - *(json_object ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - json_array_result *arg1 = (json_array_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_json_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - json_array_result *arg1 = (json_array_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1json_1array_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (json_array_result *)new json_array_result(); - *(json_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1json_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - json_array_result *arg1 = (json_array_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(json_array_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_BoolResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - bool_result *arg1 = (bool_result *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(bool_result **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_BoolResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - bool_result *arg1 = (bool_result *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(bool_result **)&jarg1; - result = (bool) ((arg1)->result); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BoolResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (bool_result *)new bool_result(); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1BoolResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - bool_result *arg1 = (bool_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(bool_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - int_result *arg1 = (int_result *) 0 ; - long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_result **)&jarg1; - arg2 = (long long)jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - int_result *arg1 = (int_result *) 0 ; - long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_result **)&jarg1; - result = (long long) ((arg1)->result); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1int_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (int_result *)new int_result(); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1int_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - int_result *arg1 = (int_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(int_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DateResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - date_result *arg1 = (date_result *) 0 ; - long long arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(date_result **)&jarg1; - arg2 = (long long)jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DateResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - date_result *arg1 = (date_result *) 0 ; - long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(date_result **)&jarg1; - result = (long long) ((arg1)->result); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1DateResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - date_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (date_result *)new date_result(); - *(date_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1DateResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - date_result *arg1 = (date_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(date_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_double_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) { - double_result *arg1 = (double_result *) 0 ; - double arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(double_result **)&jarg1; - arg2 = (double)jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_double_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jdouble jresult = 0 ; - double_result *arg1 = (double_result *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(double_result **)&jarg1; - result = (double) ((arg1)->result); - jresult = (jdouble)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1double_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (double_result *)new double_result(); - *(double_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1double_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - double_result *arg1 = (double_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(double_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - int_array_result *arg1 = (int_array_result *) 0 ; - long long *arg2 = (long long *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - arg2 = *(long long **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - int_array_result *arg1 = (int_array_result *) 0 ; - long long *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - result = (long long *) ((arg1)->result); - *(long long **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - int_array_result *arg1 = (int_array_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_int_1array_1result_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - int_array_result *arg1 = (int_array_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1int_1array_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - int_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (int_array_result *)new int_array_result(); - *(int_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1int_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - int_array_result *arg1 = (int_array_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(int_array_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_string_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - string_result *arg1 = (string_result *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_result **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->result; - if (arg2) { - arg1->result = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->result, (const char *)arg2); - } else { - arg1->result = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_string_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - string_result *arg1 = (string_result *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_result **)&jarg1; - result = (char *) ((arg1)->result); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1string_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (string_result *)new string_result(); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1string_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - string_result *arg1 = (string_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(string_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - string_array_result *arg1 = (string_array_result *) 0 ; - char **arg2 = (char **) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - arg2 = *(char ***)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - string_array_result *arg1 = (string_array_result *) 0 ; - char **result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - result = (char **) ((arg1)->result); - *(char ***)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - string_array_result *arg1 = (string_array_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringArrayResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - string_array_result *arg1 = (string_array_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringArrayResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (string_array_result *)new string_array_result(); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StringArrayResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - string_array_result *arg1 = (string_array_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(string_array_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1query_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_filters *arg1 = (search_filters *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_filters **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->query = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1query_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_filters *arg1 = (search_filters *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - result = (json_object *) ((arg1)->query); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1sort_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_filters *arg1 = (search_filters *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_filters **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->sort = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1sort_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_filters *arg1 = (search_filters *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - result = (json_object *) ((arg1)->sort); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1aggregations_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_filters *arg1 = (search_filters *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_filters **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->aggregations = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1aggregations_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_filters *arg1 = (search_filters *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - result = (json_object *) ((arg1)->aggregations); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1search_1after_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_filters *arg1 = (search_filters *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_filters **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->search_after = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchFilters_1search_1after_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_filters *arg1 = (search_filters *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - result = (json_object *) ((arg1)->search_after); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SearchFilters(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_filters *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_filters *)new search_filters(); - *(search_filters **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SearchFilters(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_filters *arg1 = (search_filters *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_filters **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - profile_search *arg1 = (profile_search *) 0 ; - profile *arg2 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile_search **)&jarg1; - arg2 = *(profile **)&jarg2; - if (arg1) (arg1)->hits = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile_search *arg1 = (profile_search *) 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - result = (profile *) ((arg1)->hits); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - profile_search *arg1 = (profile_search *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->hits_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile_search *arg1 = (profile_search *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - result = ((arg1)->hits_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - profile_search *arg1 = (profile_search *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - profile_search *arg1 = (profile_search *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - profile_search *arg1 = (profile_search *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_profile_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - profile_search *arg1 = (profile_search *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1profile_1search(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - profile_search *result = 0 ; - - (void)jenv; - (void)jcls; - result = (profile_search *)new profile_search(); - *(profile_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1profile_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { - profile_search *arg1 = (profile_search *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(profile_search **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - role_search *arg1 = (role_search *) 0 ; - role *arg2 = (role *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role_search **)&jarg1; - arg2 = *(role **)&jarg2; - if (arg1) (arg1)->hits = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role_search *arg1 = (role_search *) 0 ; - role *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - result = (role *) ((arg1)->hits); - *(role **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - role_search *arg1 = (role_search *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->hits_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role_search *arg1 = (role_search *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - result = ((arg1)->hits_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - role_search *arg1 = (role_search *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_role_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - role_search *arg1 = (role_search *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1role_1search(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - role_search *result = 0 ; - - (void)jenv; - (void)jcls; - result = (role_search *)new role_search(); - *(role_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1role_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { - role_search *arg1 = (role_search *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(role_search **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - user_search *arg1 = (user_search *) 0 ; - user *arg2 = (user *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user_search **)&jarg1; - arg2 = *(user **)&jarg2; - if (arg1) (arg1)->hits = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_search *arg1 = (user_search *) 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - result = (user *) ((arg1)->hits); - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_search *arg1 = (user_search *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->hits_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_search *arg1 = (user_search *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - result = ((arg1)->hits_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - user_search *arg1 = (user_search *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - user_search *arg1 = (user_search *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - user_search *arg1 = (user_search *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_user_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - user_search *arg1 = (user_search *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1user_1search(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - user_search *result = 0 ; - - (void)jenv; - (void)jcls; - result = (user_search *)new user_search(); - *(user_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1user_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { - user_search *arg1 = (user_search *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(user_search **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1acknowledged_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - ack_result *arg1 = (ack_result *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->acknowledged = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1acknowledged_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - ack_result *arg1 = (ack_result *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - result = (bool) ((arg1)->acknowledged); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1shards_1acknowledged_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - ack_result *arg1 = (ack_result *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->shards_acknowledged = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_ack_1result_1shards_1acknowledged_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - ack_result *arg1 = (ack_result *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - result = (bool) ((arg1)->shards_acknowledged); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ack_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - ack_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (ack_result *)new ack_result(); - *(ack_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ack_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - ack_result *arg1 = (ack_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(ack_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_ShardsResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - shards_result *arg1 = (shards_result *) 0 ; - shards *arg2 = (shards *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(shards_result **)&jarg1; - arg2 = *(shards **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ShardsResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - shards_result *arg1 = (shards_result *) 0 ; - shards *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards_result **)&jarg1; - result = (shards *) ((arg1)->result); - *(shards **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ShardsResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - shards_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (shards_result *)new shards_result(); - *(shards_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ShardsResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - shards_result *arg1 = (shards_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(shards_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1strict_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - specification *arg1 = (specification *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->strict = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1strict_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - specification *arg1 = (specification *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - result = (bool) ((arg1)->strict); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1fields_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification *arg1 = (specification *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->fields = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1fields_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification *arg1 = (specification *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - result = (json_object *) ((arg1)->fields); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1validators_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification *arg1 = (specification *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->validators = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1validators_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification *arg1 = (specification *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - result = (json_object *) ((arg1)->validators); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification *)new specification(); - *(specification **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification *arg1 = (specification *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1validation_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification_entry *arg1 = (specification_entry *) 0 ; - specification *arg2 = (specification *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification_entry **)&jarg1; - arg2 = *(specification **)&jarg2; - if (arg1) (arg1)->validation = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1validation_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_entry *arg1 = (specification_entry *) 0 ; - specification *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - result = (specification *) ((arg1)->validation); - *(specification **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1index_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - specification_entry *arg1 = (specification_entry *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->index; - if (arg2) { - arg1->index = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->index, (const char *)arg2); - } else { - arg1->index = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1index_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - specification_entry *arg1 = (specification_entry *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - result = (char *) ((arg1)->index); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - specification_entry *arg1 = (specification_entry *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->collection; - if (arg2) { - arg1->collection = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->collection, (const char *)arg2); - } else { - arg1->collection = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1entry_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - specification_entry *arg1 = (specification_entry *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - result = (char *) ((arg1)->collection); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1entry(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification_entry *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification_entry *)new specification_entry(); - *(specification_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification_entry *arg1 = (specification_entry *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification_entry **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification_result *arg1 = (specification_result *) 0 ; - specification *arg2 = (specification *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification_result **)&jarg1; - arg2 = *(specification **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_result *arg1 = (specification_result *) 0 ; - specification *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_result **)&jarg1; - result = (specification *) ((arg1)->result); - *(specification **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification_result *)new specification_result(); - *(specification_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification_result *arg1 = (specification_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - document *arg2 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(document **)&jarg2; - if (arg1) (arg1)->documents = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (document *) ((arg1)->documents); - *(document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - search_result *arg1 = (search_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->documents_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1documents_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = ((arg1)->documents_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1fetched_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - search_result *arg1 = (search_result *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->fetched = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1fetched_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (unsigned int) ((arg1)->fetched); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - search_result *arg1 = (search_result *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1aggregations_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->aggregations = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1aggregations_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (json_object *) ((arg1)->aggregations); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1filters_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(search_filters **)&jarg2; - if (arg1) (arg1)->filters = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1filters_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - search_filters *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (search_filters *) ((arg1)->filters); - *(search_filters **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1options_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - query_options *arg2 = (query_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(query_options **)&jarg2; - if (arg1) (arg1)->options = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1options_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - query_options *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (query_options *) ((arg1)->options); - *(query_options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_result *arg1 = (search_result *) 0 ; - collection *arg2 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_result **)&jarg1; - arg2 = *(collection **)&jarg2; - if (arg1) (arg1)->collection = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SearchResult_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (collection *) ((arg1)->collection); - *(collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SearchResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_result *)new search_result(); - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SearchResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_result *arg1 = (search_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1profiles_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_profiles_result *arg1 = (search_profiles_result *) 0 ; - profile_search *arg2 = (profile_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_profiles_result **)&jarg1; - arg2 = *(profile_search **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1profiles_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_profiles_result *arg1 = (search_profiles_result *) 0 ; - profile_search *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_profiles_result **)&jarg1; - result = (profile_search *) ((arg1)->result); - *(profile_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1profiles_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_profiles_result *)new search_profiles_result(); - *(search_profiles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_profiles_result *arg1 = (search_profiles_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_profiles_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1roles_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_roles_result *arg1 = (search_roles_result *) 0 ; - role_search *arg2 = (role_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_roles_result **)&jarg1; - arg2 = *(role_search **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1roles_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_roles_result *arg1 = (search_roles_result *) 0 ; - role_search *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_roles_result **)&jarg1; - result = (role_search *) ((arg1)->result); - *(role_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1roles_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_roles_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_roles_result *)new search_roles_result(); - *(search_roles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1roles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_roles_result *arg1 = (search_roles_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_roles_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1users_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - search_users_result *arg1 = (search_users_result *) 0 ; - user_search *arg2 = (user_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(search_users_result **)&jarg1; - arg2 = *(user_search **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_search_1users_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_users_result *arg1 = (search_users_result *) 0 ; - user_search *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_users_result **)&jarg1; - result = (user_search *) ((arg1)->result); - *(user_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1search_1users_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - search_users_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (search_users_result *)new search_users_result(); - *(search_users_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1search_1users_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - search_users_result *arg1 = (search_users_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(search_users_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification_search *arg1 = (specification_search *) 0 ; - specification_entry *arg2 = (specification_entry *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification_search **)&jarg1; - arg2 = *(specification_entry **)&jarg2; - if (arg1) (arg1)->hits = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_search *arg1 = (specification_search *) 0 ; - specification_entry *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - result = (specification_entry *) ((arg1)->hits); - *(specification_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - specification_search *arg1 = (specification_search *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->hits_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1hits_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_search *arg1 = (specification_search *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - result = ((arg1)->hits_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1total_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - specification_search *arg1 = (specification_search *) 0 ; - unsigned int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - arg2 = (unsigned int)jarg2; - if (arg1) (arg1)->total = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1total_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_search *arg1 = (specification_search *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - result = (unsigned int) ((arg1)->total); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1scroll_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - specification_search *arg1 = (specification_search *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->scroll_id; - if (arg2) { - arg1->scroll_id = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->scroll_id, (const char *)arg2); - } else { - arg1->scroll_id = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1scroll_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - specification_search *arg1 = (specification_search *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - result = (char *) ((arg1)->scroll_id); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1search(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification_search *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification_search *)new specification_search(); - *(specification_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1search(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification_search *arg1 = (specification_search *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification_search **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - specification_search_result *arg1 = (specification_search_result *) 0 ; - specification_search *arg2 = (specification_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(specification_search_result **)&jarg1; - arg2 = *(specification_search **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_specification_1search_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - specification_search_result *arg1 = (specification_search_result *) 0 ; - specification_search *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search_result **)&jarg1; - result = (specification_search *) ((arg1)->result); - *(specification_search **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1specification_1search_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - specification_search_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (specification_search_result *)new specification_search_result(); - *(specification_search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1specification_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - specification_search_result *arg1 = (specification_search_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(specification_search_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1mapping_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - mapping *arg1 = (mapping *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping **)&jarg1; - arg2 = *(json_object **)&jarg2; - if (arg1) (arg1)->mapping = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1mapping_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - mapping *arg1 = (mapping *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping **)&jarg1; - result = (json_object *) ((arg1)->mapping); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - mapping *arg1 = (mapping *) 0 ; - collection *arg2 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping **)&jarg1; - arg2 = *(collection **)&jarg2; - if (arg1) (arg1)->collection = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - mapping *arg1 = (mapping *) 0 ; - collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping **)&jarg1; - result = (collection *) ((arg1)->collection); - *(collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1) { - mapping *arg1 = (mapping *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(mapping **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1result_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - mapping_result *arg1 = (mapping_result *) 0 ; - mapping *arg2 = (mapping *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping_result **)&jarg1; - arg2 = *(mapping **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_mapping_1result_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - mapping_result *arg1 = (mapping_result *) 0 ; - mapping *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping_result **)&jarg1; - result = (mapping *) ((arg1)->result); - *(mapping **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1mapping_1result(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - mapping_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (mapping_result *)new mapping_result(); - *(mapping_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1mapping_1result(JNIEnv *jenv, jclass jcls, jlong jarg1) { - mapping_result *arg1 = (mapping_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(mapping_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1persisted_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - collection_entry *arg1 = (collection_entry *) 0 ; - bool arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - arg2 = jarg2 ? true : false; - if (arg1) (arg1)->persisted = arg2; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1persisted_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - collection_entry *arg1 = (collection_entry *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - result = (bool) ((arg1)->persisted); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1name_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - collection_entry *arg1 = (collection_entry *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - delete [] arg1->name; - if (arg2) { - arg1->name = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->name, (const char *)arg2); - } else { - arg1->name = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsList_1name_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - collection_entry *arg1 = (collection_entry *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - result = (char *) ((arg1)->name); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1CollectionsList(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - collection_entry *result = 0 ; - - (void)jenv; - (void)jcls; - result = (collection_entry *)new collection_entry(); - *(collection_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1CollectionsList(JNIEnv *jenv, jclass jcls, jlong jarg1) { - collection_entry *arg1 = (collection_entry *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(collection_entry **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - collection_entry *arg2 = (collection_entry *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection_entry_result **)&jarg1; - arg2 = *(collection_entry **)&jarg2; - if (arg1) (arg1)->result = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - collection_entry *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry_result **)&jarg1; - result = (collection_entry *) ((arg1)->result); - *(collection_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1length_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry_result **)&jarg1; - arg2 = (size_t)jarg2; - if (arg1) (arg1)->result_length = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_CollectionsListResult_1result_1length_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - size_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry_result **)&jarg1; - result = ((arg1)->result_length); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1CollectionsListResult(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - collection_entry_result *result = 0 ; - - (void)jenv; - (void)jcls; - result = (collection_entry_result *)new collection_entry_result(); - *(collection_entry_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1CollectionsListResult(JNIEnv *jenv, jclass jcls, jlong jarg1) { - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(collection_entry_result **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1p_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - _GoString_ *arg1 = (_GoString_ *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(_GoString_ **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - { - if (arg2) { - arg1->p = (char const *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->p, (const char *)arg2); - } else { - arg1->p = 0; - } - } - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1p_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - _GoString_ *arg1 = (_GoString_ *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(_GoString_ **)&jarg1; - result = (char *) ((arg1)->p); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1n_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - _GoString_ *arg1 = (_GoString_ *) 0 ; - ptrdiff_t arg2 ; - ptrdiff_t *argp2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(_GoString_ **)&jarg1; - argp2 = *(ptrdiff_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null ptrdiff_t"); - return ; - } - arg2 = *argp2; - if (arg1) (arg1)->n = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI__1GoString_1_1n_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - _GoString_ *arg1 = (_GoString_ *) 0 ; - ptrdiff_t result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(_GoString_ **)&jarg1; - result = ((arg1)->n); - *(ptrdiff_t **)&jresult = new ptrdiff_t((const ptrdiff_t &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1_1GoString_1(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - _GoString_ *result = 0 ; - - (void)jenv; - (void)jcls; - result = (_GoString_ *)new _GoString_(); - *(_GoString_ **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1_1GoString_1(JNIEnv *jenv, jclass jcls, jlong jarg1) { - _GoString_ *arg1 = (_GoString_ *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(_GoString_ **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_free_1char_1array(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) { - char **arg1 = (char **) 0 ; - size_t arg2 ; - - (void)jenv; - (void)jcls; - arg1 = *(char ***)&jarg1; - arg2 = (size_t)jarg2; - free_char_array(arg1,arg2); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_assign_1geopos(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jdouble jarg3, jdouble jarg4) { - double (*arg1)[2] = (double (*)[2]) 0 ; - int arg2 ; - double arg3 ; - double arg4 ; - - (void)jenv; - (void)jcls; - arg1 = *(double (**)[2])&jarg1; - arg2 = (int)jarg2; - arg3 = (double)jarg3; - arg4 = (double)jarg4; - assign_geopos((double (*)[2])arg1,arg2,arg3,arg4); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1t_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoInterface *arg1 = (GoInterface *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoInterface **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->t = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1t_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoInterface *arg1 = (GoInterface *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoInterface **)&jarg1; - result = (void *) ((arg1)->t); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1v_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoInterface *arg1 = (GoInterface *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoInterface **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->v = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoInterface_1v_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoInterface *arg1 = (GoInterface *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoInterface **)&jarg1; - result = (void *) ((arg1)->v); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GoInterface(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - GoInterface *result = 0 ; - - (void)jenv; - (void)jcls; - result = (GoInterface *)new GoInterface(); - *(GoInterface **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GoInterface(JNIEnv *jenv, jclass jcls, jlong jarg1) { - GoInterface *arg1 = (GoInterface *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(GoInterface **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1data_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoSlice *arg1 = (GoSlice *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - arg2 = *(void **)&jarg2; - if (arg1) (arg1)->data = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1data_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoSlice *arg1 = (GoSlice *) 0 ; - void *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - result = (void *) ((arg1)->data); - *(void **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1len_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoSlice *arg1 = (GoSlice *) 0 ; - GoInt arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - arg2 = (GoInt)jarg2; - if (arg1) (arg1)->len = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1len_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoSlice *arg1 = (GoSlice *) 0 ; - GoInt result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - result = (GoInt) ((arg1)->len); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1cap_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - GoSlice *arg1 = (GoSlice *) 0 ; - GoInt arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - arg2 = (GoInt)jarg2; - if (arg1) (arg1)->cap = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GoSlice_1cap_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - GoSlice *arg1 = (GoSlice *) 0 ; - GoInt result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(GoSlice **)&jarg1; - result = (GoInt) ((arg1)->cap); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GoSlice(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - GoSlice *result = 0 ; - - (void)jenv; - (void)jcls; - result = (GoSlice *)new GoSlice(); - *(GoSlice **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GoSlice(JNIEnv *jenv, jclass jcls, jlong jarg1) { - GoSlice *arg1 = (GoSlice *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(GoSlice **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - kuzzle_set_jwt(arg1,arg2); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1unset_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_unset_jwt(arg1); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1jwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_get_jwt(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1login(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - int *arg4 = (int *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(int **)&jarg4; - result = (string_result *)kuzzle_login(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_logout(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1check_1token(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - token_validity *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (token_validity *)kuzzle_check_token(arg1,arg2); - *(token_validity **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1create_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_create_my_credentials(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1delete_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_delete_my_credentials(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_get_my_credentials(arg1,arg2,arg3); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_update_my_credentials(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1validate_1my_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_validate_my_credentials(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1my_1rights(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (json_result *)kuzzle_get_my_rights(arg1,arg2); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1update_1self(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - user_data *arg2 = (user_data *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(user_data **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_update_self(arg1,arg2,arg3); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1who_1am_1i(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (user_result *)kuzzle_who_am_i(arg1); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterCollection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - collection *arg1 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - unregisterCollection(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jstring jarg4) { - collection *arg1 = (collection *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return ; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return ; - } - kuzzle_new_collection(arg1,arg2,arg3,arg4); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_collection_create(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1publish_1message(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_collection_publish_message(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1truncate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_collection_truncate(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jlong jarg5) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - room_options *arg3 = (room_options *) 0 ; - kuzzle_notification_listener arg4 = (kuzzle_notification_listener) 0 ; - void *arg5 = (void *) 0 ; - room_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(room_options **)&jarg3; - arg4 = *(kuzzle_notification_listener *)&jarg4; - arg5 = *(void **)&jarg5; - result = (room_result *)kuzzle_collection_subscribe(arg1,arg2,arg3,arg4,arg5); - *(room_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_collection_count(arg1,arg2,arg3); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1create_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - document *arg3 = (document *) 0 ; - query_options *arg4 = (query_options *) 0 ; - document_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(document **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (document_result *)kuzzle_collection_create_document(arg1,arg2,arg3,arg4); - *(document_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1delete_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_collection_delete_document(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1document_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_collection_document_exists(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1fetch_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - document_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (document_result *)kuzzle_collection_fetch_document(arg1,arg2,arg3); - *(document_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1replace_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - document *arg3 = (document *) 0 ; - query_options *arg4 = (query_options *) 0 ; - document_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(document **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (document_result *)kuzzle_collection_replace_document(arg1,arg2,arg3,arg4); - *(document_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1update_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - document *arg3 = (document *) 0 ; - query_options *arg4 = (query_options *) 0 ; - document_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(document **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (document_result *)kuzzle_collection_update_document(arg1,arg2,arg3,arg4); - *(document_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1scroll(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (search_result *)kuzzle_collection_scroll(arg1,arg2,arg3); - *(search_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (search_result *)kuzzle_collection_search(arg1,arg2,arg3); - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1create_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - document **arg2 = (document **) 0 ; - unsigned int arg3 ; - query_options *arg4 = (query_options *) 0 ; - document_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = *(document ***)&jarg2; - arg3 = (unsigned int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (document_array_result *)kuzzle_collection_m_create_document(arg1,arg2,arg3,arg4); - *(document_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1create_1or_1replace_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - document **arg2 = (document **) 0 ; - unsigned int arg3 ; - query_options *arg4 = (query_options *) 0 ; - document_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = *(document ***)&jarg2; - arg3 = (unsigned int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (document_array_result *)kuzzle_collection_m_create_or_replace_document(arg1,arg2,arg3,arg4); - *(document_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1delete_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_array_result *)kuzzle_collection_m_delete_document(arg1,arg2,arg3,arg4); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1get_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - document_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (document_array_result *)kuzzle_collection_m_get_document(arg1,arg2,arg3,arg4); - *(document_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1replace_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - document **arg2 = (document **) 0 ; - unsigned int arg3 ; - query_options *arg4 = (query_options *) 0 ; - document_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = *(document ***)&jarg2; - arg3 = (unsigned int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (document_array_result *)kuzzle_collection_m_replace_document(arg1,arg2,arg3,arg4); - *(document_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1m_1update_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - document **arg2 = (document **) 0 ; - unsigned int arg3 ; - query_options *arg4 = (query_options *) 0 ; - document_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(collection **)&jarg1; - arg2 = *(document ***)&jarg2; - arg3 = (unsigned int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (document_array_result *)kuzzle_collection_m_update_document(arg1,arg2,arg3,arg4); - *(document_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - mapping *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - result = (mapping *)kuzzle_new_mapping(arg1); - *(mapping **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1get_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - query_options *arg2 = (query_options *) 0 ; - mapping_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (mapping_result *)kuzzle_collection_get_mapping(arg1,arg2); - *(mapping_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1mapping_1apply(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - mapping *arg1 = (mapping *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_mapping_apply(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1mapping_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - mapping *arg1 = (mapping *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_mapping_refresh(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1mapping_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - mapping *arg1 = (mapping *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(mapping **)&jarg1; - arg2 = *(json_object **)&jarg2; - kuzzle_mapping_set(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1delete_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_collection_delete_specifications(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1get_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - query_options *arg2 = (query_options *) 0 ; - specification_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(collection **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (specification_result *)kuzzle_collection_get_specifications(arg1,arg2); - *(specification_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1scroll_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - specification_search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (specification_search_result *)kuzzle_collection_scroll_specifications(arg1,arg2,arg3); - *(specification_search_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1search_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - specification_search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (specification_search_result *)kuzzle_collection_search_specifications(arg1,arg2,arg3); - *(specification_search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1update_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - specification *arg2 = (specification *) 0 ; - query_options *arg3 = (query_options *) 0 ; - specification_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = *(specification **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (specification_result *)kuzzle_collection_update_specifications(arg1,arg2,arg3); - *(specification_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1collection_1validate_1specifications(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - collection *arg1 = (collection *) 0 ; - specification *arg2 = (specification *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(collection **)&jarg1; - arg2 = *(specification **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_collection_validate_specifications(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1kuzzle_1request(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle_request *arg1 = (kuzzle_request *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_request **)&jarg1; - kuzzle_free_kuzzle_request(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1query_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - query_object *arg1 = (query_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_object **)&jarg1; - kuzzle_free_query_object(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - offline_queue *arg1 = (offline_queue *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(offline_queue **)&jarg1; - kuzzle_free_offline_queue(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1query_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - query_options *arg1 = (query_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(query_options **)&jarg1; - kuzzle_free_query_options(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1room_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - room_options *arg1 = (room_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_options **)&jarg1; - kuzzle_free_room_options(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1options(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - options *arg1 = (options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(options **)&jarg1; - kuzzle_free_options(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1meta(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - meta *arg1 = (meta *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(meta **)&jarg1; - kuzzle_free_meta(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1policy_1restriction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - policy_restriction *arg1 = (policy_restriction *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy_restriction **)&jarg1; - kuzzle_free_policy_restriction(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - policy *arg1 = (policy *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(policy **)&jarg1; - kuzzle_free_policy(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profile *arg1 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - kuzzle_free_profile(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - role *arg1 = (role *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - kuzzle_free_role(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user *arg1 = (user *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - kuzzle_free_user(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1data(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_data *arg1 = (user_data *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_data **)&jarg1; - kuzzle_free_user_data(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - collection *arg1 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection **)&jarg1; - kuzzle_free_collection(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - document *arg1 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - kuzzle_free_document(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - document_result *arg1 = (document_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_result **)&jarg1; - kuzzle_free_document_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1notification_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - notification_content *arg1 = (notification_content *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_content **)&jarg1; - kuzzle_free_notification_content(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1notification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - notification_result *arg1 = (notification_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - kuzzle_free_notification_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profile_result *arg1 = (profile_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_result **)&jarg1; - kuzzle_free_profile_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profiles_result *arg1 = (profiles_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profiles_result **)&jarg1; - kuzzle_free_profiles_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - role_result *arg1 = (role_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_result **)&jarg1; - kuzzle_free_role_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1right(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_right *arg1 = (user_right *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_right **)&jarg1; - kuzzle_free_user_right(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1rights_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_rights_result *arg1 = (user_rights_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_rights_result **)&jarg1; - kuzzle_free_user_rights_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_result *arg1 = (user_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_result **)&jarg1; - kuzzle_free_user_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1statistics(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - statistics *arg1 = (statistics *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics **)&jarg1; - kuzzle_free_statistics(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1statistics_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - statistics_result *arg1 = (statistics_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(statistics_result **)&jarg1; - kuzzle_free_statistics_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1all_1statistics_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - all_statistics_result *arg1 = (all_statistics_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(all_statistics_result **)&jarg1; - kuzzle_free_all_statistics_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1geopos_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - geopos_result *arg1 = (geopos_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(geopos_result **)&jarg1; - kuzzle_free_geopos_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1token_1validity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - token_validity *arg1 = (token_validity *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(token_validity **)&jarg1; - kuzzle_free_token_validity(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1kuzzle_1response(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle_response *arg1 = (kuzzle_response *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_response **)&jarg1; - kuzzle_free_kuzzle_response(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - json_result *arg1 = (json_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_result **)&jarg1; - kuzzle_free_json_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - json_array_result *arg1 = (json_array_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_array_result **)&jarg1; - kuzzle_free_json_array_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1bool_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - bool_result *arg1 = (bool_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(bool_result **)&jarg1; - kuzzle_free_bool_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1int_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - int_result *arg1 = (int_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_result **)&jarg1; - kuzzle_free_int_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1double_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - double_result *arg1 = (double_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(double_result **)&jarg1; - kuzzle_free_double_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1int_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - int_array_result *arg1 = (int_array_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(int_array_result **)&jarg1; - kuzzle_free_int_array_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1string_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - string_result *arg1 = (string_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_result **)&jarg1; - kuzzle_free_string_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1string_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - string_array_result *arg1 = (string_array_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(string_array_result **)&jarg1; - kuzzle_free_string_array_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1filters(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_filters *arg1 = (search_filters *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_filters **)&jarg1; - kuzzle_free_search_filters(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1profile_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profile_search *arg1 = (profile_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile_search **)&jarg1; - kuzzle_free_profile_search(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1role_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - role_search *arg1 = (role_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role_search **)&jarg1; - kuzzle_free_role_search(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1ack_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - ack_result *arg1 = (ack_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(ack_result **)&jarg1; - kuzzle_free_ack_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1shards_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - shards_result *arg1 = (shards_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(shards_result **)&jarg1; - kuzzle_free_shards_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification *arg1 = (specification *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification **)&jarg1; - kuzzle_free_specification(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification_entry *arg1 = (specification_entry *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_entry **)&jarg1; - kuzzle_free_specification_entry(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification_result *arg1 = (specification_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_result **)&jarg1; - kuzzle_free_specification_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_result *arg1 = (search_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - kuzzle_free_search_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1profiles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_profiles_result *arg1 = (search_profiles_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_profiles_result **)&jarg1; - kuzzle_free_search_profiles_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1roles_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_roles_result *arg1 = (search_roles_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_roles_result **)&jarg1; - kuzzle_free_search_roles_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification_search *arg1 = (specification_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search **)&jarg1; - kuzzle_free_specification_search(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1specification_1search_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - specification_search_result *arg1 = (specification_search_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(specification_search_result **)&jarg1; - kuzzle_free_specification_search_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1mapping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - mapping *arg1 = (mapping *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping **)&jarg1; - kuzzle_free_mapping(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1mapping_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - mapping_result *arg1 = (mapping_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(mapping_result **)&jarg1; - kuzzle_free_mapping_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1void_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - void_result *arg1 = (void_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(void_result **)&jarg1; - kuzzle_free_void_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection_1entry(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - collection_entry *arg1 = (collection_entry *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry **)&jarg1; - kuzzle_free_collection_entry(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1collection_1entry_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - collection_entry_result *arg1 = (collection_entry_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(collection_entry_result **)&jarg1; - kuzzle_free_collection_entry_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1user_1search(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user_search *arg1 = (user_search *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user_search **)&jarg1; - kuzzle_free_user_search(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1search_1users_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - search_users_result *arg1 = (search_users_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_users_result **)&jarg1; - kuzzle_free_search_users_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1document_1array_1result(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - document_array_result *arg1 = (document_array_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document_array_result **)&jarg1; - kuzzle_free_document_array_result(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterDocument(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - document *arg1 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - unregisterDocument(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1document(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jlong jarg4, jobject jarg4_) { - document *arg1 = (document *) 0 ; - collection *arg2 = (collection *) 0 ; - char *arg3 = (char *) 0 ; - json_object *arg4 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg4_; - arg1 = *(document **)&jarg1; - arg2 = *(collection **)&jarg2; - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return ; - } - arg4 = *(json_object **)&jarg4; - kuzzle_new_document(arg1,arg2,arg3,arg4); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jlong jarg4) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - room_options *arg2 = (room_options *) 0 ; - kuzzle_notification_listener arg3 = (kuzzle_notification_listener) 0 ; - void *arg4 = (void *) 0 ; - room_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(room_options **)&jarg2; - arg3 = *(kuzzle_notification_listener *)&jarg3; - arg4 = *(void **)&jarg4; - result = (room_result *)kuzzle_document_subscribe(arg1,arg2,arg3,arg4); - *(room_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - document_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (document_result *)kuzzle_document_save(arg1,arg2); - *(document_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - document_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (document_result *)kuzzle_document_refresh(arg1,arg2); - *(document_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1publish(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_document_publish(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_document_exists(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_document_delete(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1set_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3) { - document *arg1 = (document *) 0 ; - json_object *arg2 = (json_object *) 0 ; - _Bool arg3 ; - _Bool *argp3 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(document **)&jarg1; - arg2 = *(json_object **)&jarg2; - argp3 = *(_Bool **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); - return ; - } - arg3 = *argp3; - kuzzle_document_set_content(arg1,arg2,arg3); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1document_1get_1content(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - document *arg1 = (document *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(document **)&jarg1; - result = (json_object *)kuzzle_document_get_content(arg1); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterIndex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - unregisterIndex(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - kuzzle_new_index(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - char *arg2 = (char *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (void_result *)kuzzle_index_create(arg1,arg2); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - char *arg2 = (char *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (void_result *)kuzzle_index_delete(arg1,arg2); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1mdelete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - result = (string_array_result *)kuzzle_index_mdelete(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - char *arg2 = (char *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (bool_result *)kuzzle_index_exists(arg1,arg2); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - char *arg2 = (char *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (void_result *)kuzzle_index_refresh(arg1,arg2); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1refresh_1internal(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - result = (void_result *)kuzzle_index_refresh_internal(arg1); - *(void_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1set_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - char *arg2 = (char *) 0 ; - _Bool arg3 ; - _Bool *argp3 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - argp3 = *(_Bool **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); - return 0; - } - arg3 = *argp3; - result = (void_result *)kuzzle_index_set_auto_refresh(arg1,arg2,arg3); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1get_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - char *arg2 = (char *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (bool_result *)kuzzle_index_get_auto_refresh(arg1,arg2); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1index_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle_index *arg1 = (kuzzle_index *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle_index **)&jarg1; - result = (string_result *)kuzzle_index_list(arg1); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1new(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - json_object *arg1 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - kuzzle_json_new(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1put(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jint jarg4) { - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - void *arg3 = (void *) 0 ; - int arg4 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - arg3 = *(void **)&jarg3; - arg4 = (int)jarg4; - kuzzle_json_put(arg1,arg2,arg3,arg4); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1string(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jstring jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (char *)kuzzle_json_get_string(arg1,arg2); - if (result) jresult = jenv->NewStringUTF((const char *)result); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1int(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jint jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (int)kuzzle_json_get_int(arg1,arg2); - jresult = (jint)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1double(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jdouble jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (double)kuzzle_json_get_double(arg1,arg2); - jresult = (jdouble)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1bool(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - json_bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = kuzzle_json_get_bool(arg1,arg2); - *(json_bool **)&jresult = new json_bool((const json_bool &)result); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1json_1get_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (json_object *)kuzzle_json_get_json_object(arg1,arg2); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1free_1json_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - json_object *arg1 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - kuzzle_free_json_object(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterKuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - unregisterKuzzle(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - options *arg4 = (options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return ; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return ; - } - arg4 = *(options **)&jarg4; - kuzzle_new_kuzzle(arg1,arg2,arg3,arg4); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_connect(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_disconnect(arg1); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1default_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_get_default_index(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1default_1index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (int)kuzzle_set_default_index(arg1,arg2); - jresult = (jint)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1offline_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - offline_queue *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (offline_queue *)kuzzle_get_offline_queue(arg1); - *(offline_queue **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1flush_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_flush_queue(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1replay_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_replay_queue(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1start_1queuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_start_queuing(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1stop_1queuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzle *arg1 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - kuzzle_stop_queuing(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1add_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jlong jarg4) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - kuzzle_event_listener arg3 = (kuzzle_event_listener) 0 ; - void *arg4 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - arg3 = *(kuzzle_event_listener *)&jarg3; - arg4 = *(void **)&jarg4; - kuzzle_add_listener(arg1,arg2,arg3,arg4); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jlong jarg4) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - kuzzle_event_listener arg3 = (kuzzle_event_listener) 0 ; - void *arg4 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - arg3 = *(kuzzle_event_listener *)&jarg3; - arg4 = *(void **)&jarg4; - kuzzle_once(arg1,arg2,arg3,arg4); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1listener_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - GoInt result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - result = (GoInt)kuzzle_listener_count(arg1,arg2); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1remove_1listener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - void *arg3 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - arg3 = *(void **)&jarg3; - kuzzle_remove_listener(arg1,arg2,arg3); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1remove_1all_1listeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - kuzzle_remove_all_listeners(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_auto_queue(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1queue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool arg2 ; - _Bool *argp2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - argp2 = *(_Bool **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); - return ; - } - arg2 = *argp2; - kuzzle_set_auto_queue(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1reconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_auto_reconnect(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1resubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_auto_resubscribe(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1replay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_auto_replay(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1auto_1replay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool arg2 ; - _Bool *argp2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - argp2 = *(_Bool **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null _Bool"); - return ; - } - arg2 = *argp2; - kuzzle_set_auto_replay(arg1,arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1host(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (char *)kuzzle_get_host(arg1); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1offline_1queue_1loader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_offline_queue_loader result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (kuzzle_offline_queue_loader)kuzzle_get_offline_queue_loader(arg1); - *(kuzzle_offline_queue_loader *)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1offline_1queue_1loader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_offline_queue_loader arg2 = (kuzzle_offline_queue_loader) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_offline_queue_loader *)&jarg2; - kuzzle_set_offline_queue_loader(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1port(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_port(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_queue_filter result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (kuzzle_queue_filter)kuzzle_get_queue_filter(arg1); - *(kuzzle_queue_filter *)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1filter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_queue_filter arg2 = (kuzzle_queue_filter) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_queue_filter *)&jarg2; - kuzzle_set_queue_filter(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1max_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_queue_max_size(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1max_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - kuzzle_set_queue_max_size(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1queue_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_queue_ttl(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1queue_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - kuzzle_set_queue_ttl(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1replay_1interval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_replay_interval(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1replay_1interval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - kuzzle_set_replay_interval(arg1,arg2); -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1reconnection_1delay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (int)kuzzle_get_reconnection_delay(arg1); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1ssl_1connection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - _Bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = kuzzle_get_ssl_connection(arg1); - *(_Bool **)&jresult = new _Bool((const _Bool &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzle **)&jarg1; - result = (json_object *)kuzzle_get_volatile(arg1); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1set_1volatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzle *arg1 = (kuzzle *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(json_object **)&jarg2; - kuzzle_set_volatile(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1append(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_append(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_bitcount(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jlong jarg6, jobject jarg6_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char **arg4 = (char **) 0 ; - size_t arg5 ; - query_options *arg6 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg6_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(char ***)&jarg4; - arg5 = (size_t)jarg5; - arg6 = *(query_options **)&jarg6; - result = (int_result *)kuzzle_ms_bitop(arg1,arg2,arg3,arg4,arg5,arg6); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1bitpos(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jshort jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned char arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (unsigned char)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_bitpos(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1dbsize(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (int_result *)kuzzle_ms_dbsize(arg1,arg2); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1decr(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_decr(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1decrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_decrby(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1del(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_del(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_exists(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1expire(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned long arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (unsigned long)jarg3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_expire(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1expireat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jobject jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned long long arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return 0; - } - clazz = jenv->GetObjectClass(jarg3); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg3 = 0; - if (sz > 0) { - arg3 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_expireat(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1flushdb(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (void_result *)kuzzle_ms_flushdb(arg1,arg2); - *(void_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geoadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object **arg3 = (json_object **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_geoadd(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geodist(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (double_result *)kuzzle_ms_geodist(arg1,arg2,arg3,arg4,arg5); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geohash(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_geohash(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1geopos(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - geopos_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (geopos_result *)kuzzle_ms_geopos(arg1,arg2,arg3,arg4,arg5); - *(geopos_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1georadius(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jdouble jarg5, jstring jarg6, jlong jarg7, jobject jarg7_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - double arg4 ; - double arg5 ; - char *arg6 = (char *) 0 ; - query_options *arg7 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg7_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = (double)jarg4; - arg5 = (double)jarg5; - arg6 = 0; - if (jarg6) { - arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); - if (!arg6) return 0; - } - arg7 = *(query_options **)&jarg7; - result = (json_array_result *)kuzzle_ms_georadius(arg1,arg2,arg3,arg4,arg5,arg6,arg7); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1georadiusbymember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - double arg4 ; - char *arg5 = (char *) 0 ; - query_options *arg6 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg6_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (double)jarg4; - arg5 = 0; - if (jarg5) { - arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); - if (!arg5) return 0; - } - arg6 = *(query_options **)&jarg6; - result = (json_array_result *)kuzzle_ms_georadiusbymember(arg1,arg2,arg3,arg4,arg5,arg6); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_ms_get(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getbit(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_getbit(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - int arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = (int)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_result *)kuzzle_ms_getrange(arg1,arg2,arg3,arg4,arg5); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1getset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_getset(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hdel(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_hdel(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hexists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_hexists(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_hget(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hgetall(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_ms_hgetall(arg1,arg2,arg3); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hincrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_hincrby(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hincrbyfloat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (double_result *)kuzzle_ms_hincrbyfloat(arg1,arg2,arg3,arg4,arg5); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hkeys(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_hkeys(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_hlen(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_hmget(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hmset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object **arg3 = (json_object **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_hmset(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_ms_hscan(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (bool_result *)kuzzle_ms_hset(arg1,arg2,arg3,arg4,arg5); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hsetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (bool_result *)kuzzle_ms_hsetnx(arg1,arg2,arg3,arg4,arg5); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hstrlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_hstrlen(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1hvals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_hvals(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incr(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_incr(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_incrby(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1incrbyfloat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - query_options *arg4 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = *(query_options **)&jarg4; - result = (double_result *)kuzzle_ms_incrbyfloat(arg1,arg2,arg3,arg4); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1keys(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_keys(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lindex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_lindex(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1linsert(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - char *arg5 = (char *) 0 ; - query_options *arg6 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg6_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = 0; - if (jarg5) { - arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); - if (!arg5) return 0; - } - arg6 = *(query_options **)&jarg6; - result = (int_result *)kuzzle_ms_linsert(arg1,arg2,arg3,arg4,arg5,arg6); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1llen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_llen(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_ms_lpop(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_lpush(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lpushx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_lpushx(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_lrange(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lrem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_lrem(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1lset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_lset(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ltrim(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_ltrim(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_array_result *)kuzzle_ms_mget(arg1,arg2,arg3,arg4); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1mset(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - json_object **arg2 = (json_object **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(json_object ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (void_result *)kuzzle_ms_mset(arg1,arg2,arg3,arg4); - *(void_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1msetnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - json_object **arg2 = (json_object **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(json_object ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_msetnx(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1object(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_object(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1persist(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_ms_persist(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pexpire(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned long arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (unsigned long)jarg3; - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_pexpire(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pexpireat(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jobject jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - unsigned long long arg3 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - { - jclass clazz; - jmethodID mid; - jbyteArray ba; - jbyte* bae; - jsize sz; - int i; - - if (!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null"); - return 0; - } - clazz = jenv->GetObjectClass(jarg3); - mid = jenv->GetMethodID(clazz, "toByteArray", "()[B"); - ba = (jbyteArray)jenv->CallObjectMethod(jarg3, mid); - bae = jenv->GetByteArrayElements(ba, 0); - sz = jenv->GetArrayLength(ba); - arg3 = 0; - if (sz > 0) { - arg3 = (unsigned long long)(signed char)bae[0]; - for(i=1; iReleaseByteArrayElements(ba, bae, 0); - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_pexpireat(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (bool_result *)kuzzle_ms_pfadd(arg1,arg2,arg3,arg4,arg5); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_pfcount(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pfmerge(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_pfmerge(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ping(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_ms_ping(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1psetex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - unsigned long arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (unsigned long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_psetex(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1pttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_pttl(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1randomkey(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_ms_randomkey(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rename(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (void_result *)kuzzle_ms_rename(arg1,arg2,arg3,arg4); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1renamenx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_renamenx(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_ms_rpop(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpoplpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_ms_rpoplpush(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpush(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_rpush(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1rpushx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_rpushx(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_sadd(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1scan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - int arg2 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = (int)jarg2; - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_ms_scan(arg1,arg2,arg3); - *(json_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1scard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_scard(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sdiff(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_sdiff(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sdiffstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jstring jarg5, jlong jarg6, jobject jarg6_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - char *arg5 = (char *) 0 ; - query_options *arg6 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg6_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = 0; - if (jarg5) { - arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); - if (!arg5) return 0; - } - arg6 = *(query_options **)&jarg6; - result = (int_result *)kuzzle_ms_sdiffstore(arg1,arg2,arg3,arg4,arg5,arg6); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (void_result *)kuzzle_ms_set(arg1,arg2,arg3,arg4); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1setex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - unsigned long arg4 ; - query_options *arg5 = (query_options *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (unsigned long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (void_result *)kuzzle_ms_setex(arg1,arg2,arg3,arg4,arg5); - *(void_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1setnx(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_setnx(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sinter(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_array_result *)kuzzle_ms_sinter(arg1,arg2,arg3,arg4); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sinterstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_sinterstore(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sismember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (bool_result *)kuzzle_ms_sismember(arg1,arg2,arg3,arg4); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1smembers(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_smembers(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1smove(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (bool_result *)kuzzle_ms_smove(arg1,arg2,arg3,arg4,arg5); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sort(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_sort(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1spop(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_spop(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1srandmember(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_array_result *)kuzzle_ms_srandmember(arg1,arg2,arg3); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1srem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_srem(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_ms_sscan(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1strlen(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_strlen(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sunion(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (string_array_result *)kuzzle_ms_sunion(arg1,arg2,arg3,arg4); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1sunionstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_sunionstore(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1time(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - int_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (int_array_result *)kuzzle_ms_time(arg1,arg2); - *(int_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1touch(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char **arg2 = (char **) 0 ; - size_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(char ***)&jarg2; - arg3 = (size_t)jarg3; - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_touch(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1ttl(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_ttl(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1type(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (string_result *)kuzzle_ms_type(arg1,arg2,arg3); - *(string_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zadd(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object **arg3 = (json_object **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zadd(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zcard(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (int_result *)kuzzle_ms_zcard(arg1,arg2,arg3); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zcount(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zincrby(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (double_result *)kuzzle_ms_zincrby(arg1,arg2,arg3,arg4,arg5); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zinterstore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zinterstore(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zlexcount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zlexcount(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (json_array_result *)kuzzle_ms_zrange(arg1,arg2,arg3,arg4,arg5); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_zrangebylex(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (json_array_result *)kuzzle_ms_zrangebyscore(arg1,arg2,arg3,arg4,arg5); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_zrank(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrem(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jlong jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char **arg3 = (char **) 0 ; - size_t arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(char ***)&jarg3; - arg4 = (size_t)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zrem(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zremrangebylex(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebyrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zremrangebyrank(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zremrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (int_result *)kuzzle_ms_zremrangebyscore(arg1,arg2,arg3,arg4,arg5); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrange(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - long arg4 ; - query_options *arg5 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (long)jarg3; - arg4 = (long)jarg4; - arg5 = *(query_options **)&jarg5; - result = (json_array_result *)kuzzle_ms_zrevrange(arg1,arg2,arg3,arg4,arg5); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrangebylex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - query_options *arg5 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = *(query_options **)&jarg5; - result = (string_array_result *)kuzzle_ms_zrevrangebylex(arg1,arg2,arg3,arg4,arg5); - *(string_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrangebyscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3, jdouble jarg4, jlong jarg5, jobject jarg5_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - double arg4 ; - query_options *arg5 = (query_options *) 0 ; - json_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg5_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - arg4 = (double)jarg4; - arg5 = *(query_options **)&jarg5; - result = (json_array_result *)kuzzle_ms_zrevrangebyscore(arg1,arg2,arg3,arg4,arg5); - *(json_array_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zrevrank(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (int_result *)kuzzle_ms_zrevrank(arg1,arg2,arg3,arg4); - *(int_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zscan(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_ms_zscan(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1ms_1zscore(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - query_options *arg4 = (query_options *) 0 ; - double_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = *(query_options **)&jarg4; - result = (double_result *)kuzzle_ms_zscore(arg1,arg2,arg3,arg4); - *(double_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1options(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - options *result = 0 ; - - (void)jenv; - (void)jcls; - result = (options *)kuzzle_new_options(); - *(options **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1query(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - kuzzle_request *arg2 = (kuzzle_request *) 0 ; - query_options *arg3 = (query_options *) 0 ; - kuzzle_response *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(kuzzle_request **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (kuzzle_response *)kuzzle_query(arg1,arg2,arg3); - *(kuzzle_response **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterRoom(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - room *arg1 = (room *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - unregisterRoom(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1new_1room(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - room *arg1 = (room *) 0 ; - collection *arg2 = (collection *) 0 ; - json_object *arg3 = (json_object *) 0 ; - room_options *arg4 = (room_options *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(room **)&jarg1; - arg2 = *(collection **)&jarg2; - arg3 = *(json_object **)&jarg3; - arg4 = *(room_options **)&jarg4; - room_new_room(arg1,arg2,arg3,arg4); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - int_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - result = (int_result *)room_count(arg1); - *(int_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1on_1done(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { - room *arg1 = (room *) 0 ; - kuzzle_subscribe_listener arg2 = (kuzzle_subscribe_listener) 0 ; - void *arg3 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - arg2 = *(kuzzle_subscribe_listener *)&jarg2; - arg3 = *(void **)&jarg3; - room_on_done(arg1,arg2,arg3); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { - room *arg1 = (room *) 0 ; - kuzzle_notification_listener arg2 = (kuzzle_notification_listener) 0 ; - void *arg3 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - arg2 = *(kuzzle_notification_listener *)&jarg2; - arg3 = *(void **)&jarg3; - room_subscribe(arg1,arg2,arg3); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_room_1unsubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - void_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room **)&jarg1; - result = (void_result *)room_unsubscribe(arg1); - *(void_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1list_1collections(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - collection_entry_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (collection_entry_result *)kuzzle_list_collections(arg1,arg2,arg3); - *(collection_entry_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1list_1indexes(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_array_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_array_result *)kuzzle_list_indexes(arg1,arg2); - *(string_array_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1auto_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_get_auto_refresh(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1search_1result_1fetch_1next(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - search_result *arg1 = (search_result *) 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(search_result **)&jarg1; - result = (search_result *)kuzzle_search_result_fetch_next(arg1); - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - policy *arg3 = (policy *) 0 ; - size_t arg4 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(policy **)&jarg3; - arg4 = (size_t)jarg4; - result = (profile *)kuzzle_security_new_profile(arg1,arg2,arg3,arg4); - *(profile **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - profile *arg1 = (profile *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(profile **)&jarg1; - kuzzle_security_destroy_profile(arg1); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1profile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - profile_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (profile_result *)kuzzle_security_fetch_profile(arg1,arg2,arg3); - *(profile_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1scroll_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (search_profiles_result *)kuzzle_security_scroll_profiles(arg1,arg2,arg3); - *(search_profiles_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (search_profiles_result *)kuzzle_security_search_profiles(arg1,arg2,arg3); - *(search_profiles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1add_1policy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - policy *arg2 = (policy *) 0 ; - profile *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(policy **)&jarg2; - result = (profile *)kuzzle_security_profile_add_policy(arg1,arg2); - *(profile **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_security_profile_delete(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1profile_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - profile *arg1 = (profile *) 0 ; - query_options *arg2 = (query_options *) 0 ; - profile_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(profile **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (profile_result *)kuzzle_security_profile_save(arg1,arg2); - *(profile_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - role *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - result = (role *)kuzzle_security_new_role(arg1,arg2,arg3); - *(role **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - role *arg1 = (role *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(role **)&jarg1; - kuzzle_security_destroy_role(arg1); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1role(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - role_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (role_result *)kuzzle_security_fetch_role(arg1,arg2,arg3); - *(role_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1roles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_roles_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (search_roles_result *)kuzzle_security_search_roles(arg1,arg2,arg3); - *(search_roles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1role_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - role *arg1 = (role *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_security_role_delete(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1role_1save(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - role *arg1 = (role *) 0 ; - query_options *arg2 = (query_options *) 0 ; - role_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(role **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (role_result *)kuzzle_security_role_save(arg1,arg2); - *(role_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1new_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - user_data *arg3 = (user_data *) 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(user_data **)&jarg3; - result = (user *)kuzzle_security_new_user(arg1,arg2,arg3); - *(user **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1destroy_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - user *arg1 = (user *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(user **)&jarg1; - kuzzle_security_destroy_user(arg1); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1fetch_1user(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (user_result *)kuzzle_security_fetch_user(arg1,arg2,arg3); - *(user_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1scroll_1users(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_users_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (search_users_result *)kuzzle_security_scroll_users(arg1,arg2,arg3); - *(search_users_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1search_1users(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzle *arg1 = (kuzzle *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_users_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzle **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (search_users_result *)kuzzle_security_search_users(arg1,arg2,arg3); - *(search_users_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (user_result *)kuzzle_security_user_create(arg1,arg2); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_security_user_create_credentials(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1create_1with_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - json_object *arg2 = (json_object *) 0 ; - query_options *arg3 = (query_options *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(user **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(query_options **)&jarg3; - result = (user_result *)kuzzle_security_user_create_with_credentials(arg1,arg2,arg3); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1delete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_security_user_delete(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1delete_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_security_user_delete_credentials(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1credentials_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (json_result *)kuzzle_security_user_get_credentials_info(arg1,arg2,arg3); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1profiles(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - profiles_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (profiles_result *)kuzzle_security_user_get_profiles(arg1,arg2); - *(profiles_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1get_1rights(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - user_rights_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (user_rights_result *)kuzzle_security_user_get_rights(arg1,arg2); - *(user_rights_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1has_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(query_options **)&jarg3; - result = (bool_result *)kuzzle_security_user_has_credentials(arg1,arg2,arg3); - *(bool_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1user_1replace(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - query_options *arg2 = (query_options *) 0 ; - user_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(user **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (user_result *)kuzzle_security_user_replace(arg1,arg2); - *(user_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1update_1credentials(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - user *arg1 = (user *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(user **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - result = (json_result *)kuzzle_security_update_credentials(arg1,arg2,arg3,arg4); - *(json_result **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1security_1is_1action_1allowed(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6) { - jlong jresult = 0 ; - user_right **arg1 = (user_right **) 0 ; - unsigned int arg2 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - char *arg5 = (char *) 0 ; - char *arg6 = (char *) 0 ; - unsigned int result; - - (void)jenv; - (void)jcls; - arg1 = *(user_right ***)&jarg1; - arg2 = (unsigned int)jarg2; - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - arg4 = 0; - if (jarg4) { - arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0); - if (!arg4) return 0; - } - arg5 = 0; - if (jarg5) { - arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0); - if (!arg5) return 0; - } - arg6 = 0; - if (jarg6) { - arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); - if (!arg6) return 0; - } - result = (unsigned int)kuzzle_security_is_action_allowed(arg1,arg2,arg3,arg4,arg5,arg6); - jresult = (jlong)result; - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); - if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5); - if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_unregisterServer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - server *arg1 = (server *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(server **)&jarg1; - unregisterServer(arg1); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1new_1server(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - server *arg1 = (server *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - kuzzle_new_server(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1admin_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (bool_result *)kuzzle_admin_exists(arg1,arg2); - *(bool_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1all_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_get_all_stats(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - time_t arg2 ; - time_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - time_t *argp2 ; - time_t *argp3 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(server **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - arg4 = *(query_options **)&jarg4; - result = (string_result *)kuzzle_get_stats(arg1,arg2,arg3,arg4); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1last_1stats(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_get_last_stats(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1get_1config(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_get_config(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1info(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - string_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (string_result *)kuzzle_info(arg1,arg2); - *(string_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_kuzzle_1now(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - server *arg1 = (server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - date_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(server **)&jarg1; - arg2 = *(query_options **)&jarg2; - result = (date_result *)kuzzle_now(arg1,arg2); - *(date_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::NotificationListener **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1onMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::NotificationListener *arg1 = (kuzzleio::NotificationListener *) 0 ; - notification_result *arg2 = (notification_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::NotificationListener **)&jarg1; - arg2 = *(notification_result **)&jarg2; - ((kuzzleio::NotificationListener const *)arg1)->onMessage(arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotificationListener(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::NotificationListener *)new SwigDirector_NotificationListener(jenv); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); - (void)jcls; - SwigDirector_NotificationListener *director = dynamic_cast(obj); - if (director) { - director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotificationListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - kuzzleio::NotificationListener *obj = *((kuzzleio::NotificationListener **)&objarg); - SwigDirector_NotificationListener *director = dynamic_cast(obj); - (void)jcls; - if (director) { - director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1EventListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::EventListener **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1trigger(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::EventListener *arg1 = (kuzzleio::EventListener *) 0 ; - json_object *arg2 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::EventListener **)&jarg1; - arg2 = *(json_object **)&jarg2; - ((kuzzleio::EventListener const *)arg1)->trigger(arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1EventListener(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::EventListener *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::EventListener *)new SwigDirector_EventListener(jenv); - *(kuzzleio::EventListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - kuzzleio::EventListener *obj = *((kuzzleio::EventListener **)&objarg); - (void)jcls; - SwigDirector_EventListener *director = dynamic_cast(obj); - if (director) { - director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_EventListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - kuzzleio::EventListener *obj = *((kuzzleio::EventListener **)&objarg); - SwigDirector_EventListener *director = dynamic_cast(obj); - (void)jcls; - if (director) { - director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SubscribeListener(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::SubscribeListener *arg1 = (kuzzleio::SubscribeListener *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::SubscribeListener **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1onSubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::SubscribeListener *arg1 = (kuzzleio::SubscribeListener *) 0 ; - room_result *arg2 = (room_result *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::SubscribeListener **)&jarg1; - arg2 = *(room_result **)&jarg2; - ((kuzzleio::SubscribeListener const *)arg1)->onSubscribe(arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SubscribeListener(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::SubscribeListener *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::SubscribeListener *)new SwigDirector_SubscribeListener(jenv); - *(kuzzleio::SubscribeListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global) { - kuzzleio::SubscribeListener *obj = *((kuzzleio::SubscribeListener **)&objarg); - (void)jcls; - SwigDirector_SubscribeListener *director = dynamic_cast(obj); - if (director) { - director->swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE)); - } -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_SubscribeListener_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release) { - kuzzleio::SubscribeListener *obj = *((kuzzleio::SubscribeListener **)&objarg); - SwigDirector_SubscribeListener *director = dynamic_cast(obj); - (void)jcls; - if (director) { - director->swig_java_change_ownership(jenv, jself, jtake_or_release ? true : false); - } -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_PARTIAL_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(206); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_BAD_1REQUEST_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(400); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_UNAUTHORIZED_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(401); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_FORBIDDEN_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(403); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_NOT_1FOUND_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(404); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_PRECONDITION_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(412); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_SIZE_1LIMIT_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(413); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_INTERNAL_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(500); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_SERVICE_1UNAVAILABLE_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(503); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_GATEWAY_1TIMEOUT_1EXCEPTION_1get(JNIEnv *jenv, jclass jcls) { - jint jresult = 0 ; - int result; - - (void)jenv; - (void)jcls; - result = (int)(504); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jint jarg1, jstring jarg2) { - jlong jresult = 0 ; - int arg1 ; - std::string *arg2 = 0 ; - kuzzleio::KuzzleException *result = 0 ; - - (void)jenv; - (void)jcls; - arg1 = (int)jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(arg1,(std::string const &)*arg2); - *(kuzzleio::KuzzleException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jint jarg1) { - jlong jresult = 0 ; - int arg1 ; - kuzzleio::KuzzleException *result = 0 ; - - (void)jenv; - (void)jcls; - arg1 = (int)jarg1; - result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(arg1); - *(kuzzleio::KuzzleException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_12(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::KuzzleException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException(); - *(kuzzleio::KuzzleException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1KuzzleException_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::KuzzleException *arg1 = 0 ; - kuzzleio::KuzzleException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::KuzzleException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::KuzzleException const & reference is null"); - return 0; - } - result = (kuzzleio::KuzzleException *)new kuzzleio::KuzzleException((kuzzleio::KuzzleException const &)*arg1); - *(kuzzleio::KuzzleException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::KuzzleException *arg1 = (kuzzleio::KuzzleException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::KuzzleException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleException_1getMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::KuzzleException *arg1 = (kuzzleio::KuzzleException *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::KuzzleException **)&jarg1; - result = ((kuzzleio::KuzzleException const *)arg1)->getMessage(); - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::BadRequestException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException((std::string const &)*arg1); - *(kuzzleio::BadRequestException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::BadRequestException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException(); - *(kuzzleio::BadRequestException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1BadRequestException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::BadRequestException *arg1 = 0 ; - kuzzleio::BadRequestException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::BadRequestException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::BadRequestException const & reference is null"); - return 0; - } - result = (kuzzleio::BadRequestException *)new kuzzleio::BadRequestException((kuzzleio::BadRequestException const &)*arg1); - *(kuzzleio::BadRequestException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1BadRequestException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::BadRequestException *arg1 = (kuzzleio::BadRequestException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::BadRequestException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::ForbiddenException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException((std::string const &)*arg1); - *(kuzzleio::ForbiddenException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::ForbiddenException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException(); - *(kuzzleio::ForbiddenException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ForbiddenException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::ForbiddenException *arg1 = 0 ; - kuzzleio::ForbiddenException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::ForbiddenException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::ForbiddenException const & reference is null"); - return 0; - } - result = (kuzzleio::ForbiddenException *)new kuzzleio::ForbiddenException((kuzzleio::ForbiddenException const &)*arg1); - *(kuzzleio::ForbiddenException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ForbiddenException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::ForbiddenException *arg1 = (kuzzleio::ForbiddenException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::ForbiddenException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::GatewayTimeoutException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException((std::string const &)*arg1); - *(kuzzleio::GatewayTimeoutException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::GatewayTimeoutException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException(); - *(kuzzleio::GatewayTimeoutException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1GatewayTimeoutException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::GatewayTimeoutException *arg1 = 0 ; - kuzzleio::GatewayTimeoutException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::GatewayTimeoutException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::GatewayTimeoutException const & reference is null"); - return 0; - } - result = (kuzzleio::GatewayTimeoutException *)new kuzzleio::GatewayTimeoutException((kuzzleio::GatewayTimeoutException const &)*arg1); - *(kuzzleio::GatewayTimeoutException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1GatewayTimeoutException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::GatewayTimeoutException *arg1 = (kuzzleio::GatewayTimeoutException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::GatewayTimeoutException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::InternalException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::InternalException *)new kuzzleio::InternalException((std::string const &)*arg1); - *(kuzzleio::InternalException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::InternalException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::InternalException *)new kuzzleio::InternalException(); - *(kuzzleio::InternalException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1InternalException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::InternalException *arg1 = 0 ; - kuzzleio::InternalException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::InternalException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::InternalException const & reference is null"); - return 0; - } - result = (kuzzleio::InternalException *)new kuzzleio::InternalException((kuzzleio::InternalException const &)*arg1); - *(kuzzleio::InternalException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1InternalException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::InternalException *arg1 = (kuzzleio::InternalException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::InternalException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::NotFoundException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException((std::string const &)*arg1); - *(kuzzleio::NotFoundException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::NotFoundException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException(); - *(kuzzleio::NotFoundException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1NotFoundException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::NotFoundException *arg1 = 0 ; - kuzzleio::NotFoundException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::NotFoundException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::NotFoundException const & reference is null"); - return 0; - } - result = (kuzzleio::NotFoundException *)new kuzzleio::NotFoundException((kuzzleio::NotFoundException const &)*arg1); - *(kuzzleio::NotFoundException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1NotFoundException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::NotFoundException *arg1 = (kuzzleio::NotFoundException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::NotFoundException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::PartialException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::PartialException *)new kuzzleio::PartialException((std::string const &)*arg1); - *(kuzzleio::PartialException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::PartialException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::PartialException *)new kuzzleio::PartialException(); - *(kuzzleio::PartialException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PartialException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::PartialException *arg1 = 0 ; - kuzzleio::PartialException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::PartialException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::PartialException const & reference is null"); - return 0; - } - result = (kuzzleio::PartialException *)new kuzzleio::PartialException((kuzzleio::PartialException const &)*arg1); - *(kuzzleio::PartialException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1PartialException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::PartialException *arg1 = (kuzzleio::PartialException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::PartialException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::PreconditionException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException((std::string const &)*arg1); - *(kuzzleio::PreconditionException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::PreconditionException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException(); - *(kuzzleio::PreconditionException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1PreconditionException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::PreconditionException *arg1 = 0 ; - kuzzleio::PreconditionException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::PreconditionException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::PreconditionException const & reference is null"); - return 0; - } - result = (kuzzleio::PreconditionException *)new kuzzleio::PreconditionException((kuzzleio::PreconditionException const &)*arg1); - *(kuzzleio::PreconditionException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1PreconditionException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::PreconditionException *arg1 = (kuzzleio::PreconditionException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::PreconditionException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::ServiceUnavailableException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException((std::string const &)*arg1); - *(kuzzleio::ServiceUnavailableException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::ServiceUnavailableException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException(); - *(kuzzleio::ServiceUnavailableException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1ServiceUnavailableException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::ServiceUnavailableException *arg1 = 0 ; - kuzzleio::ServiceUnavailableException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::ServiceUnavailableException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::ServiceUnavailableException const & reference is null"); - return 0; - } - result = (kuzzleio::ServiceUnavailableException *)new kuzzleio::ServiceUnavailableException((kuzzleio::ServiceUnavailableException const &)*arg1); - *(kuzzleio::ServiceUnavailableException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1ServiceUnavailableException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::ServiceUnavailableException *arg1 = (kuzzleio::ServiceUnavailableException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::ServiceUnavailableException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::SizeLimitException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException((std::string const &)*arg1); - *(kuzzleio::SizeLimitException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::SizeLimitException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException(); - *(kuzzleio::SizeLimitException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1SizeLimitException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::SizeLimitException *arg1 = 0 ; - kuzzleio::SizeLimitException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::SizeLimitException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::SizeLimitException const & reference is null"); - return 0; - } - result = (kuzzleio::SizeLimitException *)new kuzzleio::SizeLimitException((kuzzleio::SizeLimitException const &)*arg1); - *(kuzzleio::SizeLimitException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1SizeLimitException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::SizeLimitException *arg1 = (kuzzleio::SizeLimitException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::SizeLimitException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::UnauthorizedException *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException((std::string const &)*arg1); - *(kuzzleio::UnauthorizedException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_11(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - kuzzleio::UnauthorizedException *result = 0 ; - - (void)jenv; - (void)jcls; - result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException(); - *(kuzzleio::UnauthorizedException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1UnauthorizedException_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::UnauthorizedException *arg1 = 0 ; - kuzzleio::UnauthorizedException *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::UnauthorizedException **)&jarg1; - if (!arg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "kuzzleio::UnauthorizedException const & reference is null"); - return 0; - } - result = (kuzzleio::UnauthorizedException *)new kuzzleio::UnauthorizedException((kuzzleio::UnauthorizedException const &)*arg1); - *(kuzzleio::UnauthorizedException **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1UnauthorizedException(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::UnauthorizedException *arg1 = (kuzzleio::UnauthorizedException *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::UnauthorizedException **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jlong jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_KuzzleEventEmitter_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jint jresult = 0 ; - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - Event arg2 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - arg2 = (Event)jarg2; - result = (int)(arg1)->listenerCount(arg2); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1KuzzleEventEmitter(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::KuzzleEventEmitter *arg1 = (kuzzleio::KuzzleEventEmitter *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::KuzzleEventEmitter **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1kuzzle_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle *arg2 = (kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(kuzzle **)&jarg2; - if (arg1) (arg1)->_kuzzle = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1_1kuzzle_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzle *) ((arg1)->_kuzzle); - *(kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Kuzzle_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - options *arg2 = (options *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg2_; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - arg2 = *(options **)&jarg2; - result = (kuzzleio::Kuzzle *)new kuzzleio::Kuzzle((std::string const &)*arg1,arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Kuzzle_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1) { - jlong jresult = 0 ; - std::string *arg1 = 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - if(!jarg1) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg1_pstr = (const char *)jenv->GetStringUTFChars(jarg1, 0); - if (!arg1_pstr) return 0; - std::string arg1_str(arg1_pstr); - arg1 = &arg1_str; - jenv->ReleaseStringUTFChars(jarg1, arg1_pstr); - result = (kuzzleio::Kuzzle *)new kuzzleio::Kuzzle((std::string const &)*arg1); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Kuzzle(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1checkToken(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - token_validity *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (token_validity *)(arg1)->checkToken((std::string const &)*arg2); - *(token_validity **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1connect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (char *)(arg1)->connect(); - if (result) jresult = jenv->NewStringUTF((const char *)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - try { - result = (json_object *)(arg1)->createMyCredentials((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1createMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (json_object *)(arg1)->createMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1deleteMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (bool)(arg1)->deleteMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1deleteMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (bool)(arg1)->deleteMyCredentials((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (json_object *)(arg1)->getMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (json_object *)(arg1)->getMyCredentials((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - try { - result = (json_object *)(arg1)->updateMyCredentials((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (json_object *)(arg1)->updateMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1validateMyCredentials_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - query_options *arg4 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - arg4 = *(query_options **)&jarg4; - try { - result = (bool)(arg1)->validateMyCredentials((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1validateMyCredentials_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (bool)(arg1)->validateMyCredentials((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1login_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jint jarg4) { - jstring jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - int arg4 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - arg4 = (int)jarg4; - try { - result = (arg1)->login((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1login_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jstring jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (arg1)->login((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAllStatistics_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (statistics *)(arg1)->getAllStatistics(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAllStatistics_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - try { - result = (statistics *)(arg1)->getAllStatistics(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getStatistics_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - time_t arg2 ; - time_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - time_t *argp2 ; - time_t *argp3 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - arg4 = *(query_options **)&jarg4; - try { - result = (statistics *)(arg1)->getStatistics(arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getStatistics_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - time_t arg2 ; - time_t arg3 ; - time_t *argp2 ; - time_t *argp3 ; - statistics *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - try { - result = (statistics *)(arg1)->getStatistics(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(statistics **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAutoRefresh_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getAutoRefresh_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (arg1)->getJwt(); - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (json_object *)(arg1)->getMyRights(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getMyRights_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - try { - result = (json_object *)(arg1)->getMyRights(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - collection_entry *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (collection_entry *)(arg1)->listCollections((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(collection_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listCollections_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - collection_entry *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (collection_entry *)(arg1)->listCollections((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(collection_entry **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::vector< std::string > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->listIndexes(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listIndexes_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::vector< std::string > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - try { - result = (arg1)->listIndexes(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1disconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - (arg1)->disconnect(); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1logout(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - (arg1)->logout(); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle_request *arg2 = (kuzzle_request *) 0 ; - query_options *arg3 = (query_options *) 0 ; - kuzzle_response *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(kuzzle_request **)&jarg2; - arg3 = *(query_options **)&jarg3; - try { - result = (kuzzle_response *)(arg1)->query(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzle_response **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1query_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzle_request *arg2 = (kuzzle_request *) 0 ; - kuzzle_response *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(kuzzle_request **)&jarg2; - try { - result = (kuzzle_response *)(arg1)->query(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzle_response **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1replayQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->replayQueue(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setAutoReplay(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - bool arg2 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = jarg2 ? true : false; - result = (kuzzleio::Kuzzle *)(arg1)->setAutoReplay(arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setDefaultIndex(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (kuzzleio::Kuzzle *)(arg1)->setDefaultIndex((std::string const &)*arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - result = (kuzzleio::Kuzzle *)(arg1)->setJwt((std::string const &)*arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1startQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->startQueuing(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1stopQueuing(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->stopQueuing(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1unsetJwt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->unsetJwt(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user_data *arg2 = (user_data *) 0 ; - query_options *arg3 = (query_options *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(user_data **)&jarg2; - arg3 = *(query_options **)&jarg3; - try { - result = (json_object *)(arg1)->updateSelf(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1updateSelf_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user_data *arg2 = (user_data *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(user_data **)&jarg2; - try { - result = (json_object *)(arg1)->updateSelf(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1whoAmI(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - user *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - try { - result = (user *)(arg1)->whoAmI(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(user **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1flushQueue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Kuzzle *)(arg1)->flushQueue(); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (json_object *)(arg1)->getVolatile(); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1setVolatile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - json_object *arg2 = (json_object *) 0 ; - kuzzleio::Kuzzle *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = *(json_object **)&jarg2; - result = (kuzzleio::Kuzzle *)(arg1)->setVolatile(arg2); - *(kuzzleio::Kuzzle **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1getListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - SwigValueWrapper< std::map< int,kuzzleio::EventListener * > > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (arg1)->getListeners(); - *(std::map< int,kuzzleio::EventListener * > **)&jresult = new std::map< int,kuzzleio::EventListener * >((const std::map< int,kuzzleio::EventListener * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1addListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->addListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeListener(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1removeAllListeners(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->removeAllListeners(arg2); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1once(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - kuzzleio::EventListener *arg3 = (kuzzleio::EventListener *) 0 ; - kuzzleio::KuzzleEventEmitter *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - arg3 = *(kuzzleio::EventListener **)&jarg3; - result = (kuzzleio::KuzzleEventEmitter *)(arg1)->once(arg2,arg3); - *(kuzzleio::KuzzleEventEmitter **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1listenerCount(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jint jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - Event arg2 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - arg2 = (Event)jarg2; - result = (int)(arg1)->listenerCount(arg2); - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1collection_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - collection *arg2 = (collection *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(collection **)&jarg2; - if (arg1) (arg1)->_collection = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1collection_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - result = (collection *) ((arg1)->_collection); - *(collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1listener_1instance_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(kuzzleio::NotificationListener **)&jarg2; - if (arg1) (arg1)->_listener_instance = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1_1listener_1instance_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - result = (kuzzleio::NotificationListener *) ((arg1)->_listener_instance); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - std::string *arg2 = 0 ; - std::string *arg3 = 0 ; - kuzzleio::Collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - result = (kuzzleio::Collection *)new kuzzleio::Collection(arg1,(std::string const &)*arg2,(std::string const &)*arg3); - *(kuzzleio::Collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Collection(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Collection **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jint jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - try { - result = (int)(arg1)->count(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1count_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jint jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - try { - result = (int)(arg1)->count(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; - std::string *arg3 = 0 ; - query_options *arg4 = (query_options *) 0 ; - kuzzleio::Collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg4_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(kuzzleio::Document **)&jarg2; - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - arg4 = *(query_options **)&jarg4; - try { - result = (kuzzleio::Collection *)(arg1)->createDocument(arg2,(std::string const &)*arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; - std::string *arg3 = 0 ; - kuzzleio::Collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(kuzzleio::Document **)&jarg2; - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return 0; - std::string arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - result = (kuzzleio::Collection *)(arg1)->createDocument(arg2,(std::string const &)*arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1createDocument_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Document *arg2 = (kuzzleio::Document *) 0 ; - kuzzleio::Collection *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(kuzzleio::Document **)&jarg2; - try { - result = (kuzzleio::Collection *)(arg1)->createDocument(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Collection **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jstring jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (arg1)->deleteDocument((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1deleteDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jstring jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (arg1)->deleteDocument((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (kuzzleio::Document *)(arg1)->fetchDocument((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1fetchDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (kuzzleio::Document *)(arg1)->fetchDocument((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; - try { - result = (arg1)->mCreateDocument(*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - try { - result = (arg1)->mCreateDocument(*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; - try { - result = (arg1)->mCreateOrReplaceDocument(*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mCreateOrReplaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - try { - result = (arg1)->mCreateOrReplaceDocument(*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< std::string > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< std::string > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; - try { - result = (arg1)->mDeleteDocument(*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mDeleteDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< std::string > *arg2 = 0 ; - std::vector< std::string > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); - return 0; - } - try { - result = (arg1)->mDeleteDocument(*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< std::string > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; - try { - result = (arg1)->mGetDocument(*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mGetDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< std::string > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > & reference is null"); - return 0; - } - try { - result = (arg1)->mGetDocument(*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; - try { - result = (arg1)->mReplaceDocument(*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mReplaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - try { - result = (arg1)->mReplaceDocument(*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - arg3 = *(query_options **)&jarg3; - try { - result = (arg1)->mUpdateDocument(*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1mUpdateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::vector< kuzzleio::Document * > *arg2 = 0 ; - std::vector< kuzzleio::Document * > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(std::vector< kuzzleio::Document * > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< kuzzleio::Document * > & reference is null"); - return 0; - } - try { - result = (arg1)->mUpdateDocument(*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< kuzzleio::Document * > **)&jresult = new std::vector< kuzzleio::Document * >((const std::vector< kuzzleio::Document * > &)result); - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessage_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jboolean jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - query_options *arg3 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(query_options **)&jarg3; - try { - result = (bool)(arg1)->publishMessage(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1publishMessage_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jboolean jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(json_object **)&jarg2; - try { - result = (bool)(arg1)->publishMessage(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; - query_options *arg4 = (query_options *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(kuzzleio::Document **)&jarg3; - arg4 = *(query_options **)&jarg4; - try { - result = (kuzzleio::Document *)(arg1)->replaceDocument((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1replaceDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(kuzzleio::Document **)&jarg3; - try { - result = (kuzzleio::Document *)(arg1)->replaceDocument((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - query_options *arg3 = (query_options *) 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(query_options **)&jarg3; - try { - result = (search_result *)(arg1)->scroll((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1scroll_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (search_result *)(arg1)->scroll((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - query_options *arg3 = (query_options *) 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(query_options **)&jarg3; - try { - result = (search_result *)(arg1)->search(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1search_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - search_result *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - try { - result = (search_result *)(arg1)->search(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(search_result **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; - room_options *arg4 = (room_options *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(kuzzleio::NotificationListener **)&jarg3; - arg4 = *(room_options **)&jarg4; - try { - result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1subscribe_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - search_filters *arg2 = (search_filters *) 0 ; - kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(search_filters **)&jarg2; - arg3 = *(kuzzleio::NotificationListener **)&jarg3; - try { - result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1getListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - result = (kuzzleio::NotificationListener *)(arg1)->getListener(); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_, jlong jarg4, jobject jarg4_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; - query_options *arg4 = (query_options *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - (void)jarg4_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(kuzzleio::Document **)&jarg3; - arg4 = *(query_options **)&jarg4; - try { - result = (kuzzleio::Document *)(arg1)->updateDocument((std::string const &)*arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Collection_1updateDocument_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *arg3 = (kuzzleio::Document *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(kuzzleio::Document **)&jarg3; - try { - result = (kuzzleio::Document *)(arg1)->updateDocument((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - room_options *arg3 = (room_options *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(room_options **)&jarg3; - result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2,arg3); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - json_object *arg2 = (json_object *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Collection **)&jarg1; - arg2 = *(json_object **)&jarg2; - result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - result = (kuzzleio::Room *)new kuzzleio::Room(arg1); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Room_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - room *arg1 = (room *) 0 ; - kuzzleio::SubscribeListener *arg2 = (kuzzleio::SubscribeListener *) 0 ; - kuzzleio::NotificationListener *arg3 = (kuzzleio::NotificationListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(room **)&jarg1; - arg2 = *(kuzzleio::SubscribeListener **)&jarg2; - arg3 = *(kuzzleio::NotificationListener **)&jarg3; - result = (kuzzleio::Room *)new kuzzleio::Room(arg1,arg2,arg3); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Room(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Room **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1count(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jint jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Room **)&jarg1; - try { - result = (int)(arg1)->count(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jint)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1getSubscribeListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - kuzzleio::SubscribeListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Room **)&jarg1; - result = (kuzzleio::SubscribeListener *)(arg1)->getSubscribeListener(); - *(kuzzleio::SubscribeListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1getNotificationListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Room **)&jarg1; - result = (kuzzleio::NotificationListener *)(arg1)->getNotificationListener(); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1onDone(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - kuzzleio::SubscribeListener *arg2 = (kuzzleio::SubscribeListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Room **)&jarg1; - arg2 = *(kuzzleio::SubscribeListener **)&jarg2; - result = (kuzzleio::Room *)(arg1)->onDone(arg2); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1subscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Room **)&jarg1; - arg2 = *(kuzzleio::NotificationListener **)&jarg2; - result = (kuzzleio::Room *)(arg1)->subscribe(arg2); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Room_1unsubscribe(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzleio::Room *arg1 = (kuzzleio::Room *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Room **)&jarg1; - try { - (arg1)->unsubscribe(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1_1document_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - document *arg2 = (document *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(document **)&jarg2; - if (arg1) (arg1)->_document = arg2; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1_1document_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - result = (document *) ((arg1)->_document); - *(document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - json_object *arg3 = (json_object *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = *(json_object **)&jarg3; - try { - result = (kuzzleio::Document *)new kuzzleio::Document(arg1,(std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - std::string *arg2 = 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (kuzzleio::Document *)new kuzzleio::Document(arg1,(std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Document_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Collection *arg1 = (kuzzleio::Collection *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Collection **)&jarg1; - try { - result = (kuzzleio::Document *)new kuzzleio::Document(arg1); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Document(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Document **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->delete_(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1delete_1_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - try { - result = (arg1)->delete_(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jboolean jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (bool)(arg1)->exists(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1exists_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - try { - result = (bool)(arg1)->exists(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jboolean jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (bool)(arg1)->publish(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1publish_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - try { - result = (bool)(arg1)->publish(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (kuzzleio::Document *)(arg1)->refresh(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1refresh_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - try { - result = (kuzzleio::Document *)(arg1)->refresh(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - query_options *arg2 = (query_options *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (kuzzleio::Document *)(arg1)->save(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1save_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - try { - result = (kuzzleio::Document *)(arg1)->save(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1setContent_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jboolean jarg3) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - json_object *arg2 = (json_object *) 0 ; - bool arg3 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = jarg3 ? true : false; - result = (kuzzleio::Document *)(arg1)->setContent(arg2,arg3); - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1setContent_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - json_object *arg2 = (json_object *) 0 ; - kuzzleio::Document *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(json_object **)&jarg2; - result = (kuzzleio::Document *)(arg1)->setContent(arg2); - *(kuzzleio::Document **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1getContent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - result = (json_object *)(arg1)->getContent(); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1subscribe_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; - room_options *arg3 = (room_options *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - (void)jarg3_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(kuzzleio::NotificationListener **)&jarg2; - arg3 = *(room_options **)&jarg3; - result = (kuzzleio::Room *)(arg1)->subscribe(arg2,arg3); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1subscribe_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::NotificationListener *arg2 = (kuzzleio::NotificationListener *) 0 ; - kuzzleio::Room *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Document **)&jarg1; - arg2 = *(kuzzleio::NotificationListener **)&jarg2; - result = (kuzzleio::Room *)(arg1)->subscribe(arg2); - *(kuzzleio::Room **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Document_1getListener(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Document *arg1 = (kuzzleio::Document *) 0 ; - kuzzleio::NotificationListener *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Document **)&jarg1; - result = (kuzzleio::NotificationListener *)(arg1)->getListener(); - *(kuzzleio::NotificationListener **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Index(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Index *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Index *)new kuzzleio::Index(arg1); - *(kuzzleio::Index **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Index(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Index **)&jarg1; - delete arg1; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1create(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - (arg1)->create((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1delete_1(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - (arg1)->delete_((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1mDelete(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::vector< std::string > *arg2 = 0 ; - std::vector< std::string > result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Index **)&jarg1; - arg2 = *(std::vector< std::string > **)&jarg2; - if (!arg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "std::vector< std::string > const & reference is null"); - return 0; - } - try { - result = (arg1)->mDelete((std::vector< std::string > const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - *(std::vector< std::string > **)&jresult = new std::vector< std::string >((const std::vector< std::string > &)result); - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (bool)(arg1)->exists((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - (arg1)->refresh((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1refreshInternal(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - try { - (arg1)->refreshInternal(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1setAutoRefresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jboolean jarg3) { - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - bool arg3 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - arg3 = jarg3 ? true : false; - try { - (arg1)->setAutoRefresh((std::string const &)*arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return ; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return ; - } - } - -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1getAutoRefresh(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string *arg2 = 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return 0; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return 0; - std::string arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - try { - result = (bool)(arg1)->getAutoRefresh((std::string const &)*arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Index_1list(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Index *arg1 = (kuzzleio::Index *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Index **)&jarg1; - try { - result = (arg1)->list(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1Server(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Kuzzle *arg1 = (kuzzleio::Kuzzle *) 0 ; - kuzzleio::Server *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Kuzzle **)&jarg1; - result = (kuzzleio::Server *)new kuzzleio::Server(arg1); - *(kuzzleio::Server **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1Server(JNIEnv *jenv, jclass jcls, jlong jarg1) { - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(kuzzleio::Server **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1adminExists(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jboolean jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (bool)(arg1)->adminExists(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getAllStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->getAllStats(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getAllStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (arg1)->getAllStats(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3, jlong jarg4, jobject jarg4_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - time_t arg2 ; - time_t arg3 ; - query_options *arg4 = (query_options *) 0 ; - time_t *argp2 ; - time_t *argp3 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg4_; - arg1 = *(kuzzleio::Server **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - arg4 = *(query_options **)&jarg4; - try { - result = (arg1)->getStats(arg2,arg3,arg4); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - time_t arg2 ; - time_t arg3 ; - time_t *argp2 ; - time_t *argp3 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - argp2 = *(time_t **)&jarg2; - if (!argp2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg2 = *argp2; - argp3 = *(time_t **)&jarg3; - if (!argp3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null time_t"); - return 0; - } - arg3 = *argp3; - try { - result = (arg1)->getStats(arg2,arg3); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getLastStats_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->getLastStats(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getLastStats_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (arg1)->getLastStats(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getConfig_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->getConfig(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1getConfig_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (arg1)->getConfig(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1info_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (arg1)->info(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1info_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jstring jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - std::string result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (arg1)->info(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = jenv->NewStringUTF((&result)->c_str()); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1_1now_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - jlong jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - query_options *arg2 = (query_options *) 0 ; - long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(kuzzleio::Server **)&jarg1; - arg2 = *(query_options **)&jarg2; - try { - result = (long long)(arg1)->now(arg2); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Server_1_1now_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - kuzzleio::Server *arg1 = (kuzzleio::Server *) 0 ; - long long result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(kuzzleio::Server **)&jarg1; - try { - result = (long long)(arg1)->now(); - } - catch(kuzzleio::BadRequestException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/BadRequestException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ForbiddenException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ForbiddenException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::GatewayTimeoutException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/GatewayTimeoutException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::InternalException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/InternalException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::NotFoundException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/NotFoundException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PartialException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PartialException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::PreconditionException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/PreconditionException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::ServiceUnavailableException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/ServiceUnavailableException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - catch(kuzzleio::SizeLimitException &_e) { - (void)_e; - SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ kuzzleio::SizeLimitException exception thrown"); - return 0; - } - catch(kuzzleio::UnauthorizedException &_e) { - { - (void)_e; - jclass excpcls = jenv->FindClass("io/kuzzle/sdk/UnauthorizedException"); - if (excpcls) { - jenv->ThrowNew(excpcls, (&_e)->what()); - } - return 0; - } - } - - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - std::vector< std::string > *result = 0 ; - - (void)jenv; - (void)jcls; - result = (std::vector< std::string > *)new std::vector< std::string >(); - *(std::vector< std::string > **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1StringVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong jresult = 0 ; - std::vector< std::string >::size_type arg1 ; - std::vector< std::string > *result = 0 ; - - (void)jenv; - (void)jcls; - arg1 = (std::vector< std::string >::size_type)jarg1; - result = (std::vector< std::string > *)new std::vector< std::string >(arg1); - *(std::vector< std::string > **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - result = ((std::vector< std::string > const *)arg1)->size(); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - result = ((std::vector< std::string > const *)arg1)->capacity(); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - arg2 = (std::vector< std::string >::size_type)jarg2; - (arg1)->reserve(arg2); -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - result = (bool)((std::vector< std::string > const *)arg1)->empty(); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - (arg1)->clear(); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1add(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::value_type *arg2 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - if(!jarg2) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg2_pstr = (const char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2_pstr) return ; - std::vector< std::string >::value_type arg2_str(arg2_pstr); - arg2 = &arg2_str; - jenv->ReleaseStringUTFChars(jarg2, arg2_pstr); - (arg1)->push_back((std::vector< std::string >::value_type const &)*arg2); -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jstring jresult = 0 ; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - int arg2 ; - std::vector< std::string >::value_type *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - arg2 = (int)jarg2; - try { - result = (std::vector< std::string >::value_type *) &std_vector_Sl_std_string_Sg__get(arg1,arg2); - } - catch(std::out_of_range &_e) { - SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); - return 0; - } - - jresult = jenv->NewStringUTF(result->c_str()); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_StringVector_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - int arg2 ; - std::vector< std::string >::value_type *arg3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< std::string > **)&jarg1; - arg2 = (int)jarg2; - if(!jarg3) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); - return ; - } - const char *arg3_pstr = (const char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3_pstr) return ; - std::vector< std::string >::value_type arg3_str(arg3_pstr); - arg3 = &arg3_str; - jenv->ReleaseStringUTFChars(jarg3, arg3_pstr); - try { - std_vector_Sl_std_string_Sg__set(arg1,arg2,(std::string const &)*arg3); - } - catch(std::out_of_range &_e) { - SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); - return ; - } - -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1StringVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(std::vector< std::string > **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1DocumentVector_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - std::vector< kuzzleio::Document * > *result = 0 ; - - (void)jenv; - (void)jcls; - result = (std::vector< kuzzleio::Document * > *)new std::vector< kuzzleio::Document * >(); - *(std::vector< kuzzleio::Document * > **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1DocumentVector_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong jresult = 0 ; - std::vector< kuzzleio::Document * >::size_type arg1 ; - std::vector< kuzzleio::Document * > *result = 0 ; - - (void)jenv; - (void)jcls; - arg1 = (std::vector< kuzzleio::Document * >::size_type)jarg1; - result = (std::vector< kuzzleio::Document * > *)new std::vector< kuzzleio::Document * >(arg1); - *(std::vector< kuzzleio::Document * > **)&jresult = result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - std::vector< kuzzleio::Document * >::size_type result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - result = ((std::vector< kuzzleio::Document * > const *)arg1)->size(); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1capacity(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jlong jresult = 0 ; - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - std::vector< kuzzleio::Document * >::size_type result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - result = ((std::vector< kuzzleio::Document * > const *)arg1)->capacity(); - jresult = (jlong)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1reserve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - std::vector< kuzzleio::Document * >::size_type arg2 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - arg2 = (std::vector< kuzzleio::Document * >::size_type)jarg2; - (arg1)->reserve(arg2); -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - jboolean jresult = 0 ; - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - result = (bool)((std::vector< kuzzleio::Document * > const *)arg1)->empty(); - jresult = (jboolean)result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1clear(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - (arg1)->clear(); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1add(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - std::vector< kuzzleio::Document * >::value_type *arg2 = 0 ; - std::vector< kuzzleio::Document * >::value_type temp2 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg2_; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - temp2 = *(std::vector< kuzzleio::Document * >::value_type *)&jarg2; - arg2 = (std::vector< kuzzleio::Document * >::value_type *)&temp2; - (arg1)->push_back((std::vector< kuzzleio::Document * >::value_type const &)*arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { - jlong jresult = 0 ; - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - int arg2 ; - std::vector< kuzzleio::Document * >::value_type *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - arg2 = (int)jarg2; - try { - result = (std::vector< kuzzleio::Document * >::value_type *) &std_vector_Sl_kuzzleio_Document_Sm__Sg__get(arg1,arg2); - } - catch(std::out_of_range &_e) { - SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); - return 0; - } - - *(std::vector< kuzzleio::Document * >::value_type *)&jresult = *result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_DocumentVector_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jlong jarg3, jobject jarg3_) { - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - int arg2 ; - std::vector< kuzzleio::Document * >::value_type *arg3 = 0 ; - std::vector< kuzzleio::Document * >::value_type temp3 = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - arg2 = (int)jarg2; - temp3 = *(std::vector< kuzzleio::Document * >::value_type *)&jarg3; - arg3 = (std::vector< kuzzleio::Document * >::value_type *)&temp3; - try { - std_vector_Sl_kuzzleio_Document_Sm__Sg__set(arg1,arg2,(kuzzleio::Document *const &)*arg3); - } - catch(std::out_of_range &_e) { - SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, (&_e)->what()); - return ; - } - -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1DocumentVector(JNIEnv *jenv, jclass jcls, jlong jarg1) { - std::vector< kuzzleio::Document * > *arg1 = (std::vector< kuzzleio::Document * > *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(std::vector< kuzzleio::Document * > **)&jarg1; - delete arg1; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_new_1JsonObject(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - result = (json_object *)new_json_object(); - *(json_object **)&jresult = result; - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_delete_1JsonObject(JNIEnv *jenv, jclass jcls, jlong jarg1) { - json_object *arg1 = (json_object *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(json_object **)&jarg1; - delete_json_object(arg1); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = 0; - if (jarg3) { - arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); - if (!arg3) return 0; - } - result = (json_object *)json_object_put__SWIG_0(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - int arg3 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (int)jarg3; - result = (json_object *)json_object_put__SWIG_1(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jdouble jarg3) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = (double)jarg3; - result = (json_object *)json_object_put__SWIG_2(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_13(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jboolean jarg3) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - bool arg3 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = jarg3 ? true : false; - result = (json_object *)json_object_put__SWIG_3(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1put_1_1SWIG_14(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3, jobject jarg3_) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - json_object *arg3 = (json_object *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - (void)jarg3_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - arg3 = *(json_object **)&jarg3; - result = (json_object *)json_object_put__SWIG_4(arg1,arg2,arg3); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jstring JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jstring jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - char *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (char *)json_object_getString(arg1,arg2); - if (result) jresult = jenv->NewStringUTF((const char *)result); - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jint JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getInt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jint jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - int result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (int)json_object_getInt(arg1,arg2); - jresult = (jint)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jdouble JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getDouble(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jdouble jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - double result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (double)json_object_getDouble(arg1,arg2); - jresult = (jdouble)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jboolean JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getBoolean(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jboolean jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - bool result; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (bool)json_object_getBoolean(arg1,arg2); - jresult = (jboolean)result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_JsonObject_1getJsonObject(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { - jlong jresult = 0 ; - json_object *arg1 = (json_object *) 0 ; - char *arg2 = (char *) 0 ; - json_object *result = 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(json_object **)&jarg1; - arg2 = 0; - if (jarg2) { - arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); - if (!arg2) return 0; - } - result = (json_object *)json_object_getJsonObject(arg1,arg2); - *(json_object **)&jresult = result; - if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); - return jresult; -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_trigger_1event_1listener(JNIEnv *jenv, jclass jcls, jint jarg1, jlong jarg2, jobject jarg2_, jlong jarg3) { - int arg1 ; - json_object *arg2 = (json_object *) 0 ; - void *arg3 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg2_; - arg1 = (int)jarg1; - arg2 = *(json_object **)&jarg2; - arg3 = *(void **)&jarg3; - kuzzleio::trigger_event_listener(arg1,arg2,arg3); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_call_1collection_1cb(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = *(void **)&jarg2; - kuzzleio::call_collection_cb(arg1,arg2); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_call_1cb_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - room_result *arg1 = (room_result *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(room_result **)&jarg1; - arg2 = *(void **)&jarg2; - kuzzleio::call_cb(arg1,arg2); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_notify(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = *(void **)&jarg2; - kuzzleio::notify(arg1,arg2); -} - - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_call_1cb_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { - notification_result *arg1 = (notification_result *) 0 ; - void *arg2 = (void *) 0 ; - - (void)jenv; - (void)jcls; - (void)jarg1_; - arg1 = *(notification_result **)&jarg1; - arg2 = *(void **)&jarg2; - kuzzleio::call_cb(arg1,arg2); -} - - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_BadRequestException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::BadRequestException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ForbiddenException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::ForbiddenException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_GatewayTimeoutException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::GatewayTimeoutException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_InternalException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::InternalException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_NotFoundException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::NotFoundException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_PartialException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::PartialException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_PreconditionException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::PreconditionException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_ServiceUnavailableException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::ServiceUnavailableException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_SizeLimitException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::SizeLimitException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_UnauthorizedException_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleException **)&baseptr = *(kuzzleio::UnauthorizedException **)&jarg1; - return baseptr; -} - -SWIGEXPORT jlong JNICALL Java_io_kuzzle_sdk_kcoreJNI_Kuzzle_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jlong baseptr = 0; - (void)jenv; - (void)jcls; - *(kuzzleio::KuzzleEventEmitter **)&baseptr = *(kuzzleio::Kuzzle **)&jarg1; - return baseptr; -} - -SWIGEXPORT void JNICALL Java_io_kuzzle_sdk_kcoreJNI_swig_1module_1init(JNIEnv *jenv, jclass jcls) { - int i; - - static struct { - const char *method; - const char *signature; - } methods[3] = { - { - "SwigDirector_NotificationListener_onMessage", "(Lio/kuzzle/sdk/NotificationListener;J)V" - }, - { - "SwigDirector_EventListener_trigger", "(Lio/kuzzle/sdk/EventListener;J)V" - }, - { - "SwigDirector_SubscribeListener_onSubscribe", "(Lio/kuzzle/sdk/SubscribeListener;J)V" - } - }; - Swig::jclass_kcoreJNI = (jclass) jenv->NewGlobalRef(jcls); - if (!Swig::jclass_kcoreJNI) return; - for (i = 0; i < (int) (sizeof(methods)/sizeof(methods[0])); ++i) { - Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature); - if (!Swig::director_method_ids[i]) return; - } -} - - -#ifdef __cplusplus -} -#endif - diff --git a/internal/wrappers/kcore_wrap.h b/internal/wrappers/kcore_wrap.h deleted file mode 100644 index 9b466232..00000000 --- a/internal/wrappers/kcore_wrap.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 3.0.12 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - -#ifndef SWIG_kcore_WRAP_H_ -#define SWIG_kcore_WRAP_H_ - -class SwigDirector_NotificationListener : public kuzzleio::NotificationListener, public Swig::Director { - -public: - void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); - SwigDirector_NotificationListener(JNIEnv *jenv); - virtual ~SwigDirector_NotificationListener(); - virtual void onMessage(notification_result *arg0) const; -public: - bool swig_overrides(int n) { - return (n < 1 ? swig_override[n] : false); - } -protected: - Swig::BoolArray<1> swig_override; -}; - -class SwigDirector_EventListener : public kuzzleio::EventListener, public Swig::Director { - -public: - void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); - SwigDirector_EventListener(JNIEnv *jenv); - virtual ~SwigDirector_EventListener(); - virtual void trigger(json_object *arg0) const; -public: - bool swig_overrides(int n) { - return (n < 1 ? swig_override[n] : false); - } -protected: - Swig::BoolArray<1> swig_override; -}; - -class SwigDirector_SubscribeListener : public kuzzleio::SubscribeListener, public Swig::Director { - -public: - void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); - SwigDirector_SubscribeListener(JNIEnv *jenv); - virtual ~SwigDirector_SubscribeListener(); - virtual void onSubscribe(room_result *arg0) const; -public: - bool swig_overrides(int n) { - return (n < 1 ? swig_override[n] : false); - } -protected: - Swig::BoolArray<1> swig_override; -}; - - -#endif From 4dd9720a73d3d83af5eb650fa3457e49e0c1015f Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 7 Mar 2018 16:30:04 +0100 Subject: [PATCH 049/363] Update validateSpecifications return type --- collection/validate_specifications.go | 13 +++++++++---- collection/validate_specifications_test.go | 10 ++++++---- internal/wrappers/cgo/kuzzle/collection.go | 6 +++--- internal/wrappers/cpp/collection.cpp | 9 ++++++--- internal/wrappers/headers/collection.hpp | 2 +- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go index 65044904..9279ef17 100644 --- a/collection/validate_specifications.go +++ b/collection/validate_specifications.go @@ -1,13 +1,15 @@ package collection import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // ValidateSpecifications validates the provided specifications. -func (dc *Collection) ValidateSpecifications(body string) error { +func (dc *Collection) ValidateSpecifications(body string) (string, error) { if body == "" { - return types.NewError("Collection.ValidateSpecifications: body required", 400) + return "", types.NewError("Collection.ValidateSpecifications: body required", 400) } ch := make(chan *types.KuzzleResponse) @@ -22,8 +24,11 @@ func (dc *Collection) ValidateSpecifications(body string) error { res := <-ch if res.Error != nil { - return res.Error + return "", res.Error } - return nil + var valid string + json.Unmarshal(res.Result, &valid) + + return valid, nil } diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index 104f9c6f..27abb1f9 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -16,7 +16,7 @@ import ( func TestValidateSpecificationsBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.ValidateSpecifications("") + _, err := nc.ValidateSpecifications("") assert.NotNil(t, err) } @@ -29,7 +29,7 @@ func TestValidateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.ValidateSpecifications("body") + _, err := nc.ValidateSpecifications("body") assert.NotNil(t, err) } @@ -47,7 +47,7 @@ func TestValidateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.ValidateSpecifications("body") + _, err := nc.ValidateSpecifications("body") assert.Nil(t, err) } @@ -56,10 +56,12 @@ func ExampleCollection_ValidateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.ValidateSpecifications("body") + res, err := nc.ValidateSpecifications("body") if err != nil { fmt.Println(err.Error()) return } + + fmt.Println(res) } diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 109fb1ee..b2560958 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -108,7 +108,7 @@ func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col } //export kuzzle_collection_validate_specifications -func kuzzle_collection_validate_specifications(c *C.collection, body *C.char) *C.void_result { - err := (*collection.Collection)(c.instance).ValidateSpecifications(C.GoString(body)) - return goToCVoidResult(err) +func kuzzle_collection_validate_specifications(c *C.collection, body *C.char) *C.string_result { + res, err := (*collection.Collection)(c.instance).ValidateSpecifications(C.GoString(body)) + return goToCStringResult(&res, err) } diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index a7f13961..f6e9b379 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -98,12 +98,15 @@ namespace kuzzleio { return ret; } - void Collection::validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str())); + std::string Collection::validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str())); if (r->error != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + std::string ret = r->result; + kuzzle_free_string_result(r); + + return ret; } void Collection::deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index 0c59b7ef..a8f68d5b 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -23,7 +23,7 @@ namespace kuzzleio { std::string getSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; search_result* searchSpecifications(search_options *searchOptions) Kuz_Throw_KuzzleException; std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; - void validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException; + std::string validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException; void deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; }; } From 8644775c10dd01871924ccb1a2de630ab6b37731 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 9 Mar 2018 13:37:15 +0100 Subject: [PATCH 050/363] Apply requested changes from scottinet --- index/create.go | 2 +- index/delete.go | 2 +- index/exists.go | 2 +- index/exists_test.go | 4 +++- index/getAutoRefresh.go | 2 +- index/index.go | 2 +- index/list.go | 28 ++++++++++++++++++++------- index/list_test.go | 12 +++--------- index/mDelete.go | 8 +++++--- index/mDelete_test.go | 8 +++++--- index/refresh.go | 8 ++------ index/refreshInternal.go | 2 +- index/setAutoRefresh.go | 2 +- internal/wrappers/cgo/kuzzle/index.go | 4 ++-- internal/wrappers/cpp/index.cpp | 14 +++++++++----- internal/wrappers/headers/index.hpp | 2 +- 16 files changed, 58 insertions(+), 44 deletions(-) diff --git a/index/create.go b/index/create.go index ff16d0b1..64771fba 100644 --- a/index/create.go +++ b/index/create.go @@ -17,7 +17,7 @@ func (i *Index) Create(index string) error { Controller: "index", Action: "create", } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result diff --git a/index/delete.go b/index/delete.go index 9271a9e0..0b6ef849 100644 --- a/index/delete.go +++ b/index/delete.go @@ -15,7 +15,7 @@ func (i *Index) Delete(index string) error { Controller: "index", Action: "delete", } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result diff --git a/index/exists.go b/index/exists.go index 6b877b9a..cc1134fa 100644 --- a/index/exists.go +++ b/index/exists.go @@ -21,7 +21,7 @@ func (i *Index) Exists(index string) (bool, error) { Action: "exists", } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result diff --git a/index/exists_test.go b/index/exists_test.go index 994883e9..8f37fea0 100644 --- a/index/exists_test.go +++ b/index/exists_test.go @@ -53,9 +53,11 @@ func TestExists(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - _, err := i.Exists("index") + res, err := i.Exists("index") assert.Nil(t, err) + assert.NotNil(t, res) + assert.Equal(t, true, res) } func ExampleIndex_Exists() { diff --git a/index/getAutoRefresh.go b/index/getAutoRefresh.go index f7121c9d..14d9b639 100644 --- a/index/getAutoRefresh.go +++ b/index/getAutoRefresh.go @@ -20,7 +20,7 @@ func (i *Index) GetAutoRefresh(index string) (bool, error) { Action: "getAutoRefresh", } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result diff --git a/index/index.go b/index/index.go index 562c2e48..62bee6b0 100644 --- a/index/index.go +++ b/index/index.go @@ -5,7 +5,7 @@ import ( ) type Index struct { - k types.IKuzzle + kuzzle types.IKuzzle } func NewIndex(k types.IKuzzle) *Index { diff --git a/index/list.go b/index/list.go index 93d4e0e2..de86e9b3 100644 --- a/index/list.go +++ b/index/list.go @@ -1,8 +1,14 @@ package index -import "github.com/kuzzleio/sdk-go/types" +import ( + "encoding/json" + "fmt" -func (i *Index) List() (string, error) { + "github.com/kuzzleio/sdk-go/types" +) + +// List list all index +func (i *Index) List() ([]string, error) { result := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ @@ -10,16 +16,24 @@ func (i *Index) List() (string, error) { Action: "list", } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result if res.Error != nil { - return "", res.Error + return nil, res.Error + } + + var collectionList struct { + Total int + Hits []string } - var collectionList string - collectionList = string(res.Result) + err := json.Unmarshal(res.Result, &collectionList) + + if err != nil { + return nil, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + } - return collectionList, nil + return collectionList.Hits, nil } diff --git a/index/list_test.go b/index/list_test.go index 205f5276..82bf0105 100644 --- a/index/list_test.go +++ b/index/list_test.go @@ -35,15 +35,7 @@ func TestList(t *testing.T) { assert.Equal(t, "index", parsedQuery.Controller) assert.Equal(t, "list", parsedQuery.Action) - res := types.KuzzleResponse{Result: []byte(` - { - "total": 2, - "hits": [ - "index_1", - "index_2" - ] - }`), - } + res := types.KuzzleResponse{Result: []byte(`{"total": 2, "hits":["index_1", "index_2"]}`)} r, _ := json.Marshal(res.Result) return &types.KuzzleResponse{Result: r} @@ -53,8 +45,10 @@ func TestList(t *testing.T) { i := index.NewIndex(k) res, err := i.List() + expectedResponse := []string{"index_1", "index_2"} assert.Nil(t, err) assert.NotNil(t, res) + assert.Equal(t, expectedResponse, res) } func ExampleIndex_List() { diff --git a/index/mDelete.go b/index/mDelete.go index f50f06f5..f2c3ed6e 100644 --- a/index/mDelete.go +++ b/index/mDelete.go @@ -20,7 +20,7 @@ func (i *Index) MDelete(indexes []string) ([]string, error) { Action: "mDelete", Body: indexes, } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result @@ -28,12 +28,14 @@ func (i *Index) MDelete(indexes []string) ([]string, error) { return nil, res.Error } - var deletedIndexes []string + var deletedIndexes struct { + Deleted []string + } err := json.Unmarshal(res.Result, &deletedIndexes) if err != nil { return nil, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) } - return deletedIndexes, nil + return deletedIndexes.Deleted, nil } diff --git a/index/mDelete_test.go b/index/mDelete_test.go index 7787fc92..c8974d73 100644 --- a/index/mDelete_test.go +++ b/index/mDelete_test.go @@ -48,16 +48,18 @@ func TestMDelete(t *testing.T) { assert.Equal(t, "index", q.Controller) assert.Equal(t, "mDelete", q.Action) - return &types.KuzzleResponse{Result: []byte(`["index1"]`)} + return &types.KuzzleResponse{Result: []byte(`{"deleted":["index1"]}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - indexes := []string{"index"} - _, err := i.MDelete(indexes) + indexes := []string{"index1"} + res, err := i.MDelete(indexes) assert.Nil(t, err) + assert.NotNil(t, res) + assert.Equal(t, indexes, res) } func ExampleIndex_MDelete() { diff --git a/index/refresh.go b/index/refresh.go index 1516195c..66be1b10 100644 --- a/index/refresh.go +++ b/index/refresh.go @@ -16,13 +16,9 @@ func (i *Index) Refresh(index string) error { Action: "refresh", Index: index, } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result - if res.Error != nil { - return res.Error - } - - return nil + return res.Error } diff --git a/index/refreshInternal.go b/index/refreshInternal.go index 0cc4745a..2fd7522c 100644 --- a/index/refreshInternal.go +++ b/index/refreshInternal.go @@ -10,7 +10,7 @@ func (i *Index) RefreshInternal() error { Controller: "index", Action: "refreshInternal", } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result diff --git a/index/setAutoRefresh.go b/index/setAutoRefresh.go index da4314a1..38027581 100644 --- a/index/setAutoRefresh.go +++ b/index/setAutoRefresh.go @@ -18,7 +18,7 @@ func (i *Index) SetAutoRefresh(index string, autoRefresh bool) error { }{autoRefresh}, } - go i.k.Query(query, nil, result) + go i.kuzzle.Query(query, nil, result) res := <-result diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index 896e12c1..15e8b9d6 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -94,7 +94,7 @@ func kuzzle_index_get_auto_refresh(i *C.kuzzle_index, index *C.char) *C.bool_res } //export kuzzle_index_list -func kuzzle_index_list(i *C.kuzzle_index) *C.string_result { +func kuzzle_index_list(i *C.kuzzle_index) *C.string_array_result { res, err := (*indexPkg.Index)(i.instance).List() - return goToCStringResult(&res, err) + return goToCStringArrayResult(res, err) } diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index c3808a98..f500ae45 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -88,12 +88,16 @@ namespace kuzzleio { return ret; } - std::string Index::list() Kuz_Throw_KuzzleException { - string_result *r = kuzzle_index_list(_index); + std::vector Index::list() Kuz_Throw_KuzzleException { + string_array_result *r = kuzzle_index_list(_index); if (r->error != NULL) throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; + + std::vector v; + for (int i = 0; i < r->result_length; i++) + v.push_back(r->result[i]); + + kuzzle_free_string_array_result(r); + return v; } } diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp index 0f559884..f682fde3 100644 --- a/internal/wrappers/headers/index.hpp +++ b/internal/wrappers/headers/index.hpp @@ -20,7 +20,7 @@ namespace kuzzleio { void refreshInternal() Kuz_Throw_KuzzleException; void setAutoRefresh(const std::string& index, bool autoRefresh) Kuz_Throw_KuzzleException; bool getAutoRefresh(const std::string& index) Kuz_Throw_KuzzleException; - std::string list() Kuz_Throw_KuzzleException; + std::vector list() Kuz_Throw_KuzzleException; }; } From c11ca4a2350f9d3368583bc07d5d3c19cf15562f Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 9 Mar 2018 15:13:34 +0100 Subject: [PATCH 051/363] Apply requested changes from scottinet --- collection/collection.go | 14 ++-- collection/create.go | 6 +- collection/exists.go | 2 +- collection/get_mapping.go | 15 ++-- collection/list.go | 19 +++-- collection/list_test.go | 26 ++++--- collection/search_specifications.go | 4 +- collection/search_specifications_test.go | 19 +++-- collection/update_mapping.go | 6 +- collection/update_mapping_test.go | 13 ++-- collection/update_specifications.go | 19 +++-- collection/update_specifications_test.go | 19 +++-- collection/validate_specifications.go | 24 +++++-- collection/validate_specifications_test.go | 11 +-- internal/wrappers/cgo/kuzzle/c_to_go.go | 12 ++-- internal/wrappers/cgo/kuzzle/collection.go | 26 ++++--- internal/wrappers/cgo/kuzzle/search_result.go | 13 ---- internal/wrappers/cpp/collection.cpp | 8 +-- internal/wrappers/headers/collection.hpp | 2 +- types/search_options.go | 34 ++++----- types/search_result.go | 69 ++----------------- 21 files changed, 154 insertions(+), 207 deletions(-) delete mode 100644 internal/wrappers/cgo/kuzzle/search_result.go diff --git a/collection/collection.go b/collection/collection.go index 07b77424..d71b2ab6 100644 --- a/collection/collection.go +++ b/collection/collection.go @@ -4,6 +4,7 @@ import ( "github.com/kuzzleio/sdk-go/kuzzle" ) +//Collection controller type Collection struct { Kuzzle *kuzzle.Kuzzle } @@ -15,16 +16,9 @@ func NewCollection(kuzzle *kuzzle.Kuzzle) *Collection { } } +//ListOptions collection list options type ListOptions struct { Type string - From int - Size int -} - -func NewListOptions(t string, from int, size int) *ListOptions { - return &ListOptions{ - Type: t, - From: from, - Size: size, - } + From *int + Size *int } diff --git a/collection/create.go b/collection/create.go index c7eb82b6..ad40b22f 100644 --- a/collection/create.go +++ b/collection/create.go @@ -26,9 +26,5 @@ func (dc *Collection) Create(index string, collection string) error { res := <-ch - if res.Error != nil { - return res.Error - } - - return nil + return res.Error } diff --git a/collection/exists.go b/collection/exists.go index 1f584089..6a174c39 100644 --- a/collection/exists.go +++ b/collection/exists.go @@ -41,5 +41,5 @@ func (dc *Collection) Exists(index string, collection string) (bool, error) { return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) } - return true, nil + return exists, nil } diff --git a/collection/get_mapping.go b/collection/get_mapping.go index 0b215410..a7538af6 100644 --- a/collection/get_mapping.go +++ b/collection/get_mapping.go @@ -1,17 +1,19 @@ package collection import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // GetMapping retrieves the current mapping of the collection. -func (dc *Collection) GetMapping(index string, collection string) (string, error) { +func (dc *Collection) GetMapping(index string, collection string) (json.RawMessage, error) { if index == "" { - return "", types.NewError("Collection.GetMapping: index required", 400) + return nil, types.NewError("Collection.GetMapping: index required", 400) } if collection == "" { - return "", types.NewError("Collection.GetMapping: collection required", 400) + return nil, types.NewError("Collection.GetMapping: collection required", 400) } ch := make(chan *types.KuzzleResponse) @@ -27,11 +29,8 @@ func (dc *Collection) GetMapping(index string, collection string) (string, error res := <-ch if res.Error != nil { - return "", res.Error + return nil, res.Error } - var mapping string - mapping = string(res.Result) - - return mapping, nil + return res.Result, nil } diff --git a/collection/list.go b/collection/list.go index 33a305cb..0cb5790a 100644 --- a/collection/list.go +++ b/collection/list.go @@ -1,13 +1,15 @@ package collection import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) -// ListCollections retrieves the list of known data collections contained in a specified index. -func (dc *Collection) List(index string, options *ListOptions) (string, error) { +// List retrieves the list of known data collections contained in a specified index. +func (dc *Collection) List(index string, options *ListOptions) (json.RawMessage, error) { if index == "" { - return "", types.NewError("Collection.List: index required", 400) + return nil, types.NewError("Collection.List: index required", 400) } result := make(chan *types.KuzzleResponse) @@ -20,19 +22,16 @@ func (dc *Collection) List(index string, options *ListOptions) (string, error) { } queryOpts := types.NewQueryOptions() - queryOpts.SetFrom(options.From) - queryOpts.SetSize(options.Size) + queryOpts.SetFrom(*options.From) + queryOpts.SetSize(*options.Size) go dc.Kuzzle.Query(query, queryOpts, result) res := <-result if res.Error != nil { - return "", res.Error + return nil, res.Error } - var collectionList string - collectionList = string(res.Result) - - return collectionList, nil + return res.Result, nil } diff --git a/collection/list_test.go b/collection/list_test.go index 5c99f4ff..6e176a16 100644 --- a/collection/list_test.go +++ b/collection/list_test.go @@ -15,8 +15,10 @@ import ( func TestListIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - lo := collection.NewListOptions("stored", 0, 1) - _, err := nc.List("", lo) + from := 0 + size := 1 + lo := collection.ListOptions{Type: "stored", From: &from, Size: &size} + _, err := nc.List("", &lo) assert.NotNil(t, err) } @@ -28,10 +30,11 @@ func TestListError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - nc := collection.NewCollection(k) - lo := collection.NewListOptions("stored", 0, 1) - _, err := nc.List("index", lo) + from := 0 + size := 1 + lo := collection.ListOptions{Type: "stored", From: &from, Size: &size} + _, err := nc.List("index", &lo) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -64,8 +67,10 @@ func TestList(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - lo := collection.NewListOptions("all", 0, 1) - res, err := nc.List("index", lo) + from := 0 + size := 1 + lo := collection.ListOptions{Type: "stored", From: &from, Size: &size} + res, err := nc.List("index", &lo) assert.Nil(t, err) assert.NotNil(t, res) } @@ -75,8 +80,11 @@ func ExampleCollection_List() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - lo := collection.NewListOptions("all", 0, 1) - res, err := nc.List("index", lo) + + from := 0 + size := 1 + lo := collection.ListOptions{Type: "stored", From: &from, Size: &size} + res, err := nc.List("index", &lo) if err != nil { fmt.Println(err.Error()) diff --git a/collection/search_specifications.go b/collection/search_specifications.go index efe35b66..e1ad3f00 100644 --- a/collection/search_specifications.go +++ b/collection/search_specifications.go @@ -17,8 +17,8 @@ func (dc *Collection) SearchSpecifications(options *types.SearchOptions) (*types } if options != nil { - query.From = options.From - query.Size = options.Size + query.From = *options.From + query.Size = *options.Size scroll := options.Scroll if scroll != "" { query.Scroll = scroll diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go index 8cf9cc9a..e46f3603 100644 --- a/collection/search_specifications_test.go +++ b/collection/search_specifications_test.go @@ -21,8 +21,10 @@ func TestSearchSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - so := types.NewSearchOptions("all", 2, 4, "1m") - _, err := nc.SearchSpecifications(so) + so := types.SearchOptions{Type: "all", Scroll: "1m"} + so.SetFrom(0) + so.SetSize(4) + _, err := nc.SearchSpecifications(&so) assert.NotNil(t, err) } @@ -64,8 +66,10 @@ func TestSearchSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - so := types.NewSearchOptions("all", 2, 4, "1m") - res, err := nc.SearchSpecifications(so) + so := types.SearchOptions{Type: "all", Scroll: "1m"} + so.SetFrom(0) + so.SetSize(4) + res, err := nc.SearchSpecifications(&so) assert.Equal(t, 1, res.Total) assert.Nil(t, err) } @@ -75,9 +79,10 @@ func ExampleCollection_SearchSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - so := types.NewSearchOptions("all", 2, 4, "1m") - - res, err := nc.SearchSpecifications(so) + so := types.SearchOptions{Type: "all", Scroll: "1m"} + so.SetFrom(0) + so.SetSize(4) + res, err := nc.SearchSpecifications(&so) if err != nil { fmt.Println(err.Error()) diff --git a/collection/update_mapping.go b/collection/update_mapping.go index 8bb72eb4..cd2f8491 100644 --- a/collection/update_mapping.go +++ b/collection/update_mapping.go @@ -1,11 +1,13 @@ package collection import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // UpdateMapping updates the current mapping of this collection. -func (dc *Collection) UpdateMapping(index string, collection string, body string) error { +func (dc *Collection) UpdateMapping(index string, collection string, body json.RawMessage) error { if index == "" { return types.NewError("Collection.UpdateMapping: index required", 400) } @@ -14,7 +16,7 @@ func (dc *Collection) UpdateMapping(index string, collection string, body string return types.NewError("Collection.UpdateMapping: collection required", 400) } - if body == "" { + if body == nil { return types.NewError("Collection.UpdateMapping: body required", 400) } diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index 0658033c..d5fe5810 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -1,6 +1,7 @@ package collection_test import ( + "encoding/json" "fmt" "github.com/kuzzleio/sdk-go/collection" @@ -16,21 +17,21 @@ import ( func TestUpdateMappingIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("", "collection", "body") + err := nc.UpdateMapping("", "collection", json.RawMessage("body")) assert.NotNil(t, err) } func TestUpdateMappingCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "", "body") + err := nc.UpdateMapping("index", "", json.RawMessage("body")) assert.NotNil(t, err) } func TestUpdateMappingBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", "") + err := nc.UpdateMapping("index", "collection", nil) assert.NotNil(t, err) } @@ -43,7 +44,7 @@ func TestUpdateMappingError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", json.RawMessage("body")) assert.NotNil(t, err) } @@ -56,7 +57,7 @@ func TestUpdateMapping(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", json.RawMessage("body")) assert.Nil(t, err) } @@ -65,7 +66,7 @@ func ExampleCollection_UpdateMapping() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", "body") + err := nc.UpdateMapping("index", "collection", json.RawMessage("body")) if err != nil { fmt.Println(err.Error()) diff --git a/collection/update_specifications.go b/collection/update_specifications.go index 151b105d..fec10295 100644 --- a/collection/update_specifications.go +++ b/collection/update_specifications.go @@ -1,21 +1,23 @@ package collection import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // UpdateSpecifications updates the current specifications of this collection. -func (dc *Collection) UpdateSpecifications(index string, collection string, body string) (string, error) { +func (dc *Collection) UpdateSpecifications(index string, collection string, body json.RawMessage) (json.RawMessage, error) { if index == "" { - return "", types.NewError("Collection.UpdateSpecifications: index required", 400) + return nil, types.NewError("Collection.UpdateSpecifications: index required", 400) } if collection == "" { - return "", types.NewError("Collection.UpdateSpecifications: collection required", 400) + return nil, types.NewError("Collection.UpdateSpecifications: collection required", 400) } - if body == "" { - return "", types.NewError("Collection.UpdateSpecifications: body required", 400) + if body == nil { + return nil, types.NewError("Collection.UpdateSpecifications: body required", 400) } ch := make(chan *types.KuzzleResponse) @@ -32,11 +34,8 @@ func (dc *Collection) UpdateSpecifications(index string, collection string, body res := <-ch if res.Error != nil { - return "", res.Error + return nil, res.Error } - var result string - result = string(res.Result) - - return result, nil + return res.Result, nil } diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go index 83cd4a4a..3eee24c8 100644 --- a/collection/update_specifications_test.go +++ b/collection/update_specifications_test.go @@ -1,12 +1,11 @@ package collection_test import ( + "encoding/json" "fmt" - - "github.com/kuzzleio/sdk-go/collection" - "testing" + "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" @@ -16,21 +15,21 @@ import ( func TestUpdateSpecificationsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("", "collection", "body") + _, err := nc.UpdateSpecifications("", "collection", json.RawMessage("body")) assert.NotNil(t, err) } func TestUpdateSpecificationsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "", "body") + _, err := nc.UpdateSpecifications("index", "", json.RawMessage("body")) assert.NotNil(t, err) } func TestUpdateSpecificationsBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", "") + _, err := nc.UpdateSpecifications("index", "collection", nil) assert.NotNil(t, err) } @@ -43,20 +42,20 @@ func TestUpdateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", "body") + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body")) assert.NotNil(t, err) } func TestUpdateSpecifications(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Result: []byte(`{}`)} + return &types.KuzzleResponse{Result: []byte(`{ "myindex": { "mycollection": { "strict": false, "fields": {} } }}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", "body") + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body")) assert.Nil(t, err) } @@ -65,7 +64,7 @@ func ExampleCollection_UpdateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", "body") + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body")) if err != nil { fmt.Println(err.Error()) diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go index 9279ef17..c4322ea7 100644 --- a/collection/validate_specifications.go +++ b/collection/validate_specifications.go @@ -2,14 +2,15 @@ package collection import ( "encoding/json" + "fmt" "github.com/kuzzleio/sdk-go/types" ) // ValidateSpecifications validates the provided specifications. -func (dc *Collection) ValidateSpecifications(body string) (string, error) { - if body == "" { - return "", types.NewError("Collection.ValidateSpecifications: body required", 400) +func (dc *Collection) ValidateSpecifications(body json.RawMessage) (bool, error) { + if body == nil { + return false, types.NewError("Collection.ValidateSpecifications: body required", 400) } ch := make(chan *types.KuzzleResponse) @@ -24,11 +25,20 @@ func (dc *Collection) ValidateSpecifications(body string) (string, error) { res := <-ch if res.Error != nil { - return "", res.Error + return false, res.Error } - var valid string - json.Unmarshal(res.Result, &valid) + var validationRes struct { + Valid bool + Details []string + Descritpion string + } + + err := json.Unmarshal(res.Result, &validationRes) + + if err != nil { + return false, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + } - return valid, nil + return validationRes.Valid, nil } diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index 27abb1f9..8f7c5e4b 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -1,6 +1,7 @@ package collection_test import ( + "encoding/json" "fmt" "github.com/kuzzleio/sdk-go/collection" @@ -16,7 +17,7 @@ import ( func TestValidateSpecificationsBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications("") + _, err := nc.ValidateSpecifications(nil) assert.NotNil(t, err) } @@ -29,7 +30,7 @@ func TestValidateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications("body") + _, err := nc.ValidateSpecifications(json.RawMessage("body")) assert.NotNil(t, err) } @@ -47,8 +48,10 @@ func TestValidateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications("body") + res, err := nc.ValidateSpecifications(json.RawMessage("body")) assert.Nil(t, err) + assert.NotNil(t, res) + assert.Equal(t, true, res) } func ExampleCollection_ValidateSpecifications() { @@ -56,7 +59,7 @@ func ExampleCollection_ValidateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.ValidateSpecifications("body") + res, err := nc.ValidateSpecifications(json.RawMessage("body")) if err != nil { fmt.Println(err.Error()) diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index c99f37e9..6e20ebd6 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -249,10 +249,12 @@ func cToGoSearchResult(s *C.search_result) *types.SearchResult { } func cToGoSearchOptions(s *C.search_options) *types.SearchOptions { + from := int(s.from) + size := int(s.size) return &types.SearchOptions{ Type: C.GoString(s.type_), - From: int(s.from), - Size: int(s.size), + From: &from, + Size: &size, Scroll: C.GoString(s.scroll), } } @@ -267,10 +269,12 @@ func cToGoCollectionListOptions(clo *C.collection_list_options) *collection.List } else if clo.type_ == C.REALTIME { t = "realtime" } + from := int(clo.from) + size := int(clo.size) return &collection.ListOptions{ Type: t, - From: int(clo.type_), - Size: int(clo.size), + From: &from, + Size: &size, } } diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index b2560958..42ebb594 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -7,6 +7,7 @@ package main */ import "C" import ( + "encoding/json" "unsafe" "github.com/kuzzleio/sdk-go/collection" @@ -64,7 +65,9 @@ func kuzzle_collection_exists(c *C.collection, index *C.char, col *C.char) *C.bo //export kuzzle_collection_list func kuzzle_collection_list(c *C.collection, index *C.char, clo *C.collection_list_options) *C.string_result { res, err := (*collection.Collection)(c.instance).List(C.GoString(index), cToGoCollectionListOptions(clo)) - return goToCStringResult(&res, err) + var stringResult string + json.Unmarshal(res, &stringResult) + return goToCStringResult(&stringResult, err) } // Mapping @@ -72,12 +75,15 @@ func kuzzle_collection_list(c *C.collection, index *C.char, clo *C.collection_li //export kuzzle_collection_get_mapping func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char) *C.string_result { res, err := (*collection.Collection)(c.instance).GetMapping(C.GoString(index), C.GoString(col)) - return goToCStringResult(&res, err) + var stringResult string + stringResult = string(res) + return goToCStringResult(&stringResult, err) } //export kuzzle_collection_update_mapping func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char) *C.void_result { - err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), C.GoString(body)) + newBody, _ := json.Marshal(body) + err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), newBody) return goToCVoidResult(err) } @@ -103,12 +109,16 @@ func kuzzle_collection_search_specifications(c *C.collection, searchOptions *C.s //export kuzzle_collection_update_specifications func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col *C.char, body *C.char) *C.string_result { - res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), C.GoString(body)) - return goToCStringResult(&res, err) + newBody, _ := json.Marshal(body) + res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), newBody) + var stringResult string + stringResult = string(res) + return goToCStringResult(&stringResult, err) } //export kuzzle_collection_validate_specifications -func kuzzle_collection_validate_specifications(c *C.collection, body *C.char) *C.string_result { - res, err := (*collection.Collection)(c.instance).ValidateSpecifications(C.GoString(body)) - return goToCStringResult(&res, err) +func kuzzle_collection_validate_specifications(c *C.collection, body *C.char) *C.bool_result { + newBody, _ := json.Marshal(body) + res, err := (*collection.Collection)(c.instance).ValidateSpecifications(newBody) + return goToCBoolResult(res, err) } diff --git a/internal/wrappers/cgo/kuzzle/search_result.go b/internal/wrappers/cgo/kuzzle/search_result.go deleted file mode 100644 index 91e62a6a..00000000 --- a/internal/wrappers/cgo/kuzzle/search_result.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" -*/ -import "C" - -////export kuzzle_search_result_fetch_next -//func kuzzle_search_result_fetch_next(sr *C.search_result) *C.search_result { -// res, err := cToGoSearchResult(sr).FetchNext() -// return goToCSearchResult(sr.collection, res, err) -//} diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index f6e9b379..be4566c1 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -98,13 +98,13 @@ namespace kuzzleio { return ret; } - std::string Collection::validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str())); + bool Collection::validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str())); if (r->error != NULL) throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); + bool ret = r->result; + kuzzle_free_bool_result(r); return ret; } diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index a8f68d5b..60e5e1c0 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -23,7 +23,7 @@ namespace kuzzleio { std::string getSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; search_result* searchSpecifications(search_options *searchOptions) Kuz_Throw_KuzzleException; std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; - std::string validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException; + bool validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException; void deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; }; } diff --git a/types/search_options.go b/types/search_options.go index 481a6e7a..fb54e2cd 100644 --- a/types/search_options.go +++ b/types/search_options.go @@ -1,37 +1,29 @@ package types +// SearchOptions options for search functions type SearchOptions struct { Type string - From int - Size int + From *int + Size *int Scroll string } -func NewSearchOptions(t string, from int, size int, scroll string) *SearchOptions { - return &SearchOptions{ - Type: t, - From: from, - Size: size, - Scroll: scroll, - } -} - -func (so *SearchOptions) SetType(nt string) *SearchOptions { +//SetType Type setter +func (so *SearchOptions) SetType(nt string) { so.Type = nt - return so } -func (so *SearchOptions) SetFrom(nf int) *SearchOptions { - so.From = nf - return so +//SetFrom From setter +func (so *SearchOptions) SetFrom(nf int) { + so.From = &nf } -func (so *SearchOptions) SetSize(ns int) *SearchOptions { - so.Size = ns - return so +//SetSize Size setter +func (so *SearchOptions) SetSize(ns int) { + so.Size = &ns } -func (so *SearchOptions) SetScroll(ns string) *SearchOptions { +//SetScroll Scroll setter +func (so *SearchOptions) SetScroll(ns string) { so.Scroll = ns - return so } diff --git a/types/search_result.go b/types/search_result.go index 8fee1d19..d463333e 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -14,11 +14,12 @@ type SearchResult struct { Filters *SearchFilters } +//NewSearchResult Search Result constructor func NewSearchResult(collection json.RawMessage, filters *SearchFilters, options QueryOptions, raw *KuzzleResponse) *SearchResult { type ParseSearchResult struct { Documents json.RawMessage `json:"hits"` Total int `json:"total"` - ScrollId string `json:"_scroll_id"` + ScrollID string `json:"_scroll_id"` Aggregations json.RawMessage `json:"aggregations"` } @@ -35,77 +36,15 @@ func NewSearchResult(collection json.RawMessage, filters *SearchFilters, options Options: NewQueryOptions(), } - sr.Options.SetScrollId(parsed.ScrollId) + sr.Options.SetScrollId(parsed.ScrollID) if options != nil { sr.Options.SetFrom(options.From()) sr.Options.SetSize(options.Size()) } else { sr.Options.SetFrom(0) - sr.Options.SetSize(0) + sr.Options.SetSize(10) } return sr } - -//// FetchNext returns a new SearchResult that corresponds to the next result page -//func (ksr *SearchResult) FetchNext() (*SearchResult, error) { -// if ksr.Fetched >= ksr.Total { -// return nil, nil -// } -// -// if ksr.Options.ScrollId() != "" { -// res, err := ksr.Scroll(ksr.Options.ScrollId(), nil) -// return ksr.afterFetch(res, err) -// } -// -// if ksr.Options.Size() > 0 { -// if ksr.Filters != nil && len(ksr.Filters.Sort) > 0 { -// source := ksr.Documents[len(ksr.Documents)-1].SourceToMap() -// -// filters := &SearchFilters{ -// Query: ksr.Filters.Query, -// Sort: ksr.Filters.Sort, -// Aggregations: ksr.Filters.Aggregations, -// } -// -// for _, sortRules := range ksr.Filters.Sort { -// switch t := sortRules.(type) { -// case string: -// filters.SearchAfter = append(filters.SearchAfter, source[t]) -// case map[string]interface{}: -// for field := range t { -// filters.SearchAfter = append(filters.SearchAfter, source[field]) -// } -// } -// } -// -// res, err := ksr.Collection.Search(filters, ksr.Options) -// return ksr.afterFetch(res, err) -// } else { -// opts := NewQueryOptions() -// opts.SetFrom(ksr.Options.From() + ksr.Options.Size()) -// -// if opts.From() >= ksr.Total { -// return nil, nil -// } -// -// opts.SetSize(ksr.Options.Size()) -// -// res, err := ksr.Collection.Search(ksr.Filters, opts) -// return ksr.afterFetch(res, err) -// } -// } -// -// return nil, NewError("SearchResult.FetchNext: Unable to retrieve results: missing scrollId or from/size parameters", 400) -//} -// -//func (ksr *SearchResult) afterFetch(nextResult *SearchResult, err error) (*SearchResult, error) { -// if err != nil { -// return nextResult, err -// } -// -// nextResult.Fetched = len(nextResult.Documents) + ksr.Fetched -// -// return nextResult, nil -//} From eec64b6069d140a746e7aa5b21f6f1d835debce6 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 9 Mar 2018 15:26:11 +0100 Subject: [PATCH 052/363] Fix Merge conflict --- internal/wrappers/headers/document.hpp | 36 ------------------------- internal/wrappers/kcore.i | 10 ------- internal/wrappers/templates/java/core.i | 10 ------- 3 files changed, 56 deletions(-) delete mode 100644 internal/wrappers/headers/document.hpp diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp deleted file mode 100644 index f6151528..00000000 --- a/internal/wrappers/headers/document.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _DOCUMENT_HPP_ -#define _DOCUMENT_HPP_ - -#include "listeners.hpp" -#include "exceptions.hpp" -#include "core.hpp" -#include "room.hpp" - -#include -#include - -namespace kuzzleio { - class Collection; - - class Document { - Document(){}; - Collection *_collection; - NotificationListener* _listener_instance; - - public: - document *_document; - Document(Collection *collection, const std::string& id="", json_object* content=NULL) Kuz_Throw_KuzzleException; - virtual ~Document(); - std::string delete_(query_options* options=NULL) Kuz_Throw_KuzzleException; - bool exists(query_options* options=NULL) Kuz_Throw_KuzzleException; - bool publish(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* refresh(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* save(query_options* options=NULL) Kuz_Throw_KuzzleException; - Document* setContent(json_object* content, bool replace=false); - json_object* getContent(); - Room* subscribe(NotificationListener* listener, room_options* options=NULL); - NotificationListener* getListener(); - }; -} - -#endif diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index 097f3a69..c05ec82c 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -7,12 +7,7 @@ #include "event_emitter.hpp" #include "kuzzle.hpp" #include "collection.hpp" -<<<<<<< HEAD -======= -#include "room.hpp" -#include "document.hpp" #include "index.hpp" ->>>>>>> 1.x #include "server.hpp" #include #include @@ -28,10 +23,5 @@ %include "event_emitter.hpp" %include "kuzzle.hpp" %include "collection.hpp" -<<<<<<< HEAD -======= -%include "room.hpp" -%include "document.hpp" %include "index.hpp" ->>>>>>> 1.x %include "server.hpp" diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 0a91e6ba..74157baf 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -34,12 +34,7 @@ %{ #include "kuzzle.cpp" #include "collection.cpp" -<<<<<<< HEAD -======= -#include "room.cpp" -#include "document.cpp" #include "index.cpp" ->>>>>>> 1.x #include "server.cpp" %} @@ -143,10 +138,5 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" -<<<<<<< HEAD -======= -%include "room.cpp" -%include "document.cpp" %include "index.cpp" ->>>>>>> 1.x %include "server.cpp" From f45dcd54f4a8c44638d582c6946872afd5f93335 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 12 Mar 2018 15:27:02 +0100 Subject: [PATCH 053/363] json_object to string --- auth/auth.go | 2 +- auth/checkToken.go | 2 +- auth/checkToken_test.go | 3 ++- auth/createMyCredentials.go | 6 ++++-- auth/createMyCredentials_test.go | 10 +++++++--- auth/credentialsExist.go | 2 +- auth/deleteMyCredentials.go | 2 +- auth/deleteMyCredentials_test.go | 3 ++- auth/getCurrentUser.go | 2 +- auth/getCurrentUser_test.go | 3 ++- auth/getMyCredentials.go | 6 ++++-- auth/getMyCredentials_test.go | 3 ++- auth/getMyRights.go | 2 +- auth/getMyRights_test.go | 3 ++- auth/getStrategies.go | 2 +- auth/login.go | 8 ++++---- auth/login_test.go | 9 +++++---- auth/logout.go | 4 ++-- auth/logout_test.go | 3 ++- auth/update_my_credentials.go | 4 ++-- auth/update_my_credentials_test.go | 17 +++++++++++------ auth/update_self.go | 2 +- auth/update_self_test.go | 3 ++- auth/validate_my_credentials.go | 4 ++-- auth/validate_my_credentials_test.go | 16 +++++++++++----- internal/wrappers/cgo/kuzzle/auth.go | 17 ++++++++--------- internal/wrappers/cpp/auth.cpp | 20 ++++++++++---------- internal/wrappers/headers/auth.hpp | 10 +++++----- kuzzle/kuzzle_test.go | 3 ++- 29 files changed, 99 insertions(+), 72 deletions(-) diff --git a/auth/auth.go b/auth/auth.go index 9957134d..4581797c 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -3,7 +3,7 @@ package auth import "github.com/kuzzleio/sdk-go/types" type Auth struct { - k types.IKuzzle + kuzzle types.IKuzzle } func NewAuth(k types.IKuzzle) *Auth { diff --git a/auth/checkToken.go b/auth/checkToken.go index 813d8959..88118ed6 100644 --- a/auth/checkToken.go +++ b/auth/checkToken.go @@ -29,7 +29,7 @@ func (a *Auth) CheckToken(token string) (*TokenValidity, error) { Action: "checkToken", Body: &body{token}, } - go a.k.Query(query, nil, result) + go a.kuzzle.Query(query, nil, result) res := <-result diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go index e1552c4a..5d0882f1 100644 --- a/auth/checkToken_test.go +++ b/auth/checkToken_test.go @@ -56,8 +56,9 @@ func ExampleKuzzle_CheckToken() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - jwt, err := k.Auth.Login("local", myCredentials, nil) + jwt, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/createMyCredentials.go b/auth/createMyCredentials.go index 73b1865c..41d3161f 100644 --- a/auth/createMyCredentials.go +++ b/auth/createMyCredentials.go @@ -1,11 +1,13 @@ package auth import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // CreateMyCredentials create credentials of the specified strategy for the current user. -func (a *Auth) CreateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (types.Credentials, error) { +func (a *Auth) CreateMyCredentials(strategy string, credentials json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { if strategy == "" { return nil, types.NewError("Kuzzle.CreateMyCredentials: strategy is required", 400) } @@ -17,7 +19,7 @@ func (a *Auth) CreateMyCredentials(strategy string, credentials interface{}, opt Body: credentials, Strategy: strategy, } - go a.k.Query(query, options, result) + go a.kuzzle.Query(query, options, result) res := <-result diff --git a/auth/createMyCredentials_test.go b/auth/createMyCredentials_test.go index 0bb24323..a702307b 100644 --- a/auth/createMyCredentials_test.go +++ b/auth/createMyCredentials_test.go @@ -59,8 +59,9 @@ func TestCreateMyCredentials(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) + marsh, _ := json.Marshal(myCredentials{"foo", "bar"}) - res, _ := k.Auth.CreateMyCredentials("local", myCredentials{"foo", "bar"}, nil) + res, _ := k.Auth.CreateMyCredentials("local", marsh, nil) r := myCredentials{} json.Unmarshal(res, &r) @@ -78,15 +79,18 @@ func ExampleKuzzle_CreateMyCredentials() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return } newCredentials := credentials{"new", "foo"} - res, err := k.Auth.CreateMyCredentials("other_strategy", newCredentials, nil) + marsh, _ = json.Marshal(newCredentials) + + res, err := k.Auth.CreateMyCredentials("other_strategy", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/credentialsExist.go b/auth/credentialsExist.go index 498c3862..c720a0ee 100644 --- a/auth/credentialsExist.go +++ b/auth/credentialsExist.go @@ -18,7 +18,7 @@ func (a *Auth) CredentialsExist(strategy string, options types.QueryOptions) (bo Action: "credentialsExist", Strategy: strategy, } - go a.k.Query(query, options, result) + go a.kuzzle.Query(query, options, result) res := <-result diff --git a/auth/deleteMyCredentials.go b/auth/deleteMyCredentials.go index 49a05724..ae475f79 100644 --- a/auth/deleteMyCredentials.go +++ b/auth/deleteMyCredentials.go @@ -21,7 +21,7 @@ func (a *Auth) DeleteMyCredentials(strategy string, options types.QueryOptions) Strategy: strategy, } - go a.k.Query(query, options, result) + go a.kuzzle.Query(query, options, result) res := <-result diff --git a/auth/deleteMyCredentials_test.go b/auth/deleteMyCredentials_test.go index 642b026c..c5861a2a 100644 --- a/auth/deleteMyCredentials_test.go +++ b/auth/deleteMyCredentials_test.go @@ -72,8 +72,9 @@ func ExampleKuzzle_DeleteMyCredentials() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/getCurrentUser.go b/auth/getCurrentUser.go index 9d1a04ec..eff47f08 100644 --- a/auth/getCurrentUser.go +++ b/auth/getCurrentUser.go @@ -15,7 +15,7 @@ func (a *Auth) GetCurrentUser() (*security.User, error) { Action: "getCurrentUser", } - go a.k.Query(query, nil, result) + go a.kuzzle.Query(query, nil, result) res := <-result diff --git a/auth/getCurrentUser_test.go b/auth/getCurrentUser_test.go index 3d653c72..a713f578 100644 --- a/auth/getCurrentUser_test.go +++ b/auth/getCurrentUser_test.go @@ -59,8 +59,9 @@ func ExampleKuzzle_GetCurrentUser() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/getMyCredentials.go b/auth/getMyCredentials.go index 59d73980..51f0d712 100644 --- a/auth/getMyCredentials.go +++ b/auth/getMyCredentials.go @@ -1,11 +1,13 @@ package auth import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // GetMyCredentials get credential information of the specified strategy for the current user. -func (a *Auth) GetMyCredentials(strategy string, options types.QueryOptions) (types.Credentials, error) { +func (a *Auth) GetMyCredentials(strategy string, options types.QueryOptions) (json.RawMessage, error) { if strategy == "" { return nil, types.NewError("Kuzzle.GetMyCredentials: strategy is required", 400) } @@ -17,7 +19,7 @@ func (a *Auth) GetMyCredentials(strategy string, options types.QueryOptions) (ty Strategy: strategy, } - go a.k.Query(query, options, result) + go a.kuzzle.Query(query, options, result) res := <-result diff --git a/auth/getMyCredentials_test.go b/auth/getMyCredentials_test.go index 0b2a1643..da2f54bd 100644 --- a/auth/getMyCredentials_test.go +++ b/auth/getMyCredentials_test.go @@ -82,8 +82,9 @@ func ExampleKuzzle_GetMyCredentials() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/getMyRights.go b/auth/getMyRights.go index f6c9f899..ab292b51 100644 --- a/auth/getMyRights.go +++ b/auth/getMyRights.go @@ -19,7 +19,7 @@ func (a *Auth) GetMyRights(options types.QueryOptions) ([]*types.UserRights, err Hits []*types.UserRights `json:"hits"` } - go a.k.Query(query, options, result) + go a.kuzzle.Query(query, options, result) res := <-result diff --git a/auth/getMyRights_test.go b/auth/getMyRights_test.go index cd38a43d..671fc5b8 100644 --- a/auth/getMyRights_test.go +++ b/auth/getMyRights_test.go @@ -83,8 +83,9 @@ func ExampleKuzzle_GetMyRights() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/getStrategies.go b/auth/getStrategies.go index 6452f4b6..0ffc983c 100644 --- a/auth/getStrategies.go +++ b/auth/getStrategies.go @@ -14,7 +14,7 @@ func (a *Auth) GetStrategies(options types.QueryOptions) ([]string, error) { Controller: "auth", Action: "getStrategies", } - go a.k.Query(query, options, ch) + go a.kuzzle.Query(query, options, ch) res := <-ch diff --git a/auth/login.go b/auth/login.go index a0836376..6184a791 100644 --- a/auth/login.go +++ b/auth/login.go @@ -9,7 +9,7 @@ import ( // Login send login request to kuzzle with credentials. // If login success, store the jwtToken into kuzzle object. -func (a *Auth) Login(strategy string, credentials interface{}, expiresIn *int) (string, error) { +func (a *Auth) Login(strategy string, credentials json.RawMessage, expiresIn *int) (string, error) { if strategy == "" { return "", types.NewError("Kuzzle.Login: cannot authenticate to Kuzzle without an authentication strategy", 400) } @@ -38,18 +38,18 @@ func (a *Auth) Login(strategy string, credentials interface{}, expiresIn *int) ( result := make(chan *types.KuzzleResponse) - go a.k.Query(q, nil, result) + go a.kuzzle.Query(q, nil, result) res := <-result json.Unmarshal(res.Result, &token) if res.Error != nil { - a.k.EmitEvent(event.LoginAttempt, &types.LoginAttempt{Success: false, Error: res.Error}) + a.kuzzle.EmitEvent(event.LoginAttempt, &types.LoginAttempt{Success: false, Error: res.Error}) return "", res.Error } - a.k.SetJwt(token.Jwt) + a.kuzzle.SetJwt(token.Jwt) return token.Jwt, nil } diff --git a/auth/login_test.go b/auth/login_test.go index 23ad1ee3..7d06bb22 100644 --- a/auth/login_test.go +++ b/auth/login_test.go @@ -15,7 +15,7 @@ import ( func TestLoginNoStrategy(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Auth.Login("", struct{}{}, nil) + _, err := k.Auth.Login("", json.RawMessage("{}"), nil) assert.NotNil(t, err) } @@ -36,7 +36,7 @@ func TestLoginError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - k.Auth.Login("local", struct{}{}, nil) + k.Auth.Login("local", json.RawMessage("{}"), nil) } func TestLogin(t *testing.T) { @@ -67,7 +67,7 @@ func TestLogin(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) expiresIn := 42 - token, _ := k.Auth.Login("local", struct{}{}, &expiresIn) + token, _ := k.Auth.Login("local", json.RawMessage("{}"), &expiresIn) assert.Equal(t, "token", token) } @@ -81,8 +81,9 @@ func ExampleKuzzle_Login() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - jwt, err := k.Auth.Login("local", myCredentials, nil) + jwt, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/logout.go b/auth/logout.go index aa6936f3..5ac9593f 100644 --- a/auth/logout.go +++ b/auth/logout.go @@ -12,7 +12,7 @@ func (a *Auth) Logout() error { } result := make(chan *types.KuzzleResponse) - go a.k.Query(q, nil, result) + go a.kuzzle.Query(q, nil, result) res := <-result @@ -20,7 +20,7 @@ func (a *Auth) Logout() error { return res.Error } - a.k.SetJwt("") + a.kuzzle.SetJwt("") return nil } diff --git a/auth/logout_test.go b/auth/logout_test.go index 6243dc2d..3eccc56b 100644 --- a/auth/logout_test.go +++ b/auth/logout_test.go @@ -57,8 +57,9 @@ func ExampleKuzzle_Logout() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/update_my_credentials.go b/auth/update_my_credentials.go index 941c233f..f217a015 100644 --- a/auth/update_my_credentials.go +++ b/auth/update_my_credentials.go @@ -7,7 +7,7 @@ import ( ) // UpdateMyCredentials update credentials of the specified strategy for the current user. -func (a *Auth) UpdateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (json.RawMessage, error) { +func (a *Auth) UpdateMyCredentials(strategy string, credentials json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { if strategy == "" { return nil, types.NewError("Kuzzle.UpdateMyCredentials: strategy is required", 400) } @@ -20,7 +20,7 @@ func (a *Auth) UpdateMyCredentials(strategy string, credentials interface{}, opt Body: credentials, Strategy: strategy, } - go a.k.Query(query, options, result) + go a.kuzzle.Query(query, options, result) res := <-result diff --git a/auth/update_my_credentials_test.go b/auth/update_my_credentials_test.go index 8b76bda2..3bc5c24e 100644 --- a/auth/update_my_credentials_test.go +++ b/auth/update_my_credentials_test.go @@ -39,14 +39,16 @@ func TestUpdateMyCredentialsEmptyStrategy(t *testing.T) { } func TestUpdateMyCredentials(t *testing.T) { - type myCredentials struct { + type credentials struct { Username string `json:"username"` Password string `json:"password"` } + myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - ack := myCredentials{Username: "foo", Password: "bar"} + ack := credentials{Username: "foo", Password: "bar"} r, _ := json.Marshal(ack) request := types.KuzzleRequest{} @@ -59,8 +61,8 @@ func TestUpdateMyCredentials(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Auth.UpdateMyCredentials("local", myCredentials{"foo", "bar"}, nil) - creds := myCredentials{} + res, _ := k.Auth.UpdateMyCredentials("local", marsh, nil) + creds := credentials{} json.Unmarshal(res, &creds) assert.Equal(t, "foo", creds.Username) @@ -77,15 +79,18 @@ func ExampleKuzzle_UpdateMyCredentials() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return } newCredentials := credentials{"foo", "new"} - res, err := k.Auth.UpdateMyCredentials("local", newCredentials, nil) + marsh, _ = json.Marshal(newCredentials) + + res, err := k.Auth.UpdateMyCredentials("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/update_self.go b/auth/update_self.go index 13c5840f..fb21ec5e 100644 --- a/auth/update_self.go +++ b/auth/update_self.go @@ -20,7 +20,7 @@ func (a *Auth) UpdateSelf(data json.RawMessage, options types.QueryOptions) (*se Action: "updateSelf", Body: data, } - go a.k.Query(query, options, ch) + go a.kuzzle.Query(query, options, ch) res := <-ch diff --git a/auth/update_self_test.go b/auth/update_self_test.go index b70b9c29..016e09bf 100644 --- a/auth/update_self_test.go +++ b/auth/update_self_test.go @@ -54,8 +54,9 @@ func ExampleKuzzle_UpdateSelf() { Password string `json:"password"` } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/auth/validate_my_credentials.go b/auth/validate_my_credentials.go index 0d7efb9a..0d7988ee 100644 --- a/auth/validate_my_credentials.go +++ b/auth/validate_my_credentials.go @@ -7,7 +7,7 @@ import ( ) // ValidateMyCredentials validate credentials of the specified strategy for the current user. -func (a *Auth) ValidateMyCredentials(strategy string, credentials interface{}, options types.QueryOptions) (bool, error) { +func (a *Auth) ValidateMyCredentials(strategy string, credentials json.RawMessage, options types.QueryOptions) (bool, error) { result := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ @@ -17,7 +17,7 @@ func (a *Auth) ValidateMyCredentials(strategy string, credentials interface{}, o Body: credentials, } - go a.k.Query(query, options, result) + go a.kuzzle.Query(query, options, result) res := <-result diff --git a/auth/validate_my_credentials_test.go b/auth/validate_my_credentials_test.go index 9b7962dc..acc8e0b2 100644 --- a/auth/validate_my_credentials_test.go +++ b/auth/validate_my_credentials_test.go @@ -44,11 +44,15 @@ func TestValidateMyCredentials(t *testing.T) { }, } - k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Auth.ValidateMyCredentials("local", struct { + type credentials struct { Username string `json:"username"` Password string `json:"password"` - }{"foo", "bar"}, nil) + } + myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Auth.ValidateMyCredentials("local", marsh, nil) assert.Nil(t, err) assert.Equal(t, true, res) @@ -64,14 +68,16 @@ func ExampleKuzzle_ValidateMyCredentials() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return } - res, err := k.Auth.ValidateMyCredentials("local", myCredentials, nil) + marsh, _ = json.Marshal(myCredentials) + res, err := k.Auth.ValidateMyCredentials("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index bdcfe220..d504101e 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -2,7 +2,6 @@ package main /* #cgo CFLAGS: -I../../headers - #cgo LDFLAGS: -ljson-c #include #include @@ -66,10 +65,10 @@ func kuzzle_check_token(a *C.auth, token *C.char) *C.token_validity { } //export kuzzle_create_my_credentials -func kuzzle_create_my_credentials(a *C.auth, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.string_result { +func kuzzle_create_my_credentials(a *C.auth, strategy *C.char, credentials *C.char, options *C.query_options) *C.string_result { res, err := (*auth.Auth)(a.instance).CreateMyCredentials( C.GoString(strategy), - JsonCConvert(credentials).(map[string]interface{}), + json.RawMessage(C.GoString(credentials)), SetQueryOptions(options)) str := string(res) @@ -126,13 +125,13 @@ func kuzzle_get_strategies(a *C.auth, options *C.query_options) *C.string_array_ } //export kuzzle_login -func kuzzle_login(a *C.auth, strategy *C.char, credentials *C.json_object, expires_in *C.int) *C.string_result { +func kuzzle_login(a *C.auth, strategy *C.char, credentials *C.char, expires_in *C.int) *C.string_result { var expire int if expires_in != nil { expire = int(*expires_in) } - res, err := (*auth.Auth)(a.instance).Login(C.GoString(strategy), JsonCConvert(credentials).(map[string]interface{}), &expire) + res, err := (*auth.Auth)(a.instance).Login(C.GoString(strategy), json.RawMessage(C.GoString(credentials)), &expire) return goToCStringResult(&res, err) } @@ -148,10 +147,10 @@ func kuzzle_logout(a *C.auth) *C.char { } //export kuzzle_update_my_credentials -func kuzzle_update_my_credentials(a *C.auth, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.string_result { +func kuzzle_update_my_credentials(a *C.auth, strategy *C.char, credentials *C.char, options *C.query_options) *C.string_result { res, err := (*auth.Auth)(a.instance).UpdateMyCredentials( C.GoString(strategy), - JsonCConvert(credentials).(map[string]interface{}), + json.RawMessage(C.GoString(credentials)), SetQueryOptions(options)) str := string(res) @@ -170,10 +169,10 @@ func kuzzle_update_self(a *C.auth, data *C.char, options *C.query_options) *C.us } //export kuzzle_validate_my_credentials -func kuzzle_validate_my_credentials(a *C.auth, strategy *C.char, credentials *C.json_object, options *C.query_options) *C.bool_result { +func kuzzle_validate_my_credentials(a *C.auth, strategy *C.char, credentials *C.char, options *C.query_options) *C.bool_result { res, err := (*auth.Auth)(a.instance).ValidateMyCredentials( C.GoString(strategy), - JsonCConvert(credentials).(map[string]interface{}), + json.RawMessage(C.GoString(credentials)), SetQueryOptions(options)) return goToCBoolResult(res, err) diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 0eea920a..542bbf0d 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -15,8 +15,8 @@ namespace kuzzleio { return kuzzle_check_token(_auth, const_cast(token.c_str())); } - std::string Auth::createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { - string_result* r = kuzzle_create_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); + std::string Auth::createMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_create_my_credentials(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), options); if (r->error) throwExceptionFromStatus(r); std::string ret = r->result; @@ -78,8 +78,8 @@ namespace kuzzleio { return v; } - std::string Auth::login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException { - string_result* r = kuzzle_login(_auth, const_cast(strategy.c_str()), credentials, NULL); + std::string Auth::login(const std::string& strategy, const std::string& credentials) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_login(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), NULL); if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; @@ -87,8 +87,8 @@ namespace kuzzleio { return ret; } - std::string Auth::login(const std::string& strategy, json_object* credentials, int expires_in) Kuz_Throw_KuzzleException { - string_result* r = kuzzle_login(_auth, const_cast(strategy.c_str()), credentials, &expires_in); + std::string Auth::login(const std::string& strategy, const std::string& credentials, int expires_in) Kuz_Throw_KuzzleException { + string_result* r = kuzzle_login(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), &expires_in); if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; @@ -100,8 +100,8 @@ namespace kuzzleio { kuzzle_logout(_auth); } - std::string Auth::updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_update_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); + std::string Auth::updateMyCredentials(const std::string& strategy, const std::string& credentials, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_update_my_credentials(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; @@ -118,8 +118,8 @@ namespace kuzzleio { return ret; } - bool Auth::validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_validate_my_credentials(_auth, const_cast(strategy.c_str()), credentials, options); + bool Auth::validateMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_validate_my_credentials(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index 5e25a996..697ad7df 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -13,19 +13,19 @@ namespace kuzzleio { Auth(Kuzzle *kuzzle); virtual ~Auth(); token_validity* checkToken(const std::string& token); - std::string createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string createMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; bool credentialsExist(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; void deleteMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; user* getCurrentUser() Kuz_Throw_KuzzleException; std::string getMyCredentials(const std::string& strategy, query_options *options=NULL) Kuz_Throw_KuzzleException; user_right* getMyRights(query_options *options=NULL) Kuz_Throw_KuzzleException; std::vector getStrategies(query_options *options=NULL) Kuz_Throw_KuzzleException; - std::string login(const std::string& strategy, json_object* credentials, int expiresIn) Kuz_Throw_KuzzleException; - std::string login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException; + std::string login(const std::string& strategy, const std::string& credentials, int expiresIn) Kuz_Throw_KuzzleException; + std::string login(const std::string& strategy, const std::string& credentials) Kuz_Throw_KuzzleException; void logout(); - std::string updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string updateMyCredentials(const std::string& strategy, const std::string& credentials, query_options *options=NULL) Kuz_Throw_KuzzleException; user* updateSelf(const std::string& content, query_options* options=NULL) Kuz_Throw_KuzzleException; - bool validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; + bool validateMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; }; } diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index c0a702f6..a2ce9a5c 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -86,8 +86,9 @@ func ExampleKuzzle_UnsetJwt() { } myCredentials := credentials{"foo", "bar"} + marsh, _ := json.Marshal(myCredentials) - _, err := k.Auth.Login("local", myCredentials, nil) + _, err := k.Auth.Login("local", marsh, nil) if err != nil { fmt.Println(err.Error()) return From 8cf078c8591a4746bbfdc296b894ffbc1c7e4d75 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 12 Mar 2018 15:37:00 +0100 Subject: [PATCH 054/363] conflict --- internal/wrappers/headers/kuzzlesdk.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index a3f5a211..4c2e2eaa 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -95,21 +95,17 @@ typedef struct { typedef struct { void *instance; -<<<<<<< HEAD kuzzle *kuzzle; } auth; typedef struct { void *instance; kuzzle *kuzzle; -======= - kuzzle* kuzzle; } kuzzle_index; typedef struct { void *instance; kuzzle* kuzzle; ->>>>>>> origin/1.x } server; //options passed to room constructor From 6862cd5cc9d2a03fb59473fdd2c2889f85c4d9ed Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 12 Mar 2018 15:51:57 +0100 Subject: [PATCH 055/363] fix merge --- internal/wrappers/cpp/kuzzle.cpp | 30 +++++++--------------------- internal/wrappers/headers/kuzzle.hpp | 3 --- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 5b8726e9..22cf58cc 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -27,10 +27,15 @@ namespace kuzzleio { return kuzzle_connect(_kuzzle); } -<<<<<<< HEAD bool Kuzzle::createIndex(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_create_index(_kuzzle, const_cast(index.c_str()), options); -======= + if (r->error != NULL) + throwExceptionFromStatus(r); + bool ret = r->result; + kuzzle_free_bool_result(r); + return ret; + } + json_object* Kuzzle::createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { json_result* r = kuzzle_create_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); if (r->error) @@ -69,7 +74,6 @@ namespace kuzzleio { bool Kuzzle::validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_validate_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); ->>>>>>> origin/1.x if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; @@ -77,26 +81,6 @@ namespace kuzzleio { return ret; } -<<<<<<< HEAD -======= - std::string Kuzzle::login(const std::string& strategy, json_object* credentials) Kuz_Throw_KuzzleException { - string_result* r = kuzzle_login(_kuzzle, const_cast(strategy.c_str()), credentials, NULL); - if (r->error != NULL) - throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - std::string Kuzzle::login(const std::string& strategy, json_object* credentials, int expires_in) Kuz_Throw_KuzzleException { - string_result* r = kuzzle_login(_kuzzle, const_cast(strategy.c_str()), credentials, &expires_in); - if (r->error != NULL) - throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - ->>>>>>> origin/1.x bool Kuzzle::getAutoRefresh(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_get_auto_refresh(_kuzzle, const_cast(index.c_str()), options); if (r->error != NULL) diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 3fc6bab0..0bf9c9b7 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -23,11 +23,8 @@ namespace kuzzleio { virtual ~Kuzzle(); char* connect(); -<<<<<<< HEAD bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; -======= json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; ->>>>>>> origin/1.x statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; From 53cb9bc06878610ac80fb932265cb00573516faa Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 12 Mar 2018 15:57:32 +0100 Subject: [PATCH 056/363] remove credentials method --- internal/wrappers/cpp/kuzzle.cpp | 54 -------------------------------- 1 file changed, 54 deletions(-) diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 22cf58cc..69c00b52 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -27,60 +27,6 @@ namespace kuzzleio { return kuzzle_connect(_kuzzle); } - bool Kuzzle::createIndex(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_create_index(_kuzzle, const_cast(index.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - - json_object* Kuzzle::createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { - json_result* r = kuzzle_create_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); - if (r->error) - throwExceptionFromStatus(r); - json_object *ret = r->result; - kuzzle_free_json_result(r); - return ret; - } - - bool Kuzzle::deleteMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_delete_my_credentials(_kuzzle, const_cast(strategy.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - - json_object* Kuzzle::getMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { - json_result *r = kuzzle_get_my_credentials(_kuzzle, const_cast(strategy.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - json_object *ret = r->result; - kuzzle_free_json_result(r); - return ret; - } - - json_object* Kuzzle::updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options) Kuz_Throw_KuzzleException { - json_result *r = kuzzle_update_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - json_object *ret = r->result; - kuzzle_free_json_result(r); - return ret; - } - - bool Kuzzle::validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_validate_my_credentials(_kuzzle, const_cast(strategy.c_str()), credentials, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - bool Kuzzle::getAutoRefresh(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { bool_result *r = kuzzle_get_auto_refresh(_kuzzle, const_cast(index.c_str()), options); if (r->error != NULL) From c710c61b7cf37c9de52a9bff9418b7d839708a25 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 13 Mar 2018 17:33:14 +0100 Subject: [PATCH 057/363] add index controller to kuzzle class --- internal/wrappers/cgo/kuzzle/kuzzle.go | 5 +++++ internal/wrappers/cpp/index.cpp | 5 +++++ internal/wrappers/cpp/kuzzle.cpp | 3 +++ internal/wrappers/headers/index.hpp | 1 + internal/wrappers/headers/kuzzle.hpp | 3 +++ kuzzle/kuzzle.go | 4 ++++ 6 files changed, 21 insertions(+) diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index bc9514b5..239cbe58 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -65,6 +65,11 @@ func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) k.loader = nil } +//export kuzzle_get_index_controller +func kuzzle_get_index_controller(k *C.kuzzle) *C.kuzzle_index { + return (*C.kuzzle_index)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Index)) +} + // Allocates memory //export kuzzle_connect func kuzzle_connect(k *C.kuzzle) *C.char { diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index f500ae45..a4c392a4 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -9,6 +9,11 @@ namespace kuzzleio { kuzzle_new_index(_index, kuzzle->_kuzzle); } + Index::Index(Kuzzle* kuzzle, kuzzle_index *index) { + _index = index; + kuzzle_new_index(_index, kuzzle->_kuzzle); + } + Index::~Index() { unregisterIndex(_index); delete(_index); diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 99c8b95d..e7a8e12e 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -1,6 +1,7 @@ #include #include #include "kuzzle.hpp" +#include "index.hpp" #include #include @@ -15,12 +16,14 @@ namespace kuzzleio { Kuzzle::Kuzzle(const std::string& host, options *opts) { this->_kuzzle = new kuzzle(); + this->index = new Index(this, kuzzle_get_index_controller(_kuzzle)); kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); } Kuzzle::~Kuzzle() { unregisterKuzzle(this->_kuzzle); delete(this->_kuzzle); + delete(this->index); } token_validity* Kuzzle::checkToken(const std::string& token) { diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp index f682fde3..32393bcf 100644 --- a/internal/wrappers/headers/index.hpp +++ b/internal/wrappers/headers/index.hpp @@ -11,6 +11,7 @@ namespace kuzzleio { public: Index(Kuzzle* kuzzle); + Index(Kuzzle* kuzzle, kuzzle_index *index); virtual ~Index(); void create(const std::string& index) Kuz_Throw_KuzzleException; void delete_(const std::string& index) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 07e1e2aa..bcd3656a 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -12,12 +12,15 @@ namespace kuzzleio { + class Index; + class Kuzzle : public KuzzleEventEmitter { private: std::map _listener_instances; public: kuzzle *_kuzzle; + Index *index; Kuzzle(const std::string& host, options *options=NULL); virtual ~Kuzzle(); diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index f2ec83b6..6274cef2 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -5,6 +5,8 @@ import ( "sync" "time" + "github.com/kuzzleio/sdk-go/index" + "github.com/kuzzleio/sdk-go/connection" "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/ms" @@ -35,6 +37,7 @@ type Kuzzle struct { MemoryStorage *ms.Ms Security *security.Security Server *server.Server + Index *index.Index } // NewKuzzle is the Kuzzle constructor @@ -57,6 +60,7 @@ func NewKuzzle(c connection.Connection, options types.Options) (*Kuzzle, error) k.MemoryStorage = &ms.Ms{k} k.Security = &security.Security{k} k.Server = server.NewServer(k) + k.Index = index.NewIndex(k) var err error From ec5815ebcdc957f79b4bb41f00df71f5be6edff9 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 13 Mar 2018 17:50:26 +0100 Subject: [PATCH 058/363] add server controller to kuzzle class --- internal/wrappers/cgo/kuzzle/kuzzle.go | 5 +++++ internal/wrappers/cpp/kuzzle.cpp | 2 ++ internal/wrappers/cpp/server.cpp | 5 +++++ internal/wrappers/headers/kuzzle.hpp | 2 ++ internal/wrappers/headers/server.hpp | 1 + 5 files changed, 15 insertions(+) diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 239cbe58..73b55b96 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -70,6 +70,11 @@ func kuzzle_get_index_controller(k *C.kuzzle) *C.kuzzle_index { return (*C.kuzzle_index)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Index)) } +//export kuzzle_get_server_controller +func kuzzle_get_server_controller(k *C.kuzzle) *C.server { + return (*C.server)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Server)) +} + // Allocates memory //export kuzzle_connect func kuzzle_connect(k *C.kuzzle) *C.char { diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index e7a8e12e..a368ce20 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -2,6 +2,7 @@ #include #include "kuzzle.hpp" #include "index.hpp" +#include "server.hpp" #include #include @@ -17,6 +18,7 @@ namespace kuzzleio { Kuzzle::Kuzzle(const std::string& host, options *opts) { this->_kuzzle = new kuzzle(); this->index = new Index(this, kuzzle_get_index_controller(_kuzzle)); + this->server = new Server(this, kuzzle_get_server_controller(_kuzzle)); kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); } diff --git a/internal/wrappers/cpp/server.cpp b/internal/wrappers/cpp/server.cpp index c6b1f167..6f973bfb 100644 --- a/internal/wrappers/cpp/server.cpp +++ b/internal/wrappers/cpp/server.cpp @@ -6,6 +6,11 @@ namespace kuzzleio { kuzzle_new_server(_server, kuzzle->_kuzzle); } + Server::Server(Kuzzle* kuzzle, server *server) { + _server = server; + kuzzle_new_server(_server, kuzzle->_kuzzle); + } + Server::~Server() { unregisterServer(_server); delete(_server); diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index bcd3656a..244b6be1 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -13,6 +13,7 @@ namespace kuzzleio { class Index; + class Server; class Kuzzle : public KuzzleEventEmitter { private: @@ -21,6 +22,7 @@ namespace kuzzleio { public: kuzzle *_kuzzle; Index *index; + Server *server; Kuzzle(const std::string& host, options *options=NULL); virtual ~Kuzzle(); diff --git a/internal/wrappers/headers/server.hpp b/internal/wrappers/headers/server.hpp index f40b14b5..b7cad1de 100644 --- a/internal/wrappers/headers/server.hpp +++ b/internal/wrappers/headers/server.hpp @@ -11,6 +11,7 @@ namespace kuzzleio { public: Server(Kuzzle* kuzzle); + Server(Kuzzle *kuzzle, server *server); virtual ~Server(); bool adminExists(query_options *options) Kuz_Throw_KuzzleException; std::string getAllStats(query_options* options=NULL) Kuz_Throw_KuzzleException; From 068593bbbe2020eb5bb85ef19f29f59ad84e1984 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 13 Mar 2018 18:05:25 +0100 Subject: [PATCH 059/363] Add Collection controller to Kuzzle Object --- collection/collection.go | 6 +++--- internal/wrappers/cgo/kuzzle/kuzzle.go | 5 +++++ internal/wrappers/cpp/collection.cpp | 5 +++++ internal/wrappers/cpp/kuzzle.cpp | 3 +++ internal/wrappers/headers/collection.hpp | 1 + internal/wrappers/headers/kuzzle.hpp | 2 ++ kuzzle/kuzzle.go | 3 +++ 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/collection/collection.go b/collection/collection.go index d71b2ab6..d2d704db 100644 --- a/collection/collection.go +++ b/collection/collection.go @@ -1,16 +1,16 @@ package collection import ( - "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" ) //Collection controller type Collection struct { - Kuzzle *kuzzle.Kuzzle + Kuzzle types.IKuzzle } // NewCollection instanciates a new collection -func NewCollection(kuzzle *kuzzle.Kuzzle) *Collection { +func NewCollection(kuzzle types.IKuzzle) *Collection { return &Collection{ Kuzzle: kuzzle, } diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index bc9514b5..d5150314 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -65,6 +65,11 @@ func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) k.loader = nil } +//export kuzzle_get_collection_controller +func kuzzle_get_collection_controller(k *C.kuzzle) *C.collection { + return (*C.collection)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Collection)) +} + // Allocates memory //export kuzzle_connect func kuzzle_connect(k *C.kuzzle) *C.char { diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index be4566c1..27a94220 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -7,6 +7,11 @@ namespace kuzzleio { kuzzle_new_collection(_collection, kuzzle->_kuzzle); } + Collection::Collection(Kuzzle* kuzzle, collection *collection) { + _collection = collection; + kuzzle_new_collection(_collection, kuzzle->_kuzzle); + } + Collection::~Collection() { unregisterCollection(_collection); kuzzle_free_collection(_collection); diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 3db8b0ce..9c0c4fbd 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -1,6 +1,7 @@ #include #include #include "kuzzle.hpp" +#include "collection.hpp" #include #include @@ -15,12 +16,14 @@ namespace kuzzleio { Kuzzle::Kuzzle(const std::string& host, options *opts) { this->_kuzzle = new kuzzle(); + this->collection = new Collection(this, kuzzle_get_collection_controller(this->_kuzzle)); kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); } Kuzzle::~Kuzzle() { unregisterKuzzle(this->_kuzzle); delete(this->_kuzzle); + delete(this->collection); } token_validity* Kuzzle::checkToken(const std::string& token) { diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index 60e5e1c0..8ebd03d2 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -13,6 +13,7 @@ namespace kuzzleio { public: Collection(Kuzzle* kuzzle); + Collection(Kuzzle* kuzzle, collection *collection); virtual ~Collection(); void create(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; bool exists(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 2cc3debf..842fe72c 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -11,6 +11,7 @@ #include namespace kuzzleio { + class Collection; class Kuzzle : public KuzzleEventEmitter { private: @@ -18,6 +19,7 @@ namespace kuzzleio { public: kuzzle *_kuzzle; + Collection *collection; Kuzzle(const std::string& host, options *options=NULL); virtual ~Kuzzle(); diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index f2ec83b6..5b9a723e 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -5,6 +5,7 @@ import ( "sync" "time" + "github.com/kuzzleio/sdk-go/collection" "github.com/kuzzleio/sdk-go/connection" "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/ms" @@ -35,6 +36,7 @@ type Kuzzle struct { MemoryStorage *ms.Ms Security *security.Security Server *server.Server + Collection *collection.Collection } // NewKuzzle is the Kuzzle constructor @@ -57,6 +59,7 @@ func NewKuzzle(c connection.Connection, options types.Options) (*Kuzzle, error) k.MemoryStorage = &ms.Ms{k} k.Security = &security.Security{k} k.Server = server.NewServer(k) + k.Collection = collection.NewCollection(k) var err error From e4756166fa3fbb1964edb588fdbc5c1835f901ce Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 14 Mar 2018 09:54:26 +0100 Subject: [PATCH 060/363] added auth controller to kuzzle object --- internal/wrappers/cgo/kuzzle/kuzzle.go | 5 +++++ internal/wrappers/cpp/auth.cpp | 5 +++++ internal/wrappers/cpp/kuzzle.cpp | 3 +++ internal/wrappers/headers/auth.hpp | 1 + internal/wrappers/headers/kuzzle.hpp | 3 +++ 5 files changed, 17 insertions(+) diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index bc9514b5..78ae7553 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -65,6 +65,11 @@ func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) k.loader = nil } +//export kuzzle_get_auth_controller +func kuzzle_get_auth_controller(k *C.kuzzle) *C.auth { + return (*C.auth)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Auth)) +} + // Allocates memory //export kuzzle_connect func kuzzle_connect(k *C.kuzzle) *C.char { diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 542bbf0d..4ce46c4b 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -6,6 +6,11 @@ namespace kuzzleio { kuzzle_new_auth(_auth, kuzzle->_kuzzle); } + Auth::Auth(Kuzzle *kuzzle, auth *auth) { + _auth = auth; + kuzzle_new_auth(_auth, kuzzle->_kuzzle); + } + Auth::~Auth() { unregisterAuth(_auth); delete(_auth); diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 69c00b52..288d00c2 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -1,6 +1,7 @@ #include #include #include "kuzzle.hpp" +#include "auth.hpp" #include #include @@ -15,12 +16,14 @@ namespace kuzzleio { Kuzzle::Kuzzle(const std::string& host, options *opts) { this->_kuzzle = new kuzzle(); + this->auth = new Auth(this, kuzzle_get_auth_controller(_kuzzle)); kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); } Kuzzle::~Kuzzle() { unregisterKuzzle(this->_kuzzle); delete(this->_kuzzle); + delete(this->auth); } char* Kuzzle::connect() { diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index 697ad7df..fe09e6b2 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -11,6 +11,7 @@ namespace kuzzleio { public: Auth(Kuzzle *kuzzle); + Auth(Kuzzle *kuzzle, auth *auth); virtual ~Auth(); token_validity* checkToken(const std::string& token); std::string createMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 0bf9c9b7..1275f8c5 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -12,12 +12,15 @@ namespace kuzzleio { + class Auth; + class Kuzzle : public KuzzleEventEmitter { private: std::map _listener_instances; public: kuzzle *_kuzzle; + Auth *auth; Kuzzle(const std::string& host, options *options=NULL); virtual ~Kuzzle(); From 03832856e1bb0aa7756ec50b9719eb2d043728cd Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 14 Mar 2018 09:56:25 +0100 Subject: [PATCH 061/363] delete server ctrl cpp instance in kuzzle destructor --- internal/wrappers/cpp/kuzzle.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index a368ce20..1e9ddc69 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -26,6 +26,7 @@ namespace kuzzleio { unregisterKuzzle(this->_kuzzle); delete(this->_kuzzle); delete(this->index); + delete(this->server); } token_validity* Kuzzle::checkToken(const std::string& token) { From bfba8a8cdf11c48aa7ecdca91c125360659ceefb Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 14 Mar 2018 10:25:36 +0100 Subject: [PATCH 062/363] Add Document Controller to Kuzzle Object --- document/document.go | 6 +++--- internal/wrappers/cgo/kuzzle/kuzzle.go | 5 +++++ internal/wrappers/cpp/document.cpp | 5 +++++ internal/wrappers/cpp/kuzzle.cpp | 3 +++ internal/wrappers/headers/document.hpp | 1 + internal/wrappers/headers/kuzzle.hpp | 2 ++ kuzzle/kuzzle.go | 3 +++ 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/document/document.go b/document/document.go index 3f27b7f5..1a73f92b 100644 --- a/document/document.go +++ b/document/document.go @@ -1,14 +1,14 @@ package document import ( - "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" ) type Document struct { - Kuzzle *kuzzle.Kuzzle + Kuzzle types.IKuzzle } -func NewDocument(kuzzle *kuzzle.Kuzzle) *Document { +func NewDocument(kuzzle types.IKuzzle) *Document { return &Document{ Kuzzle: kuzzle, } diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index bc9514b5..3293fa9a 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -65,6 +65,11 @@ func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) k.loader = nil } +//export kuzzle_get_document_controller +func kuzzle_get_document_controller(k *C.kuzzle) *C.document { + return (*C.document)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Document)) +} + // Allocates memory //export kuzzle_connect func kuzzle_connect(k *C.kuzzle) *C.char { diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index bea75fa5..ccccd67f 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -7,6 +7,11 @@ namespace kuzzleio { kuzzle_new_document(_document, kuzzle->_kuzzle); } + Document::Document(Kuzzle* kuzzle, document *document) { + _document = document; + kuzzle_new_document(_document, kuzzle->_kuzzle); + } + Document::~Document() { unregisterDocument(_document); kuzzle_free_document(_document); diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 57536c50..440f5470 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -2,6 +2,7 @@ #include #include #include "kuzzle.hpp" +#include "document.hpp" #include #include @@ -16,12 +17,14 @@ namespace kuzzleio { Kuzzle::Kuzzle(const std::string& host, options *opts) { this->_kuzzle = new kuzzle(); + this->document = new Document(this, kuzzle_get_document_controller(this->_kuzzle)); kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); } Kuzzle::~Kuzzle() { unregisterKuzzle(this->_kuzzle); delete(this->_kuzzle); + delete(this->document); } token_validity* Kuzzle::checkToken(const std::string& token) { diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp index 6d7a613d..903a3cd8 100644 --- a/internal/wrappers/headers/document.hpp +++ b/internal/wrappers/headers/document.hpp @@ -12,6 +12,7 @@ namespace kuzzleio { public: Document(Kuzzle* kuzzle); + Document(Kuzzle* kuzzle, document *document); virtual ~Document(); int count_(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; bool exists(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 5c53cecb..ae5dfa38 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -11,6 +11,7 @@ #include namespace kuzzleio { + class Document; class Kuzzle : public KuzzleEventEmitter { private: @@ -18,6 +19,7 @@ namespace kuzzleio { public: kuzzle *_kuzzle; + Document *document; Kuzzle(const std::string& host, options *options=NULL); virtual ~Kuzzle(); diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index f2ec83b6..5d2d61fa 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -6,6 +6,7 @@ import ( "time" "github.com/kuzzleio/sdk-go/connection" + "github.com/kuzzleio/sdk-go/document" "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/ms" "github.com/kuzzleio/sdk-go/security" @@ -35,6 +36,7 @@ type Kuzzle struct { MemoryStorage *ms.Ms Security *security.Security Server *server.Server + Document *document.Document } // NewKuzzle is the Kuzzle constructor @@ -57,6 +59,7 @@ func NewKuzzle(c connection.Connection, options types.Options) (*Kuzzle, error) k.MemoryStorage = &ms.Ms{k} k.Security = &security.Security{k} k.Server = server.NewServer(k) + k.Document = document.NewDocument(k) var err error From 6968c88743d5c7ff863c5a944ddf773da0a9dc43 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 16 Mar 2018 16:06:36 +0100 Subject: [PATCH 063/363] Apply From & Size requested changes from scottinet --- types/search_result.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/search_result.go b/types/search_result.go index d463333e..55bb0865 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -41,9 +41,6 @@ func NewSearchResult(collection json.RawMessage, filters *SearchFilters, options if options != nil { sr.Options.SetFrom(options.From()) sr.Options.SetSize(options.Size()) - } else { - sr.Options.SetFrom(0) - sr.Options.SetSize(10) } return sr From 657c2cbfbe6f44a345793249cddd2f00e0ae51d7 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 16 Mar 2018 16:27:27 +0100 Subject: [PATCH 064/363] Apply getSpecifications return type change requested by scottinet --- collection/get_specifications.go | 15 ++++++------- collection/get_specifications_test.go | 26 ++++++++++++---------- internal/wrappers/cgo/kuzzle/collection.go | 4 +++- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/collection/get_specifications.go b/collection/get_specifications.go index f5f432a2..fe74d524 100644 --- a/collection/get_specifications.go +++ b/collection/get_specifications.go @@ -1,17 +1,19 @@ package collection import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // GetSpecifications retrieves the current specifications of the collection. -func (dc *Collection) GetSpecifications(index string, collection string) (string, error) { +func (dc *Collection) GetSpecifications(index string, collection string) (json.RawMessage, error) { if index == "" { - return "", types.NewError("Collection.GetSpecifications: index required", 400) + return nil, types.NewError("Collection.GetSpecifications: index required", 400) } if collection == "" { - return "", types.NewError("Collection.GetSpecifications: collection required", 400) + return nil, types.NewError("Collection.GetSpecifications: collection required", 400) } ch := make(chan *types.KuzzleResponse) @@ -27,11 +29,8 @@ func (dc *Collection) GetSpecifications(index string, collection string) (string res := <-ch if res.Error != nil { - return "", res.Error + return nil, res.Error } - var specifications string - specifications = string(res.Result) - - return specifications, nil + return res.Result, nil } diff --git a/collection/get_specifications_test.go b/collection/get_specifications_test.go index afd2efb6..3c955e57 100644 --- a/collection/get_specifications_test.go +++ b/collection/get_specifications_test.go @@ -51,18 +51,20 @@ func TestGetSpecifications(t *testing.T) { assert.Equal(t, "index", parsedQuery.Index) assert.Equal(t, "collection", parsedQuery.Collection) - res := types.KuzzleResponse{Result: []byte(`{ - "collection": "collection", - "index": "index", - "validation": { - "fields": { - "myField": { - "defaultValue": 42, - "mandatory": true, - "type": "integer" - } - }, - "strict": true + res := types.KuzzleResponse{Result: []byte(` + { + "collection": "collection", + "index": "index", + "validation": { + "fields": { + "myField": { + "defaultValue": 42, + "mandatory": true, + "type": "integer" + } + }, + "strict": true + } }`), } diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 42ebb594..69e85dcc 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -98,7 +98,9 @@ func kuzzle_collection_delete_specifications(c *C.collection, index *C.char, col //export kuzzle_collection_get_specifications func kuzzle_collection_get_specifications(c *C.collection, index *C.char, col *C.char) *C.string_result { res, err := (*collection.Collection)(c.instance).GetSpecifications(C.GoString(index), C.GoString(col)) - return goToCStringResult(&res, err) + var stringResult string + stringResult = string(res) + return goToCStringResult(&stringResult, err) } //export kuzzle_collection_search_specifications From 496bfcacb2d29d34d377da21a45fb17b848fa38c Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Mon, 19 Mar 2018 16:36:41 +0100 Subject: [PATCH 065/363] Apply requested changes by jenow --- collection/collection.go | 7 ---- collection/create.go | 4 +- collection/create_test.go | 10 ++--- collection/delete_specifications.go | 4 +- collection/delete_specifications_test.go | 10 ++--- collection/exists.go | 4 +- collection/exists_test.go | 10 ++--- collection/get_mapping.go | 4 +- collection/get_mapping_test.go | 10 ++--- collection/get_specifications.go | 4 +- collection/get_specifications_test.go | 10 ++--- collection/list.go | 9 +---- collection/list_test.go | 23 ++++------- collection/search_specifications.go | 14 +------ collection/search_specifications_test.go | 18 +++------ collection/truncate.go | 4 +- collection/truncate_test.go | 10 ++--- collection/update_mapping.go | 4 +- collection/update_mapping_test.go | 12 +++--- collection/update_specifications.go | 4 +- collection/update_specifications_test.go | 12 +++--- collection/validate_specifications.go | 4 +- collection/validate_specifications_test.go | 8 ++-- internal/wrappers/cgo/kuzzle/c_to_go.go | 31 --------------- internal/wrappers/cgo/kuzzle/collection.go | 44 +++++++++++----------- internal/wrappers/cpp/collection.cpp | 44 +++++++++++----------- internal/wrappers/headers/collection.hpp | 22 +++++------ internal/wrappers/headers/kuzzlesdk.h | 10 ----- types/consts.go | 7 ---- types/search_options.go | 29 -------------- 30 files changed, 136 insertions(+), 250 deletions(-) delete mode 100644 types/search_options.go diff --git a/collection/collection.go b/collection/collection.go index d2d704db..e277a477 100644 --- a/collection/collection.go +++ b/collection/collection.go @@ -15,10 +15,3 @@ func NewCollection(kuzzle types.IKuzzle) *Collection { Kuzzle: kuzzle, } } - -//ListOptions collection list options -type ListOptions struct { - Type string - From *int - Size *int -} diff --git a/collection/create.go b/collection/create.go index ad40b22f..d4f3df0c 100644 --- a/collection/create.go +++ b/collection/create.go @@ -5,7 +5,7 @@ import ( ) // Create creates a new empty data collection -func (dc *Collection) Create(index string, collection string) error { +func (dc *Collection) Create(index string, collection string, options types.QueryOptions) error { if index == "" { return types.NewError("Collection.Create: index required", 400) } @@ -22,7 +22,7 @@ func (dc *Collection) Create(index string, collection string) error { Controller: "collection", Action: "create", } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/create_test.go b/collection/create_test.go index 679550c7..90a5d463 100644 --- a/collection/create_test.go +++ b/collection/create_test.go @@ -14,14 +14,14 @@ import ( func TestCreateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.Create("", "collection") + err := nc.Create("", "collection", nil) assert.NotNil(t, err) } func TestCreateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.Create("index", "") + err := nc.Create("index", "", nil) assert.NotNil(t, err) } @@ -34,7 +34,7 @@ func TestCreateError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Create("index", "collection") + err := nc.Create("index", "collection", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -50,7 +50,7 @@ func TestCreate(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Create("index", "collection") + err := nc.Create("index", "collection", nil) assert.Nil(t, err) } @@ -59,7 +59,7 @@ func ExampleCollection_Create() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Create("index", "collection") + err := nc.Create("index", "collection", nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/delete_specifications.go b/collection/delete_specifications.go index 78cb5304..9f828960 100644 --- a/collection/delete_specifications.go +++ b/collection/delete_specifications.go @@ -3,7 +3,7 @@ package collection import "github.com/kuzzleio/sdk-go/types" // DeleteSpecifications deletes the current specifications of this collection. -func (dc *Collection) DeleteSpecifications(index string, collection string) error { +func (dc *Collection) DeleteSpecifications(index string, collection string, options types.QueryOptions) error { if index == "" { return types.NewError("Collection.DeleteSpecifications: index required", 400) } @@ -20,7 +20,7 @@ func (dc *Collection) DeleteSpecifications(index string, collection string) erro Controller: "collection", Action: "deleteSpecifications", } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/delete_specifications_test.go b/collection/delete_specifications_test.go index 3a26d9a5..08872e98 100644 --- a/collection/delete_specifications_test.go +++ b/collection/delete_specifications_test.go @@ -14,14 +14,14 @@ import ( func TestDeleteSpecificationsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.DeleteSpecifications("", "collection") + err := nc.DeleteSpecifications("", "collection", nil) assert.NotNil(t, err) } func TestDeleteSpecificationsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.DeleteSpecifications("index", "") + err := nc.DeleteSpecifications("index", "", nil) assert.NotNil(t, err) } @@ -34,7 +34,7 @@ func TestDeleteSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.DeleteSpecifications("index", "collection") + err := nc.DeleteSpecifications("index", "collection", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -50,7 +50,7 @@ func TestDeleteSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.DeleteSpecifications("index", "collection") + err := nc.DeleteSpecifications("index", "collection", nil) assert.Nil(t, err) } @@ -59,7 +59,7 @@ func ExampleCollection_DeleteSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.DeleteSpecifications("index", "collection") + err := nc.DeleteSpecifications("index", "collection", nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/exists.go b/collection/exists.go index 6a174c39..08803e6e 100644 --- a/collection/exists.go +++ b/collection/exists.go @@ -8,7 +8,7 @@ import ( ) // Exists check if a collection exists. -func (dc *Collection) Exists(index string, collection string) (bool, error) { +func (dc *Collection) Exists(index string, collection string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Collection.Exists: index required", 400) } @@ -25,7 +25,7 @@ func (dc *Collection) Exists(index string, collection string) (bool, error) { Controller: "collection", Action: "exists", } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/exists_test.go b/collection/exists_test.go index 60419dc6..6f30c562 100644 --- a/collection/exists_test.go +++ b/collection/exists_test.go @@ -14,14 +14,14 @@ import ( func TestExistsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.Exists("", "collection") + _, err := nc.Exists("", "collection", nil) assert.NotNil(t, err) } func TestExistsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.Exists("index", "") + _, err := nc.Exists("index", "", nil) assert.NotNil(t, err) } @@ -34,7 +34,7 @@ func TestExistsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.Exists("index", "collection") + _, err := nc.Exists("index", "collection", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -48,7 +48,7 @@ func TestExists(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.Exists("index", "collection") + res, err := nc.Exists("index", "collection", nil) assert.Nil(t, err) assert.Equal(t, true, res) } @@ -58,7 +58,7 @@ func ExampleCollection_Exists() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.Exists("index", "collection") + _, err := nc.Exists("index", "collection", nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/get_mapping.go b/collection/get_mapping.go index a7538af6..14254caa 100644 --- a/collection/get_mapping.go +++ b/collection/get_mapping.go @@ -7,7 +7,7 @@ import ( ) // GetMapping retrieves the current mapping of the collection. -func (dc *Collection) GetMapping(index string, collection string) (json.RawMessage, error) { +func (dc *Collection) GetMapping(index string, collection string, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Collection.GetMapping: index required", 400) } @@ -24,7 +24,7 @@ func (dc *Collection) GetMapping(index string, collection string) (json.RawMessa Controller: "collection", Action: "getMapping", } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/get_mapping_test.go b/collection/get_mapping_test.go index d2db05c8..ad707209 100644 --- a/collection/get_mapping_test.go +++ b/collection/get_mapping_test.go @@ -15,14 +15,14 @@ import ( func TestGetMappingIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.GetMapping("", "collection") + _, err := nc.GetMapping("", "collection", nil) assert.NotNil(t, err) } func TestGetMappingCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.GetMapping("index", "") + _, err := nc.GetMapping("index", "", nil) assert.NotNil(t, err) } @@ -35,7 +35,7 @@ func TestGetMappingError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.GetMapping("index", "collection") + _, err := nc.GetMapping("index", "collection", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -75,7 +75,7 @@ func TestGetMapping(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.GetMapping("index", "collection") + res, err := nc.GetMapping("index", "collection", nil) assert.Nil(t, err) assert.NotNil(t, res) } @@ -85,7 +85,7 @@ func ExampleCollection_GetMapping() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.GetMapping("index", "collection") + res, err := nc.GetMapping("index", "collection", nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/get_specifications.go b/collection/get_specifications.go index fe74d524..570a0c2a 100644 --- a/collection/get_specifications.go +++ b/collection/get_specifications.go @@ -7,7 +7,7 @@ import ( ) // GetSpecifications retrieves the current specifications of the collection. -func (dc *Collection) GetSpecifications(index string, collection string) (json.RawMessage, error) { +func (dc *Collection) GetSpecifications(index string, collection string, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Collection.GetSpecifications: index required", 400) } @@ -24,7 +24,7 @@ func (dc *Collection) GetSpecifications(index string, collection string) (json.R Controller: "collection", Action: "getSpecifications", } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/get_specifications_test.go b/collection/get_specifications_test.go index 3c955e57..b6f14989 100644 --- a/collection/get_specifications_test.go +++ b/collection/get_specifications_test.go @@ -15,14 +15,14 @@ import ( func TestGetSpecificationsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.GetSpecifications("", "collection") + _, err := nc.GetSpecifications("", "collection", nil) assert.NotNil(t, err) } func TestGetSpecificationsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.GetSpecifications("index", "") + _, err := nc.GetSpecifications("index", "", nil) assert.NotNil(t, err) } @@ -35,7 +35,7 @@ func TestGetSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.GetSpecifications("index", "collection") + _, err := nc.GetSpecifications("index", "collection", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -75,7 +75,7 @@ func TestGetSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.GetSpecifications("index", "collection") + res, err := nc.GetSpecifications("index", "collection", nil) assert.Nil(t, err) assert.NotNil(t, res) } @@ -85,7 +85,7 @@ func ExampleCollection_GetSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.GetSpecifications("index", "collection") + res, err := nc.GetSpecifications("index", "collection", nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/list.go b/collection/list.go index 0cb5790a..cd17357b 100644 --- a/collection/list.go +++ b/collection/list.go @@ -7,7 +7,7 @@ import ( ) // List retrieves the list of known data collections contained in a specified index. -func (dc *Collection) List(index string, options *ListOptions) (json.RawMessage, error) { +func (dc *Collection) List(index string, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Collection.List: index required", 400) } @@ -18,14 +18,9 @@ func (dc *Collection) List(index string, options *ListOptions) (json.RawMessage, Controller: "collection", Action: "list", Index: index, - Body: options.Type, } - queryOpts := types.NewQueryOptions() - queryOpts.SetFrom(*options.From) - queryOpts.SetSize(*options.Size) - - go dc.Kuzzle.Query(query, queryOpts, result) + go dc.Kuzzle.Query(query, options, result) res := <-result diff --git a/collection/list_test.go b/collection/list_test.go index 6e176a16..395cfcd5 100644 --- a/collection/list_test.go +++ b/collection/list_test.go @@ -15,10 +15,8 @@ import ( func TestListIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - from := 0 - size := 1 - lo := collection.ListOptions{Type: "stored", From: &from, Size: &size} - _, err := nc.List("", &lo) + + _, err := nc.List("", nil) assert.NotNil(t, err) } @@ -31,10 +29,8 @@ func TestListError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - from := 0 - size := 1 - lo := collection.ListOptions{Type: "stored", From: &from, Size: &size} - _, err := nc.List("index", &lo) + + _, err := nc.List("index", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -67,10 +63,8 @@ func TestList(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - from := 0 - size := 1 - lo := collection.ListOptions{Type: "stored", From: &from, Size: &size} - res, err := nc.List("index", &lo) + + res, err := nc.List("index", nil) assert.Nil(t, err) assert.NotNil(t, res) } @@ -81,10 +75,7 @@ func ExampleCollection_List() { nc := collection.NewCollection(k) - from := 0 - size := 1 - lo := collection.ListOptions{Type: "stored", From: &from, Size: &size} - res, err := nc.List("index", &lo) + res, err := nc.List("index", nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/search_specifications.go b/collection/search_specifications.go index e1ad3f00..06fcc59d 100644 --- a/collection/search_specifications.go +++ b/collection/search_specifications.go @@ -7,25 +7,15 @@ import ( ) // SearchSpecifications searches specifications across indexes/collections according to the provided filters. -func (dc *Collection) SearchSpecifications(options *types.SearchOptions) (*types.SearchResult, error) { +func (dc *Collection) SearchSpecifications(options types.QueryOptions) (*types.SearchResult, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ Controller: "collection", Action: "searchSpecifications", - Body: options.Type, } - if options != nil { - query.From = *options.From - query.Size = *options.Size - scroll := options.Scroll - if scroll != "" { - query.Scroll = scroll - } - } - - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go index e46f3603..f459cb13 100644 --- a/collection/search_specifications_test.go +++ b/collection/search_specifications_test.go @@ -21,10 +21,8 @@ func TestSearchSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - so := types.SearchOptions{Type: "all", Scroll: "1m"} - so.SetFrom(0) - so.SetSize(4) - _, err := nc.SearchSpecifications(&so) + + _, err := nc.SearchSpecifications(nil) assert.NotNil(t, err) } @@ -66,10 +64,8 @@ func TestSearchSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - so := types.SearchOptions{Type: "all", Scroll: "1m"} - so.SetFrom(0) - so.SetSize(4) - res, err := nc.SearchSpecifications(&so) + + res, err := nc.SearchSpecifications(nil) assert.Equal(t, 1, res.Total) assert.Nil(t, err) } @@ -79,10 +75,8 @@ func ExampleCollection_SearchSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - so := types.SearchOptions{Type: "all", Scroll: "1m"} - so.SetFrom(0) - so.SetSize(4) - res, err := nc.SearchSpecifications(&so) + + res, err := nc.SearchSpecifications(nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/truncate.go b/collection/truncate.go index 830c758c..dcaa0a4a 100644 --- a/collection/truncate.go +++ b/collection/truncate.go @@ -5,7 +5,7 @@ import ( ) // Truncate delete every Documents from the provided Collection. -func (dc *Collection) Truncate(index string, collection string) error { +func (dc *Collection) Truncate(index string, collection string, options types.QueryOptions) error { if index == "" { return types.NewError("Collection.Truncate: index required", 400) } @@ -22,7 +22,7 @@ func (dc *Collection) Truncate(index string, collection string) error { Controller: "collection", Action: "truncate", } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/truncate_test.go b/collection/truncate_test.go index 28f20b22..38537e0b 100644 --- a/collection/truncate_test.go +++ b/collection/truncate_test.go @@ -16,14 +16,14 @@ import ( func TestTruncateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.Truncate("", "collection") + err := nc.Truncate("", "collection", nil) assert.NotNil(t, err) } func TestTruncateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.Truncate("index", "") + err := nc.Truncate("index", "", nil) assert.NotNil(t, err) } @@ -36,7 +36,7 @@ func TestTruncateError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Truncate("index", "collection") + err := nc.Truncate("index", "collection", nil) assert.NotNil(t, err) } @@ -51,7 +51,7 @@ func TestTruncate(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Truncate("index", "collection") + err := nc.Truncate("index", "collection", nil) assert.Nil(t, err) } @@ -60,7 +60,7 @@ func ExampleCollection_Truncate() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.Truncate("index", "collection") + err := nc.Truncate("index", "collection", nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/update_mapping.go b/collection/update_mapping.go index cd2f8491..c28271a9 100644 --- a/collection/update_mapping.go +++ b/collection/update_mapping.go @@ -7,7 +7,7 @@ import ( ) // UpdateMapping updates the current mapping of this collection. -func (dc *Collection) UpdateMapping(index string, collection string, body json.RawMessage) error { +func (dc *Collection) UpdateMapping(index string, collection string, body json.RawMessage, options types.QueryOptions) error { if index == "" { return types.NewError("Collection.UpdateMapping: index required", 400) } @@ -29,7 +29,7 @@ func (dc *Collection) UpdateMapping(index string, collection string, body json.R Action: "updateMapping", Body: body, } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index d5fe5810..fba6706c 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -17,21 +17,21 @@ import ( func TestUpdateMappingIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("", "collection", json.RawMessage("body")) + err := nc.UpdateMapping("", "collection", json.RawMessage("body"), nil) assert.NotNil(t, err) } func TestUpdateMappingCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "", json.RawMessage("body")) + err := nc.UpdateMapping("index", "", json.RawMessage("body"), nil) assert.NotNil(t, err) } func TestUpdateMappingBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", nil) + err := nc.UpdateMapping("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -44,7 +44,7 @@ func TestUpdateMappingError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body")) + err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) assert.NotNil(t, err) } @@ -57,7 +57,7 @@ func TestUpdateMapping(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body")) + err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) assert.Nil(t, err) } @@ -66,7 +66,7 @@ func ExampleCollection_UpdateMapping() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body")) + err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/update_specifications.go b/collection/update_specifications.go index fec10295..aa3e32f1 100644 --- a/collection/update_specifications.go +++ b/collection/update_specifications.go @@ -7,7 +7,7 @@ import ( ) // UpdateSpecifications updates the current specifications of this collection. -func (dc *Collection) UpdateSpecifications(index string, collection string, body json.RawMessage) (json.RawMessage, error) { +func (dc *Collection) UpdateSpecifications(index string, collection string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Collection.UpdateSpecifications: index required", 400) } @@ -29,7 +29,7 @@ func (dc *Collection) UpdateSpecifications(index string, collection string, body Action: "updateSpecifications", Body: body, } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go index 3eee24c8..74e1e3ef 100644 --- a/collection/update_specifications_test.go +++ b/collection/update_specifications_test.go @@ -15,21 +15,21 @@ import ( func TestUpdateSpecificationsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("", "collection", json.RawMessage("body")) + _, err := nc.UpdateSpecifications("", "collection", json.RawMessage("body"), nil) assert.NotNil(t, err) } func TestUpdateSpecificationsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "", json.RawMessage("body")) + _, err := nc.UpdateSpecifications("index", "", json.RawMessage("body"), nil) assert.NotNil(t, err) } func TestUpdateSpecificationsBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", nil) + _, err := nc.UpdateSpecifications("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -42,7 +42,7 @@ func TestUpdateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body")) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) assert.NotNil(t, err) } @@ -55,7 +55,7 @@ func TestUpdateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body")) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) assert.Nil(t, err) } @@ -64,7 +64,7 @@ func ExampleCollection_UpdateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body")) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go index c4322ea7..317f2014 100644 --- a/collection/validate_specifications.go +++ b/collection/validate_specifications.go @@ -8,7 +8,7 @@ import ( ) // ValidateSpecifications validates the provided specifications. -func (dc *Collection) ValidateSpecifications(body json.RawMessage) (bool, error) { +func (dc *Collection) ValidateSpecifications(body json.RawMessage, options types.QueryOptions) (bool, error) { if body == nil { return false, types.NewError("Collection.ValidateSpecifications: body required", 400) } @@ -20,7 +20,7 @@ func (dc *Collection) ValidateSpecifications(body json.RawMessage) (bool, error) Action: "validateSpecifications", Body: body, } - go dc.Kuzzle.Query(query, nil, ch) + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index 8f7c5e4b..f55c1cba 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -17,7 +17,7 @@ import ( func TestValidateSpecificationsBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications(nil) + _, err := nc.ValidateSpecifications(nil, nil) assert.NotNil(t, err) } @@ -30,7 +30,7 @@ func TestValidateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications(json.RawMessage("body")) + _, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) assert.NotNil(t, err) } @@ -48,7 +48,7 @@ func TestValidateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.ValidateSpecifications(json.RawMessage("body")) + res, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) assert.Nil(t, err) assert.NotNil(t, res) assert.Equal(t, true, res) @@ -59,7 +59,7 @@ func ExampleCollection_ValidateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.ValidateSpecifications(json.RawMessage("body")) + res, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) if err != nil { fmt.Println(err.Error()) diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 6e20ebd6..4082233c 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -247,34 +247,3 @@ func cToGoSearchResult(s *C.search_result) *types.SearchResult { Filters: cToGoSearchFilters(s.filters), } } - -func cToGoSearchOptions(s *C.search_options) *types.SearchOptions { - from := int(s.from) - size := int(s.size) - return &types.SearchOptions{ - Type: C.GoString(s.type_), - From: &from, - Size: &size, - Scroll: C.GoString(s.scroll), - } -} - -func cToGoCollectionListOptions(clo *C.collection_list_options) *collection.ListOptions { - var t string - - if clo.type_ == C.ALL { - t = "all" - } else if clo.type_ == C.STORED { - t = "stored" - } else if clo.type_ == C.REALTIME { - t = "realtime" - } - from := int(clo.from) - size := int(clo.size) - - return &collection.ListOptions{ - Type: t, - From: &from, - Size: &size, - } -} diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 69e85dcc..014766a5 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -45,26 +45,26 @@ func kuzzle_new_collection(c *C.collection, k *C.kuzzle) { } //export kuzzle_collection_create -func kuzzle_collection_create(c *C.collection, index *C.char, col *C.char) *C.void_result { - err := (*collection.Collection)(c.instance).Create(C.GoString(index), C.GoString(col)) +func kuzzle_collection_create(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.void_result { + err := (*collection.Collection)(c.instance).Create(C.GoString(index), C.GoString(col), SetQueryOptions(options)) return goToCVoidResult(err) } //export kuzzle_collection_truncate -func kuzzle_collection_truncate(c *C.collection, index *C.char, col *C.char) *C.void_result { - err := (*collection.Collection)(c.instance).Truncate(C.GoString(index), C.GoString(col)) +func kuzzle_collection_truncate(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.void_result { + err := (*collection.Collection)(c.instance).Truncate(C.GoString(index), C.GoString(col), SetQueryOptions(options)) return goToCVoidResult(err) } //export kuzzle_collection_exists -func kuzzle_collection_exists(c *C.collection, index *C.char, col *C.char) *C.bool_result { - res, err := (*collection.Collection)(c.instance).Exists(C.GoString(index), C.GoString(col)) +func kuzzle_collection_exists(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.bool_result { + res, err := (*collection.Collection)(c.instance).Exists(C.GoString(index), C.GoString(col), SetQueryOptions(options)) return goToCBoolResult(res, err) } //export kuzzle_collection_list -func kuzzle_collection_list(c *C.collection, index *C.char, clo *C.collection_list_options) *C.string_result { - res, err := (*collection.Collection)(c.instance).List(C.GoString(index), cToGoCollectionListOptions(clo)) +func kuzzle_collection_list(c *C.collection, index *C.char, options *C.query_options) *C.string_result { + res, err := (*collection.Collection)(c.instance).List(C.GoString(index), SetQueryOptions(options)) var stringResult string json.Unmarshal(res, &stringResult) return goToCStringResult(&stringResult, err) @@ -73,54 +73,54 @@ func kuzzle_collection_list(c *C.collection, index *C.char, clo *C.collection_li // Mapping //export kuzzle_collection_get_mapping -func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char) *C.string_result { - res, err := (*collection.Collection)(c.instance).GetMapping(C.GoString(index), C.GoString(col)) +func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.string_result { + res, err := (*collection.Collection)(c.instance).GetMapping(C.GoString(index), C.GoString(col), SetQueryOptions(options)) var stringResult string stringResult = string(res) return goToCStringResult(&stringResult, err) } //export kuzzle_collection_update_mapping -func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char) *C.void_result { +func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.void_result { newBody, _ := json.Marshal(body) - err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), newBody) + err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), newBody, SetQueryOptions(options)) return goToCVoidResult(err) } // Specifications //export kuzzle_collection_delete_specifications -func kuzzle_collection_delete_specifications(c *C.collection, index *C.char, col *C.char) *C.void_result { - err := (*collection.Collection)(c.instance).DeleteSpecifications(C.GoString(index), C.GoString(col)) +func kuzzle_collection_delete_specifications(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.void_result { + err := (*collection.Collection)(c.instance).DeleteSpecifications(C.GoString(index), C.GoString(col), SetQueryOptions(options)) return goToCVoidResult(err) } //export kuzzle_collection_get_specifications -func kuzzle_collection_get_specifications(c *C.collection, index *C.char, col *C.char) *C.string_result { - res, err := (*collection.Collection)(c.instance).GetSpecifications(C.GoString(index), C.GoString(col)) +func kuzzle_collection_get_specifications(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.string_result { + res, err := (*collection.Collection)(c.instance).GetSpecifications(C.GoString(index), C.GoString(col), SetQueryOptions(options)) var stringResult string stringResult = string(res) return goToCStringResult(&stringResult, err) } //export kuzzle_collection_search_specifications -func kuzzle_collection_search_specifications(c *C.collection, searchOptions *C.search_options) *C.search_result { - res, err := (*collection.Collection)(c.instance).SearchSpecifications(cToGoSearchOptions(searchOptions)) +func kuzzle_collection_search_specifications(c *C.collection, options *C.query_options) *C.search_result { + res, err := (*collection.Collection)(c.instance).SearchSpecifications(SetQueryOptions(options)) return goToCSearchResult(res, err) } //export kuzzle_collection_update_specifications -func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col *C.char, body *C.char) *C.string_result { +func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.string_result { newBody, _ := json.Marshal(body) - res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), newBody) + res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), newBody, SetQueryOptions(options)) var stringResult string stringResult = string(res) return goToCStringResult(&stringResult, err) } //export kuzzle_collection_validate_specifications -func kuzzle_collection_validate_specifications(c *C.collection, body *C.char) *C.bool_result { +func kuzzle_collection_validate_specifications(c *C.collection, body *C.char, options *C.query_options) *C.bool_result { newBody, _ := json.Marshal(body) - res, err := (*collection.Collection)(c.instance).ValidateSpecifications(newBody) + res, err := (*collection.Collection)(c.instance).ValidateSpecifications(newBody, SetQueryOptions(options)) return goToCBoolResult(res, err) } diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 27a94220..05846d05 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -17,15 +17,15 @@ namespace kuzzleio { kuzzle_free_collection(_collection); } - void Collection::create(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_create(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + void Collection::create(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_create(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } - bool Collection::exists(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_collection_exists(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + bool Collection::exists(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_collection_exists(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -34,8 +34,8 @@ namespace kuzzleio { return ret; } - std::string Collection::list(const std::string& index, collection_list_options *collectionListOptions) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_collection_list(_collection, const_cast(index.c_str()), collectionListOptions); + std::string Collection::list(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_list(_collection, const_cast(index.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -44,16 +44,16 @@ namespace kuzzleio { return ret; } - void Collection::truncate(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + void Collection::truncate(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } - std::string Collection::getMapping(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_collection_get_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + std::string Collection::getMapping(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_get_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -63,16 +63,16 @@ namespace kuzzleio { return ret; } - void Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + void Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } - std::string Collection::getSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_collection_get_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + std::string Collection::getSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_get_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -82,8 +82,8 @@ namespace kuzzleio { return ret; } - search_result* Collection::searchSpecifications(search_options *searchOptions) Kuz_Throw_KuzzleException { - search_result *r = kuzzle_collection_search_specifications(_collection, searchOptions); + search_result* Collection::searchSpecifications(query_options *options) Kuz_Throw_KuzzleException { + search_result *r = kuzzle_collection_search_specifications(_collection, options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -93,8 +93,8 @@ namespace kuzzleio { return ret; } - std::string Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_collection_update_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + std::string Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_collection_update_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); std::string ret = r->result; @@ -103,8 +103,8 @@ namespace kuzzleio { return ret; } - bool Collection::validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str())); + bool Collection::validateSpecifications(const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -114,8 +114,8 @@ namespace kuzzleio { return ret; } - void Collection::deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str())); + void Collection::deleteSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index 8ebd03d2..fedd3902 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -15,17 +15,17 @@ namespace kuzzleio { Collection(Kuzzle* kuzzle); Collection(Kuzzle* kuzzle, collection *collection); virtual ~Collection(); - void create(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; - bool exists(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; - std::string list(const std::string& index, collection_list_options *collectionListOptions) Kuz_Throw_KuzzleException; - void truncate(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; - std::string getMapping(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; - void updateMapping(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; - std::string getSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; - search_result* searchSpecifications(search_options *searchOptions) Kuz_Throw_KuzzleException; - std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; - bool validateSpecifications(const std::string& body) Kuz_Throw_KuzzleException; - void deleteSpecifications(const std::string& index, const std::string& collection) Kuz_Throw_KuzzleException; + void create(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; + std::string list(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; + void truncate(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; + std::string getMapping(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; + void updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::string getSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; + search_result* searchSpecifications(query_options *options) Kuz_Throw_KuzzleException; + std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + bool validateSpecifications(const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + void deleteSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 29df41ef..532f70db 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -93,16 +93,6 @@ typedef struct { kuzzle_offline_queue_loader loader; } kuzzle; -typedef struct { - enum { - ALL, - STORED, - REALTIME - } type_; - int from; - int size; -} collection_list_options; - typedef struct { char *type_; int from; diff --git a/types/consts.go b/types/consts.go index 87c7611b..eed0bb84 100644 --- a/types/consts.go +++ b/types/consts.go @@ -23,10 +23,3 @@ const ( USERS_OUT = "out" USERS_NONE = "none" ) - -// user notifications constants -const ( - TYPE_ALL = "all" - TYPE_STORED = "stored" - TYPE_REALTIME = "realtime" -) diff --git a/types/search_options.go b/types/search_options.go deleted file mode 100644 index fb54e2cd..00000000 --- a/types/search_options.go +++ /dev/null @@ -1,29 +0,0 @@ -package types - -// SearchOptions options for search functions -type SearchOptions struct { - Type string - From *int - Size *int - Scroll string -} - -//SetType Type setter -func (so *SearchOptions) SetType(nt string) { - so.Type = nt -} - -//SetFrom From setter -func (so *SearchOptions) SetFrom(nf int) { - so.From = &nf -} - -//SetSize Size setter -func (so *SearchOptions) SetSize(ns int) { - so.Size = &ns -} - -//SetScroll Scroll setter -func (so *SearchOptions) SetScroll(ns string) { - so.Scroll = ns -} From 16f7e43688b71aa48ae406a176363fcbc9cc2611 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Mon, 19 Mar 2018 15:51:27 +0100 Subject: [PATCH 066/363] Apply requested changes by jenow --- document/count.go | 4 +- document/count_test.go | 10 ++-- document/create.go | 11 +--- document/createOrReplace.go | 11 +--- document/createOrReplace_test.go | 18 +++---- document/create_test.go | 18 +++---- document/delete.go | 11 +--- document/deleteByQuery.go | 11 +--- document/deleteByQuery_test.go | 20 +++---- document/delete_test.go | 15 ++---- document/document.go | 7 +-- document/exists.go | 4 +- document/exists_test.go | 10 ++-- document/get.go | 4 +- document/get_test.go | 10 ++-- document/mCreate.go | 11 +--- document/mCreateOrReplace.go | 11 +--- document/mCreateOrReplace_test.go | 20 +++---- document/mCreate_test.go | 20 +++---- document/mDelete.go | 11 +--- document/mDelete_test.go | 20 +++---- document/mGet.go | 4 +- document/mGet_test.go | 10 ++-- document/mReplace.go | 11 +--- document/mReplace_test.go | 20 +++---- document/mUpdate.go | 11 +--- document/mUpdate_test.go | 20 +++---- document/replace.go | 11 +--- document/replace_test.go | 24 ++++----- document/search.go | 13 +---- document/search_test.go | 30 ++++------- document/update.go | 11 +--- document/update_test.go | 24 ++++----- document/validate.go | 5 +- document/validate_test.go | 10 ++-- internal/wrappers/cgo/kuzzle/c_to_go.go | 8 --- internal/wrappers/cgo/kuzzle/document.go | 68 ++++++++++++------------ internal/wrappers/cpp/document.cpp | 68 ++++++++++++------------ internal/wrappers/headers/document.hpp | 34 ++++++------ internal/wrappers/headers/kuzzlesdk.h | 5 -- 40 files changed, 258 insertions(+), 386 deletions(-) diff --git a/document/count.go b/document/count.go index ee1fbbe4..dca69fac 100644 --- a/document/count.go +++ b/document/count.go @@ -7,7 +7,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) Count(index string, collection string, body string) (int, error) { +func (d *Document) Count(index string, collection string, body string, options types.QueryOptions) (int, error) { if index == "" { return 0, types.NewError("Document.Count: index required", 400) } @@ -29,7 +29,7 @@ func (d *Document) Count(index string, collection string, body string) (int, err Action: "count", Body: body, } - go d.Kuzzle.Query(query, nil, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/count_test.go b/document/count_test.go index 5fd55c1f..df7dc309 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -14,21 +14,21 @@ import ( func TestCountIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("", "collection", "body") + _, err := d.Count("", "collection", "body", nil) assert.NotNil(t, err) } func TestCountCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("index", "", "body") + _, err := d.Count("index", "", "body", nil) assert.NotNil(t, err) } func TestCountBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("index", "collection", "") + _, err := d.Count("index", "collection", "", nil) assert.NotNil(t, err) } @@ -40,7 +40,7 @@ func TestCountDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Count("index", "collection", "body") + _, err := d.Count("index", "collection", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -61,7 +61,7 @@ func TestCountDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - res, err := d.Count("index", "collection", "body") + res, err := d.Count("index", "collection", "body", nil) assert.Nil(t, err) assert.Equal(t, 1, res) } diff --git a/document/create.go b/document/create.go index 4be08653..f58fd96f 100644 --- a/document/create.go +++ b/document/create.go @@ -2,12 +2,11 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) Create(index string, collection string, _id string, body string, options *DocumentOptions) (string, error) { +func (d *Document) Create(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Create: index required", 400) } @@ -35,13 +34,7 @@ func (d *Document) Create(index string, collection string, _id string, body stri Body: body, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/createOrReplace.go b/document/createOrReplace.go index add0089f..6ff0a514 100644 --- a/document/createOrReplace.go +++ b/document/createOrReplace.go @@ -2,12 +2,11 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) CreateOrReplace(index string, collection string, _id string, body string, options *DocumentOptions) (string, error) { +func (d *Document) CreateOrReplace(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.CreateOrReplace: index required", 400) } @@ -35,13 +34,7 @@ func (d *Document) CreateOrReplace(index string, collection string, _id string, Body: body, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go index 1f3a94c6..448578cc 100644 --- a/document/createOrReplace_test.go +++ b/document/createOrReplace_test.go @@ -14,32 +14,28 @@ import ( func TestCreateOrReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.CreateOrReplace("", "collection", "id1", "body", opts) + _, err := d.CreateOrReplace("", "collection", "id1", "body", nil) assert.NotNil(t, err) } func TestCreateOrReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.CreateOrReplace("index", "", "id1", "body", opts) + _, err := d.CreateOrReplace("index", "", "id1", "body", nil) assert.NotNil(t, err) } func TestCreateOrReplaceIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.CreateOrReplace("index", "collection", "", "body", opts) + _, err := d.CreateOrReplace("index", "collection", "", "body", nil) assert.NotNil(t, err) } func TestCreateOrReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.CreateOrReplace("index", "collection", "id1", "", opts) + _, err := d.CreateOrReplace("index", "collection", "id1", "", nil) assert.NotNil(t, err) } @@ -51,8 +47,7 @@ func TestCreateOrReplaceDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.CreateOrReplace("index", "collection", "id1", "body", opts) + _, err := d.CreateOrReplace("index", "collection", "id1", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -81,7 +76,6 @@ func TestCreateOrReplaceDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.CreateOrReplace("index", "collection", id, "body", opts) + _, err := d.CreateOrReplace("index", "collection", id, "body", nil) assert.Nil(t, err) } diff --git a/document/create_test.go b/document/create_test.go index 073c7f33..dc1f6d12 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -14,32 +14,28 @@ import ( func TestCreateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Create("", "collection", "id1", "body", opts) + _, err := d.Create("", "collection", "id1", "body", nil) assert.NotNil(t, err) } func TestCreateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Create("index", "", "id1", "body", opts) + _, err := d.Create("index", "", "id1", "body", nil) assert.NotNil(t, err) } func TestCreateIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Create("index", "collection", "", "body", opts) + _, err := d.Create("index", "collection", "", "body", nil) assert.NotNil(t, err) } func TestCreateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Create("index", "collection", "id1", "", opts) + _, err := d.Create("index", "collection", "id1", "", nil) assert.NotNil(t, err) } @@ -51,8 +47,7 @@ func TestCreateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Create("index", "collection", "id1", "body", opts) + _, err := d.Create("index", "collection", "id1", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -81,7 +76,6 @@ func TestCreateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Create("index", "collection", id, "body", opts) + _, err := d.Create("index", "collection", id, "body", nil) assert.Nil(t, err) } diff --git a/document/delete.go b/document/delete.go index 6e54e23e..d263030f 100644 --- a/document/delete.go +++ b/document/delete.go @@ -2,12 +2,11 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) Delete(index string, collection string, _id string, options *DocumentOptions) (string, error) { +func (d *Document) Delete(index string, collection string, _id string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Delete: index required", 400) } @@ -30,13 +29,7 @@ func (d *Document) Delete(index string, collection string, _id string, options * Id: _id, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go index 285e8241..ce0cb1fb 100644 --- a/document/deleteByQuery.go +++ b/document/deleteByQuery.go @@ -2,12 +2,11 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) DeleteByQuery(index string, collection string, body string, options *DocumentOptions) ([]string, error) { +func (d *Document) DeleteByQuery(index string, collection string, body string, options types.QueryOptions) ([]string, error) { if index == "" { return nil, types.NewError("Document.MCreate: index required", 400) } @@ -30,13 +29,7 @@ func (d *Document) DeleteByQuery(index string, collection string, body string, o Body: body, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/deleteByQuery_test.go b/document/deleteByQuery_test.go index 3e132a7b..c86b6a4f 100644 --- a/document/deleteByQuery_test.go +++ b/document/deleteByQuery_test.go @@ -14,24 +14,24 @@ import ( func TestDeleteByQueryIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.DeleteByQuery("", "collection", "body", opts) + + _, err := d.DeleteByQuery("", "collection", "body", nil) assert.NotNil(t, err) } func TestDeleteByQueryCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.DeleteByQuery("index", "", "body", opts) + + _, err := d.DeleteByQuery("index", "", "body", nil) assert.NotNil(t, err) } func TestDeleteByQueryBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.DeleteByQuery("index", "collection", "", opts) + + _, err := d.DeleteByQuery("index", "collection", "", nil) assert.NotNil(t, err) } @@ -43,8 +43,8 @@ func TestDeleteByQueryDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.DeleteByQuery("index", "collection", "body", opts) + + _, err := d.DeleteByQuery("index", "collection", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -70,7 +70,7 @@ func TestDeleteByQueryDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.DeleteByQuery("index", "collection", "body", opts) + + _, err := d.DeleteByQuery("index", "collection", "body", nil) assert.Nil(t, err) } diff --git a/document/delete_test.go b/document/delete_test.go index f9665cbf..84a9c31a 100644 --- a/document/delete_test.go +++ b/document/delete_test.go @@ -14,24 +14,21 @@ import ( func TestDeleteIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Delete("", "collection", "id1", opts) + _, err := d.Delete("", "collection", "id1", nil) assert.NotNil(t, err) } func TestDeleteCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Delete("index", "", "id1", opts) + _, err := d.Delete("index", "", "id1", nil) assert.NotNil(t, err) } func TestDeleteIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Delete("index", "collection", "", opts) + _, err := d.Delete("index", "collection", "", nil) assert.NotNil(t, err) } @@ -43,8 +40,7 @@ func TestDeleteDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Delete("index", "collection", "id1", opts) + _, err := d.Delete("index", "collection", "id1", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -72,7 +68,6 @@ func TestDeleteDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Delete("index", "collection", id, opts) + _, err := d.Delete("index", "collection", id, nil) assert.Nil(t, err) } diff --git a/document/document.go b/document/document.go index 1a73f92b..a91de300 100644 --- a/document/document.go +++ b/document/document.go @@ -4,17 +4,14 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// Document is a Controller type Document struct { Kuzzle types.IKuzzle } +// NewDocument is a Document Controller constructor func NewDocument(kuzzle types.IKuzzle) *Document { return &Document{ Kuzzle: kuzzle, } } - -type DocumentOptions struct { - Volatile string - WaitFor bool -} diff --git a/document/exists.go b/document/exists.go index 486e5554..6dd30e2f 100644 --- a/document/exists.go +++ b/document/exists.go @@ -6,7 +6,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) Exists(index string, collection string, _id string) (bool, error) { +func (d *Document) Exists(index string, collection string, _id string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Document.Exists: index required", 400) } @@ -29,7 +29,7 @@ func (d *Document) Exists(index string, collection string, _id string) (bool, er Id: _id, } - go d.Kuzzle.Query(query, nil, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/exists_test.go b/document/exists_test.go index 33e3632e..799184d9 100644 --- a/document/exists_test.go +++ b/document/exists_test.go @@ -14,21 +14,21 @@ import ( func TestExistsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Exists("", "collection", "id1") + _, err := d.Exists("", "collection", "id1", nil) assert.NotNil(t, err) } func TestExistsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Exists("index", "", "id1") + _, err := d.Exists("index", "", "id1", nil) assert.NotNil(t, err) } func TestExistsIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Exists("index", "collection", "") + _, err := d.Exists("index", "collection", "", nil) assert.NotNil(t, err) } @@ -40,7 +40,7 @@ func TestExistsDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Exists("index", "collection", "id1") + _, err := d.Exists("index", "collection", "id1", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -64,7 +64,7 @@ func TestExistsDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - res, err := d.Exists("index", "collection", id) + res, err := d.Exists("index", "collection", id, nil) assert.Nil(t, err) assert.Equal(t, true, res) } diff --git a/document/get.go b/document/get.go index 4a23eaf5..625129d5 100644 --- a/document/get.go +++ b/document/get.go @@ -6,7 +6,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) Get(index string, collection string, _id string) (string, error) { +func (d *Document) Get(index string, collection string, _id string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Get: index required", 400) } @@ -29,7 +29,7 @@ func (d *Document) Get(index string, collection string, _id string) (string, err Id: _id, } - go d.Kuzzle.Query(query, nil, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/get_test.go b/document/get_test.go index 1c44faa8..b19a4527 100644 --- a/document/get_test.go +++ b/document/get_test.go @@ -14,21 +14,21 @@ import ( func TestGetIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Get("", "collection", "id1") + _, err := d.Get("", "collection", "id1", nil) assert.NotNil(t, err) } func TestGetCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Get("index", "", "id1") + _, err := d.Get("index", "", "id1", nil) assert.NotNil(t, err) } func TestGetIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Get("index", "collection", "") + _, err := d.Get("index", "collection", "", nil) assert.NotNil(t, err) } @@ -40,7 +40,7 @@ func TestGetDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Get("index", "collection", "id1") + _, err := d.Get("index", "collection", "id1", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -80,6 +80,6 @@ func TestGetDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Get("index", "collection", id) + _, err := d.Get("index", "collection", id, nil) assert.Nil(t, err) } diff --git a/document/mCreate.go b/document/mCreate.go index 414a639b..c92591a5 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -2,12 +2,11 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) MCreate(index string, collection string, body string, options *DocumentOptions) (string, error) { +func (d *Document) MCreate(index string, collection string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MCreate: index required", 400) } @@ -30,13 +29,7 @@ func (d *Document) MCreate(index string, collection string, body string, options Body: body, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index 5b66af12..bbfd499a 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -2,12 +2,11 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) MCreateOrReplace(index string, collection string, body string, options *DocumentOptions) (string, error) { +func (d *Document) MCreateOrReplace(index string, collection string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MCreateOrReplace: index required", 400) } @@ -30,13 +29,7 @@ func (d *Document) MCreateOrReplace(index string, collection string, body string Body: body, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index 4e9afb14..64356958 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -14,24 +14,24 @@ import ( func TestMCreateOrReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreateOrReplace("", "collection", "body", opts) + + _, err := d.MCreateOrReplace("", "collection", "body", nil) assert.NotNil(t, err) } func TestMCreateOrReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreateOrReplace("index", "", "body", opts) + + _, err := d.MCreateOrReplace("index", "", "body", nil) assert.NotNil(t, err) } func TestMCreateOrReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreateOrReplace("index", "collection", "", opts) + + _, err := d.MCreateOrReplace("index", "collection", "", nil) assert.NotNil(t, err) } @@ -43,8 +43,8 @@ func TestMCreateOrReplaceDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreateOrReplace("index", "collection", "body", opts) + + _, err := d.MCreateOrReplace("index", "collection", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -95,7 +95,7 @@ func TestMCreateOrReplaceDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreateOrReplace("index", "collection", "body", opts) + + _, err := d.MCreateOrReplace("index", "collection", "body", nil) assert.Nil(t, err) } diff --git a/document/mCreate_test.go b/document/mCreate_test.go index 40e4dc32..54635812 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -14,24 +14,24 @@ import ( func TestMCreateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreate("", "collection", "body", opts) + + _, err := d.MCreate("", "collection", "body", nil) assert.NotNil(t, err) } func TestMCreateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreate("index", "", "body", opts) + + _, err := d.MCreate("index", "", "body", nil) assert.NotNil(t, err) } func TestMCreateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreate("index", "collection", "", opts) + + _, err := d.MCreate("index", "collection", "", nil) assert.NotNil(t, err) } @@ -43,8 +43,8 @@ func TestMCreateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreate("index", "collection", "body", opts) + + _, err := d.MCreate("index", "collection", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -95,7 +95,7 @@ func TestMCreateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MCreate("index", "collection", "body", opts) + + _, err := d.MCreate("index", "collection", "body", nil) assert.Nil(t, err) } diff --git a/document/mDelete.go b/document/mDelete.go index 15e395f6..2053141b 100644 --- a/document/mDelete.go +++ b/document/mDelete.go @@ -2,12 +2,11 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) MDelete(index string, collection string, ids []string, options *DocumentOptions) ([]string, error) { +func (d *Document) MDelete(index string, collection string, ids []string, options types.QueryOptions) ([]string, error) { if index == "" { return nil, types.NewError("Document.MDelete: index required", 400) } @@ -30,13 +29,7 @@ func (d *Document) MDelete(index string, collection string, ids []string, option Body: ids, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/mDelete_test.go b/document/mDelete_test.go index c3f0a886..3980a925 100644 --- a/document/mDelete_test.go +++ b/document/mDelete_test.go @@ -14,29 +14,29 @@ import ( func TestMDeleteIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string ids = append(ids, "id1") - _, err := d.MDelete("", "collection", ids, opts) + _, err := d.MDelete("", "collection", ids, nil) assert.NotNil(t, err) } func TestMDeleteCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string ids = append(ids, "id1") - _, err := d.MDelete("index", "", ids, opts) + _, err := d.MDelete("index", "", ids, nil) assert.NotNil(t, err) } func TestMDeleteIdsNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string - _, err := d.MDelete("index", "collection", ids, opts) + _, err := d.MDelete("index", "collection", ids, nil) assert.NotNil(t, err) } @@ -48,10 +48,10 @@ func TestMDeleteDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string ids = append(ids, "id1") - _, err := d.MDelete("index", "collection", ids, opts) + _, err := d.MDelete("index", "collection", ids, nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -77,9 +77,9 @@ func TestMDeleteDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} + var ids []string ids = append(ids, "id1") - _, err := d.MDelete("index", "collection", ids, opts) + _, err := d.MDelete("index", "collection", ids, nil) assert.Nil(t, err) } diff --git a/document/mGet.go b/document/mGet.go index 99b86913..5b7e0e8c 100644 --- a/document/mGet.go +++ b/document/mGet.go @@ -6,7 +6,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) MGet(index string, collection string, ids []string, includeTrash bool) (string, error) { +func (d *Document) MGet(index string, collection string, ids []string, includeTrash bool, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MGet: index required", 400) } @@ -34,7 +34,7 @@ func (d *Document) MGet(index string, collection string, ids []string, includeTr Body: &body{Ids: ids, IncludeTrash: includeTrash}, } - go d.Kuzzle.Query(query, nil, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/mGet_test.go b/document/mGet_test.go index d6ac0536..2ee750f0 100644 --- a/document/mGet_test.go +++ b/document/mGet_test.go @@ -16,7 +16,7 @@ func TestMGetIndexNull(t *testing.T) { d := document.NewDocument(k) var ids []string ids = append(ids, "id1") - _, err := d.MGet("", "collection", ids, true) + _, err := d.MGet("", "collection", ids, true, nil) assert.NotNil(t, err) } @@ -25,7 +25,7 @@ func TestMGetCollectionNull(t *testing.T) { d := document.NewDocument(k) var ids []string ids = append(ids, "id1") - _, err := d.MGet("index", "", ids, true) + _, err := d.MGet("index", "", ids, true, nil) assert.NotNil(t, err) } @@ -33,7 +33,7 @@ func TestMGetIdsNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) var ids []string - _, err := d.MGet("index", "collection", ids, true) + _, err := d.MGet("index", "collection", ids, true, nil) assert.NotNil(t, err) } @@ -47,7 +47,7 @@ func TestMGetDocumentError(t *testing.T) { d := document.NewDocument(k) var ids []string ids = append(ids, "id1") - _, err := d.MGet("index", "collection", ids, true) + _, err := d.MGet("index", "collection", ids, true, nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -101,6 +101,6 @@ func TestMGetDocument(t *testing.T) { d := document.NewDocument(k) var ids []string ids = append(ids, "id1") - _, err := d.MGet("index", "collection", ids, true) + _, err := d.MGet("index", "collection", ids, true, nil) assert.Nil(t, err) } diff --git a/document/mReplace.go b/document/mReplace.go index 53f4cb90..5267ff49 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -2,13 +2,12 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) // MReplaceDocument mReplaces a document in Kuzzle. -func (d *Document) MReplace(index string, collection string, body string, options *DocumentOptions) (string, error) { +func (d *Document) MReplace(index string, collection string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MReplace: index required", 400) } @@ -31,13 +30,7 @@ func (d *Document) MReplace(index string, collection string, body string, option Body: body, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/mReplace_test.go b/document/mReplace_test.go index 4fa83306..5fce09a5 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -14,24 +14,24 @@ import ( func TestMReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MReplace("", "collection", "body", opts) + + _, err := d.MReplace("", "collection", "body", nil) assert.NotNil(t, err) } func TestMReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MReplace("index", "", "body", opts) + + _, err := d.MReplace("index", "", "body", nil) assert.NotNil(t, err) } func TestMReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MReplace("index", "collection", "", opts) + + _, err := d.MReplace("index", "collection", "", nil) assert.NotNil(t, err) } @@ -43,8 +43,8 @@ func TestMReplaceDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MReplace("index", "collection", "body", opts) + + _, err := d.MReplace("index", "collection", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -96,7 +96,7 @@ func TestMReplaceDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MReplace("index", "collection", "body", opts) + + _, err := d.MReplace("index", "collection", "body", nil) assert.Nil(t, err) } diff --git a/document/mUpdate.go b/document/mUpdate.go index 60c52a8b..6674f224 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -2,13 +2,12 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) // MUpdateDocument mUpdates a document in Kuzzle. -func (d *Document) MUpdate(index string, collection string, body string, options *DocumentOptions) (string, error) { +func (d *Document) MUpdate(index string, collection string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MUpdate: index required", 400) } @@ -31,13 +30,7 @@ func (d *Document) MUpdate(index string, collection string, body string, options Body: body, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index fd713202..030534ad 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -14,24 +14,24 @@ import ( func TestMUpdateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MUpdate("", "collection", "body", opts) + + _, err := d.MUpdate("", "collection", "body", nil) assert.NotNil(t, err) } func TestMUpdateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MUpdate("index", "", "body", opts) + + _, err := d.MUpdate("index", "", "body", nil) assert.NotNil(t, err) } func TestMUpdateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MUpdate("index", "collection", "", opts) + + _, err := d.MUpdate("index", "collection", "", nil) assert.NotNil(t, err) } @@ -43,8 +43,8 @@ func TestMUpdateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MUpdate("index", "collection", "body", opts) + + _, err := d.MUpdate("index", "collection", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -96,7 +96,7 @@ func TestMUpdateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.MUpdate("index", "collection", "body", opts) + + _, err := d.MUpdate("index", "collection", "body", nil) assert.Nil(t, err) } diff --git a/document/replace.go b/document/replace.go index 30a6e325..fd1382e9 100644 --- a/document/replace.go +++ b/document/replace.go @@ -2,13 +2,12 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) // ReplaceDocument replaces a document in Kuzzle. -func (d *Document) Replace(index string, collection string, _id string, body string, options *DocumentOptions) (string, error) { +func (d *Document) Replace(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Replace: index required", 400) } @@ -36,13 +35,7 @@ func (d *Document) Replace(index string, collection string, _id string, body str Id: _id, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/replace_test.go b/document/replace_test.go index 8b0843e3..e8aa0c4d 100644 --- a/document/replace_test.go +++ b/document/replace_test.go @@ -14,32 +14,32 @@ import ( func TestReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Replace("", "collection", "id1", "body", opts) + + _, err := d.Replace("", "collection", "id1", "body", nil) assert.NotNil(t, err) } func TestReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Replace("index", "", "id1", "body", opts) + + _, err := d.Replace("index", "", "id1", "body", nil) assert.NotNil(t, err) } func TestReplaceIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Replace("index", "collection", "", "body", opts) + + _, err := d.Replace("index", "collection", "", "body", nil) assert.NotNil(t, err) } func TestReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Replace("index", "collection", "id1", "", opts) + + _, err := d.Replace("index", "collection", "id1", "", nil) assert.NotNil(t, err) } @@ -51,8 +51,8 @@ func TestReplaceDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Replace("index", "collection", "id1", "body", opts) + + _, err := d.Replace("index", "collection", "id1", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -82,7 +82,7 @@ func TestReplaceDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Replace("index", "collection", id, "body", opts) + + _, err := d.Replace("index", "collection", id, "body", nil) assert.Nil(t, err) } diff --git a/document/search.go b/document/search.go index b3c39852..8e0f835a 100644 --- a/document/search.go +++ b/document/search.go @@ -7,7 +7,7 @@ import ( ) // Search documents in the given Collection, using provided filters and option. -func (d *Document) Search(index string, collection string, body string, options *types.SearchOptions) (*types.SearchResult, error) { +func (d *Document) Search(index string, collection string, body string, options types.QueryOptions) (*types.SearchResult, error) { if index == "" { return nil, types.NewError("Document.Search: index required", 400) } @@ -30,16 +30,7 @@ func (d *Document) Search(index string, collection string, body string, options Body: body, } - if options != nil { - query.From = *options.From - query.Size = *options.Size - scroll := options.Scroll - if scroll != "" { - query.Scroll = scroll - } - } - - go d.Kuzzle.Query(query, nil, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/search_test.go b/document/search_test.go index dc40dea0..3c0c932b 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -14,30 +14,24 @@ import ( func TestSearchIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - from := 2 - size := 4 - opts := types.SearchOptions{Type: "all", From: &from, Size: &size, Scroll: "1m"} - _, err := d.Search("", "collection", "body", &opts) + + _, err := d.Search("", "collection", "body", nil) assert.NotNil(t, err) } func TestSearchCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - from := 2 - size := 4 - opts := types.SearchOptions{Type: "all", From: &from, Size: &size, Scroll: "1m"} - _, err := d.Search("index", "", "body", &opts) + + _, err := d.Search("index", "", "body", nil) assert.NotNil(t, err) } func TestSearchBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - from := 2 - size := 4 - opts := types.SearchOptions{Type: "all", From: &from, Size: &size, Scroll: "1m"} - _, err := d.Search("index", "collection", "", &opts) + + _, err := d.Search("index", "collection", "", nil) assert.NotNil(t, err) } @@ -49,10 +43,8 @@ func TestSearchDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - from := 2 - size := 4 - opts := types.SearchOptions{Type: "all", From: &from, Size: &size, Scroll: "1m"} - _, err := d.Search("index", "collection", "body", &opts) + + _, err := d.Search("index", "collection", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -78,9 +70,7 @@ func TestSearchDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - from := 2 - size := 4 - opts := types.SearchOptions{Type: "all", From: &from, Size: &size, Scroll: "1m"} - _, err := d.Search("index", "collection", "body", &opts) + + _, err := d.Search("index", "collection", "body", nil) assert.Nil(t, err) } diff --git a/document/update.go b/document/update.go index 828cee55..42164410 100644 --- a/document/update.go +++ b/document/update.go @@ -2,13 +2,12 @@ package document import ( "encoding/json" - "strconv" "github.com/kuzzleio/sdk-go/types" ) // UpdateDocument updates a document in Kuzzle. -func (d *Document) Update(index string, collection string, _id string, body string, options *DocumentOptions) (string, error) { +func (d *Document) Update(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Update: index required", 400) } @@ -36,13 +35,7 @@ func (d *Document) Update(index string, collection string, _id string, body stri Id: _id, } - queryOpts := types.NewQueryOptions() - - if options != nil { - queryOpts.SetRefresh(strconv.FormatBool(options.WaitFor)) - } - - go d.Kuzzle.Query(query, queryOpts, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/update_test.go b/document/update_test.go index 272bf055..a584d527 100644 --- a/document/update_test.go +++ b/document/update_test.go @@ -14,32 +14,32 @@ import ( func TestUpdateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Update("", "collection", "id1", "body", opts) + + _, err := d.Update("", "collection", "id1", "body", nil) assert.NotNil(t, err) } func TestUpdateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Update("index", "", "id1", "body", opts) + + _, err := d.Update("index", "", "id1", "body", nil) assert.NotNil(t, err) } func TestUpdateIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Update("index", "collection", "", "body", opts) + + _, err := d.Update("index", "collection", "", "body", nil) assert.NotNil(t, err) } func TestUpdateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Update("index", "collection", "id1", "", opts) + + _, err := d.Update("index", "collection", "id1", "", nil) assert.NotNil(t, err) } @@ -51,8 +51,8 @@ func TestUpdateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Update("index", "collection", "id1", "body", opts) + + _, err := d.Update("index", "collection", "id1", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -82,7 +82,7 @@ func TestUpdateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - opts := &document.DocumentOptions{WaitFor: true, Volatile: ""} - _, err := d.Update("index", "collection", id, "body", opts) + + _, err := d.Update("index", "collection", id, "body", nil) assert.Nil(t, err) } diff --git a/document/validate.go b/document/validate.go index 75e0f19d..9c84056a 100644 --- a/document/validate.go +++ b/document/validate.go @@ -6,7 +6,8 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (d *Document) Validate(index string, collection string, body string) (bool, error) { +// Validate validates a document +func (d *Document) Validate(index string, collection string, body string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Document.Validate: index required", 400) } @@ -29,7 +30,7 @@ func (d *Document) Validate(index string, collection string, body string) (bool, Body: body, } - go d.Kuzzle.Query(query, nil, ch) + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/validate_test.go b/document/validate_test.go index 45f1ff16..919dfe46 100644 --- a/document/validate_test.go +++ b/document/validate_test.go @@ -14,21 +14,21 @@ import ( func TestValidateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("", "collection", "body") + _, err := d.Validate("", "collection", "body", nil) assert.NotNil(t, err) } func TestValidateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "", "body") + _, err := d.Validate("index", "", "body", nil) assert.NotNil(t, err) } func TestValidateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "") + _, err := d.Validate("index", "collection", "", nil) assert.NotNil(t, err) } @@ -40,7 +40,7 @@ func TestValidateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "body") + _, err := d.Validate("index", "collection", "body", nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -62,6 +62,6 @@ func TestValidateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "body") + _, err := d.Validate("index", "collection", "body", nil) assert.Nil(t, err) } diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 263f5986..6e20ebd6 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -11,7 +11,6 @@ import ( "unsafe" "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/document" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" @@ -279,10 +278,3 @@ func cToGoCollectionListOptions(clo *C.collection_list_options) *collection.List Size: &size, } } - -func cToGoDocumentOptions(d *C.document_options) *document.DocumentOptions { - return &document.DocumentOptions{ - Volatile: C.GoString(d.volatile_), - WaitFor: bool(d.waitFor), - } -} diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index fe7822b5..11774b0c 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -42,103 +42,103 @@ func kuzzle_new_document(d *C.document, k *C.kuzzle) { } //export kuzzle_document_count -func kuzzle_document_count(d *C.document, index *C.char, collection *C.char, body *C.char) *C.int_result { - res, err := (*document.Document)(d.instance).Count(C.GoString(index), C.GoString(collection), C.GoString(body)) +func kuzzle_document_count(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.int_result { + res, err := (*document.Document)(d.instance).Count(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) return goToCIntResult(res, err) } //export kuzzle_document_exists -func kuzzle_document_exists(d *C.document, index *C.char, collection *C.char, id *C.char) *C.bool_result { - res, err := (*document.Document)(d.instance).Exists(C.GoString(index), C.GoString(collection), C.GoString(id)) +func kuzzle_document_exists(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.query_options) *C.bool_result { + res, err := (*document.Document)(d.instance).Exists(C.GoString(index), C.GoString(collection), C.GoString(id), SetQueryOptions(options)) return goToCBoolResult(res, err) } //export kuzzle_document_create -func kuzzle_document_create(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).Create(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_create(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).Create(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_create_or_replace -func kuzzle_document_create_or_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).CreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_create_or_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).CreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_delete -func kuzzle_document_delete(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).Delete(C.GoString(index), C.GoString(collection), C.GoString(id), cToGoDocumentOptions(options)) +func kuzzle_document_delete(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).Delete(C.GoString(index), C.GoString(collection), C.GoString(id), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_delete_by_query -func kuzzle_document_delete_by_query(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_array_result { - res, err := (*document.Document)(d.instance).DeleteByQuery(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_delete_by_query(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_array_result { + res, err := (*document.Document)(d.instance).DeleteByQuery(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) return goToCStringArrayResult(res, err) } //export kuzzle_document_get -func kuzzle_document_get(d *C.document, index *C.char, collection *C.char, id *C.char) *C.string_result { - res, err := (*document.Document)(d.instance).Get(C.GoString(index), C.GoString(collection), C.GoString(id)) +func kuzzle_document_get(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).Get(C.GoString(index), C.GoString(collection), C.GoString(id), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_replace -func kuzzle_document_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).Replace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).Replace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_update -func kuzzle_document_update(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).Update(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_update(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).Update(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_validate -func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, body *C.char) *C.bool_result { - res, err := (*document.Document)(d.instance).Validate(C.GoString(index), C.GoString(collection), C.GoString(body)) +func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.bool_result { + res, err := (*document.Document)(d.instance).Validate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) return goToCBoolResult(res, err) } //export kuzzle_document_search -func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.search_options) *C.search_result { - res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoSearchOptions(options)) +func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.search_result { + res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) return goToCSearchResult(res, err) } //export kuzzle_document_mcreate -func kuzzle_document_mcreate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).MCreate(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_mcreate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).MCreate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_mcreate_or_replace -func kuzzle_document_mcreate_or_replace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).MCreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_mcreate_or_replace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).MCreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_mdelete -func kuzzle_document_mdelete(d *C.document, index *C.char, collection *C.char, ids **C.char, l C.size_t, options *C.document_options) *C.string_array_result { - res, err := (*document.Document)(d.instance).MDelete(C.GoString(index), C.GoString(collection), cToGoStrings(ids, l), cToGoDocumentOptions(options)) +func kuzzle_document_mdelete(d *C.document, index *C.char, collection *C.char, ids **C.char, l C.size_t, options *C.query_options) *C.string_array_result { + res, err := (*document.Document)(d.instance).MDelete(C.GoString(index), C.GoString(collection), cToGoStrings(ids, l), SetQueryOptions(options)) return goToCStringArrayResult(res, err) } //export kuzzle_document_mget -func kuzzle_document_mget(d *C.document, index *C.char, collection *C.char, ids **C.char, l C.size_t, includeTrash C.bool) *C.string_result { - res, err := (*document.Document)(d.instance).MGet(C.GoString(index), C.GoString(collection), cToGoStrings(ids, l), bool(includeTrash)) +func kuzzle_document_mget(d *C.document, index *C.char, collection *C.char, ids **C.char, l C.size_t, includeTrash C.bool, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).MGet(C.GoString(index), C.GoString(collection), cToGoStrings(ids, l), bool(includeTrash), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_mreplace -func kuzzle_document_mreplace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).MReplace(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_mreplace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).MReplace(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_mupdate -func kuzzle_document_mupdate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.document_options) *C.string_result { - res, err := (*document.Document)(d.instance).MUpdate(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoDocumentOptions(options)) +func kuzzle_document_mupdate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { + res, err := (*document.Document)(d.instance).MUpdate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) return goToCStringResult(&res, err) } diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index ccccd67f..b9a901f2 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -17,8 +17,8 @@ namespace kuzzleio { kuzzle_free_document(_document); } - int Document::count_(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { - int_result *r = kuzzle_document_count(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + int Document::count_(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + int_result *r = kuzzle_document_count(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); int ret = r->result; @@ -26,8 +26,8 @@ namespace kuzzleio { return ret; } - bool Document::exists(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_document_exists(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str())); + bool Document::exists(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_document_exists(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -36,8 +36,8 @@ namespace kuzzleio { return ret; } - std::string Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_create(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), doc_ops); + std::string Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_create(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -46,8 +46,8 @@ namespace kuzzleio { return ret; } - std::string Document::createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_create_or_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), doc_ops); + std::string Document::createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_create_or_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -56,8 +56,8 @@ namespace kuzzleio { return ret; } - std::string Document::delete_(const std::string& index, const std::string& collection, const std::string& id, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_delete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), doc_ops); + std::string Document::delete_(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_delete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -66,8 +66,8 @@ namespace kuzzleio { return ret; } - std::vector Document::deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_array_result *r = kuzzle_document_delete_by_query(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + std::vector Document::deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_array_result *r = kuzzle_document_delete_by_query(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -80,8 +80,8 @@ namespace kuzzleio { return v; } - std::string Document::get(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_get(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str())); + std::string Document::get(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_get(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -90,8 +90,8 @@ namespace kuzzleio { return ret; } - std::string Document::replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), doc_ops); + std::string Document::replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -100,8 +100,8 @@ namespace kuzzleio { return ret; } - std::string Document::update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_update(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), doc_ops); + std::string Document::update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_update(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -110,8 +110,8 @@ namespace kuzzleio { return ret; } - bool Document::validate(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_document_validate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + bool Document::validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_document_validate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -120,8 +120,8 @@ namespace kuzzleio { return ret; } - search_result* Document::search(const std::string& index, const std::string& collection, const std::string& body, search_options *opts) Kuz_Throw_KuzzleException { - search_result *r = kuzzle_document_search(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), opts); + search_result* Document::search(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + search_result *r = kuzzle_document_search(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -130,8 +130,8 @@ namespace kuzzleio { return ret; } - std::string Document::mCreate(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_mcreate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + std::string Document::mCreate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_mcreate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -140,8 +140,8 @@ namespace kuzzleio { return ret; } - std::string Document::mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_mcreate_or_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + std::string Document::mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_mcreate_or_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -150,7 +150,7 @@ namespace kuzzleio { return ret; } - std::vector Document::mDelete(const std::string& index, const std::string& collection, const std::vector& ids, document_options *doc_ops) Kuz_Throw_KuzzleException { + std::vector Document::mDelete(const std::string& index, const std::string& collection, const std::vector& ids, query_options *options) Kuz_Throw_KuzzleException { char **idsArray = new char *[ids.size()]; int i = 0; for (auto const& id : ids) { @@ -158,7 +158,7 @@ namespace kuzzleio { i++; } - string_array_result *r = kuzzle_document_mdelete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), doc_ops); + string_array_result *r = kuzzle_document_mdelete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), options); delete[] idsArray; if (r->error != NULL) throwExceptionFromStatus(r); @@ -171,7 +171,7 @@ namespace kuzzleio { return v; } - std::string Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash) Kuz_Throw_KuzzleException { + std::string Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options) Kuz_Throw_KuzzleException { char **idsArray = new char *[ids.size()]; int i = 0; for (auto const& id : ids) { @@ -179,7 +179,7 @@ namespace kuzzleio { i++; } - string_result *r = kuzzle_document_mget(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), includeTrash); + string_result *r = kuzzle_document_mget(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), includeTrash, options); delete[] idsArray; if (r->error != NULL) throwExceptionFromStatus(r); @@ -189,8 +189,8 @@ namespace kuzzleio { return ret; } - std::string Document::mReplace(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_mreplace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + std::string Document::mReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_mreplace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); @@ -199,8 +199,8 @@ namespace kuzzleio { return ret; } - std::string Document::mUpdate(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_document_mupdate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), doc_ops); + std::string Document::mUpdate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_document_mupdate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp index 903a3cd8..7de49bed 100644 --- a/internal/wrappers/headers/document.hpp +++ b/internal/wrappers/headers/document.hpp @@ -14,23 +14,23 @@ namespace kuzzleio { Document(Kuzzle* kuzzle); Document(Kuzzle* kuzzle, document *document); virtual ~Document(); - int count_(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; - bool exists(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException; - std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::string createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::string delete_(const std::string& index, const std::string& collection, const std::string& id, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::vector deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::string get(const std::string& index, const std::string& collection, const std::string& id) Kuz_Throw_KuzzleException; - std::string replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::string update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; - bool validate(const std::string& index, const std::string& collection, const std::string& body) Kuz_Throw_KuzzleException; - search_result* search(const std::string& index, const std::string& collection, const std::string& body, search_options *opts) Kuz_Throw_KuzzleException; - std::string mCreate(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::string mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::vector mDelete(const std::string& index, const std::string& collection, const std::vector& ids, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::string mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash) Kuz_Throw_KuzzleException; - std::string mReplace(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; - std::string mUpdate(const std::string& index, const std::string& collection, const std::string& body, document_options *doc_ops) Kuz_Throw_KuzzleException; + int count_(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException; + std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::string createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::string delete_(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException; + std::vector deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::string get(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException; + std::string replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::string update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + bool validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + search_result* search(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::string mCreate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::string mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::vector mDelete(const std::string& index, const std::string& collection, const std::vector& ids, query_options *options) Kuz_Throw_KuzzleException; + std::string mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options) Kuz_Throw_KuzzleException; + std::string mReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + std::string mUpdate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 370a8442..8dac50ce 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -252,11 +252,6 @@ typedef struct { kuzzle *kuzzle; } document; -typedef struct { - char *volatile_; - bool waitFor; -} document_options; - typedef struct { char *id; meta *meta; From ba5ae6690329689326c7b969880e5da4a6600957 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 21 Mar 2018 12:16:04 +0100 Subject: [PATCH 067/363] Resolve merge side-effects --- internal/wrappers/cgo/kuzzle/kuzzle.go | 15 --------------- internal/wrappers/headers/kuzzle.hpp | 7 ------- kuzzle/kuzzle.go | 1 - 3 files changed, 23 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 4c2cb453..ee6473e4 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -90,21 +90,6 @@ func kuzzle_get_collection_controller(k *C.kuzzle) *C.collection { return (*C.collection)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Collection)) } -//export kuzzle_get_auth_controller -func kuzzle_get_auth_controller(k *C.kuzzle) *C.auth { - return (*C.auth)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Auth)) -} - -//export kuzzle_get_index_controller -func kuzzle_get_index_controller(k *C.kuzzle) *C.kuzzle_index { - return (*C.kuzzle_index)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Index)) -} - -//export kuzzle_get_server_controller -func kuzzle_get_server_controller(k *C.kuzzle) *C.server { - return (*C.server)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Server)) -} - // Allocates memory //export kuzzle_connect func kuzzle_connect(k *C.kuzzle) *C.char { diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index f2458bbe..2e156e8d 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -17,10 +17,6 @@ namespace kuzzleio { class Index; class Server; - class Auth; - class Index; - class Server; - class Kuzzle : public KuzzleEventEmitter { private: std::map _listener_instances; @@ -32,9 +28,6 @@ namespace kuzzleio { Server *server; Collection *collection; Document *document; - Auth *auth; - Index *index; - Server *server; Kuzzle(const std::string& host, options *options=NULL); virtual ~Kuzzle(); diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index a538f6c2..6be7e1aa 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -39,7 +39,6 @@ type Kuzzle struct { Document *document.Document Index *index.Index Collection *collection.Collection - Index *index.Index } // NewKuzzle is the Kuzzle constructor From 448be0edfb61d6508f792af60c6b816a345cd095 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Thu, 22 Mar 2018 15:26:25 +0100 Subject: [PATCH 068/363] Realtime Controller --- connection/connection.go | 4 +- connection/websocket/web_socket.go | 22 ++-- internal/mock_connection.go | 4 +- internal/wrappers/cgo/kuzzle/c_to_go.go | 19 +++ internal/wrappers/cgo/kuzzle/realtime.go | 39 +++++++ internal/wrappers/cgo/kuzzle/room.go | 73 ------------ internal/wrappers/cgo/kuzzle/root_api.go | 39 ------- internal/wrappers/cpp/kuzzle.cpp | 22 ---- internal/wrappers/cpp/realtime.cpp | 52 ++++++++- internal/wrappers/cpp/room.cpp | 55 --------- internal/wrappers/headers/kuzzle.hpp | 2 - internal/wrappers/headers/kuzzlesdk.h | 4 + internal/wrappers/headers/realtime.hpp | 8 +- internal/wrappers/headers/room.hpp | 31 ----- internal/wrappers/kcore.i | 2 + internal/wrappers/templates/java/core.i | 1 - kuzzle/get_auto_refresh.go | 36 ------ kuzzle/get_auto_refresh_test.go | 75 ------------ kuzzle/kuzzle.go | 8 +- kuzzle/kuzzle_test.go | 1 - kuzzle/list_collections.go | 51 -------- kuzzle/list_collections_test.go | 132 --------------------- kuzzle/list_indexes.go | 33 ------ kuzzle/list_indexes_test.go | 76 ------------ realtime/count.go | 18 +-- realtime/count_test.go | 43 ++++--- realtime/join.go | 56 +++++++++ realtime/join_test.go | 78 +++++++++++++ realtime/list.go | 33 ++++++ realtime/list_test.go | 79 +++++++++++++ realtime/publish.go | 30 +++++ realtime/publish_test.go | 78 +++++++++++++ realtime/realtime.go | 2 + realtime/subscribe.go | 62 ++++++++++ realtime/subscribe_test.go | 143 +++++++++++++++++++++++ realtime/unsubscribe.go | 39 +++++++ realtime/unsubscribe_test.go | 58 +++++++++ realtime/validate.go | 40 +++++++ realtime/validate_test.go | 79 +++++++++++++ types/ikuzzle.go | 2 + 40 files changed, 960 insertions(+), 669 deletions(-) delete mode 100644 internal/wrappers/cgo/kuzzle/room.go delete mode 100644 internal/wrappers/cgo/kuzzle/root_api.go delete mode 100644 internal/wrappers/cpp/room.cpp delete mode 100644 internal/wrappers/headers/room.hpp delete mode 100644 kuzzle/get_auto_refresh.go delete mode 100644 kuzzle/get_auto_refresh_test.go delete mode 100644 kuzzle/list_collections.go delete mode 100644 kuzzle/list_collections_test.go delete mode 100644 kuzzle/list_indexes.go delete mode 100644 kuzzle/list_indexes_test.go create mode 100644 realtime/join.go create mode 100644 realtime/join_test.go create mode 100644 realtime/list.go create mode 100644 realtime/list_test.go create mode 100644 realtime/publish.go create mode 100644 realtime/publish_test.go create mode 100644 realtime/subscribe.go create mode 100644 realtime/subscribe_test.go create mode 100644 realtime/unsubscribe.go create mode 100644 realtime/unsubscribe_test.go create mode 100644 realtime/validate.go create mode 100644 realtime/validate_test.go diff --git a/connection/connection.go b/connection/connection.go index 03d0acb4..25e846ce 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -17,8 +17,8 @@ type Connection interface { Close() error State() int EmitEvent(int, interface{}) - RegisterRoom(types.IRoom) - UnregisterRoom(string) + RegisterSub(string, string, chan<- types.KuzzleNotification) + UnregisterSub(string) RequestHistory() map[string]time.Time Rooms() *types.RoomList StartQueuing() diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 3c51a2ae..7fa53a20 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -18,6 +18,12 @@ const ( MAX_EMIT_TIMEOUT = 10 ) +type Subscription struct { + RoomID string `json:"roomId"` + Channel string `json:"channel"` + NotificationChannel chan<- types.KuzzleNotification +} + type webSocket struct { ws *websocket.Conn mu *sync.Mutex @@ -263,21 +269,21 @@ func (ws *webSocket) cleanQueue() { } } -func (ws *webSocket) RegisterRoom(room types.IRoom) { - rooms, found := ws.subscriptions.Load(room.Channel()) +func (ws *webSocket) RegisterSub(channel, roomID string, notifChan chan<- types.KuzzleNotification) { + subs, found := ws.subscriptions.Load(channel) if !found { - rooms = map[string]types.IRoom{} - ws.subscriptions.Store(room.Channel(), rooms) + subs = map[string]Subscription{} + ws.subscriptions.Store(channel, subs) } - rooms.(map[string]types.IRoom)[room.Id()] = room + subs.(map[string]Subscription)[roomID] = Subscription{channel, roomID, notifChan} } -func (ws *webSocket) UnregisterRoom(roomId string) { - _, ok := ws.subscriptions.Load(roomId) +func (ws *webSocket) UnregisterSub(roomID string) { + _, ok := ws.subscriptions.Load(roomID) if ok { - ws.subscriptions.Delete(roomId) + ws.subscriptions.Delete(roomID) } } diff --git a/internal/mock_connection.go b/internal/mock_connection.go index 07875897..5875fa71 100644 --- a/internal/mock_connection.go +++ b/internal/mock_connection.go @@ -70,10 +70,10 @@ func (c *MockedConnection) EmitEvent(event int, arg interface{}) { } } -func (c *MockedConnection) RegisterRoom(room types.IRoom) { +func (c *MockedConnection) RegisterSub(channel, roomID string, notifChan chan<- types.KuzzleNotification) { } -func (c *MockedConnection) UnregisterRoom(id string) {} +func (c *MockedConnection) UnregisterSub(roomID string) {} func (c *MockedConnection) RequestHistory() map[string]time.Time { r := make(map[string]time.Time) diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 4082233c..a2f7ef38 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -247,3 +247,22 @@ func cToGoSearchResult(s *C.search_result) *types.SearchResult { Filters: cToGoSearchFilters(s.filters), } } + +func cToGoKuzzleNotificationChannel(c *C.callback) chan<- types.KuzzleNotification { + return make(chan<- types.KuzzleNotification) +} + +func cToGoRoomOptions(ro *C.room_options) types.RoomOptions { + var volatiles map[string]interface{} + + json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(ro.volatiles))), &volatiles) + + newOpt := types.NewRoomOptions() + newOpt.SetScope(C.GoString(ro.scope)) + newOpt.SetState(C.GoString(ro.state)) + newOpt.SetUsers(C.GoString(ro.user)) + newOpt.SetVolatile(volatiles) + newOpt.SetSubscribeToSelf(bool(ro.subscribe_to_self)) + + return newOpt +} diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index 3951f995..fe2a1270 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -8,6 +8,7 @@ package main import "C" import ( + "encoding/json" "unsafe" "github.com/kuzzleio/sdk-go/kuzzle" @@ -49,3 +50,41 @@ func kuzzle_realtime_count(rt *C.realtime, index, collection, roomId *C.char) *C res, err := (*realtime.Realtime)(rt.instance).Count(C.GoString(index), C.GoString(collection), C.GoString(roomId)) return goToCIntResult(res, err) } + +//export kuzzle_realtime_list +func kuzzle_realtime_list(rt *C.realtime, index, collection *C.char) *C.string_result { + res, err := (*realtime.Realtime)(rt.instance).List(C.GoString(index), C.GoString(collection)) + var stringResult string + json.Unmarshal(res, &stringResult) + return goToCStringResult(&stringResult, err) +} + +//export kuzzle_realtime_publish +func kuzzle_realtime_publish(rt *C.realtime, index, collection, body *C.char) *C.void_result { + err := (*realtime.Realtime)(rt.instance).Publish(C.GoString(index), C.GoString(collection), C.GoString(body)) + return goToCVoidResult(err) +} + +//export kuzzle_realtime_unsubscribe +func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result { + err := (*realtime.Realtime)(rt.instance).Unsubscribe(C.GoString(roomId)) + return goToCVoidResult(err) +} + +//export kuzzle_realtime_subscribe +func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback *C.callback, options *C.room_options) *C.string_result { + res, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoKuzzleNotificationChannel(callback), cToGoRoomOptions(options)) + return goToCStringResult(&res, err) +} + +//export kuzzle_realtime_join +func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, callback *C.callback) *C.void_result { + err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), cToGoKuzzleNotificationChannel(callback)) + return goToCVoidResult(err) +} + +//export kuzzle_realtime_validate +func kuzzle_realtime_validate(rt *C.realtime, index, collection, body *C.char) *C.bool_result { + res, err := (*realtime.Realtime)(rt.instance).Validate(C.GoString(index), C.GoString(collection), C.GoString(body)) + return goToCBoolResult(res, err) +} diff --git a/internal/wrappers/cgo/kuzzle/room.go b/internal/wrappers/cgo/kuzzle/room.go deleted file mode 100644 index 1bd2de39..00000000 --- a/internal/wrappers/cgo/kuzzle/room.go +++ /dev/null @@ -1,73 +0,0 @@ -package main - -import ( - "unsafe" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/types" -) - -/* - #cgo CFLAGS: -I../../headers - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" - -// map which stores instances to keep references in case the gc passes -var roomInstances map[interface{}]bool - -// register new instance to the instances map -func registerRoom(instance interface{}) { - if roomInstances == nil { - roomInstances = make(map[interface{}]bool) - } - roomInstances[instance] = true -} - -// unregister an instance from the instances map -//export unregisterRoom -func unregisterRoom(r *C.room) { - delete(roomInstances, (*collection.Room)(r.instance)) -} - -//export room_new_room -func room_new_room(room *C.room, col *C.collection, filters *C.json_object, options *C.room_options) { - opts := SetRoomOptions(options) - - r := collection.NewRoom((*collection.Collection)(col.instance), JsonCConvert(filters), opts) - - registerRoom(room) - room.instance = unsafe.Pointer(r) - room.filters = filters - room.options = options -} - -//export room_on_done -func room_on_done(room *C.room, cb C.kuzzle_subscribe_listener, data unsafe.Pointer) { - c := make(chan types.SubscribeResponse) - - (*collection.Room)(room.instance).OnDone(c) - go func() { - res := <-c - C.room_on_subscribe(cb, goToCRoomResult(res.Error), data) - }() -} - -//export room_subscribe -func room_subscribe(room *C.room, cb C.kuzzle_notification_listener, data unsafe.Pointer) { - c := make(chan types.KuzzleNotification) - - (*collection.Room)(room.instance).Subscribe(c) - go func() { - res := <-c - C.kuzzle_notify(cb, goToCNotificationResult(&res), data) - }() -} - -//export room_unsubscribe -func room_unsubscribe(room *C.room) *C.void_result { - err := (*collection.Room)(room.instance).Unsubscribe() - return goToCVoidResult(err) -} diff --git a/internal/wrappers/cgo/kuzzle/root_api.go b/internal/wrappers/cgo/kuzzle/root_api.go deleted file mode 100644 index 26549783..00000000 --- a/internal/wrappers/cgo/kuzzle/root_api.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -/* - #cgo CFLAGS: -I../../headers - #cgo LDFLAGS: -ljson-c - - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "github.com/kuzzleio/sdk-go/kuzzle" -) - -//export kuzzle_list_collections -func kuzzle_list_collections(k *C.kuzzle, index *C.char, options *C.query_options) *C.collection_entry_result { - res, err := (*kuzzle.Kuzzle)(k.instance).ListCollections( - C.GoString(index), - SetQueryOptions(options)) - - return goToCCollectionListResult(res, err) -} - -//export kuzzle_list_indexes -func kuzzle_list_indexes(k *C.kuzzle, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).ListIndexes(SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_get_auto_refresh -func kuzzle_get_auto_refresh(k *C.kuzzle, index *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).GetAutoRefresh( - C.GoString(index), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 30154075..1ebddcae 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -45,28 +45,6 @@ namespace kuzzleio { return kuzzle_connect(_kuzzle); } - bool Kuzzle::getAutoRefresh(const std::string& index, query_options* options) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_get_auto_refresh(_kuzzle, const_cast(index.c_str()), options); - if (r->error != NULL) - throwExceptionFromStatus(r); - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - - std::vector Kuzzle::listIndexes(query_options* options) Kuz_Throw_KuzzleException { - string_array_result *r = kuzzle_list_indexes(_kuzzle, options); - if (r->error != NULL) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; r->result[i]; i++) - v.push_back(r->result[i]); - - kuzzle_free_string_array_result(r); - return v; - } - void Kuzzle::disconnect() { kuzzle_disconnect(_kuzzle); } diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index 66564f80..6d9cd175 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -16,7 +16,55 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); int ret = r->result; - delete(r); + kuzzle_free_int_result(r); return ret; } -} \ No newline at end of file + + void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, callback cb) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), cb); + if (r->error != NULL) + throwExceptionFromStatus(r); + kuzzle_free_void_result(r); + } + + std::string Realtime::list(const std::string& index, const std::string collection) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_realtime_list(_realtime, const_cast(index.c_str()), const_cast(collection.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + void Realtime::publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_realtime_publish(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + kuzzle_free_void_result(r); + } + + std::string Realtime::subscribe(const std::string& index, const std::string collection, const std::string body, callback cb, room_options* options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), cb, options); + if (r->error != NULL) + throwExceptionFromStatus(r); + std::string ret = r->result; + kuzzle_free_string_result(r); + return ret; + } + + void Realtime::unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_realtime_unsubscribe(_realtime, const_cast(roomId.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + kuzzle_free_void_result(r); + } + + bool Realtime::validate(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_realtime_validate(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + if (r->error != NULL) + throwExceptionFromStatus(r); + bool ret = r->result; + kuzzle_free_bool_result(r); + return ret; +} +} diff --git a/internal/wrappers/cpp/room.cpp b/internal/wrappers/cpp/room.cpp deleted file mode 100644 index fa271570..00000000 --- a/internal/wrappers/cpp/room.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "room.hpp" -#include "collection.hpp" - -namespace kuzzleio { - Room::Room(room* r, SubscribeListener* subscribe_listener, NotificationListener* notification_listener) { - this->_room = r; - this->_listener_instance = subscribe_listener; - this->_notification_listener_instance = notification_listener; - } - - Room::Room(Collection *collection, json_object *filters, room_options* options) { - this->_room = new room(); - room_new_room(this->_room, collection->_collection, filters, options); - } - - Room::~Room() { - unregisterRoom(this->_room); - delete(this->_room); - } - - void call_cb(room_result* res, void* data) { - ((Room*)data)->getSubscribeListener()->onSubscribe(res); - } - - void notify(notification_result* res, void* data) { - ((Room*)data)->getNotificationListener()->onMessage(res); - } - - SubscribeListener* Room::getSubscribeListener() { - return _listener_instance; - } - - NotificationListener* Room::getNotificationListener() { - return _notification_listener_instance; - } - - Room* Room::onDone(SubscribeListener *listener) { - _listener_instance = listener; - room_on_done(_room, &call_cb, this); - } - - Room* Room::subscribe(NotificationListener* listener) { - _notification_listener_instance = listener; - room_subscribe(_room, ¬ify, this); - } - - void Room::unsubscribe() Kuz_Throw_KuzzleException { - void_result *r = room_unsubscribe(_room); - if (r && r->error != NULL) - throwExceptionFromStatus(r); - _notification_listener_instance = NULL; - _listener_instance = NULL; - delete(r); - } -} \ No newline at end of file diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 2e156e8d..b7d74868 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -39,8 +39,6 @@ namespace kuzzleio { statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; - bool getAutoRefresh(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - std::vector listIndexes(query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); kuzzle_response* query(kuzzle_request* query, query_options* options=NULL) Kuz_Throw_KuzzleException; Kuzzle* replayQueue(); diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 3ada50d0..29a7993d 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -97,6 +97,8 @@ typedef struct { void *instance; kuzzle* kuzzle; } realtime; + +typedef struct { char *type_; int from; int size; @@ -140,6 +142,8 @@ typedef struct { char *stack; } room_result; +typedef void (callback)(char* notification); + //options passed to query() typedef struct { bool queuable; diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp index 3d40750a..3850f042 100644 --- a/internal/wrappers/headers/realtime.hpp +++ b/internal/wrappers/headers/realtime.hpp @@ -13,7 +13,13 @@ namespace kuzzleio { Realtime(Kuzzle* kuzzle); virtual ~Realtime(); int count(const std::string& index, const std::string collection, const std::string roomId) Kuz_Throw_KuzzleException; + void join(const std::string& index, const std::string collection, const std::string roomId, callback cb) Kuz_Throw_KuzzleException; + std::string list(const std::string& index, const std::string collection) Kuz_Throw_KuzzleException; + void publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; + std::string subscribe(const std::string& index, const std::string collection, const std::string body, callback cb, room_options* options) Kuz_Throw_KuzzleException; + void unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException; + bool validate(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; }; } -#endif \ No newline at end of file +#endif diff --git a/internal/wrappers/headers/room.hpp b/internal/wrappers/headers/room.hpp deleted file mode 100644 index 7386b135..00000000 --- a/internal/wrappers/headers/room.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _ROOM_HPP_ -#define _ROOM_HPP_ - -#include "listeners.hpp" -#include "exceptions.hpp" -#include "core.hpp" -#include "room.hpp" - -namespace kuzzleio { - class Collection; - - class Room { - room *_room; - SubscribeListener *_listener_instance; - NotificationListener *_notification_listener_instance; - - Room(){} - - public: - Room(Collection *collection, json_object *filters=NULL, room_options* options=NULL); - Room(room* r, SubscribeListener* subscribe_listener, NotificationListener* notification_listener); - virtual ~Room(); - SubscribeListener *getSubscribeListener(); - NotificationListener *getNotificationListener(); - Room* onDone(SubscribeListener* listener); - Room* subscribe(NotificationListener* listener); - void unsubscribe() Kuz_Throw_KuzzleException; - }; -} - -#endif \ No newline at end of file diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index e45bbc5b..e04dbe1e 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -10,6 +10,7 @@ #include "index.hpp" #include "server.hpp" #include "document.hpp" +#include "realtime.hpp" #include #include %} @@ -27,3 +28,4 @@ %include "index.hpp" %include "server.hpp" %include "document.hpp" +%include "realtime.hpp" diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index f72d89e1..e9b22566 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -141,7 +141,6 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" -%include "room.cpp" %include "document.cpp" %include "realtime.hpp" %include "auth.cpp" diff --git a/kuzzle/get_auto_refresh.go b/kuzzle/get_auto_refresh.go deleted file mode 100644 index 63c2b271..00000000 --- a/kuzzle/get_auto_refresh.go +++ /dev/null @@ -1,36 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// GetAutoRefresh the getAutoRefresh function returns the current autoRefresh status for the given index. -func (k *Kuzzle) GetAutoRefresh(index string, options types.QueryOptions) (bool, error) { - if index == "" { - if k.defaultIndex == "" { - return false, types.NewError("Kuzzle.GetAutoRefresh: index required", 400) - } - index = k.defaultIndex - } - - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "index", - Action: "getAutoRefresh", - Index: index, - } - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return false, res.Error - } - - var r bool - json.Unmarshal(res.Result, &r) - - return r, nil -} diff --git a/kuzzle/get_auto_refresh_test.go b/kuzzle/get_auto_refresh_test.go deleted file mode 100644 index 536d3520..00000000 --- a/kuzzle/get_auto_refresh_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestGetAutoRefreshDefaultIndexNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.GetAutoRefresh("", nil) - assert.NotNil(t, err) -} - -func TestGetAutoRefreshIndexNull(t *testing.T) { - opts := types.NewOptions() - opts.SetDefaultIndex("myIndex") - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Result: json.RawMessage("true")} - }, - } - - k, _ := kuzzle.NewKuzzle(c, opts) - _, err := k.GetAutoRefresh("", nil) - assert.Nil(t, err) -} - -func TestGetAutoRefreshQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - k.Connect() - _, err := k.GetAutoRefresh("index", nil) - assert.NotNil(t, err) -} - -func TestGetAutoRefresh(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Result: json.RawMessage("true")} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - type ackResult struct { - Acknowledged bool - ShardsAcknowledged bool - } - res, _ := k.GetAutoRefresh("index", nil) - assert.Equal(t, true, res) -} - -func ExampleKuzzle_GetAutoRefresh() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.GetAutoRefresh("index", nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index 1b93259e..ef349dbb 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -145,12 +145,12 @@ func (k *Kuzzle) UnsetJwt() { } } -func (k *Kuzzle) RegisterRoom(room types.IRoom) { - k.socket.RegisterRoom(room) +func (k *Kuzzle) RegisterSub(channel, roomId string, notifChan chan<- types.KuzzleNotification) { + k.socket.RegisterSub(channel, roomId, notifChan) } -func (k *Kuzzle) UnregisterRoom(roomId string) { - k.socket.UnregisterRoom(roomId) +func (k *Kuzzle) UnregisterSub(roomId string) { + k.socket.UnregisterSub(roomId) } func (k *Kuzzle) State() int { diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index 3eac6f5d..cc8557bf 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -113,7 +113,6 @@ func TestSetDefaultIndex(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) k.SetDefaultIndex("myindex") - k.ListCollections("", nil) } func ExampleKuzzle_SetDefaultIndex() { diff --git a/kuzzle/list_collections.go b/kuzzle/list_collections.go deleted file mode 100644 index 65e5a0e0..00000000 --- a/kuzzle/list_collections.go +++ /dev/null @@ -1,51 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// ListCollections retrieves the list of known data collections contained in a specified index. -func (k *Kuzzle) ListCollections(index string, options types.QueryOptions) ([]*types.CollectionsList, error) { - if index == "" { - if k.defaultIndex == "" { - return nil, types.NewError("Kuzzle.ListCollections: index required", 400) - } - index = k.defaultIndex - } - - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "collection", - Action: "list", - Index: index, - } - - if options != nil { - if options.Type() != "" { - type body struct { - Type string `json:"type"` - } - - query.Body = &body{Type: options.Type()} - } - } - - type collections struct { - Collections []*types.CollectionsList `json:"collections"` - } - - go k.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - s := collections{} - json.Unmarshal(res.Result, &s) - - return s.Collections, nil -} diff --git a/kuzzle/list_collections_test.go b/kuzzle/list_collections_test.go deleted file mode 100644 index 760494c5..00000000 --- a/kuzzle/list_collections_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "log" - "testing" -) - -func TestListCollectionsIndexNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.ListCollections("", nil) - assert.NotNil(t, err) -} - -func TestListCollectionsQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "collection", request.Controller) - assert.Equal(t, "index", request.Index) - assert.Equal(t, "list", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.ListCollections("index", nil) - assert.NotNil(t, err) -} - -func TestListCollections(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "collection", request.Controller) - assert.Equal(t, "list", request.Action) - - type collections struct { - Collections []*types.CollectionsList `json:"collections"` - } - - list := []*types.CollectionsList{ - {Name: "collection1", Type: "stored"}, - {Name: "collection2", Type: "stored"}, - } - - c := collections{ - Collections: list, - } - - h, err := json.Marshal(c) - if err != nil { - log.Fatal(err) - } - - return &types.KuzzleResponse{Result: h} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.ListCollections("index", nil) - - assert.Equal(t, "collection1", res[0].Name) - assert.Equal(t, "collection2", res[1].Name) - assert.Equal(t, "stored", res[0].Type) - assert.Equal(t, "stored", res[1].Type) -} - -func TestListCollectionsWithOptions(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "collection", request.Controller) - assert.Equal(t, "list", request.Action) - - type collections struct { - Collections []*types.CollectionsList `json:"collections"` - } - - list := []*types.CollectionsList{ - {Name: "collection1", Type: "stored"}, - {Name: "collection2", Type: "stored"}, - } - - c := collections{ - Collections: list, - } - - h, err := json.Marshal(c) - if err != nil { - log.Fatal(err) - } - - return &types.KuzzleResponse{Result: h} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - qo := types.NewQueryOptions() - qo.SetType("stored") - - res, _ := k.ListCollections("index", qo) - - assert.Equal(t, "collection1", res[0].Name) - assert.Equal(t, "collection2", res[1].Name) - assert.Equal(t, "stored", res[0].Type) - assert.Equal(t, "stored", res[1].Type) -} - -func ExampleKuzzle_ListCollections() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.ListCollections("index", nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - for _, collection := range res { - fmt.Println(collection.Type, collection.Name) - } -} diff --git a/kuzzle/list_indexes.go b/kuzzle/list_indexes.go deleted file mode 100644 index 1175f9b3..00000000 --- a/kuzzle/list_indexes.go +++ /dev/null @@ -1,33 +0,0 @@ -package kuzzle - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -// ListIndexes retrieves the list of indexes stored in Kuzzle. -func (k *Kuzzle) ListIndexes(options types.QueryOptions) ([]string, error) { - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "index", - Action: "list", - } - - go k.Query(query, options, result) - - res := <-result - - type indexes struct { - Indexes []string `json:"indexes"` - } - - if res.Error != nil { - return nil, res.Error - } - - var i indexes - json.Unmarshal(res.Result, &i) - - return i.Indexes, nil -} diff --git a/kuzzle/list_indexes_test.go b/kuzzle/list_indexes_test.go deleted file mode 100644 index 132930b7..00000000 --- a/kuzzle/list_indexes_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package kuzzle_test - -import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" - "testing" -) - -func TestListIndexesQueryError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "index", request.Controller) - assert.Equal(t, "list", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.ListIndexes(nil) - assert.NotNil(t, err) -} - -func TestListIndexes(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - request := types.KuzzleRequest{} - json.Unmarshal(query, &request) - assert.Equal(t, "index", request.Controller) - assert.Equal(t, "list", request.Action) - - type indexes struct { - Indexes []string `json:"indexes"` - } - - list := []string{ - "index1", - "index2", - } - - c := indexes{ - Indexes: list, - } - - h, _ := json.Marshal(c) - return &types.KuzzleResponse{Result: h} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.ListIndexes(nil) - - assert.Equal(t, "index1", res[0]) - assert.Equal(t, "index2", res[1]) -} - -func ExampleKuzzle_ListIndexes() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) - - res, err := k.ListIndexes(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - for _, index := range res { - fmt.Println(index) - } -} diff --git a/realtime/count.go b/realtime/count.go index c03b2d3e..2341e5d0 100644 --- a/realtime/count.go +++ b/realtime/count.go @@ -7,15 +7,19 @@ import ( ) //Count returns the number of other subscriptions on that room. -func (r *Realtime) Count(index, collection, roomId string) (int, error) { +func (r *Realtime) Count(index, collection, roomID string) (int, error) { + if index == "" || collection == "" || roomID == "" { + return -1, types.NewError("Realtime.Count: index, collection and roomID required", 400) + } + query := &types.KuzzleRequest{ Controller: "realtime", Action: "count", Index: index, Collection: collection, Body: struct { - RoomId string `json:"roomId"` - }{roomId}, + RoomID string `json:"roomID"` + }{roomID}, } result := make(chan *types.KuzzleResponse) @@ -28,11 +32,11 @@ func (r *Realtime) Count(index, collection, roomId string) (int, error) { return -1, res.Error } - type countRes struct { + var countRes struct { Count int `json:"count"` } - c := &countRes{} - json.Unmarshal(res.Result, c) - return c.Count, nil + json.Unmarshal(res.Result, &countRes) + + return countRes.Count, nil } diff --git a/realtime/count_test.go b/realtime/count_test.go index 46000ed4..12bb8279 100644 --- a/realtime/count_test.go +++ b/realtime/count_test.go @@ -2,7 +2,6 @@ package realtime_test import ( "encoding/json" - "fmt" "testing" "github.com/kuzzleio/sdk-go/realtime" @@ -13,6 +12,33 @@ import ( "github.com/stretchr/testify/assert" ) +func TestCountIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.Count("", "collection", "roomID") + + assert.NotNil(t, err) +} + +func TestCountCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.Count("index", "", "roomID") + + assert.NotNil(t, err) +} + +func TestCountRoomIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.Count("index", "collection", "") + + assert.NotNil(t, err) +} + func TestCountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { @@ -44,18 +70,3 @@ func TestCount(t *testing.T) { res, _ := realTime.Count("index", "collection", "42") assert.Equal(t, 10, res) } - -func Example_Count() { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - realTime := realtime.NewRealtime(k) - - res, err := realTime.Count("index", "collection", "42") - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/realtime/join.go b/realtime/join.go new file mode 100644 index 00000000..35145934 --- /dev/null +++ b/realtime/join.go @@ -0,0 +1,56 @@ +package realtime + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// Join permits to join a previously created subscription +func (r *Realtime) Join(index, collection, roomID string, cb chan<- types.KuzzleNotification) error { + if (index == "" || collection == "") || roomID == "" { + return types.NewError("Realtime.Join: index, collection and roomID required", 400) + } + + type SubResult struct { + Error error + } + + result := make(chan *types.KuzzleResponse) + queryResult := make(chan SubResult) + + go func() { + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "join", + Index: index, + Collection: collection, + Body: struct { + RoomID string `json:"roomID"` + }{roomID}, + } + + go r.k.Query(query, nil, result) + + res := <-result + if res.Error != nil { + queryResult <- SubResult{Error: res.Error} + return + } + + var resSub struct { + RoomID string `json:"roomId"` + Channel string `json:"channel"` + } + + json.Unmarshal(res.Result, &resSub) + queryResult <- SubResult{Error: res.Error} + + r.k.RegisterSub(resSub.Channel, resSub.RoomID, cb) + return + }() + + res := <-queryResult + + return res.Error +} diff --git a/realtime/join_test.go b/realtime/join_test.go new file mode 100644 index 00000000..9b2d8c30 --- /dev/null +++ b/realtime/join_test.go @@ -0,0 +1,78 @@ +package realtime_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestJoinIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + err := nr.Join("", "collection", "body", nil) + + assert.NotNil(t, err) +} + +func TestJoinCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + err := nr.Join("index", "", "body", nil) + + assert.NotNil(t, err) +} + +func TestJoinBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + err := nr.Join("index", "collection", "", nil) + + assert.NotNil(t, err) +} + +func TestJoinError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + + err := nr.Join("index", "collection", "body", nil) + assert.NotNil(t, err) +} + +func TestJoin(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "realtime", parsedQuery.Controller) + assert.Equal(t, "join", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.NotNil(t, parsedQuery.Body) + + res := types.KuzzleResponse{Result: []byte(`{}`)} + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nr := realtime.NewRealtime(k) + + err := nr.Join("index", "collection", "body", nil) + assert.Nil(t, err) +} diff --git a/realtime/list.go b/realtime/list.go new file mode 100644 index 00000000..a770f8b8 --- /dev/null +++ b/realtime/list.go @@ -0,0 +1,33 @@ +package realtime + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// List lists all subscriptions on all indexes and all collections. +func (r *Realtime) List(index string, collection string) (json.RawMessage, error) { + if index == "" || collection == "" { + return nil, types.NewError("Realtime.List: index and collection required", 400) + } + + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "list", + Index: index, + Collection: collection, + } + + result := make(chan *types.KuzzleResponse) + + go r.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/realtime/list_test.go b/realtime/list_test.go new file mode 100644 index 00000000..2756857e --- /dev/null +++ b/realtime/list_test.go @@ -0,0 +1,79 @@ +package realtime_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestListIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.List("", "collection") + + assert.NotNil(t, err) +} + +func TestListCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.List("index", "") + + assert.NotNil(t, err) +} + +func TestListError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.List("index", "collection") + assert.NotNil(t, err) + assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) +} + +func TestList(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "realtime", parsedQuery.Controller) + assert.Equal(t, "list", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + + res := types.KuzzleResponse{Result: []byte(` + { + "index": { + "collection": { + "afcd909773f197ab859447594bfbd154": 12, + "4adbc1948ac4dc84ac89d14b488bcad1": 4 + } + } + }`), + } + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nr := realtime.NewRealtime(k) + + res, err := nr.List("index", "collection") + assert.Nil(t, err) + assert.NotNil(t, res) +} diff --git a/realtime/publish.go b/realtime/publish.go new file mode 100644 index 00000000..24f52229 --- /dev/null +++ b/realtime/publish.go @@ -0,0 +1,30 @@ +package realtime + +import "github.com/kuzzleio/sdk-go/types" + +// Publish sends a real-time message to Kuzzle +func (r *Realtime) Publish(index string, collection string, body string) error { + if (index == "" || collection == "") || body == "" { + return types.NewError("Realtime.Publish: index, collection and body required", 400) + } + + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "publish", + Index: index, + Collection: collection, + Body: body, + } + + result := make(chan *types.KuzzleResponse) + + go r.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/realtime/publish_test.go b/realtime/publish_test.go new file mode 100644 index 00000000..8d070c41 --- /dev/null +++ b/realtime/publish_test.go @@ -0,0 +1,78 @@ +package realtime_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestPublishIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + err := nr.Publish("", "collection", "body") + + assert.NotNil(t, err) +} + +func TestPublishCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + err := nr.Publish("index", "", "body") + + assert.NotNil(t, err) +} + +func TestPublishBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + err := nr.Publish("index", "collection", "") + + assert.NotNil(t, err) +} + +func TestPublishError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + + err := nr.Publish("index", "collection", "body") + assert.NotNil(t, err) +} + +func TestPublish(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "realtime", parsedQuery.Controller) + assert.Equal(t, "publish", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.NotNil(t, parsedQuery.Body) + + res := types.KuzzleResponse{Result: []byte(`{}`)} + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nr := realtime.NewRealtime(k) + + err := nr.Publish("index", "collection", "body") + assert.Nil(t, err) +} diff --git a/realtime/realtime.go b/realtime/realtime.go index ec6362a8..2a8b96c1 100644 --- a/realtime/realtime.go +++ b/realtime/realtime.go @@ -2,10 +2,12 @@ package realtime import "github.com/kuzzleio/sdk-go/types" +// Realtime is a realtime controller type Realtime struct { k types.IKuzzle } +// NewRealtime is a realtime controller constructor func NewRealtime(k types.IKuzzle) *Realtime { return &Realtime{k} } diff --git a/realtime/subscribe.go b/realtime/subscribe.go new file mode 100644 index 00000000..ecfac8e9 --- /dev/null +++ b/realtime/subscribe.go @@ -0,0 +1,62 @@ +package realtime + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// Subscribe permits to join a previously created subscription +func (r *Realtime) Subscribe(index, collection, body string, cb chan<- types.KuzzleNotification, options types.RoomOptions) (string, error) { + if (index == "" || collection == "") || (body == "" || cb == nil) { + return "", types.NewError("Realtime.Subscribe: index, collection, body and notificationChannel required", 400) + } + + type SubResult struct { + Result string + Error error + } + + result := make(chan *types.KuzzleResponse) + queryResult := make(chan SubResult) + + go func() { + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "subscribe", + Index: index, + Collection: collection, + Body: body, + } + + if options != nil { + query.Volatile = options.Volatile() + query.Users = options.Users() + query.State = options.State() + query.Scope = options.Scope() + } + + go r.k.Query(query, nil, result) + + res := <-result + if res.Error != nil { + queryResult <- SubResult{Result: "", Error: res.Error} + return + } + + var resSub struct { + RoomID string `json:"roomId"` + Channel string `json:"channel"` + } + + json.Unmarshal(res.Result, &resSub) + queryResult <- SubResult{Result: resSub.RoomID, Error: res.Error} + + r.k.RegisterSub(resSub.Channel, resSub.RoomID, cb) + return + }() + + res := <-queryResult + + return res.Result, res.Error +} diff --git a/realtime/subscribe_test.go b/realtime/subscribe_test.go new file mode 100644 index 00000000..d4c6c728 --- /dev/null +++ b/realtime/subscribe_test.go @@ -0,0 +1,143 @@ +package realtime_test + +import ( + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/state" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestSubscribeIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + notifChan := make(chan<- types.KuzzleNotification) + _, err := nr.Subscribe("", "collection", "body", notifChan, nil) + + assert.NotNil(t, err) +} + +func TestSubscribeCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + notifChan := make(chan<- types.KuzzleNotification) + _, err := nr.Subscribe("index", "", "body", notifChan, nil) + + assert.NotNil(t, err) +} + +func TestSubscribeBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + notifChan := make(chan<- types.KuzzleNotification) + _, err := nr.Subscribe("index", "collection", "", notifChan, nil) + + assert.NotNil(t, err) +} + +func TestSubscribeNotifChannelNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.Subscribe("index", "collection", "body", nil, nil) + + assert.NotNil(t, err) +} + +func TestSubscribeQueryError(t *testing.T) { + var k *kuzzle.Kuzzle + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "ah!"}} + }, + } + k, _ = kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + c.SetState(state.Connected) + + notifChan := make(chan<- types.KuzzleNotification) + _, err := nr.Subscribe("index", "collection", "body", notifChan, nil) + assert.Equal(t, "ah!", err.Error()) +} + +func TestRenewWithSubscribeToSelf(t *testing.T) { + var k *kuzzle.Kuzzle + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) + return &types.KuzzleResponse{RequestId: "ah!", Result: roomRaw} + }, + } + k, _ = kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + c.SetState(state.Connected) + + notifChan := make(chan<- types.KuzzleNotification) + res, err := nr.Subscribe("index", "collection", "body", notifChan, nil) + assert.Nil(t, err) + assert.NotNil(t, res) + assert.Equal(t, "42", res) +} + +func TestRoomSubscribe(t *testing.T) { + var k *kuzzle.Kuzzle + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) + return &types.KuzzleResponse{Result: roomRaw} + }, + } + k, _ = kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + c.SetState(state.Connected) + + notifChan := make(chan<- types.KuzzleNotification) + res, err := nr.Subscribe("index", "collection", "body", notifChan, nil) + assert.Nil(t, err) + assert.NotNil(t, res) + assert.Equal(t, "42", res) + +} + +func TestRoomSubscribeNotConnected(t *testing.T) { + var k *kuzzle.Kuzzle + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Not Connected"}} + }, + } + + k, _ = kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + c.SetState(state.Connected) + + notifChan := make(chan<- types.KuzzleNotification) + _, err := nr.Subscribe("collection", "index", "roomdId", notifChan, nil) + assert.NotNil(t, err) + assert.Equal(t, "Not Connected", err.Error()) +} + +func ExampleRealtime_Subscribe() { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + roomRaw := []byte(`{"requestId": "rqid", "channel": "foo", "roomId": "42"}`) + return &types.KuzzleResponse{Result: roomRaw} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + c.SetState(state.Connected) + + notifChan := make(chan<- types.KuzzleNotification) + nr.Subscribe("collection", "index", "roomdId", notifChan, nil) +} diff --git a/realtime/unsubscribe.go b/realtime/unsubscribe.go new file mode 100644 index 00000000..50e6368d --- /dev/null +++ b/realtime/unsubscribe.go @@ -0,0 +1,39 @@ +package realtime + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// Unsubscribe instructs Kuzzle to detach you from its subscribers for the given room +func (r *Realtime) Unsubscribe(roomID string) error { + if roomID == "" { + return types.NewError("Realtime.Unsubscribe: roomID required", 400) + } + + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "unsubscribe", + Body: struct { + RoomID string `json:"roomID"` + }{roomID}, + } + + result := make(chan *types.KuzzleResponse) + + go r.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + + var oldRoomID string + json.Unmarshal(res.Result, &oldRoomID) + + r.k.UnregisterSub(oldRoomID) + + return nil +} diff --git a/realtime/unsubscribe_test.go b/realtime/unsubscribe_test.go new file mode 100644 index 00000000..bf01b18d --- /dev/null +++ b/realtime/unsubscribe_test.go @@ -0,0 +1,58 @@ +package realtime_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUnsubscribeRoomIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + err := nr.Unsubscribe("") + + assert.NotNil(t, err) +} + +func TestUnsubscribeError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + + err := nr.Unsubscribe("roomID") + assert.NotNil(t, err) +} + +func TestUnsubscribe(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "realtime", parsedQuery.Controller) + assert.Equal(t, "unsubscribe", parsedQuery.Action) + assert.NotNil(t, parsedQuery.Body) + + res := types.KuzzleResponse{Result: []byte(`{}`)} + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nr := realtime.NewRealtime(k) + + err := nr.Unsubscribe("roomID") + assert.Nil(t, err) +} diff --git a/realtime/validate.go b/realtime/validate.go new file mode 100644 index 00000000..fc0e132e --- /dev/null +++ b/realtime/validate.go @@ -0,0 +1,40 @@ +package realtime + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// Validate validates data against existing validation rules +func (r *Realtime) Validate(index string, collection string, body string) (bool, error) { + if (index == "" || collection == "") || body == "" { + return false, types.NewError("Realtime.Validate: index, collection and body required", 400) + } + + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "validate", + Index: index, + Collection: collection, + Body: body, + } + + result := make(chan *types.KuzzleResponse) + + go r.k.Query(query, nil, result) + + res := <-result + + if res.Error != nil { + return false, res.Error + } + + var isValid struct { + Value bool `json:"valid"` + } + + json.Unmarshal(res.Result, &isValid) + + return isValid.Value, nil +} diff --git a/realtime/validate_test.go b/realtime/validate_test.go new file mode 100644 index 00000000..a2bd065a --- /dev/null +++ b/realtime/validate_test.go @@ -0,0 +1,79 @@ +package realtime_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestValidateIndexNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.Validate("", "collection", "body") + + assert.NotNil(t, err) +} + +func TestValidateCollectionNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.Validate("index", "", "body") + + assert.NotNil(t, err) +} + +func TestValidateBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.Validate("index", "collection", "") + + assert.NotNil(t, err) +} + +func TestValidateError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: types.NewError("Unit test error")} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + nr := realtime.NewRealtime(k) + + _, err := nr.Validate("index", "collection", "body") + assert.NotNil(t, err) +} + +func TestValidate(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "realtime", parsedQuery.Controller) + assert.Equal(t, "validate", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.NotNil(t, parsedQuery.Body) + + res := types.KuzzleResponse{Result: []byte(`{"valid": true}`)} + + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + nr := realtime.NewRealtime(k) + + res, err := nr.Validate("index", "collection", "body") + assert.Nil(t, err) + assert.Equal(t, true, res) +} diff --git a/types/ikuzzle.go b/types/ikuzzle.go index cae3f6ea..7cac5c0c 100644 --- a/types/ikuzzle.go +++ b/types/ikuzzle.go @@ -4,4 +4,6 @@ type IKuzzle interface { Query(query *KuzzleRequest, options QueryOptions, responseChannel chan<- *KuzzleResponse) EmitEvent(int, interface{}) SetJwt(string) + RegisterSub(string, string, chan<- KuzzleNotification) + UnregisterSub(string) } From 6bd9c635f9c1e4970c2a0ae5856e553aa6179e90 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Thu, 22 Mar 2018 15:43:52 +0100 Subject: [PATCH 069/363] Add Realtime controller to Kuzzle object --- internal/wrappers/cgo/kuzzle/kuzzle.go | 5 +++++ internal/wrappers/cpp/kuzzle.cpp | 2 ++ internal/wrappers/headers/kuzzle.hpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index ee6473e4..6883daba 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -90,6 +90,11 @@ func kuzzle_get_collection_controller(k *C.kuzzle) *C.collection { return (*C.collection)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Collection)) } +//export kuzzle_get_realtime_controller +func kuzzle_get_realtime_controller(k *C.kuzzle) *C.realtime { + return (*C.realtime)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Realtime)) +} + // Allocates memory //export kuzzle_connect func kuzzle_connect(k *C.kuzzle) *C.char { diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 1ebddcae..8c8b3590 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -28,6 +28,7 @@ namespace kuzzleio { this->index = new Index(this, kuzzle_get_index_controller(_kuzzle)); this->server = new Server(this, kuzzle_get_server_controller(_kuzzle)); this->collection = new Collection(this, kuzzle_get_collection_controller(this->_kuzzle)); + this->realtime = new Realtime(this, kuzzle_get_realtime_controller(this->_kuzzle)); kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); } @@ -39,6 +40,7 @@ namespace kuzzleio { delete(this->index); delete(this->server); delete(this->collection); + delete(this->realtime); } char* Kuzzle::connect() { diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index b7d74868..0c772c5b 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -16,6 +16,7 @@ namespace kuzzleio { class Auth; class Index; class Server; + class Realtime; class Kuzzle : public KuzzleEventEmitter { private: @@ -28,6 +29,7 @@ namespace kuzzleio { Server *server; Collection *collection; Document *document; + Realtime *realtime; Kuzzle(const std::string& host, options *options=NULL); virtual ~Kuzzle(); From e72875c291aafc2626928fd4587129cad63c734b Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 23 Mar 2018 13:47:12 +0100 Subject: [PATCH 070/363] WIP: subscribe and join still remaining to do --- connection/websocket/web_socket.go | 22 ++++++++---- realtime/subscribe.go | 55 +++++++++++++++++++++++------- types/ikuzzle.go | 2 ++ types/room.go | 2 +- 4 files changed, 61 insertions(+), 20 deletions(-) diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 7fa53a20..08859b9f 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -18,10 +18,12 @@ const ( MAX_EMIT_TIMEOUT = 10 ) -type Subscription struct { - RoomID string `json:"roomId"` - Channel string `json:"channel"` - NotificationChannel chan<- types.KuzzleNotification +type subscription struct { + roomID string + channel string + internalState int + subscribeResponseChannel chan<- types.SubscribeResponse + notificationChannel chan<- types.KuzzleNotification } type webSocket struct { @@ -269,15 +271,21 @@ func (ws *webSocket) cleanQueue() { } } -func (ws *webSocket) RegisterSub(channel, roomID string, notifChan chan<- types.KuzzleNotification) { +func (ws *webSocket) RegisterSub(channel, roomID string, internalState int, notifChan chan<- types.KuzzleNotification, subChan chan<- types.SubscribeResponse) { subs, found := ws.subscriptions.Load(channel) if !found { - subs = map[string]Subscription{} + subs = map[string]subscription{} ws.subscriptions.Store(channel, subs) } - subs.(map[string]Subscription)[roomID] = Subscription{channel, roomID, notifChan} + subs.(map[string]subscription)[roomID] = subscription{ + channel: channel, + roomID: roomID, + internalState: internalState, + notificationChannel: notifChan, + subscribeResponseChannel: subChan, + } } func (ws *webSocket) UnregisterSub(roomID string) { diff --git a/realtime/subscribe.go b/realtime/subscribe.go index ecfac8e9..81e78332 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -3,6 +3,7 @@ package realtime import ( "encoding/json" + "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/types" ) @@ -12,15 +13,22 @@ func (r *Realtime) Subscribe(index, collection, body string, cb chan<- types.Kuz return "", types.NewError("Realtime.Subscribe: index, collection, body and notificationChannel required", 400) } - type SubResult struct { - Result string - Error error + if r.k.InternalState() == internalState.active { + if room.SubscribeResponseChan != nil { + room.SubscribeResponseChan <- types.SubscribeResponse{Room: room} + } + return room.roomId, nil + } + + if room.internalState == subscribing { + return room.id, nil } - result := make(chan *types.KuzzleResponse) - queryResult := make(chan SubResult) + queryResult := make(chan types.SubscribeResponse) go func() { + result := make(chan *types.KuzzleResponse) + query := &types.KuzzleRequest{ Controller: "realtime", Action: "subscribe", @@ -29,31 +37,54 @@ func (r *Realtime) Subscribe(index, collection, body string, cb chan<- types.Kuz Body: body, } + opts := types.NewQueryOptions() + if options != nil { - query.Volatile = options.Volatile() query.Users = options.Users() query.State = options.State() query.Scope = options.Scope() + + opts.SetVolatile(options.Volatile()) } - go r.k.Query(query, nil, result) + go r.k.Query(query, opts, result) res := <-result if res.Error != nil { - queryResult <- SubResult{Result: "", Error: res.Error} + queryResult <- types.SubscribeResponse{Room: "", Error: res.Error} return } var resSub struct { - RoomID string `json:"roomId"` - Channel string `json:"channel"` + RequestID string `json:"requestId"` + RoomID string `json:"roomId"` + Channel string `json:"channel"` } json.Unmarshal(res.Result, &resSub) - queryResult <- SubResult{Result: resSub.RoomID, Error: res.Error} + queryResult <- types.SubscribeResponse{Room: resSub.RoomID, Error: res.Error} r.k.RegisterSub(resSub.Channel, resSub.RoomID, cb) - return + + go func() { + <-room.OnDisconnect + r.k.SetInternalState(resSub.Channel, resSub.RoomID, inactive) + + }() + go func() { + <-room.OnTokenExpired + }() + go func() { + <-room.OnReconnect + + if r.k.AutoResubscribe() { + r.Subscribe(index, collection, body, cb, options) + } + }() + + r.k.AddListener(event.Disconnected, cb) + r.k.AddListener(event.TokenExpired, cb) + r.k.AddListener(event.Reconnected, cb) }() res := <-queryResult diff --git a/types/ikuzzle.go b/types/ikuzzle.go index 7cac5c0c..152d65fa 100644 --- a/types/ikuzzle.go +++ b/types/ikuzzle.go @@ -6,4 +6,6 @@ type IKuzzle interface { SetJwt(string) RegisterSub(string, string, chan<- KuzzleNotification) UnregisterSub(string) + AddListener(event int, notifChan chan<- KuzzleNotification) + AutoResubscribe() bool } diff --git a/types/room.go b/types/room.go index cfa1c37c..85922209 100644 --- a/types/room.go +++ b/types/room.go @@ -3,7 +3,7 @@ package types import "sync" type SubscribeResponse struct { - Room IRoom + Room string Error error } From 60dc11daf68361f2ec9bb4a6d4aa6ca24d815210 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 26 Mar 2018 16:23:15 +0200 Subject: [PATCH 071/363] realtime.subscribe --- connection/connection.go | 4 +- connection/websocket/web_socket.go | 45 +++++----- internal/mock_connection.go | 8 +- internal/mock_room.go | 42 ---------- internal/wrappers/cgo/kuzzle/realtime.go | 2 +- internal/wrappers/cpp/kuzzle.cpp | 1 + internal/wrappers/cpp/realtime.cpp | 5 ++ internal/wrappers/headers/realtime.hpp | 1 + internal/wrappers/templates/java/core.i | 2 +- kuzzle/kuzzle.go | 30 +++---- kuzzle/kuzzle_test.go | 3 - realtime/join.go | 48 +---------- realtime/join_test.go | 13 +-- realtime/subscribe.go | 101 +++++++++-------------- realtime/subscribe_test.go | 41 +++++---- types/ikuzzle.go | 8 +- types/room.go | 22 ----- 17 files changed, 120 insertions(+), 256 deletions(-) delete mode 100644 internal/mock_room.go delete mode 100644 types/room.go diff --git a/connection/connection.go b/connection/connection.go index 25e846ce..6fefeedb 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -1,6 +1,7 @@ package connection import ( + "encoding/json" "time" "github.com/kuzzleio/sdk-go/types" @@ -17,10 +18,9 @@ type Connection interface { Close() error State() int EmitEvent(int, interface{}) - RegisterSub(string, string, chan<- types.KuzzleNotification) + RegisterSub(string, string, json.RawMessage, chan<- types.KuzzleNotification, chan<- interface{}) UnregisterSub(string) RequestHistory() map[string]time.Time - Rooms() *types.RoomList StartQueuing() StopQueuing() ReplayQueue() diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 08859b9f..bfcb1904 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -19,11 +19,12 @@ const ( ) type subscription struct { - roomID string - channel string - internalState int - subscribeResponseChannel chan<- types.SubscribeResponse - notificationChannel chan<- types.KuzzleNotification + roomID string + channel string + filters json.RawMessage + notificationChannel chan<- types.KuzzleNotification + onReconnectChannel chan<- interface{} + subscribeToSelf bool } type webSocket struct { @@ -34,7 +35,7 @@ type webSocket struct { listenChan chan []byte channelsResult sync.Map - subscriptions *types.RoomList + subscriptions sync.Map lastUrl string wasConnected bool eventListeners map[int]map[chan<- interface{}]bool @@ -81,7 +82,7 @@ func NewWebSocket(host string, options types.Options) connection.Connection { offlineQueue: []*types.QueryObject{}, queueMaxSize: opts.QueueMaxSize(), channelsResult: sync.Map{}, - subscriptions: &types.RoomList{}, + subscriptions: sync.Map{}, eventListeners: make(map[int]map[chan<- interface{}]bool), eventListenersOnce: make(map[int]map[chan<- interface{}]bool), requestHistory: make(map[string]time.Time), @@ -271,7 +272,7 @@ func (ws *webSocket) cleanQueue() { } } -func (ws *webSocket) RegisterSub(channel, roomID string, internalState int, notifChan chan<- types.KuzzleNotification, subChan chan<- types.SubscribeResponse) { +func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { subs, found := ws.subscriptions.Load(channel) if !found { @@ -280,17 +281,20 @@ func (ws *webSocket) RegisterSub(channel, roomID string, internalState int, noti } subs.(map[string]subscription)[roomID] = subscription{ - channel: channel, - roomID: roomID, - internalState: internalState, - notificationChannel: notifChan, - subscribeResponseChannel: subChan, + channel: channel, + roomID: roomID, + notificationChannel: notifChan, + onReconnectChannel: onReconnectChannel, + filters: filters, } } func (ws *webSocket) UnregisterSub(roomID string) { - _, ok := ws.subscriptions.Load(roomID) + s, ok := ws.subscriptions.Load(roomID) if ok { + for _, sub := range s.(map[string]subscription) { + close(sub.onReconnectChannel) + } ws.subscriptions.Delete(roomID) } } @@ -308,13 +312,12 @@ func (ws *webSocket) listen() { json.Unmarshal(msg, ¬ification) - for _, room := range s.(map[string]types.IRoom) { - channel := room.RealtimeChannel() - - if channel != nil && (!fromSelf || room.SubscribeToSelf()) { - channel <- notification + for _, sub := range s.(map[string]subscription) { + if sub.notificationChannel != nil && (!fromSelf || sub.subscribeToSelf) { + sub.notificationChannel <- notification } } + } else if c, found := ws.channelsResult.Load(message.RequestId); found { if message.Error != nil && message.Error.Message == "Token expired" { ws.EmitEvent(event.TokenExpired, nil) @@ -505,10 +508,6 @@ func (ws *webSocket) RequestHistory() map[string]time.Time { return ws.requestHistory } -func (ws *webSocket) Rooms() *types.RoomList { - return ws.subscriptions -} - func (ws *webSocket) AutoQueue() bool { return ws.autoQueue } diff --git a/internal/mock_connection.go b/internal/mock_connection.go index 5875fa71..40f9736f 100644 --- a/internal/mock_connection.go +++ b/internal/mock_connection.go @@ -1,6 +1,7 @@ package internal import ( + "encoding/json" "time" "github.com/kuzzleio/sdk-go/connection" @@ -14,7 +15,6 @@ type MockedConnection struct { mock.Mock MockSend func([]byte, types.QueryOptions) *types.KuzzleResponse MockEmitEvent func(int, interface{}) - MockGetRooms func() *types.RoomList MockAddListener func(int, chan<- interface{}) MockRemoveAllListeners func(int) MockRemoveListener func(int, chan<- interface{}) @@ -70,7 +70,7 @@ func (c *MockedConnection) EmitEvent(event int, arg interface{}) { } } -func (c *MockedConnection) RegisterSub(channel, roomID string, notifChan chan<- types.KuzzleNotification) { +func (c *MockedConnection) RegisterSub(channel, roomID string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChan chan<- interface{}) { } func (c *MockedConnection) UnregisterSub(roomID string) {} @@ -83,10 +83,6 @@ func (c *MockedConnection) RequestHistory() map[string]time.Time { func (c *MockedConnection) RenewSubscriptions() {} -func (c *MockedConnection) Rooms() *types.RoomList { - return c.MockGetRooms() -} - func (c *MockedConnection) StartQueuing() {} func (c *MockedConnection) StopQueuing() {} diff --git a/internal/mock_room.go b/internal/mock_room.go deleted file mode 100644 index 6c4ab387..00000000 --- a/internal/mock_room.go +++ /dev/null @@ -1,42 +0,0 @@ -package internal - -import "github.com/kuzzleio/sdk-go/types" - -type MockedRoom struct { - MockedSubscribe func() -} - -func (m MockedRoom) Subscribe(realtimeNotificationChannel chan<- *types.KuzzleNotification) { - m.MockedSubscribe() -} -func (m MockedRoom) Unsubscribe() error { - return nil -} - -func (m MockedRoom) GetRealtimeChannel() chan<- *types.KuzzleNotification { - return make(chan<- *types.KuzzleNotification) -} - -func (m MockedRoom) GetResponseChannel() chan<- *types.SubscribeResponse { - return make(chan<- *types.SubscribeResponse) -} - -func (m MockedRoom) RoomId() string { - return "" -} - -func (m MockedRoom) Filters() interface{} { - return nil -} - -func (m MockedRoom) Channel() string { - return "" -} - -func (m MockedRoom) Id() string { - return "" -} - -func (m MockedRoom) SubscribeToSelf() bool { - return true -} diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index fe2a1270..f96ef2c7 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -73,7 +73,7 @@ func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result //export kuzzle_realtime_subscribe func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback *C.callback, options *C.room_options) *C.string_result { - res, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), C.GoString(body), cToGoKuzzleNotificationChannel(callback), cToGoRoomOptions(options)) + res, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), cToGoKuzzleNotificationChannel(callback), cToGoRoomOptions(options)) return goToCStringResult(&res, err) } diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 8c8b3590..9a82af00 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -9,6 +9,7 @@ #include "auth.hpp" #include "index.hpp" #include "server.hpp" +#include "realtime.hpp" #include #include diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index 6d9cd175..b132a913 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -6,6 +6,11 @@ namespace kuzzleio { kuzzle_new_realtime(_realtime, kuzzle->_kuzzle); } + Realtime::Realtime(Kuzzle *kuzzle, realtime *realtime) { + _realtime = realtime; + kuzzle_new_realtime(_realtime, kuzzle->_kuzzle); + } + Realtime::~Realtime() { unregisterRealtime(_realtime); delete(_realtime); diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp index 3850f042..16417b24 100644 --- a/internal/wrappers/headers/realtime.hpp +++ b/internal/wrappers/headers/realtime.hpp @@ -11,6 +11,7 @@ namespace kuzzleio { public: Realtime(Kuzzle* kuzzle); + Realtime(Kuzzle* kuzzle, realtime* realtime); virtual ~Realtime(); int count(const std::string& index, const std::string collection, const std::string roomId) Kuz_Throw_KuzzleException; void join(const std::string& index, const std::string collection, const std::string roomId, callback cb) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index e9b22566..612891cd 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -142,7 +142,7 @@ struct json_object { }; %include "kuzzle.cpp" %include "collection.cpp" %include "document.cpp" -%include "realtime.hpp" +%include "realtime.cpp" %include "auth.cpp" %include "index.cpp" %include "server.cpp" diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index ef349dbb..abfbcdf1 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -2,7 +2,7 @@ package kuzzle import ( - "sync" + "encoding/json" "time" "github.com/kuzzleio/sdk-go/auth" @@ -131,22 +131,22 @@ func (k *Kuzzle) SetJwt(token string) { func (k *Kuzzle) UnsetJwt() { k.jwt = "" - rooms := k.socket.Rooms() - if rooms != nil { - k.socket.Rooms().Range(func(key, value interface{}) bool { - value.(*sync.Map).Range(func(key, value interface{}) bool { - room := value.(types.IRoom) - room.Subscribe(room.RealtimeChannel()) - return true - }) - - return true - }) - } + // rooms := k.socket.Rooms() + // if rooms != nil { + // k.socket.Rooms().Range(func(key, value interface{}) bool { + // value.(*sync.Map).Range(func(key, value interface{}) bool { + // room := value.(types.IRoom) + // room.Subscribe(room.RealtimeChannel()) + // return true + // }) + + // return true + // }) + // } } -func (k *Kuzzle) RegisterSub(channel, roomId string, notifChan chan<- types.KuzzleNotification) { - k.socket.RegisterSub(channel, roomId, notifChan) +func (k *Kuzzle) RegisterSub(channel, roomId string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { + k.socket.RegisterSub(channel, roomId, filters, notifChan, onReconnectChannel) } func (k *Kuzzle) UnregisterSub(roomId string) { diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index cc8557bf..c4f290f0 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -61,9 +61,6 @@ func TestUnsetJwt(t *testing.T) { return &types.KuzzleResponse{Result: marsh} }, - MockGetRooms: func() *types.RoomList { - return nil - }, } k, _ = kuzzle.NewKuzzle(c, nil) diff --git a/realtime/join.go b/realtime/join.go index 35145934..52a60f31 100644 --- a/realtime/join.go +++ b/realtime/join.go @@ -1,56 +1,10 @@ package realtime import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" ) // Join permits to join a previously created subscription func (r *Realtime) Join(index, collection, roomID string, cb chan<- types.KuzzleNotification) error { - if (index == "" || collection == "") || roomID == "" { - return types.NewError("Realtime.Join: index, collection and roomID required", 400) - } - - type SubResult struct { - Error error - } - - result := make(chan *types.KuzzleResponse) - queryResult := make(chan SubResult) - - go func() { - query := &types.KuzzleRequest{ - Controller: "realtime", - Action: "join", - Index: index, - Collection: collection, - Body: struct { - RoomID string `json:"roomID"` - }{roomID}, - } - - go r.k.Query(query, nil, result) - - res := <-result - if res.Error != nil { - queryResult <- SubResult{Error: res.Error} - return - } - - var resSub struct { - RoomID string `json:"roomId"` - Channel string `json:"channel"` - } - - json.Unmarshal(res.Result, &resSub) - queryResult <- SubResult{Error: res.Error} - - r.k.RegisterSub(resSub.Channel, resSub.RoomID, cb) - return - }() - - res := <-queryResult - - return res.Error + return nil } diff --git a/realtime/join_test.go b/realtime/join_test.go index 9b2d8c30..9318bb39 100644 --- a/realtime/join_test.go +++ b/realtime/join_test.go @@ -1,16 +1,6 @@ package realtime_test -import ( - "encoding/json" - "testing" - - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/realtime" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - +/* func TestJoinIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) @@ -76,3 +66,4 @@ func TestJoin(t *testing.T) { err := nr.Join("index", "collection", "body", nil) assert.Nil(t, err) } +*/ diff --git a/realtime/subscribe.go b/realtime/subscribe.go index 81e78332..df2e018b 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -8,86 +8,59 @@ import ( ) // Subscribe permits to join a previously created subscription -func (r *Realtime) Subscribe(index, collection, body string, cb chan<- types.KuzzleNotification, options types.RoomOptions) (string, error) { - if (index == "" || collection == "") || (body == "" || cb == nil) { - return "", types.NewError("Realtime.Subscribe: index, collection, body and notificationChannel required", 400) +func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, cb chan<- types.KuzzleNotification, options types.RoomOptions) (string, error) { + if (index == "" || collection == "") || (filters == nil || cb == nil) { + return "", types.NewError("Realtime.Subscribe: index, collection, filters and notificationChannel required", 400) } - if r.k.InternalState() == internalState.active { - if room.SubscribeResponseChan != nil { - room.SubscribeResponseChan <- types.SubscribeResponse{Room: room} - } - return room.roomId, nil - } + result := make(chan *types.KuzzleResponse) - if room.internalState == subscribing { - return room.id, nil + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "subscribe", + Index: index, + Collection: collection, + Body: filters, } - queryResult := make(chan types.SubscribeResponse) - - go func() { - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "realtime", - Action: "subscribe", - Index: index, - Collection: collection, - Body: body, - } - - opts := types.NewQueryOptions() + opts := types.NewQueryOptions() - if options != nil { - query.Users = options.Users() - query.State = options.State() - query.Scope = options.Scope() - - opts.SetVolatile(options.Volatile()) - } + if options != nil { + query.Users = options.Users() + query.State = options.State() + query.Scope = options.Scope() - go r.k.Query(query, opts, result) + opts.SetVolatile(options.Volatile()) + } - res := <-result - if res.Error != nil { - queryResult <- types.SubscribeResponse{Room: "", Error: res.Error} - return - } + go r.k.Query(query, opts, result) - var resSub struct { - RequestID string `json:"requestId"` - RoomID string `json:"roomId"` - Channel string `json:"channel"` - } + res := <-result + if res.Error != nil { + return "", res.Error + } - json.Unmarshal(res.Result, &resSub) - queryResult <- types.SubscribeResponse{Room: resSub.RoomID, Error: res.Error} + var resSub struct { + RequestID string `json:"requestId"` + RoomID string `json:"roomId"` + Channel string `json:"channel"` + } - r.k.RegisterSub(resSub.Channel, resSub.RoomID, cb) + json.Unmarshal(res.Result, &resSub) - go func() { - <-room.OnDisconnect - r.k.SetInternalState(resSub.Channel, resSub.RoomID, inactive) + onReconnect := make(chan interface{}) - }() - go func() { - <-room.OnTokenExpired - }() - go func() { - <-room.OnReconnect + r.k.RegisterSub(resSub.Channel, resSub.RoomID, filters, cb, onReconnect) - if r.k.AutoResubscribe() { - r.Subscribe(index, collection, body, cb, options) - } - }() + go func() { + <-onReconnect - r.k.AddListener(event.Disconnected, cb) - r.k.AddListener(event.TokenExpired, cb) - r.k.AddListener(event.Reconnected, cb) + if r.k.AutoResubscribe() { + go r.k.Query(query, opts, result) + } }() - res := <-queryResult + r.k.AddListener(event.Reconnected, onReconnect) - return res.Result, res.Error + return resSub.RoomID, nil } diff --git a/realtime/subscribe_test.go b/realtime/subscribe_test.go index d4c6c728..04264e51 100644 --- a/realtime/subscribe_test.go +++ b/realtime/subscribe_test.go @@ -1,6 +1,7 @@ package realtime_test import ( + "encoding/json" "testing" "github.com/kuzzleio/sdk-go/internal" @@ -16,7 +17,7 @@ func TestSubscribeIndexNull(t *testing.T) { nr := realtime.NewRealtime(k) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("", "collection", "body", notifChan, nil) + _, err := nr.Subscribe("", "collection", json.RawMessage("filters"), notifChan, nil) assert.NotNil(t, err) } @@ -26,26 +27,32 @@ func TestSubscribeCollectionNull(t *testing.T) { nr := realtime.NewRealtime(k) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("index", "", "body", notifChan, nil) + _, err := nr.Subscribe("index", "", json.RawMessage("filters"), notifChan, nil) assert.NotNil(t, err) } -func TestSubscribeBodyNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - nr := realtime.NewRealtime(k) +func TestSubscribeNotifChannelNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) - notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("index", "collection", "", notifChan, nil) + assert.Equal(t, "realtime", parsedQuery.Controller) + assert.Equal(t, "publish", parsedQuery.Action) + assert.Equal(t, "index", parsedQuery.Index) + assert.Equal(t, "collection", parsedQuery.Collection) + assert.NotNil(t, parsedQuery.Body) - assert.NotNil(t, err) -} + res := types.KuzzleResponse{Result: []byte(`{}`)} -func TestSubscribeNotifChannelNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + r, _ := json.Marshal(res.Result) + return &types.KuzzleResponse{Result: r} + }, + }, nil) nr := realtime.NewRealtime(k) - _, err := nr.Subscribe("index", "collection", "body", nil, nil) + _, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), nil, nil) assert.NotNil(t, err) } @@ -63,7 +70,7 @@ func TestSubscribeQueryError(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("index", "collection", "body", notifChan, nil) + _, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) assert.Equal(t, "ah!", err.Error()) } @@ -81,7 +88,7 @@ func TestRenewWithSubscribeToSelf(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - res, err := nr.Subscribe("index", "collection", "body", notifChan, nil) + res, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) assert.Nil(t, err) assert.NotNil(t, res) assert.Equal(t, "42", res) @@ -101,7 +108,7 @@ func TestRoomSubscribe(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - res, err := nr.Subscribe("index", "collection", "body", notifChan, nil) + res, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) assert.Nil(t, err) assert.NotNil(t, res) assert.Equal(t, "42", res) @@ -122,7 +129,7 @@ func TestRoomSubscribeNotConnected(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("collection", "index", "roomdId", notifChan, nil) + _, err := nr.Subscribe("collection", "index", json.RawMessage(""), notifChan, nil) assert.NotNil(t, err) assert.Equal(t, "Not Connected", err.Error()) } @@ -139,5 +146,5 @@ func ExampleRealtime_Subscribe() { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - nr.Subscribe("collection", "index", "roomdId", notifChan, nil) + nr.Subscribe("collection", "index", json.RawMessage(""), notifChan, nil) } diff --git a/types/ikuzzle.go b/types/ikuzzle.go index 152d65fa..641919b9 100644 --- a/types/ikuzzle.go +++ b/types/ikuzzle.go @@ -1,11 +1,15 @@ package types +import ( + "encoding/json" +) + type IKuzzle interface { Query(query *KuzzleRequest, options QueryOptions, responseChannel chan<- *KuzzleResponse) EmitEvent(int, interface{}) SetJwt(string) - RegisterSub(string, string, chan<- KuzzleNotification) + RegisterSub(string, string, json.RawMessage, chan<- KuzzleNotification, chan<- interface{}) UnregisterSub(string) - AddListener(event int, notifChan chan<- KuzzleNotification) + AddListener(event int, notifChan chan<- interface{}) AutoResubscribe() bool } diff --git a/types/room.go b/types/room.go deleted file mode 100644 index 85922209..00000000 --- a/types/room.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -import "sync" - -type SubscribeResponse struct { - Room string - Error error -} - -type IRoom interface { - Subscribe(realtimeNotificationChannel chan<- KuzzleNotification) - Unsubscribe() error - RealtimeChannel() chan<- KuzzleNotification - ResponseChannel() chan SubscribeResponse - RoomId() string - Filters() interface{} - Channel() string - Id() string - SubscribeToSelf() bool -} - -type RoomList = sync.Map From 94d5e493b4d0feade69cb8a750410e942dfa3900 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 27 Mar 2018 10:14:22 +0200 Subject: [PATCH 072/363] realtime.join --- internal/wrappers/cgo/kuzzle/realtime.go | 4 +- internal/wrappers/cpp/realtime.cpp | 4 +- internal/wrappers/headers/realtime.hpp | 2 +- realtime/join.go | 62 +++++++++++++++++++++++- realtime/join_test.go | 36 +++++++++++--- 5 files changed, 94 insertions(+), 14 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index f96ef2c7..ef74a2a6 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -78,8 +78,8 @@ func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, } //export kuzzle_realtime_join -func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, callback *C.callback) *C.void_result { - err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), cToGoKuzzleNotificationChannel(callback)) +func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, options *C.room_options, callback *C.callback) *C.void_result { + err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), cToGoRoomOptions(options), cToGoKuzzleNotificationChannel(callback)) return goToCVoidResult(err) } diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index b132a913..cef52985 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -25,8 +25,8 @@ namespace kuzzleio { return ret; } - void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, callback cb) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), cb); + void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, callback cb) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), options, cb); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp index 16417b24..40d6c1a9 100644 --- a/internal/wrappers/headers/realtime.hpp +++ b/internal/wrappers/headers/realtime.hpp @@ -14,7 +14,7 @@ namespace kuzzleio { Realtime(Kuzzle* kuzzle, realtime* realtime); virtual ~Realtime(); int count(const std::string& index, const std::string collection, const std::string roomId) Kuz_Throw_KuzzleException; - void join(const std::string& index, const std::string collection, const std::string roomId, callback cb) Kuz_Throw_KuzzleException; + void join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, callback cb) Kuz_Throw_KuzzleException; std::string list(const std::string& index, const std::string collection) Kuz_Throw_KuzzleException; void publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; std::string subscribe(const std::string& index, const std::string collection, const std::string body, callback cb, room_options* options) Kuz_Throw_KuzzleException; diff --git a/realtime/join.go b/realtime/join.go index 52a60f31..80082ad8 100644 --- a/realtime/join.go +++ b/realtime/join.go @@ -1,10 +1,70 @@ package realtime import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/types" ) // Join permits to join a previously created subscription -func (r *Realtime) Join(index, collection, roomID string, cb chan<- types.KuzzleNotification) error { +func (r *Realtime) Join(index, collection, roomID string, options types.RoomOptions, cb chan<- types.KuzzleNotification) error { + if (index == "" || collection == "" || roomID == "") || (cb == nil) { + return types.NewError("Realtime.Subscribe: index, collection, filters and notificationChannel required", 400) + } + + result := make(chan *types.KuzzleResponse) + + type body struct { + RoomId string `json:"roomId"` + } + + query := &types.KuzzleRequest{ + Controller: "realtime", + Action: "join", + Index: index, + Collection: collection, + Body: body{roomID}, + } + + opts := types.NewQueryOptions() + + if options != nil { + query.Users = options.Users() + query.State = options.State() + query.Scope = options.Scope() + + opts.SetVolatile(options.Volatile()) + } + + go r.k.Query(query, opts, result) + + res := <-result + if res.Error != nil { + return res.Error + } + + var resSub struct { + RequestID string `json:"requestId"` + RoomID string `json:"roomId"` + Channel string `json:"channel"` + } + + json.Unmarshal(res.Result, &resSub) + + onReconnect := make(chan interface{}) + + r.k.RegisterSub(resSub.Channel, resSub.RoomID, nil, cb, onReconnect) + + go func() { + <-onReconnect + + if r.k.AutoResubscribe() { + go r.k.Query(query, opts, result) + } + }() + + r.k.AddListener(event.Reconnected, onReconnect) + return nil } diff --git a/realtime/join_test.go b/realtime/join_test.go index 9318bb39..b78039e3 100644 --- a/realtime/join_test.go +++ b/realtime/join_test.go @@ -1,11 +1,21 @@ package realtime_test -/* +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + func TestJoinIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - err := nr.Join("", "collection", "body", nil) + err := nr.Join("", "collection", "roomId", nil, make(chan<- types.KuzzleNotification)) assert.NotNil(t, err) } @@ -14,16 +24,25 @@ func TestJoinCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - err := nr.Join("index", "", "body", nil) + err := nr.Join("index", "", "roomId", nil, make(chan<- types.KuzzleNotification)) assert.NotNil(t, err) } -func TestJoinBodyNull(t *testing.T) { +func TestJoinRoomIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - err := nr.Join("index", "collection", "", nil) + err := nr.Join("index", "collection", "", nil, make(chan<- types.KuzzleNotification)) + + assert.NotNil(t, err) +} + +func TestJoinChanNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + nr := realtime.NewRealtime(k) + + err := nr.Join("index", "collection", "roomId", nil, nil) assert.NotNil(t, err) } @@ -37,7 +56,8 @@ func TestJoinError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nr := realtime.NewRealtime(k) - err := nr.Join("index", "collection", "body", nil) + err := nr.Join("index", "collection", "roomId", nil, make(chan<- types.KuzzleNotification)) + assert.NotNil(t, err) } @@ -63,7 +83,7 @@ func TestJoin(t *testing.T) { nr := realtime.NewRealtime(k) - err := nr.Join("index", "collection", "body", nil) + err := nr.Join("index", "collection", "roomId", nil, make(chan<- types.KuzzleNotification)) + assert.Nil(t, err) } -*/ From 4683c2bac6412bc1610f2f8f92bc4d4cfcf57da3 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 27 Mar 2018 11:00:31 +0200 Subject: [PATCH 073/363] cancel subscriptions on unsetJWT --- connection/connection.go | 1 + connection/websocket/web_socket.go | 12 ++++++++++++ kuzzle/kuzzle.go | 1 + 3 files changed, 14 insertions(+) diff --git a/connection/connection.go b/connection/connection.go index 6fefeedb..70d3ebd5 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -20,6 +20,7 @@ type Connection interface { EmitEvent(int, interface{}) RegisterSub(string, string, json.RawMessage, chan<- types.KuzzleNotification, chan<- interface{}) UnregisterSub(string) + CancelSubs() RequestHistory() map[string]time.Time StartQueuing() StopQueuing() diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index bfcb1904..476c7f98 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -299,6 +299,18 @@ func (ws *webSocket) UnregisterSub(roomID string) { } } +func (ws *webSocket) CancelSubs() { + ws.subscriptions.Range(func(roomId, s interface{}) bool { + for _, sub := range s.(map[string]subscription) { + if sub.notificationChannel != nil { + close(sub.onReconnectChannel) + } + ws.subscriptions.Delete(roomId) + } + return true + }) +} + func (ws *webSocket) listen() { for { msg := <-ws.listenChan diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index abfbcdf1..f8833ac4 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -131,6 +131,7 @@ func (k *Kuzzle) SetJwt(token string) { func (k *Kuzzle) UnsetJwt() { k.jwt = "" + k.socket.CancelSubs() // rooms := k.socket.Rooms() // if rooms != nil { // k.socket.Rooms().Range(func(key, value interface{}) bool { From 974ef36604cc69471d62a31f8fce2b46ae439190 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 27 Mar 2018 11:09:41 +0200 Subject: [PATCH 074/363] remove comment --- kuzzle/kuzzle.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index f8833ac4..b89a3bb3 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -132,18 +132,6 @@ func (k *Kuzzle) UnsetJwt() { k.jwt = "" k.socket.CancelSubs() - // rooms := k.socket.Rooms() - // if rooms != nil { - // k.socket.Rooms().Range(func(key, value interface{}) bool { - // value.(*sync.Map).Range(func(key, value interface{}) bool { - // room := value.(types.IRoom) - // room.Subscribe(room.RealtimeChannel()) - // return true - // }) - - // return true - // }) - // } } func (k *Kuzzle) RegisterSub(channel, roomId string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { From cc45b4c5e4e4057a0e1f07669a87934ebb1cfe1a Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 27 Mar 2018 12:17:17 +0200 Subject: [PATCH 075/363] add mock for CancelSubs --- internal/mock_connection.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/mock_connection.go b/internal/mock_connection.go index 40f9736f..7cead302 100644 --- a/internal/mock_connection.go +++ b/internal/mock_connection.go @@ -73,6 +73,8 @@ func (c *MockedConnection) EmitEvent(event int, arg interface{}) { func (c *MockedConnection) RegisterSub(channel, roomID string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChan chan<- interface{}) { } +func (c *MockedConnection) CancelSubs() {} + func (c *MockedConnection) UnregisterSub(roomID string) {} func (c *MockedConnection) RequestHistory() map[string]time.Time { From 8d5d96818ed373686751812a0f8cbcf82950b752 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Mon, 26 Mar 2018 11:26:15 +0200 Subject: [PATCH 076/363] All functions implemented and tested in Golang --- internal/wrappers/cgo/kuzzle/security.go | 54 +- kuzzle/kuzzle.go | 2 +- security/createCredentials.go | 33 + security/createCredentials_test.go | 63 ++ security/createFirstAdmin.go | 36 + security/createFirstAdmin_test.go | 49 ++ security/createOrReplaceProfile.go | 36 + security/createOrReplaceProfile_test.go | 56 ++ security/createOrReplaceRole.go | 36 + security/createOrReplaceRole_test.go | 57 ++ security/createProfile.go | 36 + security/createProfile_test.go | 63 ++ security/createRestrictedUser.go | 35 + security/createRestrictedUser_test.go | 49 ++ security/createRole.go | 36 + security/createRole_test.go | 56 ++ security/createUser.go | 31 + security/createUser_test.go | 49 ++ security/deleteCredentials.go | 30 + security/deleteCredentials_test.go | 56 ++ security/deleteProfile.go | 37 + security/deleteProfile_test.go | 50 ++ security/deleteRole.go | 37 + security/deleteRole_test.go | 50 ++ security/deleteUser.go | 37 + security/deleteUser_test.go | 50 ++ security/fetch_profile.go | 19 - security/fetch_role.go | 19 - security/fetch_user.go | 19 - ...al_fields.go => getAllCredentialFields.go} | 8 +- ...test.go => getAllCredentialFields_test.go} | 9 +- ...ntial_fields.go => getCredentialFields.go} | 8 +- ...ds_test.go => getCredentialFields_test.go} | 7 +- security/getCredentials.go | 31 + security/getCredentialsById.go | 32 + security/getCredentialsById_test.go | 56 ++ security/getCredentials_test.go | 56 ++ security/getProfile.go | 34 + .../{raw_fetch.go => getProfileMapping.go} | 12 +- security/getProfileMapping_test.go | 42 + security/getProfileRights.go | 31 + security/getProfileRights_test.go | 49 ++ ...tch_profile_test.go => getProfile_test.go} | 39 +- security/getRole.go | 33 + security/{raw_scroll.go => getRoleMapping.go} | 13 +- security/getRoleMapping_test.go | 42 + .../{fetch_role_test.go => getRole_test.go} | 14 +- security/getUser.go | 33 + security/getUserMapping.go | 26 + security/getUserMapping_test.go | 42 + security/getUserRights.go | 31 + security/getUserRights_test.go | 49 ++ .../{fetch_user_test.go => getUser_test.go} | 13 +- security/hasCredentials.go | 35 + security/hasCredentials_test.go | 67 ++ security/is_action_allowed_test.go | 2 +- security/json_profile.go | 2 +- security/mDeleteCredentials.go | 37 + security/mDeleteCredentials_test.go | 49 ++ security/mDeleteRoles.go | 37 + security/mDeleteRoles_test.go | 49 ++ security/mDeleteUsers.go | 37 + security/mDeleteUsers_test.go | 49 ++ security/mGetProfiles.go | 42 + security/mGetProfiles_test.go | 90 +++ security/mGetRoles.go | 42 + security/mGetRoles_test.go | 89 +++ security/new_profile.go | 11 - security/new_role.go | 15 - security/new_user.go | 19 - security/profile.go | 70 +- security/profile_test.go | 287 ------- security/raw_delete.go | 33 - security/raw_search.go | 35 - security/replaceUser.go | 36 + security/replaceUser_test.go | 65 ++ security/role.go | 65 +- security/role_test.go | 229 ------ security/scroll_profiles.go | 30 - security/scroll_users.go | 28 - security/searchProfiles.go | 50 ++ ...rofiles_test.go => searchProfiles_test.go} | 62 +- security/searchRoles.go | 47 ++ ...arch_roles_test.go => searchRoles_test.go} | 8 +- security/searchUsers.go | 49 ++ ...arch_users_test.go => searchUsers_test.go} | 71 +- security/search_profiles.go | 29 - security/search_roles.go | 27 - security/search_users.go | 28 - security/security.go | 2 +- security/updateCredentials.go | 31 + ...ials_test.go => updateCredentials_test.go} | 33 +- security/updateProfile.go | 34 + security/updateProfileMapping.go | 28 + security/updateProfileMapping_test.go | 49 ++ security/updateProfile_test.go | 64 ++ security/updateRole.go | 34 + security/updateRoleMapping.go | 28 + security/updateRoleMapping_test.go | 49 ++ security/updateRole_test.go | 64 ++ security/updateUser.go | 34 + security/updateUserMapping.go | 28 + security/updateUserMapping_test.go | 49 ++ security/updateUser_test.go | 64 ++ security/update_credentials.go | 40 - security/user.go | 207 +---- security/user_test.go | 746 ------------------ ..._credentials.go => validateCredentials.go} | 5 +- ...ls_test.go => validateCredentials_test.go} | 23 +- types/kuzzle_request.go | 1 + types/query_options.go | 12 + 111 files changed, 3225 insertions(+), 2212 deletions(-) create mode 100644 security/createCredentials.go create mode 100644 security/createCredentials_test.go create mode 100644 security/createFirstAdmin.go create mode 100644 security/createFirstAdmin_test.go create mode 100644 security/createOrReplaceProfile.go create mode 100644 security/createOrReplaceProfile_test.go create mode 100644 security/createOrReplaceRole.go create mode 100644 security/createOrReplaceRole_test.go create mode 100644 security/createProfile.go create mode 100644 security/createProfile_test.go create mode 100644 security/createRestrictedUser.go create mode 100644 security/createRestrictedUser_test.go create mode 100644 security/createRole.go create mode 100644 security/createRole_test.go create mode 100644 security/createUser.go create mode 100644 security/createUser_test.go create mode 100644 security/deleteCredentials.go create mode 100644 security/deleteCredentials_test.go create mode 100644 security/deleteProfile.go create mode 100644 security/deleteProfile_test.go create mode 100644 security/deleteRole.go create mode 100644 security/deleteRole_test.go create mode 100644 security/deleteUser.go create mode 100644 security/deleteUser_test.go delete mode 100644 security/fetch_profile.go delete mode 100644 security/fetch_role.go delete mode 100644 security/fetch_user.go rename security/{get_all_credential_fields.go => getAllCredentialFields.go} (74%) rename security/{get_all_credential_fields_test.go => getAllCredentialFields_test.go} (93%) rename security/{get_credential_fields.go => getCredentialFields.go} (75%) rename security/{get_credential_fields_test.go => getCredentialFields_test.go} (96%) create mode 100644 security/getCredentials.go create mode 100644 security/getCredentialsById.go create mode 100644 security/getCredentialsById_test.go create mode 100644 security/getCredentials_test.go create mode 100644 security/getProfile.go rename security/{raw_fetch.go => getProfileMapping.go} (56%) create mode 100644 security/getProfileMapping_test.go create mode 100644 security/getProfileRights.go create mode 100644 security/getProfileRights_test.go rename security/{fetch_profile_test.go => getProfile_test.go} (63%) create mode 100644 security/getRole.go rename security/{raw_scroll.go => getRoleMapping.go} (53%) create mode 100644 security/getRoleMapping_test.go rename security/{fetch_role_test.go => getRole_test.go} (87%) create mode 100644 security/getUser.go create mode 100644 security/getUserMapping.go create mode 100644 security/getUserMapping_test.go create mode 100644 security/getUserRights.go create mode 100644 security/getUserRights_test.go rename security/{fetch_user_test.go => getUser_test.go} (89%) create mode 100644 security/hasCredentials.go create mode 100644 security/hasCredentials_test.go create mode 100644 security/mDeleteCredentials.go create mode 100644 security/mDeleteCredentials_test.go create mode 100644 security/mDeleteRoles.go create mode 100644 security/mDeleteRoles_test.go create mode 100644 security/mDeleteUsers.go create mode 100644 security/mDeleteUsers_test.go create mode 100644 security/mGetProfiles.go create mode 100644 security/mGetProfiles_test.go create mode 100644 security/mGetRoles.go create mode 100644 security/mGetRoles_test.go delete mode 100644 security/new_profile.go delete mode 100644 security/new_role.go delete mode 100644 security/new_user.go delete mode 100644 security/profile_test.go delete mode 100644 security/raw_delete.go delete mode 100644 security/raw_search.go create mode 100644 security/replaceUser.go create mode 100644 security/replaceUser_test.go delete mode 100644 security/role_test.go delete mode 100644 security/scroll_profiles.go delete mode 100644 security/scroll_users.go create mode 100644 security/searchProfiles.go rename security/{search_profiles_test.go => searchProfiles_test.go} (58%) create mode 100644 security/searchRoles.go rename security/{search_roles_test.go => searchRoles_test.go} (93%) create mode 100644 security/searchUsers.go rename security/{search_users_test.go => searchUsers_test.go} (54%) delete mode 100644 security/search_profiles.go delete mode 100644 security/search_roles.go delete mode 100644 security/search_users.go create mode 100644 security/updateCredentials.go rename security/{update_credentials_test.go => updateCredentials_test.go} (71%) create mode 100644 security/updateProfile.go create mode 100644 security/updateProfileMapping.go create mode 100644 security/updateProfileMapping_test.go create mode 100644 security/updateProfile_test.go create mode 100644 security/updateRole.go create mode 100644 security/updateRoleMapping.go create mode 100644 security/updateRoleMapping_test.go create mode 100644 security/updateRole_test.go create mode 100644 security/updateUser.go create mode 100644 security/updateUserMapping.go create mode 100644 security/updateUserMapping_test.go create mode 100644 security/updateUser_test.go delete mode 100644 security/update_credentials.go delete mode 100644 security/user_test.go rename security/{validate_credentials.go => validateCredentials.go} (89%) rename security/{validate_credentials_test.go => validateCredentials_test.go} (78%) diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index eb5d7fbf..af84459e 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -10,10 +10,11 @@ package main import "C" import ( + "unsafe" + "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" - "unsafe" ) // --- profile @@ -64,7 +65,7 @@ func kuzzle_security_fetch_profile(k *C.kuzzle, id *C.char, o *C.query_options) result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) options := SetQueryOptions(o) - profile, err := (*kuzzle.Kuzzle)(k.instance).Security.FetchProfile(C.GoString(id), options) + profile, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfile(C.GoString(id), options) if err != nil { Set_profile_result_error(result, err) return result @@ -75,18 +76,10 @@ func kuzzle_security_fetch_profile(k *C.kuzzle, id *C.char, o *C.query_options) return result } -//export kuzzle_security_scroll_profiles -func kuzzle_security_scroll_profiles(k *C.kuzzle, s *C.char, o *C.query_options) *C.search_profiles_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.ScrollProfiles(C.GoString(s), options) - - return goToCProfileSearchResult(k, res, err) -} - //export kuzzle_security_search_profiles -func kuzzle_security_search_profiles(k *C.kuzzle, f *C.search_filters, o *C.query_options) *C.search_profiles_result { +func kuzzle_security_search_profiles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_profiles_result { options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchProfiles(cToGoSearchFilters(f), options) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchProfiles(C.GoString(body), options) return goToCProfileSearchResult(k, res, err) } @@ -100,21 +93,19 @@ func kuzzle_security_profile_add_policy(p *C.profile, policy *C.policy) *C.profi } //export kuzzle_security_profile_delete -func kuzzle_security_profile_delete(p *C.profile, o *C.query_options) *C.string_result { +func kuzzle_security_profile_delete(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { options := SetQueryOptions(o) - profile := cToGoProfile(p) - - res, err := profile.Delete(options) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteProfile(C.GoString(id), options) return goToCStringResult(&res, err) } -//export kuzzle_security_profile_save -func kuzzle_security_profile_save(p *C.profile, o *C.query_options) *C.profile_result { +//export kuzzle_security_profile_create +func kuzzle_security_profile_create(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.profile_result { options := SetQueryOptions(o) - res, err := cToGoProfile(p).Save(options) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateProfile(C.GoString(id), C.GoString(body), options) - return goToCProfileResult(p.kuzzle, res, err) + return goToCProfileResult(k, res, err) } // --- role @@ -145,12 +136,12 @@ func kuzzle_security_destroy_role(r *C.role) { C.free(unsafe.Pointer(r)) } -//export kuzzle_security_fetch_role -func kuzzle_security_fetch_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.role_result { +//export kuzzle_security_get_role +func kuzzle_security_get_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.role_result { result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) options := SetQueryOptions(o) - role, err := (*kuzzle.Kuzzle)(k.instance).Security.FetchRole(C.GoString(id), options) + role, err := (*kuzzle.Kuzzle)(k.instance).Security.GetRole(C.GoString(id), options) if err != nil { Set_role_result_error(result, err) return result @@ -162,24 +153,17 @@ func kuzzle_security_fetch_role(k *C.kuzzle, id *C.char, o *C.query_options) *C. } //export kuzzle_security_search_roles -func kuzzle_security_search_roles(k *C.kuzzle, f *C.search_filters, o *C.query_options) *C.search_roles_result { +func kuzzle_security_search_roles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_roles_result { options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchRoles(cToGoSearchFilters(f), options) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchRoles(C.GoString(body), options) return goToCRoleSearchResult(k, res, err) } //export kuzzle_security_role_delete -func kuzzle_security_role_delete(r *C.role, o *C.query_options) *C.string_result { - result := (*C.string_result)(C.calloc(1, C.sizeof_string_result)) - opts := SetQueryOptions(o) - - role, err := cToGoRole(r) - if err != nil { - Set_string_result_error(result, err) - return result - } - res, err := role.Delete(opts) +func kuzzle_security_role_delete(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { + options := SetQueryOptions(o) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteRole(C.GoString(id), options) return goToCStringResult(&res, err) } diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index 6be7e1aa..bc010427 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -59,7 +59,7 @@ func NewKuzzle(c connection.Connection, options types.Options) (*Kuzzle, error) k.RequestHistory = k.socket.RequestHistory() k.MemoryStorage = &ms.Ms{k} - k.Security = &security.Security{k} + k.Security = security.NewSecurity(k) k.Auth = auth.NewAuth(k) k.RequestHistory = k.socket.RequestHistory() diff --git a/security/createCredentials.go b/security/createCredentials.go new file mode 100644 index 00000000..4e6cc8d3 --- /dev/null +++ b/security/createCredentials.go @@ -0,0 +1,33 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// CreateCredentials create credentials of the specified strategy with given body infos. +func (s *Security) CreateCredentials(strategy, id, body string, options types.QueryOptions) (json.RawMessage, error) { + if strategy == "" || id == "" || body == "" { + return nil, types.NewError("Kuzzle.CreateCredentials: strategy, id and body are required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "createCredentials", + Id: id, + Strategy: strategy, + Body: body, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/createCredentials_test.go b/security/createCredentials_test.go new file mode 100644 index 00000000..67ab83ca --- /dev/null +++ b/security/createCredentials_test.go @@ -0,0 +1,63 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateCredentialsStrategyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateCredentials("", "userid", "myCredentials", nil) + assert.Error(t, err) +} + +func TestCreateCredentialsIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateCredentials("strategy", "", "myCredentials", nil) + assert.Error(t, err) +} + +func TestCreateCredentialsBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateCredentials("strategy", "userId", "", nil) + assert.Error(t, err) +} + +func TestCreateCredentialsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.CreateCredentials("strategy", "userId", "body", nil) + assert.NotNil(t, err) +} + +func TestCreateCredentials(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "createCredentials", parsedQuery.Action) + assert.Equal(t, "strategy", parsedQuery.Strategy) + assert.Equal(t, "userid", parsedQuery.Id) + assert.Equal(t, "myCredentials", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte{}} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.CreateCredentials("strategy", "userid", "myCredentials", nil) + + assert.Nil(t, err) +} diff --git a/security/createFirstAdmin.go b/security/createFirstAdmin.go new file mode 100644 index 00000000..b255089a --- /dev/null +++ b/security/createFirstAdmin.go @@ -0,0 +1,36 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// CreateFirstAdmin create credentials of the specified strategy with given body infos. +func (s *Security) CreateFirstAdmin(body string, options types.QueryOptions) (json.RawMessage, error) { + if body == "" { + return nil, types.NewError("Kuzzle.CreateFirstAdmin: strategy, id and body are required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "createFirstAdmin", + Body: body, + } + + if options != nil { + query.Id = options.ID() + query.Reset = options.Reset() + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/createFirstAdmin_test.go b/security/createFirstAdmin_test.go new file mode 100644 index 00000000..9fde4b39 --- /dev/null +++ b/security/createFirstAdmin_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateFirstAdminBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateFirstAdmin("", nil) + assert.Error(t, err) +} + +func TestCreateFirstAdminError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.CreateFirstAdmin("body", nil) + assert.NotNil(t, err) +} + +func TestCreateFirstAdmin(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "createFirstAdmin", parsedQuery.Action) + assert.Equal(t, "myFirstAdmin", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte{}} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.CreateFirstAdmin("myFirstAdmin", nil) + + assert.Nil(t, err) +} diff --git a/security/createOrReplaceProfile.go b/security/createOrReplaceProfile.go new file mode 100644 index 00000000..9d33e65e --- /dev/null +++ b/security/createOrReplaceProfile.go @@ -0,0 +1,36 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// CreateOrReplaceProfile creates or replaces (if _id matches an existing one) a profile with a list of policies. +func (s *Security) CreateOrReplaceProfile(id, body string, options types.QueryOptions) (*Profile, error) { + if body == "" { + return nil, types.NewError("Kuzzle.CreateOrReplaceProfile: body is required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "createOrReplaceProfile", + Id: id, + Body: body, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + var profile *Profile + + json.Unmarshal(res.Result, &profile) + + return profile, nil +} diff --git a/security/createOrReplaceProfile_test.go b/security/createOrReplaceProfile_test.go new file mode 100644 index 00000000..26616e8d --- /dev/null +++ b/security/createOrReplaceProfile_test.go @@ -0,0 +1,56 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateOrReplaceProfileBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateOrReplaceProfile("id", "", nil) + assert.Error(t, err) +} + +func TestCreateOrReplaceProfileError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.CreateOrReplaceProfile("id", "body", nil) + assert.NotNil(t, err) +} + +func TestCreateOrReplaceProfile(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "createOrReplaceProfile", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "newProfile", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "id", + "_index": "%kuzzle", + "_type": "profiles", + "_version": 1 + }`), + } + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.CreateOrReplaceProfile("id", "newProfile", nil) + assert.Equal(t, "id", res.Id) + assert.Nil(t, err) +} diff --git a/security/createOrReplaceRole.go b/security/createOrReplaceRole.go new file mode 100644 index 00000000..5a5c0e9f --- /dev/null +++ b/security/createOrReplaceRole.go @@ -0,0 +1,36 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// CreateOrReplaceRole creates or replaces (if _id matches an existing one) a Role with a list of policies. +func (s *Security) CreateOrReplaceRole(id, body string, options types.QueryOptions) (*Role, error) { + if body == "" { + return nil, types.NewError("Kuzzle.CreateOrReplaceRole: body is required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "createOrReplaceRole", + Id: id, + Body: body, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + var role *Role + + json.Unmarshal(res.Result, &role) + + return role, nil +} diff --git a/security/createOrReplaceRole_test.go b/security/createOrReplaceRole_test.go new file mode 100644 index 00000000..def54e24 --- /dev/null +++ b/security/createOrReplaceRole_test.go @@ -0,0 +1,57 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateOrReplaceRoleBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateOrReplaceRole("id", "", nil) + assert.Error(t, err) +} + +func TestCreateOrReplaceRoleError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.CreateOrReplaceRole("id", "body", nil) + assert.NotNil(t, err) +} + +func TestCreateOrReplaceRole(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "createOrReplaceRole", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "newRole", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "id", + "_index": "%kuzzle", + "_type": "roles", + "_version": 1 + }`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.CreateOrReplaceRole("id", "newRole", nil) + + assert.NotNil(t, res) + assert.Nil(t, err) + assert.Equal(t, "id", res.Id) +} diff --git a/security/createProfile.go b/security/createProfile.go new file mode 100644 index 00000000..7341366d --- /dev/null +++ b/security/createProfile.go @@ -0,0 +1,36 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// CreateProfile creates or replaces (if _id matches an existing one) a profile with a list of policies. +func (s *Security) CreateProfile(id, body string, options types.QueryOptions) (*Profile, error) { + if id == "" || body == "" { + return nil, types.NewError("Kuzzle.CreateProfile: id and body are required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "createProfile", + Id: id, + Body: body, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + var profile *Profile + + json.Unmarshal(res.Result, &profile) + + return profile, nil +} diff --git a/security/createProfile_test.go b/security/createProfile_test.go new file mode 100644 index 00000000..dea065ce --- /dev/null +++ b/security/createProfile_test.go @@ -0,0 +1,63 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateProfileIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateProfile("", "body", nil) + assert.Error(t, err) +} + +func TestCreateProfileBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateProfile("id", "", nil) + assert.Error(t, err) +} + +func TestCreateProfileError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.CreateProfile("id", "body", nil) + assert.NotNil(t, err) +} + +func TestCreateProfile(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "createProfile", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "newProfile", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "id", + "_index": "%kuzzle", + "_type": "profiles", + "_version": 1 + }`), + } + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.CreateProfile("id", "newProfile", nil) + assert.NotNil(t, res) + assert.Nil(t, err) + assert.Equal(t, "id", res.Id) +} diff --git a/security/createRestrictedUser.go b/security/createRestrictedUser.go new file mode 100644 index 00000000..a55e1669 --- /dev/null +++ b/security/createRestrictedUser.go @@ -0,0 +1,35 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// CreateRestrictedUser create credentials of the specified strategy with given body infos. +func (s *Security) CreateRestrictedUser(body string, options types.QueryOptions) (json.RawMessage, error) { + if body == "" { + return nil, types.NewError("Kuzzle.CreateRestrictedUser: strategy, id and body are required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "createRestrictedUser", + Body: body, + } + + if options != nil { + query.Id = options.ID() + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/createRestrictedUser_test.go b/security/createRestrictedUser_test.go new file mode 100644 index 00000000..c02fa95a --- /dev/null +++ b/security/createRestrictedUser_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateRestrictedUserBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateRestrictedUser("", nil) + assert.Error(t, err) +} + +func TestCreateRestrictedUserError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.CreateRestrictedUser("body", nil) + assert.NotNil(t, err) +} + +func TestCreateRestrictedUser(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "createRestrictedUser", parsedQuery.Action) + assert.Equal(t, "myRestrictedUser", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte{}} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.CreateRestrictedUser("myRestrictedUser", nil) + + assert.Nil(t, err) +} diff --git a/security/createRole.go b/security/createRole.go new file mode 100644 index 00000000..7d278f97 --- /dev/null +++ b/security/createRole.go @@ -0,0 +1,36 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// CreateRole creates or replaces (if _id matches an existing one) a Role with a list of policies. +func (s *Security) CreateRole(id, body string, options types.QueryOptions) (*Role, error) { + if id == "" || body == "" { + return nil, types.NewError("Kuzzle.CreateRole: id and body are required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "createRole", + Id: id, + Body: body, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + var role *Role + + json.Unmarshal(res.Result, &role) + + return role, nil +} diff --git a/security/createRole_test.go b/security/createRole_test.go new file mode 100644 index 00000000..1a293a7e --- /dev/null +++ b/security/createRole_test.go @@ -0,0 +1,56 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateRoleIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateRole("", "body", nil) + assert.Error(t, err) +} + +func TestCreateRoleBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateRole("id", "", nil) + assert.Error(t, err) +} + +func TestCreateRoleError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.CreateRole("id", "body", nil) + assert.NotNil(t, err) +} + +func TestCreateRole(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "createRole", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "newRole", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte{}} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.CreateRole("id", "newRole", nil) + + assert.Nil(t, err) +} diff --git a/security/createUser.go b/security/createUser.go new file mode 100644 index 00000000..0f2c24bb --- /dev/null +++ b/security/createUser.go @@ -0,0 +1,31 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// CreateUser creates or replaces (if _id matches an existing one) a User with a list of policies. +func (s *Security) CreateUser(body string, options types.QueryOptions) (json.RawMessage, error) { + if body == "" { + return nil, types.NewError("Kuzzle.CreateUser: body is required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "createUser", + Body: body, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/createUser_test.go b/security/createUser_test.go new file mode 100644 index 00000000..03eb856f --- /dev/null +++ b/security/createUser_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestCreateUserBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.CreateUser("", nil) + assert.Error(t, err) +} + +func TestCreateUserError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.CreateUser("body", nil) + assert.NotNil(t, err) +} + +func TestCreateUser(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "createUser", parsedQuery.Action) + assert.Equal(t, "newUser", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte{}} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.CreateUser("newUser", nil) + assert.NotNil(t, res) + assert.Nil(t, err) +} diff --git a/security/deleteCredentials.go b/security/deleteCredentials.go new file mode 100644 index 00000000..49783d01 --- /dev/null +++ b/security/deleteCredentials.go @@ -0,0 +1,30 @@ +package security + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// DeleteCredentials delete credentials of the specified strategy with given body infos. +func (s *Security) DeleteCredentials(strategy, id string, options types.QueryOptions) error { + if strategy == "" || id == "" { + return types.NewError("Kuzzle.DeleteCredentials: strategy and id are required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "deleteCredentials", + Id: id, + Strategy: strategy, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/security/deleteCredentials_test.go b/security/deleteCredentials_test.go new file mode 100644 index 00000000..e5ef0f7d --- /dev/null +++ b/security/deleteCredentials_test.go @@ -0,0 +1,56 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestDeleteCredentialsStrategyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + err := k.Security.DeleteCredentials("", "id", nil) + assert.Error(t, err) +} + +func TestDeleteCredentialsIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + err := k.Security.DeleteCredentials("strategy", "", nil) + assert.Error(t, err) +} + +func TestDeleteCredentialsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + err := k.Security.DeleteCredentials("strategy", "id", nil) + assert.NotNil(t, err) +} + +func TestDeleteCredentials(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "deleteCredentials", parsedQuery.Action) + assert.Equal(t, "strategy", parsedQuery.Strategy) + assert.Equal(t, "id", parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte{}} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + err := k.Security.DeleteCredentials("strategy", "id", nil) + + assert.Nil(t, err) +} diff --git a/security/deleteProfile.go b/security/deleteProfile.go new file mode 100644 index 00000000..c2d0273c --- /dev/null +++ b/security/deleteProfile.go @@ -0,0 +1,37 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// DeleteProfile deletes (if _id matches an existing one) a Profile with a list of policies. +func (s *Security) DeleteProfile(id string, options types.QueryOptions) (string, error) { + if id == "" { + return "", types.NewError("Kuzzle.DeleteProfile: id is required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "deleteProfile", + Id: id, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return "", res.Error + } + + var deletedProfileID struct { + ID string `json:"_id"` + } + + json.Unmarshal(res.Result, &deletedProfileID) + + return deletedProfileID.ID, nil +} diff --git a/security/deleteProfile_test.go b/security/deleteProfile_test.go new file mode 100644 index 00000000..2085ed42 --- /dev/null +++ b/security/deleteProfile_test.go @@ -0,0 +1,50 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestDeleteProfileIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.DeleteProfile("", nil) + assert.Error(t, err) +} + +func TestDeleteProfileError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.DeleteProfile("id", nil) + assert.NotNil(t, err) +} + +func TestDeleteProfile(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "deleteProfile", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(`{"_id": "id"}`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.DeleteProfile("id", nil) + assert.NotNil(t, res) + assert.Equal(t, "id", res) + assert.Nil(t, err) +} diff --git a/security/deleteRole.go b/security/deleteRole.go new file mode 100644 index 00000000..6ec7dee4 --- /dev/null +++ b/security/deleteRole.go @@ -0,0 +1,37 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// DeleteRole creates or replaces (if _id matches an existing one) a Profile with a list of policies. +func (s *Security) DeleteRole(id string, options types.QueryOptions) (string, error) { + if id == "" { + return "", types.NewError("Kuzzle.DeleteRole: id is required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "deleteRole", + Id: id, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return "", res.Error + } + + var deletedRole struct { + ID string `json:"_id"` + } + + json.Unmarshal(res.Result, &deletedRole) + + return deletedRole.ID, nil +} diff --git a/security/deleteRole_test.go b/security/deleteRole_test.go new file mode 100644 index 00000000..f76cdbe7 --- /dev/null +++ b/security/deleteRole_test.go @@ -0,0 +1,50 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestDeleteRoleIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.DeleteRole("", nil) + assert.Error(t, err) +} + +func TestDeleteRoleError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.DeleteRole("id", nil) + assert.NotNil(t, err) +} + +func TestDeleteRole(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "deleteRole", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(`{"_id": "id"}`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.DeleteRole("id", nil) + assert.NotNil(t, res) + assert.Equal(t, "id", res) + assert.Nil(t, err) +} diff --git a/security/deleteUser.go b/security/deleteUser.go new file mode 100644 index 00000000..1dfecd17 --- /dev/null +++ b/security/deleteUser.go @@ -0,0 +1,37 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// DeleteUser deletes (if _id matches an existing one) a Profile with a list of policies. +func (s *Security) DeleteUser(id string, options types.QueryOptions) (string, error) { + if id == "" { + return "", types.NewError("Kuzzle.DeleteUser: id is required", 400) + } + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "deleteUser", + Id: id, + } + + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return "", res.Error + } + + var deletedUser struct { + ID string `json:"_id"` + } + + json.Unmarshal(res.Result, &deletedUser) + + return deletedUser.ID, nil +} diff --git a/security/deleteUser_test.go b/security/deleteUser_test.go new file mode 100644 index 00000000..096fffa4 --- /dev/null +++ b/security/deleteUser_test.go @@ -0,0 +1,50 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestDeleteUserIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.DeleteUser("", nil) + assert.Error(t, err) +} + +func TestDeleteUserError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.DeleteUser("id", nil) + assert.NotNil(t, err) +} + +func TestDeleteUser(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "deleteUser", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + + return &types.KuzzleResponse{Result: []byte(`{"_id": "id"}`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.DeleteUser("id", nil) + assert.NotNil(t, res) + assert.Equal(t, "id", res) + assert.Nil(t, err) +} diff --git a/security/fetch_profile.go b/security/fetch_profile.go deleted file mode 100644 index a172006e..00000000 --- a/security/fetch_profile.go +++ /dev/null @@ -1,19 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) FetchProfile(id string, options types.QueryOptions) (*Profile, error) { - res, err := s.rawFetch("getProfile", id, options) - - if err != nil { - return nil, err - } - - jsonProfile := &jsonProfile{} - json.Unmarshal(res, jsonProfile) - - return s.jsonProfileToProfile(jsonProfile), nil -} diff --git a/security/fetch_role.go b/security/fetch_role.go deleted file mode 100644 index d58a2179..00000000 --- a/security/fetch_role.go +++ /dev/null @@ -1,19 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) FetchRole(id string, options types.QueryOptions) (*Role, error) { - res, err := s.rawFetch("getRole", id, options) - - if err != nil { - return nil, err - } - - jsonRole := &jsonRole{} - json.Unmarshal(res, jsonRole) - - return s.jsonRoleToRole(jsonRole), nil -} diff --git a/security/fetch_user.go b/security/fetch_user.go deleted file mode 100644 index e0d20d52..00000000 --- a/security/fetch_user.go +++ /dev/null @@ -1,19 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) FetchUser(id string, options types.QueryOptions) (*User, error) { - res, err := s.rawFetch("getUser", id, options) - - if err != nil { - return nil, err - } - - jsonUser := &jsonUser{} - json.Unmarshal(res, jsonUser) - - return s.jsonUserToUser(jsonUser), nil -} diff --git a/security/get_all_credential_fields.go b/security/getAllCredentialFields.go similarity index 74% rename from security/get_all_credential_fields.go rename to security/getAllCredentialFields.go index 54e3928d..c4eaf887 100644 --- a/security/get_all_credential_fields.go +++ b/security/getAllCredentialFields.go @@ -2,11 +2,12 @@ package security import ( "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // GetAllCredentialFields gets an array of strategy's fieldnames for each strategies -func (s *Security) GetAllCredentialFields(options types.QueryOptions) (types.CredentialFields, error) { +func (s *Security) GetAllCredentialFields(options types.QueryOptions) (json.RawMessage, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ @@ -21,8 +22,5 @@ func (s *Security) GetAllCredentialFields(options types.QueryOptions) (types.Cre return nil, res.Error } - credentialFields := types.CredentialFields{} - json.Unmarshal(res.Result, &credentialFields) - - return credentialFields, nil + return res.Result, nil } diff --git a/security/get_all_credential_fields_test.go b/security/getAllCredentialFields_test.go similarity index 93% rename from security/get_all_credential_fields_test.go rename to security/getAllCredentialFields_test.go index 3d8a8602..011b7b31 100644 --- a/security/get_all_credential_fields_test.go +++ b/security/getAllCredentialFields_test.go @@ -3,12 +3,13 @@ package security_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestGetAllCredentialFieldsError(t *testing.T) { @@ -44,9 +45,7 @@ func TestGetAllCredentialFields(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) res, err := k.Security.GetAllCredentialFields(nil) assert.Nil(t, err) - - assert.Equal(t, "username", res["local"][0]) - assert.Equal(t, "password", res["local"][1]) + assert.NotNil(t, res) } func ExampleSecurity_GetAllCredentialFields() { @@ -59,5 +58,5 @@ func ExampleSecurity_GetAllCredentialFields() { return } - fmt.Println(res["local"]) + fmt.Println(res) } diff --git a/security/get_credential_fields.go b/security/getCredentialFields.go similarity index 75% rename from security/get_credential_fields.go rename to security/getCredentialFields.go index 166fc1aa..02089078 100644 --- a/security/get_credential_fields.go +++ b/security/getCredentialFields.go @@ -2,11 +2,12 @@ package security import ( "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // GetCredentialFields gets an array of strategy's fieldnames -func (s *Security) GetCredentialFields(strategy string, options types.QueryOptions) (types.CredentialStrategyFields, error) { +func (s *Security) GetCredentialFields(strategy string, options types.QueryOptions) (json.RawMessage, error) { if strategy == "" { return nil, types.NewError("Security.GetCredentialFields: strategy is required", 400) } @@ -26,8 +27,5 @@ func (s *Security) GetCredentialFields(strategy string, options types.QueryOptio return nil, res.Error } - credentialFields := types.CredentialStrategyFields{} - json.Unmarshal(res.Result, &credentialFields) - - return credentialFields, nil + return res.Result, nil } diff --git a/security/get_credential_fields_test.go b/security/getCredentialFields_test.go similarity index 96% rename from security/get_credential_fields_test.go rename to security/getCredentialFields_test.go index c44af8e8..1ac3ee29 100644 --- a/security/get_credential_fields_test.go +++ b/security/getCredentialFields_test.go @@ -3,12 +3,13 @@ package security_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestGetCredentialFieldsEmptyStrategy(t *testing.T) { @@ -55,9 +56,7 @@ func TestGetCredentialFields(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) res, err := k.Security.GetCredentialFields("local", nil) assert.Nil(t, err) - - assert.Equal(t, "username", res[0]) - assert.Equal(t, "password", res[1]) + assert.NotNil(t, res) } func ExampleSecurity_GetCredentialFields() { diff --git a/security/getCredentials.go b/security/getCredentials.go new file mode 100644 index 00000000..5b604fea --- /dev/null +++ b/security/getCredentials.go @@ -0,0 +1,31 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) GetCredentials(strategy, id string, options types.QueryOptions) (json.RawMessage, error) { + if strategy == "" || id == "" { + return nil, types.NewError("Security.GetCredentials: strategy and id are required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "getCredentials", + Strategy: strategy, + Id: id, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/getCredentialsById.go b/security/getCredentialsById.go new file mode 100644 index 00000000..bfa94422 --- /dev/null +++ b/security/getCredentialsById.go @@ -0,0 +1,32 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// GetCredentialsByID recover credentials from given strategy identified by given id +func (s *Security) GetCredentialsByID(strategy, id string, options types.QueryOptions) (json.RawMessage, error) { + if strategy == "" || id == "" { + return nil, types.NewError("Security.GetCredentialById: strategy and id are required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "getCredentialsById", + Strategy: strategy, + Id: id, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/getCredentialsById_test.go b/security/getCredentialsById_test.go new file mode 100644 index 00000000..b10f5201 --- /dev/null +++ b/security/getCredentialsById_test.go @@ -0,0 +1,56 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetCredentialsByIDStrategyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.GetCredentialsByID("", "id", nil) + assert.Error(t, err) +} + +func TestGetCredentialsByIDIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.GetCredentialsByID("strategy", "", nil) + assert.Error(t, err) +} + +func TestGetCredentialsByIDError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.GetCredentialsByID("strategy", "id", nil) + assert.NotNil(t, err) +} + +func TestGetCredentialsByID(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "getCredentialsById", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "strategy", parsedQuery.Strategy) + + return &types.KuzzleResponse{Result: []byte(`{"username": "user", "kuid": "id"}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := k.Security.GetCredentialsByID("strategy", "id", nil) + assert.NoError(t, err) + assert.NotNil(t, res) +} diff --git a/security/getCredentials_test.go b/security/getCredentials_test.go new file mode 100644 index 00000000..c0a54d70 --- /dev/null +++ b/security/getCredentials_test.go @@ -0,0 +1,56 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetCredentialsStrategyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.GetCredentials("", "id", nil) + assert.Error(t, err) +} + +func TestGetCredentialsIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.GetCredentials("strategy", "", nil) + assert.Error(t, err) +} + +func TestGetCredentialsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.GetCredentials("strategy", "id", nil) + assert.NotNil(t, err) +} + +func TestGetCredentials(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "getCredentials", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "strategy", parsedQuery.Strategy) + + return &types.KuzzleResponse{Result: []byte(`{"username": "user", "kuid": "id"}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := k.Security.GetCredentials("strategy", "id", nil) + assert.NoError(t, err) + assert.NotNil(t, res) +} diff --git a/security/getProfile.go b/security/getProfile.go new file mode 100644 index 00000000..6c0d4578 --- /dev/null +++ b/security/getProfile.go @@ -0,0 +1,34 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// GetProfile fetch profile matching with given id +func (s *Security) GetProfile(id string, options types.QueryOptions) (*Profile, error) { + if id == "" { + return nil, types.NewError("Security.GetProfile: id is required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "getProfile", + Id: id, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + jsonProfile := &jsonProfile{} + json.Unmarshal(res.Result, jsonProfile) + + return s.jsonProfileToProfile(jsonProfile), nil +} diff --git a/security/raw_fetch.go b/security/getProfileMapping.go similarity index 56% rename from security/raw_fetch.go rename to security/getProfileMapping.go index 3487134c..26f2e3ca 100644 --- a/security/raw_fetch.go +++ b/security/getProfileMapping.go @@ -1,20 +1,18 @@ package security import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) rawFetch(action string, id string, options types.QueryOptions) ([]byte, error) { - if id == "" { - return nil, types.NewError("Security."+action+": id is required", 400) - } - +// GetProfileMapping gets an array of strategy's fieldnames for each strategies +func (s *Security) GetProfileMapping(options types.QueryOptions) (json.RawMessage, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ Controller: "security", - Action: action, - Id: id, + Action: "getProfileMapping", } go s.Kuzzle.Query(query, options, ch) diff --git a/security/getProfileMapping_test.go b/security/getProfileMapping_test.go new file mode 100644 index 00000000..9c018144 --- /dev/null +++ b/security/getProfileMapping_test.go @@ -0,0 +1,42 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetProfileMappingError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.GetProfileMapping(nil) + assert.NotNil(t, err) +} + +func TestGetProfileMapping(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "getProfileMapping", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`{"mapping": { "test": "test" }}`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.GetProfileMapping(nil) + assert.NotNil(t, res) + assert.Nil(t, err) +} diff --git a/security/getProfileRights.go b/security/getProfileRights.go new file mode 100644 index 00000000..edb0367e --- /dev/null +++ b/security/getProfileRights.go @@ -0,0 +1,31 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// GetProfileRights gets rights for given profile id +func (s *Security) GetProfileRights(id string, options types.QueryOptions) (json.RawMessage, error) { + if id == "" { + return nil, types.NewError("Security.GetProfileRights: id is required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "getProfileRights", + Id: id, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/getProfileRights_test.go b/security/getProfileRights_test.go new file mode 100644 index 00000000..1ee62877 --- /dev/null +++ b/security/getProfileRights_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetProfileRightsIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + + _, err := k.Security.GetProfileRights("", nil) + assert.NotNil(t, err) +} + +func TestGetProfileRightsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.GetProfileRights("id", nil) + assert.NotNil(t, err) +} + +func TestGetProfileRights(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "getProfileRights", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`{"mapping": { "test": "test" }}`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.GetProfileRights("id", nil) + assert.NotNil(t, res) + assert.Nil(t, err) +} diff --git a/security/fetch_profile_test.go b/security/getProfile_test.go similarity index 63% rename from security/fetch_profile_test.go rename to security/getProfile_test.go index 1f31df93..81815607 100644 --- a/security/fetch_profile_test.go +++ b/security/getProfile_test.go @@ -8,21 +8,19 @@ import ( "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) -func TestFetchProfileEmptyId(t *testing.T) { +func TestGetProfileEmptyId(t *testing.T) { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.FetchProfile("", nil) + _, err := k.Security.GetProfile("", nil) assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) } -func TestFetchProfileError(t *testing.T) { +func TestGetProfileError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{ @@ -31,11 +29,11 @@ func TestFetchProfileError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.FetchProfile("profileId", nil) + _, err := k.Security.GetProfile("profileId", nil) assert.NotNil(t, err) } -func TestFetchProfile(t *testing.T) { +func TestGetProfile(t *testing.T) { id := "profileId" c := &internal.MockedConnection{ @@ -47,29 +45,30 @@ func TestFetchProfile(t *testing.T) { assert.Equal(t, "getProfile", parsedQuery.Action) assert.Equal(t, id, parsedQuery.Id) - p := &security.Profile{ - Id: id, - Policies: []*types.Policy{ - {RoleId: "admin"}, - {RoleId: "other"}, - }, + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "profileId", + "index": "%kuzzle", + "collection": "profiles", + "action": "getProfile", + "controller": "security", + "requestId": "" + }`), } - r, _ := security.ProfileToJson(p) - return &types.KuzzleResponse{Result: r} }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.FetchProfile(id, nil) - + res, err := k.Security.GetProfile(id, nil) + assert.NoError(t, err) + assert.NotNil(t, res) assert.Equal(t, id, res.Id) - assert.Equal(t, []*types.Policy{{RoleId: "admin"}, {RoleId: "other"}}, res.Policies) + } -func ExampleFetchProfile() { +func ExampleGetProfile() { id := "profileId" c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.FetchProfile(id, nil) + res, err := k.Security.GetProfile(id, nil) if err != nil { fmt.Println(err.Error()) diff --git a/security/getRole.go b/security/getRole.go new file mode 100644 index 00000000..171a9a09 --- /dev/null +++ b/security/getRole.go @@ -0,0 +1,33 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) GetRole(id string, options types.QueryOptions) (*Role, error) { + if id == "" { + return nil, types.NewError("Security.GetRole: id is required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "getRole", + Id: id, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + jsonRole := &jsonRole{} + json.Unmarshal(res.Result, jsonRole) + + return s.jsonRoleToRole(jsonRole), nil +} diff --git a/security/raw_scroll.go b/security/getRoleMapping.go similarity index 53% rename from security/raw_scroll.go rename to security/getRoleMapping.go index 30b01df7..3cb19369 100644 --- a/security/raw_scroll.go +++ b/security/getRoleMapping.go @@ -1,22 +1,19 @@ package security import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) rawScroll(action string, scrollId string, options types.QueryOptions) ([]byte, error) { - if scrollId == "" { - return nil, types.NewError("Security."+action+": scroll id is required", 400) - } - +// GetRoleMapping gets mapping for Roles +func (s *Security) GetRoleMapping(options types.QueryOptions) (json.RawMessage, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ Controller: "security", - Action: action, - ScrollId: scrollId, + Action: "getRoleMapping", } - go s.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/security/getRoleMapping_test.go b/security/getRoleMapping_test.go new file mode 100644 index 00000000..6d072bc9 --- /dev/null +++ b/security/getRoleMapping_test.go @@ -0,0 +1,42 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetRoleMappingError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.GetRoleMapping(nil) + assert.NotNil(t, err) +} + +func TestGetRoleMapping(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "getRoleMapping", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`{"mapping": { "test": "test" }}`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.GetRoleMapping(nil) + assert.NotNil(t, res) + assert.Nil(t, err) +} diff --git a/security/fetch_role_test.go b/security/getRole_test.go similarity index 87% rename from security/fetch_role_test.go rename to security/getRole_test.go index e3af6d3e..6b062e34 100644 --- a/security/fetch_role_test.go +++ b/security/getRole_test.go @@ -13,31 +13,31 @@ import ( "github.com/stretchr/testify/assert" ) -func TestFetchRoleEmptyId(t *testing.T) { +func TestGetRoleEmptyId(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Result: []byte{}} }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.FetchRole("", nil) + _, err := k.Security.GetRole("", nil) assert.NotNil(t, err) } -func TestFetchRoleError(t *testing.T) { +func TestGetRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.FetchRole("roleId", nil) + _, err := k.Security.GetRole("roleId", nil) assert.NotNil(t, err) } -func TestFetchRole(t *testing.T) { +func TestGetRole(t *testing.T) { id := "roleId" c := &internal.MockedConnection{ @@ -70,7 +70,7 @@ func TestFetchRole(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.FetchRole(id, nil) + res, _ := k.Security.GetRole(id, nil) assert.Equal(t, id, res.Id) assert.Equal(t, map[string]*types.Controller{ @@ -90,7 +90,7 @@ func ExampleSecurityRole_Fetch() { id := "roleId" c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.FetchRole(id, nil) + res, err := k.Security.GetRole(id, nil) if err != nil { fmt.Println(err.Error()) diff --git a/security/getUser.go b/security/getUser.go new file mode 100644 index 00000000..6065a00f --- /dev/null +++ b/security/getUser.go @@ -0,0 +1,33 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) GetUser(id string, options types.QueryOptions) (*User, error) { + if id == "" { + return nil, types.NewError("Security.GetUser: id is required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "getUser", + Id: id, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + jsonUser := &jsonUser{} + json.Unmarshal(res.Result, jsonUser) + + return s.jsonUserToUser(jsonUser), nil +} diff --git a/security/getUserMapping.go b/security/getUserMapping.go new file mode 100644 index 00000000..767e6d30 --- /dev/null +++ b/security/getUserMapping.go @@ -0,0 +1,26 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// GetUserMapping gets mapping for Users +func (s *Security) GetUserMapping(options types.QueryOptions) (json.RawMessage, error) { + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "getUserMapping", + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/getUserMapping_test.go b/security/getUserMapping_test.go new file mode 100644 index 00000000..7cea93e0 --- /dev/null +++ b/security/getUserMapping_test.go @@ -0,0 +1,42 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetUserMappingError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.GetUserMapping(nil) + assert.NotNil(t, err) +} + +func TestGetUserMapping(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "getUserMapping", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`{"mapping": { "test": "test" }}`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.GetUserMapping(nil) + assert.NotNil(t, res) + assert.Nil(t, err) +} diff --git a/security/getUserRights.go b/security/getUserRights.go new file mode 100644 index 00000000..4ae66cdb --- /dev/null +++ b/security/getUserRights.go @@ -0,0 +1,31 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// GetUserRights gets rights for given profile id +func (s *Security) GetUserRights(id string, options types.QueryOptions) (json.RawMessage, error) { + if id == "" { + return nil, types.NewError("Security.GetUserRights: id is required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "getUserRights", + Id: id, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + return res.Result, nil +} diff --git a/security/getUserRights_test.go b/security/getUserRights_test.go new file mode 100644 index 00000000..e142422e --- /dev/null +++ b/security/getUserRights_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestGetUserRightsIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + + _, err := k.Security.GetUserRights("", nil) + assert.NotNil(t, err) +} + +func TestGetUserRightsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.GetUserRights("id", nil) + assert.NotNil(t, err) +} + +func TestGetUserRights(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "getUserRights", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`{"mapping": { "test": "test" }}`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.GetUserRights("id", nil) + assert.NotNil(t, res) + assert.Nil(t, err) +} diff --git a/security/fetch_user_test.go b/security/getUser_test.go similarity index 89% rename from security/fetch_user_test.go rename to security/getUser_test.go index d25334c5..afe58afe 100644 --- a/security/fetch_user_test.go +++ b/security/getUser_test.go @@ -5,6 +5,7 @@ import ( "testing" "encoding/json" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" @@ -21,12 +22,12 @@ func TestFetchEmptyKuid(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.FetchUser("", nil) + _, err := k.Security.GetUser("", nil) assert.NotNil(t, err) } -func TestFetchUserError(t *testing.T) { +func TestGetUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { return &types.KuzzleResponse{ @@ -35,11 +36,11 @@ func TestFetchUserError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.FetchUser("userId", nil) + _, err := k.Security.GetUser("userId", nil) assert.NotNil(t, err) } -func TestFetchUser(t *testing.T) { +func TestGetUser(t *testing.T) { id := "userId" c := &internal.MockedConnection{ @@ -62,7 +63,7 @@ func TestFetchUser(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.FetchUser(id, nil) + res, _ := k.Security.GetUser(id, nil) assert.Equal(t, id, res.Id) @@ -82,7 +83,7 @@ func ExampleUser_Fetch() { id := "userId" c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.FetchUser(id, nil) + res, err := k.Security.GetUser(id, nil) if err != nil { fmt.Println(err.Error()) diff --git a/security/hasCredentials.go b/security/hasCredentials.go new file mode 100644 index 00000000..90d440ad --- /dev/null +++ b/security/hasCredentials.go @@ -0,0 +1,35 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// HasCredentials check the existence of the specified strategy credentials for the id +func (s *Security) HasCredentials(strategy, id string, options types.QueryOptions) (bool, error) { + if strategy == "" || id == "" { + return false, types.NewError("Security.HasCredentials: strategy and id are required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "hasCredentials", + Strategy: strategy, + Id: id, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return false, res.Error + } + + var hasCreds bool + json.Unmarshal(res.Result, &hasCreds) + + return hasCreds, nil +} diff --git a/security/hasCredentials_test.go b/security/hasCredentials_test.go new file mode 100644 index 00000000..0deb8752 --- /dev/null +++ b/security/hasCredentials_test.go @@ -0,0 +1,67 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestHasCredentialsStrategyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + res, err := k.Security.HasCredentials("", "id", nil) + + assert.Error(t, err) + assert.NotNil(t, res) + assert.Equal(t, false, res) +} + +func TestHasCredentialsIdNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + res, err := k.Security.HasCredentials("strategy", "", nil) + + assert.Error(t, err) + assert.NotNil(t, res) + assert.Equal(t, false, res) +} + +func TestHasCredentialsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := k.Security.HasCredentials("strategy", "id", nil) + + assert.Error(t, err) + assert.NotNil(t, res) + assert.Equal(t, false, res) +} + +func TestHasCredentials(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "hasCredentials", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "strategy", parsedQuery.Strategy) + + return &types.KuzzleResponse{Result: []byte(`true`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := k.Security.HasCredentials("strategy", "id", nil) + + assert.NoError(t, err) + assert.NotNil(t, res) + assert.Equal(t, true, res) +} diff --git a/security/is_action_allowed_test.go b/security/is_action_allowed_test.go index d055d7d4..31fbdf87 100644 --- a/security/is_action_allowed_test.go +++ b/security/is_action_allowed_test.go @@ -57,7 +57,7 @@ func TestIsActionAllowedResultDenied(t *testing.T) { assert.Equal(t, security.ActionIsDenied, res) } -func ExampleSecurityUser_IsActionAllowed() { +func ExampleIsActionAllowed() { userRights := []*types.UserRights{ {Controller: "wow-controller", Action: "*", Index: "much-index", Collection: "very-collection", Value: "allowed"}, } diff --git a/security/json_profile.go b/security/json_profile.go index 2f5a962a..11c668ae 100644 --- a/security/json_profile.go +++ b/security/json_profile.go @@ -2,6 +2,7 @@ package security import ( "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) @@ -33,6 +34,5 @@ func ProfileToJson(p *Profile) ([]byte, error) { Policies: p.Policies, }, } - return json.Marshal(j) } diff --git a/security/mDeleteCredentials.go b/security/mDeleteCredentials.go new file mode 100644 index 00000000..d3b77df8 --- /dev/null +++ b/security/mDeleteCredentials.go @@ -0,0 +1,37 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// MDeleteCredentials deletes all credentials matching with given ids +func (s *Security) MDeleteCredentials(ids []string, options types.QueryOptions) ([]string, error) { + if len(ids) == 0 { + return nil, types.NewError("Security.MDeleteCredentials: ids array can't be nil", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "mDeleteCredentials", + Body: struct { + Ids []string `json:"ids"` + }{ids}, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var mDeletedIds []string + json.Unmarshal(res.Result, &mDeletedIds) + + return mDeletedIds, nil + +} diff --git a/security/mDeleteCredentials_test.go b/security/mDeleteCredentials_test.go new file mode 100644 index 00000000..0ce262d3 --- /dev/null +++ b/security/mDeleteCredentials_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMDeleteCredentialsEmptyIDs(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.MDeleteCredentials([]string(nil), nil) + assert.Error(t, err) +} + +func TestMDeleteCredentialsError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.MDeleteCredentials([]string{"id"}, nil) + assert.NotNil(t, err) +} + +func TestMDeleteCredentials(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "mDeleteCredentials", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`["id"]`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.MDeleteCredentials([]string{"id"}, nil) + assert.Nil(t, err) + assert.NotNil(t, res) + assert.Equal(t, "id", res[0]) +} diff --git a/security/mDeleteRoles.go b/security/mDeleteRoles.go new file mode 100644 index 00000000..0ef8e556 --- /dev/null +++ b/security/mDeleteRoles.go @@ -0,0 +1,37 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// MDeleteRoles deletes all roles matching with given ids +func (s *Security) MDeleteRoles(ids []string, options types.QueryOptions) ([]string, error) { + if len(ids) == 0 { + return nil, types.NewError("Security.MDeleteRoles: ids array can't be nil", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "mDeleteRoles", + Body: struct { + Ids []string `json:"ids"` + }{ids}, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var mDeletedIds []string + json.Unmarshal(res.Result, &mDeletedIds) + + return mDeletedIds, nil + +} diff --git a/security/mDeleteRoles_test.go b/security/mDeleteRoles_test.go new file mode 100644 index 00000000..882c9206 --- /dev/null +++ b/security/mDeleteRoles_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMDeleteRolesEmptyIDs(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.MDeleteRoles([]string(nil), nil) + assert.Error(t, err) +} + +func TestMDeleteRolesError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.MDeleteRoles([]string{"id"}, nil) + assert.NotNil(t, err) +} + +func TestMDeleteRoles(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "mDeleteRoles", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`["id"]`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.MDeleteRoles([]string{"id"}, nil) + assert.Nil(t, err) + assert.NotNil(t, res) + assert.Equal(t, "id", res[0]) +} diff --git a/security/mDeleteUsers.go b/security/mDeleteUsers.go new file mode 100644 index 00000000..d84dcb16 --- /dev/null +++ b/security/mDeleteUsers.go @@ -0,0 +1,37 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// MDeleteUsers deletes all users matching with given ids +func (s *Security) MDeleteUsers(ids []string, options types.QueryOptions) ([]string, error) { + if len(ids) == 0 { + return nil, types.NewError("Security.MDeleteUsers: ids array can't be nil", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "mDeleteUsers", + Body: struct { + Ids []string `json:"ids"` + }{ids}, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var mDeletedIds []string + json.Unmarshal(res.Result, &mDeletedIds) + + return mDeletedIds, nil + +} diff --git a/security/mDeleteUsers_test.go b/security/mDeleteUsers_test.go new file mode 100644 index 00000000..b427c81b --- /dev/null +++ b/security/mDeleteUsers_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMDeleteUsersEmptyIDs(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.MDeleteUsers([]string(nil), nil) + assert.Error(t, err) +} + +func TestMDeleteUsersError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + _, err := k.Security.MDeleteUsers([]string{"id"}, nil) + assert.NotNil(t, err) +} + +func TestMDeleteUsers(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "mDeleteUsers", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`["id"]`)} + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.MDeleteUsers([]string{"id"}, nil) + assert.Nil(t, err) + assert.NotNil(t, res) + assert.Equal(t, "id", res[0]) +} diff --git a/security/mGetProfiles.go b/security/mGetProfiles.go new file mode 100644 index 00000000..f6b3faaf --- /dev/null +++ b/security/mGetProfiles.go @@ -0,0 +1,42 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// MGetProfiles deletes all roles matching with given ids +func (s *Security) MGetProfiles(ids []string, options types.QueryOptions) ([]*Profile, error) { + if len(ids) == 0 { + return nil, types.NewError("Security.MGetProfiles: ids array can't be nil", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "mGetProfiles", + Body: struct { + Ids []string `json:"ids"` + }{ids}, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var fetchedRaw jsonProfileSearchResult + var fetchedProfiles []*Profile + json.Unmarshal(res.Result, &fetchedRaw) + + for _, jsonProfileRaw := range fetchedRaw.Hits { + fetchedProfiles = append(fetchedProfiles, s.jsonProfileToProfile(jsonProfileRaw)) + } + + return fetchedProfiles, nil + +} diff --git a/security/mGetProfiles_test.go b/security/mGetProfiles_test.go new file mode 100644 index 00000000..fee96ae2 --- /dev/null +++ b/security/mGetProfiles_test.go @@ -0,0 +1,90 @@ +package security_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMGetProfilesEmptyId(t *testing.T) { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.MGetProfiles([]string{}, nil) + + assert.NotNil(t, err) +} + +func TestMGetProfilesError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{ + Error: types.NewError("Test error"), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.MGetProfiles([]string{"id"}, nil) + assert.NotNil(t, err) +} + +func TestMGetProfiles(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "mGetProfiles", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`{ + "_shards": { + "failed": 0, + "successful": 5, + "total": 5 + }, + "hits": [ + { + "_id": "id", + "_index": "%kuzzle", + "_score": 1, + "_source": { + "policies": [] + }, + "_type": "profiles" + } + ], + "max_score": null, + "timed_out": false, + "took": 1, + "total": 1 + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.MGetProfiles([]string{"id"}, nil) + assert.NoError(t, err) + assert.NotNil(t, res) + assert.Equal(t, "id", res[0].Id) + +} + +func ExampleMGetProfiles() { + c := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.MGetProfiles([]string{"id"}, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res[0]) +} diff --git a/security/mGetRoles.go b/security/mGetRoles.go new file mode 100644 index 00000000..90b8c83d --- /dev/null +++ b/security/mGetRoles.go @@ -0,0 +1,42 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// MGetRoles gets all roles matching with given ids +func (s *Security) MGetRoles(ids []string, options types.QueryOptions) ([]*Role, error) { + if len(ids) == 0 { + return nil, types.NewError("Security.MGetRoles: ids array can't be nil", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "mGetRoles", + Body: struct { + Ids []string `json:"ids"` + }{ids}, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var fetchedRaw jsonRoleSearchResult + var fetchedRoles []*Role + json.Unmarshal(res.Result, &fetchedRaw) + + for _, jsonRoleRaw := range fetchedRaw.Hits { + fetchedRoles = append(fetchedRoles, s.jsonRoleToRole(jsonRoleRaw)) + } + + return fetchedRoles, nil + +} diff --git a/security/mGetRoles_test.go b/security/mGetRoles_test.go new file mode 100644 index 00000000..62ca433f --- /dev/null +++ b/security/mGetRoles_test.go @@ -0,0 +1,89 @@ +package security_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestMGetRolesEmptyId(t *testing.T) { + c := &internal.MockedConnection{} + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.MGetRoles([]string{}, nil) + + assert.NotNil(t, err) +} + +func TestMGetRolesError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{ + Error: types.NewError("Test error"), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.MGetRoles([]string{"id"}, nil) + assert.NotNil(t, err) +} + +func TestMGetRoles(t *testing.T) { + + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "mGetRoles", parsedQuery.Action) + + return &types.KuzzleResponse{Result: []byte(`{ + "_shards": { + "failed": 0, + "successful": 5, + "total": 5 + }, + "hits": [ + { + "_id": "id", + "_index": "%kuzzle", + "_score": 1, + "_source": { + "controllers": {} + }, + "_type": "roles" + } + ], + "max_score": null, + "timed_out": false, + "took": 1, + "total": 2 + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.MGetRoles([]string{"id"}, nil) + assert.NoError(t, err) + assert.Equal(t, "id", res[0].Id) + +} + +func ExampleMGetRoles() { + c := websocket.NewWebSocket("localhost:7512", nil) + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.MGetRoles([]string{"id"}, nil) + + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(res[0]) +} diff --git a/security/new_profile.go b/security/new_profile.go deleted file mode 100644 index bbce15a7..00000000 --- a/security/new_profile.go +++ /dev/null @@ -1,11 +0,0 @@ -package security - -import "github.com/kuzzleio/sdk-go/types" - -func (s *Security) NewProfile(id string, policies []*types.Policy) *Profile { - return &Profile{ - Id: id, - Policies: policies, - Security: s, - } -} diff --git a/security/new_role.go b/security/new_role.go deleted file mode 100644 index 1319b6b3..00000000 --- a/security/new_role.go +++ /dev/null @@ -1,15 +0,0 @@ -package security - -import "github.com/kuzzleio/sdk-go/types" - -func (s *Security) NewRole(id string, controllers *types.Controllers) *Role { - r := &Role{ - Id: id, - Security: s, - } - if controllers != nil { - r.Controllers = controllers.Controllers - } - - return r -} diff --git a/security/new_user.go b/security/new_user.go deleted file mode 100644 index c69fe461..00000000 --- a/security/new_user.go +++ /dev/null @@ -1,19 +0,0 @@ -package security - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) NewUser(id string, content *types.UserData) *User { - u := &User{ - Id: id, - Security: s, - } - - if content != nil { - u.Content = content.Content - u.ProfileIds = content.ProfileIds - } - - return u -} diff --git a/security/profile.go b/security/profile.go index 76861cf0..c616763e 100644 --- a/security/profile.go +++ b/security/profile.go @@ -1,8 +1,6 @@ package security import ( - "encoding/json" - "fmt" "github.com/kuzzleio/sdk-go/types" ) @@ -18,68 +16,10 @@ type ProfileSearchResult struct { ScrollId string `json:"scrollId"` } -func (p *Profile) AddPolicy(policy *types.Policy) *Profile { - p.Policies = append(p.Policies, policy) - - return p -} - -// Delete deletes the profile form Kuzzle. -func (p *Profile) Delete(options types.QueryOptions) (string, error) { - return p.Security.rawDelete("deleteProfile", p.Id, options) -} - -// Save creates or replaces the profile in Kuzzle. -func (p Profile) Save(options types.QueryOptions) (*Profile, error) { - action := "createOrReplaceProfile" - - if options == nil && p.Id == "" { - action = "createProfile" - } - - if options != nil { - if options.IfExist() == "error" { - action = "createProfile" - } else if options.IfExist() != "replace" { - return nil, types.NewError(fmt.Sprintf("Invalid value for 'ifExist' option: '%s'", options.IfExist()), 400) - } - } - - return p.persist(action, options) -} - -func (p *Profile) persist(action string, options types.QueryOptions) (*Profile, error) { - if options == nil { - options = types.NewQueryOptions() +func (s *Security) NewProfile(id string, policies []*types.Policy) *Profile { + return &Profile{ + Id: id, + Policies: policies, + Security: s, } - - if action != "createProfile" && p.Id == "" { - return nil, types.NewError("Profile."+action+": id is required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "security", - Action: action, - Body: types.Policies{ - Policies: p.Policies, - }, - Id: p.Id, - } - go p.Security.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - jsonProfile := &jsonProfile{} - json.Unmarshal(res.Result, jsonProfile) - - p.Id = jsonProfile.Id - p.Policies = jsonProfile.Source.Policies - - return p, nil } diff --git a/security/profile_test.go b/security/profile_test.go deleted file mode 100644 index 0f3e661a..00000000 --- a/security/profile_test.go +++ /dev/null @@ -1,287 +0,0 @@ -package security_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/security" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestProfileAddPolicy(t *testing.T) { - id := "profileId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getProfile", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - p := &security.Profile{ - Id: id, - Policies: []*types.Policy{ - {RoleId: "admin"}, - {RoleId: "other"}, - }, - } - r, _ := security.ProfileToJson(p) - return &types.KuzzleResponse{Result: r} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - p, _ := k.Security.FetchProfile(id, nil) - - policy := &types.Policy{ - RoleId: "roleId", - RestrictedTo: []*types.PolicyRestriction{ - {Index: "index"}, - {Index: "other-index", Collections: []string{"foo", "bar"}}, - }, - } - - p.AddPolicy(policy) - - assert.Equal(t, []*types.Policy{ - {RoleId: "admin"}, - {RoleId: "other"}, - { - RoleId: "roleId", - RestrictedTo: []*types.PolicyRestriction{ - {Index: "index"}, - {Index: "other-index", Collections: []string{"foo", "bar"}}, - }, - }, - }, p.Policies) -} - -func ExampleProfile_AddPolicy() { - id := "profileId" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - p, _ := k.Security.FetchProfile(id, nil) - - policy := types.Policy{ - RoleId: "roleId", - RestrictedTo: []*types.PolicyRestriction{ - {Index: "index"}, - {Index: "other-index", Collections: []string{"foo", "bar"}}, - }, - } - - p.AddPolicy(&policy) - - fmt.Println(p.Policies) -} - -func TestProfileSaveEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createProfile", parsedQuery.Action) - return &types.KuzzleResponse{Result: []byte{}} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - profile := k.Security.NewProfile("", nil) - - _, err := profile.Save(nil) - assert.Nil(t, err) -} - -func TestProfileSaveErrorOption(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createProfile", parsedQuery.Action) - - return &types.KuzzleResponse{Result: []byte{}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - profile := k.Security.NewProfile("profileid", nil) - options := types.NewQueryOptions() - options.SetIfExist("error") - - _, err := profile.Save(options) - assert.Nil(t, err) - -} - -func TestProfileSaveInvalidOption(t *testing.T) { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - profile := k.Security.NewProfile("profileid", nil) - options := types.NewQueryOptions() - options.SetIfExist("invalid") - - _, err := profile.Save(options) - assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) - assert.Equal(t, "Invalid value for 'ifExist' option: 'invalid'", err.(*types.KuzzleError).Message) -} - -func TestProfileSaveEmptyIdWithReplaceOption(t *testing.T) { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - profile := k.Security.NewProfile("", nil) - options := types.NewQueryOptions() - options.SetIfExist("replace") - - _, err := profile.Save(options) - assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) - assert.Equal(t, "Profile.createOrReplaceProfile: id is required", err.(*types.KuzzleError).Message) -} - -func TestProfileSave(t *testing.T) { - id := "profileId" - expectedNewProfile := &security.Profile{ - Id: id, - Policies: []*types.Policy{ - {RoleId: "newRoleId"}, - {RoleId: "newRoleId", RestrictedTo: []*types.PolicyRestriction{ - {Index: "index", Collections: []string{"foo", "bar"}}, - }}, - }, - } - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createOrReplaceProfile", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - assert.Equal(t, map[string]interface{}{ - "policies": []interface{}{ - map[string]interface{}{"roleId": "newRoleId"}, - map[string]interface{}{ - "roleId": "otherRoleId", - "restrictedTo": []interface{}{ - map[string]interface{}{ - "index": "index", - "collections": []interface{}{ - "foo", - "bar", - }, - }, - }, - }, - }, - }, parsedQuery.Body) - - r, _ := security.ProfileToJson(expectedNewProfile) - return &types.KuzzleResponse{Result: r} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - p := k.Security.NewProfile(id, []*types.Policy{ - {RoleId: "newRoleId"}, - {RoleId: "otherRoleId", RestrictedTo: []*types.PolicyRestriction{{Index: "index", Collections: []string{"foo", "bar"}}}}, - }) - _, err := p.Save(nil) - assert.Nil(t, err) -} - -func ExampleProfile_Save() { - id := "profileId" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - p, _ := k.Security.FetchProfile(id, nil) - - newPolicies := []types.Policy{ - {RoleId: "newRoleId"}, - {RoleId: "otherRoleId", RestrictedTo: []*types.PolicyRestriction{{Index: "index", Collections: []string{"foo", "bar"}}}}, - } - - for _, policy := range newPolicies { - p.AddPolicy(&policy) - } - res, err := p.Save(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Policies) -} - -func TestProfileDelete(t *testing.T) { - id := "SomeMenJustWantToWatchTheWorldBurn" - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - callCount++ - if callCount == 1 { - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getProfile", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - p := &security.Profile{ - Id: id, - Policies: []*types.Policy{ - {RoleId: "admin"}, - {RoleId: "other"}, - }, - } - r, _ := security.ProfileToJson(p) - return &types.KuzzleResponse{Result: r} - } - if callCount == 2 { - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "deleteProfile", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - res := types.ShardResponse{Id: id} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - p, _ := k.Security.FetchProfile(id, nil) - - inTheEnd, _ := p.Delete(nil) - - assert.Equal(t, id, inTheEnd) -} - -func ExampleProfile_Delete() { - id := "SomeMenJustWantToWatchTheWorldBurn" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - p, _ := k.Security.FetchProfile(id, nil) - res, err := p.Delete(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/security/raw_delete.go b/security/raw_delete.go deleted file mode 100644 index 12aea13d..00000000 --- a/security/raw_delete.go +++ /dev/null @@ -1,33 +0,0 @@ -package security - -import ( - "encoding/json" - "errors" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) rawDelete(action string, id string, options types.QueryOptions) (string, error) { - if id == "" { - return "", types.NewError("Security." + action + ": id is required") - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "security", - Action: action, - Id: id, - } - go s.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return "", errors.New(res.Error.Message) - } - - shardResponse := types.ShardResponse{} - json.Unmarshal(res.Result, &shardResponse) - - return shardResponse.Id, nil -} diff --git a/security/raw_search.go b/security/raw_search.go deleted file mode 100644 index 470de501..00000000 --- a/security/raw_search.go +++ /dev/null @@ -1,35 +0,0 @@ -package security - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) rawSearch(action string, filters interface{}, options types.QueryOptions) ([]byte, error) { - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "security", - Action: action, - Body: filters, - } - - if options != nil { - query.From = options.From() - query.Size = options.Size() - - scroll := options.Scroll() - if scroll != "" { - query.Scroll = scroll - } - } - - go s.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - return res.Result, nil -} diff --git a/security/replaceUser.go b/security/replaceUser.go new file mode 100644 index 00000000..a992bc02 --- /dev/null +++ b/security/replaceUser.go @@ -0,0 +1,36 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +// ReplaceUser replaces the matching user with the given one +func (s *Security) ReplaceUser(id, content string, options types.QueryOptions) (*User, error) { + if id == "" || content == "" { + return nil, types.NewError("Security.ReplaceUser: id and content are required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "replaceUser", + Id: id, + Body: content, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var replaced *User + json.Unmarshal(res.Result, &replaced) + + return replaced, nil + +} diff --git a/security/replaceUser_test.go b/security/replaceUser_test.go new file mode 100644 index 00000000..ccdaa3ad --- /dev/null +++ b/security/replaceUser_test.go @@ -0,0 +1,65 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestReplaceUserIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + res, err := k.Security.ReplaceUser("", "content", nil) + assert.Nil(t, res) + assert.Error(t, err) +} + +func TestReplaceUserContentNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + res, err := k.Security.ReplaceUser("id", "", nil) + assert.Nil(t, res) + assert.Error(t, err) +} + +func TestReplaceUserError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.ReplaceUser("id", "content", nil) + assert.Nil(t, res) + assert.Error(t, err) +} + +func TestReplaceUser(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + + request := types.KuzzleRequest{} + json.Unmarshal(query, &request) + assert.Equal(t, "security", request.Controller) + assert.Equal(t, "replaceUser", request.Action) + assert.Equal(t, "id", request.Id) + assert.Equal(t, "content", request.Body) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "id", + "_source": { + "profileIds": ["profileId"], + "name": "John Doe" + } + }`), + } + }, + } + + k, _ := kuzzle.NewKuzzle(c, nil) + res, err := k.Security.ReplaceUser("id", "content", nil) + assert.NoError(t, err) + assert.Equal(t, "id", res.Id) +} diff --git a/security/role.go b/security/role.go index 5ab59086..341c530e 100644 --- a/security/role.go +++ b/security/role.go @@ -1,9 +1,6 @@ package security import ( - "encoding/json" - "fmt" - "github.com/kuzzleio/sdk-go/types" ) @@ -18,62 +15,14 @@ type RoleSearchResult struct { Total int } -// Delete a role from Kuzzle -func (r *Role) Delete(options types.QueryOptions) (string, error) { - return r.Security.rawDelete("deleteRole", r.Id, options) -} - -// Save creates or replaces the role in Kuzzle -func (r *Role) Save(options types.QueryOptions) (*Role, error) { - action := "createOrReplaceRole" - - if options == nil && r.Id == "" { - action = "createRole" - } - - if options != nil { - if options.IfExist() == "error" { - action = "createRole" - } else if options.IfExist() != "replace" { - return nil, types.NewError(fmt.Sprintf("Invalid value for 'ifExist' option: '%s'", options.IfExist()), 400) - } +func (s *Security) NewRole(id string, controllers *types.Controllers) *Role { + r := &Role{ + Id: id, + Security: s, } - - return r.persist(action, options) -} - -func (r *Role) persist(action string, options types.QueryOptions) (*Role, error) { - if options == nil { - options = types.NewQueryOptions() + if controllers != nil { + r.Controllers = controllers.Controllers } - if action != "createRole" && r.Id == "" { - return nil, types.NewError("Role.Save: role id is required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "security", - Action: action, - Body: types.Controllers{ - Controllers: r.Controllers, - }, - Id: r.Id, - } - go r.Security.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - jsonRole := &jsonRole{} - json.Unmarshal(res.Result, jsonRole) - - r.Controllers = jsonRole.Source.Controllers - r.Id = jsonRole.Id - - return r, nil + return r } diff --git a/security/role_test.go b/security/role_test.go deleted file mode 100644 index 1fea1aa2..00000000 --- a/security/role_test.go +++ /dev/null @@ -1,229 +0,0 @@ -package security_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/security" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestRoleSaveEmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createRole", parsedQuery.Action) - - return &types.KuzzleResponse{Result: []byte{}} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - role := k.Security.NewRole("", nil) - - _, err := role.Save(nil) - assert.Nil(t, err) -} - -func TestRoleSaveEmptyIdWithReplaceOption(t *testing.T) { - c := &internal.MockedConnection{} - - k, _ := kuzzle.NewKuzzle(c, nil) - role := k.Security.NewRole("", nil) - - options := types.NewQueryOptions() - options.SetIfExist("replace") - _, err := role.Save(options) - - assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) - assert.Equal(t, "Role.Save: role id is required", err.(*types.KuzzleError).Message) -} - -func TestRoleSaveWithErrorOption(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parseQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parseQuery) - - assert.Equal(t, "security", parseQuery.Controller) - assert.Equal(t, "createRole", parseQuery.Action) - assert.Equal(t, "roleid", parseQuery.Id) - - return &types.KuzzleResponse{Result: []byte{}} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - role := k.Security.NewRole("roleid", nil) - options := types.NewQueryOptions() - options.SetIfExist("error") - - _, err := role.Save(options) - assert.Nil(t, err) -} - -func TestRoleSaveInvalidIfExistOption(t *testing.T) { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - role := k.Security.NewRole("roleid", nil) - - options := types.NewQueryOptions() - options.SetIfExist("invalid") - - _, err := role.Save(options) - assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) - assert.Equal(t, "Invalid value for 'ifExist' option: 'invalid'", err.(*types.KuzzleError).Message) -} - -func TestRoleSave(t *testing.T) { - id := "roleId" - callCount := 0 - newContent := types.Controllers{Controllers: map[string]*types.Controller{"document": {Actions: map[string]bool{"get": true}}}} - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - if callCount == 0 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getRole", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - res := security.Role{ - Id: id, - Controllers: map[string]*types.Controller{ - "*": { - Actions: map[string]bool{ - "*": true, - }, - }, - }, - } - r, _ := security.RoleToJson(&res) - return &types.KuzzleResponse{Result: r} - } - if callCount == 1 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createOrReplaceRole", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - assert.Equal(t, map[string]interface{}{ - "controllers": map[string]interface{}{ - "document": map[string]interface{}{ - "actions": map[string]interface{}{"get": true}, - }, - }, - }, parsedQuery.Body) - - res := security.Role{ - Id: id, - Controllers: newContent.Controllers, - } - r, _ := security.RoleToJson(&res) - return &types.KuzzleResponse{Result: r} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r, _ := k.Security.FetchRole(id, nil) - - r.Controllers = newContent.Controllers - _, err := r.Save(nil) - assert.Nil(t, err) -} - -func ExampleRole_Save() { - id := "roleId" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - r, _ := k.Security.FetchRole(id, nil) - newContent := types.Controllers{Controllers: map[string]*types.Controller{"document": {Actions: map[string]bool{"get": true}}}} - - r.Controllers = newContent.Controllers - res, err := r.Save(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Controllers) -} - -func TestRoleDelete(t *testing.T) { - id := "SomeMenJustWantToWatchTheWorldBurn" - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - if callCount == 0 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getRole", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - res := security.Role{ - Id: id, - Controllers: map[string]*types.Controller{ - "*": { - Actions: map[string]bool{ - "*": true, - }, - }, - }, - } - r, _ := security.RoleToJson(&res) - return &types.KuzzleResponse{Result: r} - } - if callCount == 1 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "deleteRole", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - res := types.ShardResponse{Id: id} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - r, _ := k.Security.FetchRole(id, nil) - - inTheEnd, _ := r.Delete(nil) - assert.Equal(t, id, inTheEnd) -} - -func ExampleRole_Delete() { - id := "SomeMenJustWantToWatchTheWorldBurn" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - r, _ := k.Security.FetchRole(id, nil) - - res, err := r.Delete(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} diff --git a/security/scroll_profiles.go b/security/scroll_profiles.go deleted file mode 100644 index 3710fda8..00000000 --- a/security/scroll_profiles.go +++ /dev/null @@ -1,30 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) ScrollProfiles(scrollId string, options types.QueryOptions) (*ProfileSearchResult, error) { - res, err := s.rawScroll("scrollProfiles", scrollId, options) - - if err != nil { - return nil, err - } - - jsonSearchResult := &jsonProfileSearchResult{} - json.Unmarshal(res, jsonSearchResult) - - searchResult := &ProfileSearchResult{ - Total: jsonSearchResult.Total, - ScrollId: jsonSearchResult.ScrollId, - } - - for _, j := range jsonSearchResult.Hits { - p := s.jsonProfileToProfile(j) - p.Security = s - searchResult.Hits = append(searchResult.Hits, p) - } - - return searchResult, nil -} diff --git a/security/scroll_users.go b/security/scroll_users.go deleted file mode 100644 index ae20b5ff..00000000 --- a/security/scroll_users.go +++ /dev/null @@ -1,28 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) ScrollUsers(scrollId string, options types.QueryOptions) (*UserSearchResult, error) { - res, err := s.rawScroll("scrollUsers", scrollId, options) - - if err != nil { - return nil, err - } - - jsonSearchResult := &jsonUserSearchResult{} - json.Unmarshal(res, jsonSearchResult) - - searchResult := &UserSearchResult{ - Total: jsonSearchResult.Total, - ScrollId: jsonSearchResult.ScrollId, - } - - for _, j := range jsonSearchResult.Hits { - searchResult.Hits = append(searchResult.Hits, s.jsonUserToUser(j)) - } - - return searchResult, nil -} diff --git a/security/searchProfiles.go b/security/searchProfiles.go new file mode 100644 index 00000000..8e2458c5 --- /dev/null +++ b/security/searchProfiles.go @@ -0,0 +1,50 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) SearchProfiles(body string, options types.QueryOptions) (*ProfileSearchResult, error) { + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "searchProfiles", + Body: body, + } + + if options != nil { + query.From = options.From() + query.Size = options.Size() + + scroll := options.Scroll() + if scroll != "" { + query.Scroll = scroll + } + } + + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + jsonSearchResult := &jsonProfileSearchResult{} + json.Unmarshal(res.Result, jsonSearchResult) + + searchResult := &ProfileSearchResult{ + ScrollId: jsonSearchResult.ScrollId, + Total: jsonSearchResult.Total, + } + for _, j := range jsonSearchResult.Hits { + p := s.jsonProfileToProfile(j) + p.Security = s + searchResult.Hits = append(searchResult.Hits, p) + } + + return searchResult, nil +} diff --git a/security/search_profiles_test.go b/security/searchProfiles_test.go similarity index 58% rename from security/search_profiles_test.go rename to security/searchProfiles_test.go index 257ef2a3..422192cf 100644 --- a/security/search_profiles_test.go +++ b/security/searchProfiles_test.go @@ -21,7 +21,7 @@ func TestSearchProfileError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.SearchProfiles(nil, nil) + _, err := k.Security.SearchProfiles("", nil) assert.NotNil(t, err) } @@ -43,7 +43,7 @@ func TestSearchProfile(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.SearchProfiles(nil, nil) + res, _ := k.Security.SearchProfiles("", nil) assert.Equal(t, 42, res.Total) assert.Equal(t, "profile42", res.Hits[0].Id) @@ -55,7 +55,7 @@ func TestSearchProfile(t *testing.T) { func ExampleSearchProfiles() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.SearchProfiles(nil, nil) + res, err := k.Security.SearchProfiles("", nil) if err != nil { fmt.Println(err.Error()) @@ -90,7 +90,7 @@ func TestSearchProfileWithScroll(t *testing.T) { opts.SetSize(4) opts.SetScroll("1m") - res, _ := k.Security.SearchProfiles(nil, opts) + res, _ := k.Security.SearchProfiles("", opts) assert.Equal(t, 42, res.Total) assert.Equal(t, 1, len(res.Hits)) assert.Equal(t, []*types.Policy{ @@ -99,57 +99,3 @@ func TestSearchProfileWithScroll(t *testing.T) { assert.Equal(t, "f00b4r", res.ScrollId) assert.Equal(t, "profile42", res.Hits[0].Id) } - -func TestScrollProfileEmptyScrollId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ScrollProfiles("", nil) - assert.NotNil(t, err) -} - -func TestScrollProfileError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ScrollProfiles("f00b4r", nil) - assert.NotNil(t, err) -} - -func TestScrollProfile(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "scrollProfiles", parsedQuery.Action) - - return &types.KuzzleResponse{Result: []byte(`{ - "total": 42, - "hits": [ - {"_id": "profile42", "_source": {"policies": [{"roleId": "admin"}]}} - ] - }`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.Security.ScrollProfiles("f00b4r", nil) - assert.Equal(t, 42, res.Total) - assert.Equal(t, 1, len(res.Hits)) - assert.Equal(t, []*types.Policy{ - {RoleId: "admin"}, - }, res.Hits[0].Policies) - assert.Equal(t, "profile42", res.Hits[0].Id) -} diff --git a/security/searchRoles.go b/security/searchRoles.go new file mode 100644 index 00000000..b85a99bd --- /dev/null +++ b/security/searchRoles.go @@ -0,0 +1,47 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) SearchRoles(body string, options types.QueryOptions) (*RoleSearchResult, error) { + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "searchRoles", + Body: body, + } + + if options != nil { + query.From = options.From() + query.Size = options.Size() + + scroll := options.Scroll() + if scroll != "" { + query.Scroll = scroll + } + } + + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + jsonSearchResult := &jsonRoleSearchResult{} + json.Unmarshal(res.Result, jsonSearchResult) + + searchResult := &RoleSearchResult{ + Total: jsonSearchResult.Total, + } + for _, j := range jsonSearchResult.Hits { + r := s.jsonRoleToRole(j) + searchResult.Hits = append(searchResult.Hits, r) + } + + return searchResult, nil +} diff --git a/security/search_roles_test.go b/security/searchRoles_test.go similarity index 93% rename from security/search_roles_test.go rename to security/searchRoles_test.go index a0cb4e20..def67397 100644 --- a/security/search_roles_test.go +++ b/security/searchRoles_test.go @@ -19,7 +19,7 @@ func TestSearchRolesError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.FetchRole("", nil) + _, err := k.Security.SearchRoles("", nil) assert.NotNil(t, err) } @@ -39,7 +39,7 @@ func TestSearchRoles(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.SearchRoles(nil, nil) + res, _ := k.Security.SearchRoles("", nil) assert.Equal(t, 42, res.Total) assert.Equal(t, 1, len(res.Hits)) @@ -49,7 +49,7 @@ func TestSearchRoles(t *testing.T) { func ExampleSecurityRole_Search() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.SearchRoles(nil, nil) + res, err := k.Security.SearchRoles("", nil) if err != nil { fmt.Println(err.Error()) @@ -96,7 +96,7 @@ func TestSearchWithOptions(t *testing.T) { opts.SetSize(4) opts.SetScroll("1m") - res, _ := k.Security.SearchRoles(nil, opts) + res, _ := k.Security.SearchRoles("", opts) assert.Equal(t, 42, res.Total) assert.Equal(t, res.Hits[0].Id, "role42") assert.Equal(t, 1, len(res.Hits)) diff --git a/security/searchUsers.go b/security/searchUsers.go new file mode 100644 index 00000000..dbf0a6b9 --- /dev/null +++ b/security/searchUsers.go @@ -0,0 +1,49 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) SearchUsers(body string, options types.QueryOptions) (*UserSearchResult, error) { + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "searchUsers", + Body: body, + } + + if options != nil { + query.From = options.From() + query.Size = options.Size() + + scroll := options.Scroll() + if scroll != "" { + query.Scroll = scroll + } + } + + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + jsonSearchResult := &jsonUserSearchResult{} + json.Unmarshal(res.Result, jsonSearchResult) + + searchResult := &UserSearchResult{ + Total: jsonSearchResult.Total, + ScrollId: jsonSearchResult.ScrollId, + } + + for _, j := range jsonSearchResult.Hits { + searchResult.Hits = append(searchResult.Hits, s.jsonUserToUser(j)) + } + + return searchResult, nil +} diff --git a/security/search_users_test.go b/security/searchUsers_test.go similarity index 54% rename from security/search_users_test.go rename to security/searchUsers_test.go index 643ba891..76ee1113 100644 --- a/security/search_users_test.go +++ b/security/searchUsers_test.go @@ -19,7 +19,7 @@ func TestSearchUsersError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.SearchUsers(nil, nil) + _, err := k.Security.SearchUsers("", nil) assert.NotNil(t, err) } @@ -41,7 +41,7 @@ func TestSearchUsers(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.SearchUsers(nil, nil) + res, _ := k.Security.SearchUsers("", nil) assert.Equal(t, 42, res.Total) assert.Equal(t, 1, len(res.Hits)) @@ -53,7 +53,7 @@ func TestSearchUsers(t *testing.T) { func ExampleSearchUsers() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.SearchUsers(nil, nil) + res, err := k.Security.SearchUsers("", nil) if err != nil { fmt.Println(err.Error()) @@ -89,68 +89,5 @@ func TestSearchUsersWithScroll(t *testing.T) { opts.SetSize(4) opts.SetScroll("1m") - k.Security.SearchUsers(nil, opts) -} - -func TestScrollEmptyScrollId(t *testing.T) { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ScrollUsers("", nil) - - assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) - assert.Equal(t, "Security.scrollUsers: scroll id is required", err.(*types.KuzzleError).Message) -} - -func TestScrollError(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ScrollUsers("f00b4r", nil) - assert.NotNil(t, err) -} - -func TestScroll(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "scrollUsers", parsedQuery.Action) - - return &types.KuzzleResponse{Result: []byte(`{ - "total": 42, - "hits": [ - {"_id": "user42", "_source": {"profileIds": ["admin", "other"], "foo": "bar"}} - ] - }`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - res, _ := k.Security.ScrollUsers("f00b4r", nil) - assert.Equal(t, 42, res.Total) - assert.Equal(t, 1, len(res.Hits)) - assert.Equal(t, []string{"admin", "other"}, res.Hits[0].ProfileIds) - assert.Equal(t, map[string]interface{}{"foo": "bar"}, res.Hits[0].Content) -} - -func ExampleScrollUsers() { - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - - res, err := k.Security.ScrollUsers("f00b4r", nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Hits[0].Id, res.Hits[0].Content) + k.Security.SearchUsers("", opts) } diff --git a/security/search_profiles.go b/security/search_profiles.go deleted file mode 100644 index 58566cef..00000000 --- a/security/search_profiles.go +++ /dev/null @@ -1,29 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) SearchProfiles(filters interface{}, options types.QueryOptions) (*ProfileSearchResult, error) { - res, err := s.rawSearch("searchProfiles", filters, options) - - if err != nil { - return nil, err - } - - jsonSearchResult := &jsonProfileSearchResult{} - json.Unmarshal(res, jsonSearchResult) - - searchResult := &ProfileSearchResult{ - ScrollId: jsonSearchResult.ScrollId, - Total: jsonSearchResult.Total, - } - for _, j := range jsonSearchResult.Hits { - p := s.jsonProfileToProfile(j) - p.Security = s - searchResult.Hits = append(searchResult.Hits, p) - } - - return searchResult, nil -} diff --git a/security/search_roles.go b/security/search_roles.go deleted file mode 100644 index 2a87df39..00000000 --- a/security/search_roles.go +++ /dev/null @@ -1,27 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) SearchRoles(filters interface{}, options types.QueryOptions) (*RoleSearchResult, error) { - res, err := s.rawSearch("searchRoles", filters, options) - - if err != nil { - return nil, err - } - - jsonSearchResult := &jsonRoleSearchResult{} - json.Unmarshal(res, jsonSearchResult) - - searchResult := &RoleSearchResult{ - Total: jsonSearchResult.Total, - } - for _, j := range jsonSearchResult.Hits { - r := s.jsonRoleToRole(j) - searchResult.Hits = append(searchResult.Hits, r) - } - - return searchResult, nil -} diff --git a/security/search_users.go b/security/search_users.go deleted file mode 100644 index c35d8b81..00000000 --- a/security/search_users.go +++ /dev/null @@ -1,28 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" -) - -func (s *Security) SearchUsers(filters interface{}, options types.QueryOptions) (*UserSearchResult, error) { - res, err := s.rawSearch("searchUsers", filters, options) - - if err != nil { - return nil, err - } - - jsonSearchResult := &jsonUserSearchResult{} - json.Unmarshal(res, jsonSearchResult) - - searchResult := &UserSearchResult{ - Total: jsonSearchResult.Total, - ScrollId: jsonSearchResult.ScrollId, - } - - for _, j := range jsonSearchResult.Hits { - searchResult.Hits = append(searchResult.Hits, s.jsonUserToUser(j)) - } - - return searchResult, nil -} diff --git a/security/security.go b/security/security.go index 9d793328..d4ff112c 100644 --- a/security/security.go +++ b/security/security.go @@ -9,7 +9,7 @@ type Security struct { } // NewSecurity returns a new instance of Security -func New(kuzzle types.IKuzzle) *Security { +func NewSecurity(kuzzle types.IKuzzle) *Security { return &Security{ Kuzzle: kuzzle, } diff --git a/security/updateCredentials.go b/security/updateCredentials.go new file mode 100644 index 00000000..b3ea1674 --- /dev/null +++ b/security/updateCredentials.go @@ -0,0 +1,31 @@ +package security + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +// UpdateCredentials updates credentials of the specified strategy for the given user. +func (s *Security) UpdateCredentials(strategy string, kuid string, body string, options types.QueryOptions) error { + if strategy == "" || kuid == "" { + return types.NewError("Security.UpdateCredentials: strategy and kuid are required", 400) + } + + result := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "updateCredentials", + Body: body, + Strategy: strategy, + Id: kuid, + } + go s.Kuzzle.Query(query, options, result) + + res := <-result + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/security/update_credentials_test.go b/security/updateCredentials_test.go similarity index 71% rename from security/update_credentials_test.go rename to security/updateCredentials_test.go index ba0fdaf4..cc8655f4 100644 --- a/security/update_credentials_test.go +++ b/security/updateCredentials_test.go @@ -3,12 +3,13 @@ package security_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestUpdateCredentialsQueryError(t *testing.T) { @@ -22,7 +23,7 @@ func TestUpdateCredentialsQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.UpdateCredentials("local", "someId", nil, nil) + err := k.Security.UpdateCredentials("local", "someId", "", nil) assert.NotNil(t, err) } @@ -33,7 +34,7 @@ func TestUpdateCredentialsEmptyStrategy(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.UpdateCredentials("", "someId", nil, nil) + err := k.Security.UpdateCredentials("", "someId", "", nil) assert.NotNil(t, err) } @@ -44,53 +45,35 @@ func TestUpdateCredentialsEmptyKuid(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.UpdateCredentials("local", "", nil, nil) + err := k.Security.UpdateCredentials("local", "", "", nil) assert.NotNil(t, err) } func TestUpdateCredentials(t *testing.T) { - type myCredentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - ack := myCredentials{Username: "foo", Password: "bar"} - r, _ := json.Marshal(ack) - request := types.KuzzleRequest{} json.Unmarshal(query, &request) assert.Equal(t, "security", request.Controller) assert.Equal(t, "updateCredentials", request.Action) assert.Equal(t, "local", request.Strategy) assert.Equal(t, "someId", request.Id) - return &types.KuzzleResponse{Result: r} + return &types.KuzzleResponse{Result: []byte(`{}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.UpdateCredentials("local", "someId", myCredentials{"foo", "bar"}, nil) + err := k.Security.UpdateCredentials("local", "someId", "body", nil) assert.Nil(t, err) - - assert.Equal(t, "foo", res["username"]) - assert.Equal(t, "bar", res["password"]) } func ExampleSecurity_UpdateCredentials() { - type myCredentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.UpdateCredentials("local", "someId", myCredentials{"foo", "bar"}, nil) + err := k.Security.UpdateCredentials("local", "someId", "body", nil) if err != nil { fmt.Println(err.Error()) return } - - fmt.Println(res) } diff --git a/security/updateProfile.go b/security/updateProfile.go new file mode 100644 index 00000000..093b58c6 --- /dev/null +++ b/security/updateProfile.go @@ -0,0 +1,34 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) UpdateProfile(id, body string, options types.QueryOptions) (*Profile, error) { + if id == "" || body == "" { + return nil, types.NewError("Security.UpdateProfile: id and body are required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "updateProfile", + Id: id, + Body: body, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var updated *Profile + json.Unmarshal(res.Result, &updated) + + return updated, nil +} diff --git a/security/updateProfileMapping.go b/security/updateProfileMapping.go new file mode 100644 index 00000000..710f86e3 --- /dev/null +++ b/security/updateProfileMapping.go @@ -0,0 +1,28 @@ +package security + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) UpdateProfileMapping(body string, options types.QueryOptions) error { + if body == "" { + return types.NewError("Security.UpdateProfileMapping: body is required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "updateProfileMapping", + Body: body, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/security/updateProfileMapping_test.go b/security/updateProfileMapping_test.go new file mode 100644 index 00000000..6a36b5e9 --- /dev/null +++ b/security/updateProfileMapping_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateProfileMappingBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + err := k.Security.UpdateProfileMapping("", nil) + assert.Error(t, err) +} + +func TestUpdateProfileMappingError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{ + Error: types.NewError("Test error"), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + err := k.Security.UpdateProfileMapping("body", nil) + assert.Error(t, err) +} + +func TestUpdateProfileMapping(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "updateProfileMapping", parsedQuery.Action) + assert.Equal(t, "body", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ "acknowledged" : true}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + err := k.Security.UpdateProfileMapping("body", nil) + assert.NoError(t, err) +} diff --git a/security/updateProfile_test.go b/security/updateProfile_test.go new file mode 100644 index 00000000..4736c2a1 --- /dev/null +++ b/security/updateProfile_test.go @@ -0,0 +1,64 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateProfileIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.UpdateProfile("", "body", nil) + assert.Error(t, err) +} + +func TestUpdateProfileBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.UpdateProfile("id", "", nil) + assert.Error(t, err) +} + +func TestUpdateProfileError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{ + Error: types.NewError("Test error"), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.UpdateProfile("id", "body", nil) + assert.Error(t, err) +} + +func TestUpdateProfile(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "updateProfile", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "body", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "id", + "_index": "%kuzzle", + "_type": "profile", + "_version": 2 + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := k.Security.UpdateProfile("id", "body", nil) + assert.NoError(t, err) + assert.NotNil(t, res) + assert.Equal(t, "id", res.Id) +} diff --git a/security/updateRole.go b/security/updateRole.go new file mode 100644 index 00000000..26da59f3 --- /dev/null +++ b/security/updateRole.go @@ -0,0 +1,34 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) UpdateRole(id, body string, options types.QueryOptions) (*Role, error) { + if id == "" || body == "" { + return nil, types.NewError("Security.UpdateRole: id and body are required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "updateRole", + Id: id, + Body: body, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var updated *Role + json.Unmarshal(res.Result, &updated) + + return updated, nil +} diff --git a/security/updateRoleMapping.go b/security/updateRoleMapping.go new file mode 100644 index 00000000..94348dfc --- /dev/null +++ b/security/updateRoleMapping.go @@ -0,0 +1,28 @@ +package security + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) UpdateRoleMapping(body string, options types.QueryOptions) error { + if body == "" { + return types.NewError("Security.UpdateRoleMapping: body is required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "updateRoleMapping", + Body: body, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/security/updateRoleMapping_test.go b/security/updateRoleMapping_test.go new file mode 100644 index 00000000..b3db1d4d --- /dev/null +++ b/security/updateRoleMapping_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateRoleMappingBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + err := k.Security.UpdateRoleMapping("", nil) + assert.Error(t, err) +} + +func TestUpdateRoleMappingError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{ + Error: types.NewError("Test error"), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + err := k.Security.UpdateRoleMapping("body", nil) + assert.Error(t, err) +} + +func TestUpdateRoleMapping(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "updateRoleMapping", parsedQuery.Action) + assert.Equal(t, "body", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ "acknowledged" : true}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + err := k.Security.UpdateRoleMapping("body", nil) + assert.NoError(t, err) +} diff --git a/security/updateRole_test.go b/security/updateRole_test.go new file mode 100644 index 00000000..0c709ba9 --- /dev/null +++ b/security/updateRole_test.go @@ -0,0 +1,64 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateRoleIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.UpdateRole("", "body", nil) + assert.Error(t, err) +} + +func TestUpdateRoleBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.UpdateRole("id", "", nil) + assert.Error(t, err) +} + +func TestUpdateRoleError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{ + Error: types.NewError("Test error"), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.UpdateRole("id", "body", nil) + assert.Error(t, err) +} + +func TestUpdateRole(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "updateRole", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "body", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "id", + "_index": "%kuzzle", + "_type": "role", + "_version": 2 + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := k.Security.UpdateRole("id", "body", nil) + assert.NoError(t, err) + assert.NotNil(t, res) + assert.Equal(t, "id", res.Id) +} diff --git a/security/updateUser.go b/security/updateUser.go new file mode 100644 index 00000000..688031be --- /dev/null +++ b/security/updateUser.go @@ -0,0 +1,34 @@ +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) UpdateUser(id, body string, options types.QueryOptions) (*User, error) { + if id == "" || body == "" { + return nil, types.NewError("Security.UpdateUser: id and body are required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "updateUser", + Id: id, + Body: body, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return nil, res.Error + } + + var updated *User + json.Unmarshal(res.Result, &updated) + + return updated, nil +} diff --git a/security/updateUserMapping.go b/security/updateUserMapping.go new file mode 100644 index 00000000..8b2adb0a --- /dev/null +++ b/security/updateUserMapping.go @@ -0,0 +1,28 @@ +package security + +import ( + "github.com/kuzzleio/sdk-go/types" +) + +func (s *Security) UpdateUserMapping(body string, options types.QueryOptions) error { + if body == "" { + return types.NewError("Security.UpdateUserMapping: body is required", 400) + } + + ch := make(chan *types.KuzzleResponse) + + query := &types.KuzzleRequest{ + Controller: "security", + Action: "updateUserMapping", + Body: body, + } + go s.Kuzzle.Query(query, options, ch) + + res := <-ch + + if res.Error != nil { + return res.Error + } + + return nil +} diff --git a/security/updateUserMapping_test.go b/security/updateUserMapping_test.go new file mode 100644 index 00000000..1636739a --- /dev/null +++ b/security/updateUserMapping_test.go @@ -0,0 +1,49 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateUserMappingBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + err := k.Security.UpdateUserMapping("", nil) + assert.Error(t, err) +} + +func TestUpdateUserMappingError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{ + Error: types.NewError("Test error"), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + err := k.Security.UpdateUserMapping("body", nil) + assert.Error(t, err) +} + +func TestUpdateUserMapping(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "updateUserMapping", parsedQuery.Action) + assert.Equal(t, "body", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ "acknowledged" : true}`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + err := k.Security.UpdateUserMapping("body", nil) + assert.NoError(t, err) +} diff --git a/security/updateUser_test.go b/security/updateUser_test.go new file mode 100644 index 00000000..24f02bcf --- /dev/null +++ b/security/updateUser_test.go @@ -0,0 +1,64 @@ +package security_test + +import ( + "encoding/json" + "testing" + + "github.com/kuzzleio/sdk-go/internal" + "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" + "github.com/stretchr/testify/assert" +) + +func TestUpdateUserIDNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.UpdateUser("", "body", nil) + assert.Error(t, err) +} + +func TestUpdateUserBodyNull(t *testing.T) { + k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) + _, err := k.Security.UpdateUser("id", "", nil) + assert.Error(t, err) +} + +func TestUpdateUserError(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{ + Error: types.NewError("Test error"), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + _, err := k.Security.UpdateUser("id", "body", nil) + assert.Error(t, err) +} + +func TestUpdateUser(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "security", parsedQuery.Controller) + assert.Equal(t, "updateUser", parsedQuery.Action) + assert.Equal(t, "id", parsedQuery.Id) + assert.Equal(t, "body", parsedQuery.Body) + + return &types.KuzzleResponse{Result: []byte(`{ + "_id": "id", + "_index": "%kuzzle", + "_type": "users", + "_version": 2 + }`), + } + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + res, err := k.Security.UpdateUser("id", "body", nil) + assert.NoError(t, err) + assert.NotNil(t, res) + assert.Equal(t, "id", res.Id) +} diff --git a/security/update_credentials.go b/security/update_credentials.go deleted file mode 100644 index b3735e4a..00000000 --- a/security/update_credentials.go +++ /dev/null @@ -1,40 +0,0 @@ -package security - -import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" - "reflect" -) - -// UpdateCredentials updates credentials of the specified strategy for the given user. -func (s *Security) UpdateCredentials(strategy string, kuid string, credentials interface{}, options types.QueryOptions) (map[string]interface{}, error) { - if strategy == "" { - return nil, types.NewError("Security.UpdateCredentials: strategy is required", 400) - } - - if kuid == "" { - return nil, types.NewError("Security.UpdateCredentials: kuid is required", 400) - } - - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "security", - Action: "updateCredentials", - Body: credentials, - Strategy: strategy, - Id: kuid, - } - go s.Kuzzle.Query(query, options, result) - - res := <-result - - if res.Error != nil { - return nil, res.Error - } - - ref := reflect.New(reflect.TypeOf(credentials)).Elem().Interface() - json.Unmarshal(res.Result, &ref) - - return ref.(map[string]interface{}), nil -} diff --git a/security/user.go b/security/user.go index 78a3e440..8bf63b27 100644 --- a/security/user.go +++ b/security/user.go @@ -1,15 +1,12 @@ package security import ( - "encoding/json" - "errors" - "github.com/kuzzleio/sdk-go/types" ) type User struct { - Id string - Content map[string]interface{} + Id string `json:"_id"` + Content map[string]interface{} `json:"_source"` ProfileIds []string Security *Security } @@ -20,200 +17,16 @@ type UserSearchResult struct { ScrollId string } -// Create the user in Kuzzle. -// Credentials can be created during the process by using setCredentials beforehand. -func (u *User) Create(options types.QueryOptions) (*User, error) { - return u.persist("createUser", types.UserData{Content: u.Content, ProfileIds: u.ProfileIds}, options) -} - -func (u *User) CreateCredentials(strategy string, credentials interface{}, options types.QueryOptions) (json.RawMessage, error) { - return u.queryCredentials("createCredentials", strategy, credentials, options) -} - -// CreateWithCredentials creates the user in Kuzzle along with supplied credentials -func (u *User) CreateWithCredentials(credentials types.Credentials, options types.QueryOptions) (*User, error) { - type body struct { - Content map[string]interface{} `json:"content"` - Credentials types.Credentials `json:"credentials,omitempty"` - ProfileIds []string `json:"profileIds"` - } - return u.persist("createUser", body{ - Content: u.Content, - Credentials: credentials, - ProfileIds: u.ProfileIds, - }, options) -} - -// Delete the user from Kuzzle. -func (u *User) Delete(options types.QueryOptions) (string, error) { - return u.Security.rawDelete("deleteUser", u.Id, options) -} - -// DeleteCredentials removes the user credentials for the given strategy -func (u *User) DeleteCredentials(strategy string, options types.QueryOptions) (bool, error) { - _, err := u.queryCredentials("deleteCredentials", strategy, nil, options) - return err != nil, err -} - -// GetCredentialsInfo returns user credentials for the given strategy. -func (u *User) GetCredentialsInfo(strategy string, options types.QueryOptions) (json.RawMessage, error) { - return u.queryCredentials("getCredentials", strategy, nil, options) -} - -// GetProfiles returns the associated Profile instances from the Kuzzle API, using the profile identifiers attached to this user (see getProfileIds). -func (u *User) GetProfiles(options types.QueryOptions) ([]*Profile, error) { - fetchedProfiles := []*Profile{} - - if len(u.ProfileIds) == 0 { - return fetchedProfiles, nil - } - - for _, profileId := range u.ProfileIds { - p, err := u.Security.FetchProfile(profileId, options) - - if err != nil { - return nil, err - } - - fetchedProfiles = append(fetchedProfiles, p) - } - - return fetchedProfiles, nil -} - -// GetRights returns user permissions the user is granted, per controller action -func (u *User) GetRights(options types.QueryOptions) ([]*types.UserRights, error) { - if u.Id == "" { - return nil, errors.New("Security.User.GetRights: user id required") - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "security", - Action: "getUserRights", - Id: u.Id, - } - go u.Security.Kuzzle.Query(query, options, ch) - - res := <-ch - - if res.Error != nil { - return nil, errors.New(res.Error.Message) - } - - type response struct { - UserRights []*types.UserRights `json:"hits"` - } - userRights := response{} - json.Unmarshal(res.Result, &userRights) - - return userRights.UserRights, nil -} - -// HasCredentials checks if the user has some credentials set for the given strategy. -func (u *User) HasCredentials(strategy string, options types.QueryOptions) (bool, error) { - _, err := u.queryCredentials("hasCredentials", strategy, nil, options) - return err != nil, err -} - -// Replace the user in Kuzzle. -func (u *User) Replace(options types.QueryOptions) (*User, error) { - return u.persist("replaceUser", u.getFlatBody(), options) -} - -// SaveRestricted stores the current user as restricted into Kuzzle. -func (u *User) SaveRestricted(credentials types.Credentials, options types.QueryOptions) (*User, error) { - if u.Id == "" { - return nil, types.NewError("User.SaveRestricted: id is required", 400) - } - - type body struct { - Content map[string]interface{} `json:"content"` - Credentials types.Credentials `json:"credentials,omitempty"` - } - - return u.persist("createRestrictedUser", body{Content: u.Content, Credentials: credentials}, options) -} - -// UpdateCredentials replaces the user credentials for the given strategy -// The credentials to send depends entirely on the authentication plugin and strategy you want to update credentials for. -func (u *User) UpdateCredentials(strategy string, credentials interface{}, options types.QueryOptions) (json.RawMessage, error) { - return u.queryCredentials("updateCredentials", strategy, credentials, options) -} - -func (u *User) getFlatBody() map[string]interface{} { - body := make(map[string]interface{}) - for k, v := range u.Content { - body[k] = v - } - if u.ProfileIds != nil { - body["profileIds"] = u.ProfileIds - } - - return body -} - -func (u *User) persist(action string, body interface{}, options types.QueryOptions) (*User, error) { - if options == nil { - options = types.NewQueryOptions() - } - - if action != "createUser" && u.Id == "" { - return nil, types.NewError("User."+action+": id is required", 400) - } - - ch := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "security", - Action: action, - Body: body, - Id: u.Id, - } - go u.Security.Kuzzle.Query(query, options, ch) - res := <-ch - - if res.Error != nil { - return nil, res.Error - } - - jsonUser := &jsonUser{} - json.Unmarshal(res.Result, jsonUser) - - updatedUser := u.Security.jsonUserToUser(jsonUser) - - u.Id = updatedUser.Id - u.Content = updatedUser.Content - u.ProfileIds = updatedUser.ProfileIds - - return u, nil -} - -func (u *User) queryCredentials(action string, strategy string, body interface{}, options types.QueryOptions) (json.RawMessage, error) { - if strategy == "" { - return nil, types.NewError("Security."+action+": strategy is required", 400) - } - - if u.Id == "" { - return nil, types.NewError("Security."+action+": user id is required", 400) - } - - result := make(chan *types.KuzzleResponse) - - query := &types.KuzzleRequest{ - Controller: "security", - Action: action, - Strategy: strategy, - Id: u.Id, - Body: body, +func (s *Security) NewUser(id string, content *types.UserData) *User { + u := &User{ + Id: id, + Security: s, } - go u.Security.Kuzzle.Query(query, options, result) - res := <-result - if res.Error != nil { - return nil, res.Error + if content != nil { + u.Content = content.Content + u.ProfileIds = content.ProfileIds } - return res.Result, nil + return u } diff --git a/security/user_test.go b/security/user_test.go deleted file mode 100644 index 7b9f771b..00000000 --- a/security/user_test.go +++ /dev/null @@ -1,746 +0,0 @@ -package security_test - -import ( - "encoding/json" - "fmt" - "testing" - - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/internal" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/security" - "github.com/kuzzleio/sdk-go/types" - "github.com/stretchr/testify/assert" -) - -func TestUser_GetProfiles_EmptyProfileIds(t *testing.T) { - id := "userId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - return &types.KuzzleResponse{Result: []byte(`{ - "_id": "userId", - "_source": { - "profileIds": [], - "name": "Luke", - "function": "Jedi" - } - }`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - profiles, _ := u.GetProfiles(nil) - - assert.Equal(t, []*security.Profile{}, profiles) -} - -func TestUser_GetProfiles_Error(t *testing.T) { - id := "userId" - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - if callCount == 0 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - return &types.KuzzleResponse{Result: []byte(`{ - "_id": "userId", - "_source": { - "profileIds": ["admin", "other"], - "name": "Luke", - "function": "Jedi" - } - }`)} - } - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getProfile", parsedQuery.Action) - assert.Equal(t, "admin", parsedQuery.Id) - - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - _, err := u.GetProfiles(nil) - assert.NotNil(t, err) -} - -func TestUser_GetProfiles(t *testing.T) { - id := "userId" - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - if callCount == 0 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - return &types.KuzzleResponse{Result: []byte(`{ - "_id": "userId", - "_source": { - "profileIds": ["admin", "other"], - "name": "Luke", - "function": "Jedi" - } - }`)} - } - if callCount == 1 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getProfile", parsedQuery.Action) - assert.Equal(t, "admin", parsedQuery.Id) - - return &types.KuzzleResponse{Result: []byte(`{ - "_id": "admin", - "_source": { - "policies": [ - {"roleId": "admin"}, - {"roleId": "other"} - ] - } - }`)} - } - if callCount == 2 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getProfile", parsedQuery.Action) - assert.Equal(t, "other", parsedQuery.Id) - - return &types.KuzzleResponse{Result: []byte(`{ - "_id": "other", - "_source": { - "policies": [ - {"roleId": "other"}, - {"roleId": "default"} - ] - } - }`)} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - profiles, _ := u.GetProfiles(nil) - - assert.Equal(t, 2, len(profiles)) - assert.Equal(t, "admin", profiles[0].Id) - assert.Equal(t, []*types.Policy{ - {RoleId: "admin"}, - {RoleId: "other"}, - }, profiles[0].Policies) - assert.Equal(t, "other", profiles[1].Id) - assert.Equal(t, []*types.Policy{ - {RoleId: "other"}, - {RoleId: "default"}, - }, profiles[1].Policies) -} - -func ExampleUser_GetProfiles() { - id := "userId" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - res, err := u.GetProfiles(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Id, res[0].Policies) -} - -func TestUser_Create_Error(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - user := k.Security.NewUser("userId", nil) - - _, err := user.Create(nil) - assert.NotNil(t, err) -} - -func TestUser_Create(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createUser", parsedQuery.Action) - assert.Equal(t, map[string]interface{}{ - "content": map[string]interface{}{ - "function": "Master Jedi", - }, - "profileIds": []interface{}{"admin"}, - }, parsedQuery.Body) - - return &types.KuzzleResponse{Result: []byte{}} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - u := k.Security.NewUser("", &types.UserData{ - Content: map[string]interface{}{ - "function": "Master Jedi", - }, - ProfileIds: []string{"admin"}, - }) - - _, err := u.Create(nil) - assert.Nil(t, err) -} - -func ExampleUser_Create() { - id := "userId" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - if u.Content == nil { - u.Content = make(map[string]interface{}) - } - u.Content["function"] = "Master Jedi" - res, err := u.Create(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} - -func TestUser_CreateCredentials(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createCredentials", parsedQuery.Action) - assert.Equal(t, "strategy", parsedQuery.Strategy) - assert.Equal(t, "userid", parsedQuery.Id) - assert.Equal(t, "myCredentials", parsedQuery.Body) - - return &types.KuzzleResponse{Result: []byte{}} - }, - } - - k, err := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userid", nil) - _, err = user.CreateCredentials("strategy", "myCredentials", nil) - - assert.Nil(t, err) -} - -func TestUser_CreateWithCredentials(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createUser", parsedQuery.Action) - assert.Equal(t, map[string]interface{}{ - "content": map[string]interface{}{ - "function": "Jedi", - }, - "credentials": map[string]interface{}{ - "strategy": "myCredentials", - }, - "profileIds": []interface{}{"profile1", "profile2"}, - }, parsedQuery.Body) - - return &types.KuzzleResponse{Result: []byte{}} - }, - } - - k, err := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userid", &types.UserData{ - Content: map[string]interface{}{"function": "Jedi"}, - ProfileIds: []string{"profile1", "profile2"}, - }) - _, err = user.CreateWithCredentials(types.Credentials("{\"strategy\": \"myCredentials\"}"), nil) - - assert.Nil(t, err) -} - -func TestUser_Delete_EmptyId(t *testing.T) { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("", nil) - - _, err := user.Delete(nil) - assert.NotNil(t, err) -} - -func TestUser_Delete_Error(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userId", nil) - - _, err := user.Delete(nil) - assert.NotNil(t, err) -} - -func TestUser_Delete(t *testing.T) { - id := "SomeMenJustWantToWatchTheWorldBurn" - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - if callCount == 0 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - return &types.KuzzleResponse{Result: []byte(`{ - "_id": "` + id + `", - "_source": { - "profileIds": ["admin", "other"], - "name": "Luke", - "function": "Jedi" - } - }`)} - } - if callCount == 1 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "deleteUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - res := types.ShardResponse{Id: id} - r, _ := json.Marshal(res) - return &types.KuzzleResponse{Result: r} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - inTheEnd, _ := u.Delete(nil) - assert.Equal(t, id, inTheEnd) -} - -func ExampleUser_Delete() { - id := "SomeMenJustWantToWatchTheWorldBurn" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - res, err := u.Delete(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res) -} - -func TestUser_DeleteCredentials(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "deleteCredentials", parsedQuery.Action) - assert.Equal(t, "strategy", parsedQuery.Strategy) - assert.Equal(t, "userid", parsedQuery.Id) - - return &types.KuzzleResponse{} - }, - } - - k, err := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userid", nil) - - _, err = user.DeleteCredentials("strategy", nil) - - assert.Nil(t, err) -} - -func TestUser_GetCredentialsInfo_EmptyStrategy(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - user := k.Security.NewUser("userid", nil) - _, err := user.GetCredentialsInfo("", nil) - - assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) - assert.Equal(t, "Security.getCredentials: strategy is required", err.(*types.KuzzleError).Message) -} - -func TestUser_GetCredentialsInfo_EmptyUserId(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - user := k.Security.NewUser("", nil) - _, err := user.GetCredentialsInfo("strategy", nil) - - assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) - assert.Equal(t, "Security.getCredentials: user id is required", err.(*types.KuzzleError).Message) -} - -func TestUser_GetCredentialsInfo(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - q := &types.KuzzleRequest{} - json.Unmarshal(query, q) - - assert.Equal(t, "security", q.Controller) - assert.Equal(t, "getCredentials", q.Action) - assert.Equal(t, "strategy", q.Strategy) - assert.Equal(t, "userid", q.Id) - - return &types.KuzzleResponse{} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userid", nil) - - _, err := user.GetCredentialsInfo("strategy", nil) - assert.Nil(t, err) -} - -func TestUser_GetRights_EmptyId(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("", nil) - _, err := user.GetRights(nil) - assert.NotNil(t, err) -} - -func TestUser_GetRights_Error(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userid", nil) - _, err := user.GetRights(nil) - assert.NotNil(t, err) -} - -func TestUser_GetRights(t *testing.T) { - id := "userId" - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getUserRights", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - type resultUserRights struct { - UserRights []*types.UserRights `json:"hits"` - } - userRights := []*types.UserRights{ - {Controller: "wow-controller", Action: "such-action", Index: "much indexes", Collection: "very collection", Value: "wow"}, - } - actualRights := resultUserRights{UserRights: userRights} - r, _ := json.Marshal(actualRights) - return &types.KuzzleResponse{Result: r} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser(id, nil) - res, _ := user.GetRights(nil) - - expectedRights := []*types.UserRights{ - {Controller: "wow-controller", Action: "such-action", Index: "much indexes", Collection: "very collection", Value: "wow"}, - } - - assert.Equal(t, expectedRights, res) -} - -func ExampleUser_GetRights() { - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userid", nil) - - res, err := user.GetRights(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res[0].Index, res[0].Collection, res[0].Controller, res[0].Action, res[0].Value) -} - -func TestUser_HasCredentials(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "hasCredentials", parsedQuery.Action) - assert.Equal(t, "strategy", parsedQuery.Strategy) - assert.Equal(t, "userid", parsedQuery.Id) - - return &types.KuzzleResponse{} - }, - } - - k, err := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userid", nil) - - _, err = user.HasCredentials("strategy", nil) - assert.Nil(t, err) -} - -func TestUserSaveRestrictedEmptyId(t *testing.T) { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("", nil) - - _, err := user.SaveRestricted(nil, nil) - assert.NotNil(t, err) - assert.Equal(t, 400, err.(*types.KuzzleError).Status) - assert.Equal(t, "User.SaveRestricted: id is required", err.(*types.KuzzleError).Message) -} - -func TestUserSaveRestricted(t *testing.T) { - id := "userId" - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - if callCount == 0 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - return &types.KuzzleResponse{Result: []byte(`{ - "_id": "userId", - "_source": { - "profileIds": ["admin", "other"], - "name": "Luke", - "function": "Jedi" - } - }`)} - } - if callCount == 1 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "createRestrictedUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - assert.Equal(t, map[string]interface{}{ - "content": map[string]interface{}{ - "name": "Luke", - "function": "Master Jedi", - }, - }, parsedQuery.Body) - - return &types.KuzzleResponse{Result: []byte{}} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - u.Content["function"] = "Master Jedi" - _, err := u.SaveRestricted(nil, nil) - assert.Nil(t, err) -} - -func ExampleUser_SaveRestricted() { - id := "userId" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - if u.Content == nil { - u.Content = make(map[string]interface{}) - } - u.Content["function"] = "Master Jedi" - res, err := u.SaveRestricted(nil, nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} - -func TestUser_Replace_EmptyId(t *testing.T) { - c := &internal.MockedConnection{} - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("", nil) - - _, err := user.Replace(nil) - assert.NotNil(t, err) -} - -func TestUser_Replace_Error(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{ - Error: types.NewError("Test error"), - } - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("", nil) - - _, err := user.Replace(nil) - assert.NotNil(t, err) -} - -func TestUser_Replace(t *testing.T) { - id := "userId" - callCount := 0 - - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - if callCount == 0 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "getUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - - return &types.KuzzleResponse{Result: []byte(`{ - "_id": "userId", - "_source": { - "profileIds": ["admin", "other"], - "name": "Luke", - "function": "Jedi" - } - }`)} - } - if callCount == 1 { - callCount++ - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "replaceUser", parsedQuery.Action) - assert.Equal(t, id, parsedQuery.Id) - assert.Equal(t, map[string]interface{}{ - "profileIds": []interface{}{"admin", "other"}, - "name": "Luke", - "function": "Master Jedi", - }, parsedQuery.Body) - - return &types.KuzzleResponse{Result: []byte{}} - } - - return &types.KuzzleResponse{Result: nil} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - u.Content["function"] = "Master Jedi" - _, err := u.Replace(nil) - assert.Nil(t, err) -} - -func ExampleUser_Replace() { - id := "userId" - c := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(c, nil) - u, _ := k.Security.FetchUser(id, nil) - - if u.Content == nil { - u.Content = make(map[string]interface{}) - } - u.Content["function"] = "Master Jedi" - res, err := u.Replace(nil) - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Println(res.Id, res.Content) -} - -func TestUser_UpdateCredentials(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - q := &types.KuzzleRequest{} - json.Unmarshal(query, q) - - assert.Equal(t, "security", q.Controller) - assert.Equal(t, "updateCredentials", q.Action) - assert.Equal(t, "strategy", q.Strategy) - assert.Equal(t, "userid", q.Id) - assert.Equal(t, "myCredentials", q.Body) - - return &types.KuzzleResponse{} - }, - } - - k, _ := kuzzle.NewKuzzle(c, nil) - user := k.Security.NewUser("userid", nil) - - _, err := user.UpdateCredentials("strategy", "myCredentials", nil) - assert.Nil(t, err) -} diff --git a/security/validate_credentials.go b/security/validateCredentials.go similarity index 89% rename from security/validate_credentials.go rename to security/validateCredentials.go index d8efbac3..d9d144a5 100644 --- a/security/validate_credentials.go +++ b/security/validateCredentials.go @@ -2,11 +2,12 @@ package security import ( "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // ValidateCredentials validates credentials of the specified strategy for the given user. -func (s *Security) ValidateCredentials(strategy string, kuid string, credentials interface{}, options types.QueryOptions) (bool, error) { +func (s *Security) ValidateCredentials(strategy string, kuid string, body string, options types.QueryOptions) (bool, error) { if strategy == "" { return false, types.NewError("Security.ValidateCredentials: strategy is required", 400) } @@ -20,7 +21,7 @@ func (s *Security) ValidateCredentials(strategy string, kuid string, credentials query := &types.KuzzleRequest{ Controller: "security", Action: "validateCredentials", - Body: credentials, + Body: body, Strategy: strategy, Id: kuid, } diff --git a/security/validate_credentials_test.go b/security/validateCredentials_test.go similarity index 78% rename from security/validate_credentials_test.go rename to security/validateCredentials_test.go index d106e36b..f249085f 100644 --- a/security/validate_credentials_test.go +++ b/security/validateCredentials_test.go @@ -3,12 +3,13 @@ package security_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestValidateCredentialsQueryError(t *testing.T) { @@ -22,7 +23,7 @@ func TestValidateCredentialsQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ValidateCredentials("local", "someId", nil, nil) + _, err := k.Security.ValidateCredentials("local", "someId", "body", nil) assert.NotNil(t, err) } @@ -33,7 +34,7 @@ func TestValidateCredentialsEmptyStrategy(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ValidateCredentials("", "someId", nil, nil) + _, err := k.Security.ValidateCredentials("", "someId", "body", nil) assert.NotNil(t, err) } @@ -44,16 +45,11 @@ func TestValidateCredentialsEmptyKuid(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ValidateCredentials("local", "", nil, nil) + _, err := k.Security.ValidateCredentials("local", "", "body", nil) assert.NotNil(t, err) } func TestValidateCredentials(t *testing.T) { - type myCredentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { @@ -71,20 +67,15 @@ func TestValidateCredentials(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.ValidateCredentials("local", "someId", myCredentials{"foo", "bar"}, nil) + res, err := k.Security.ValidateCredentials("local", "someId", "body", nil) assert.Nil(t, err) assert.Equal(t, true, res) } func ExampleSecurity_ValidateCredentials() { - type myCredentials struct { - Username string `json:"username"` - Password string `json:"password"` - } - c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.ValidateCredentials("local", "someId", myCredentials{"foo", "bar"}, nil) + res, err := k.Security.ValidateCredentials("local", "someId", "body", nil) if err != nil { fmt.Println(err.Error()) diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index 84a70fdb..48f3232e 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -44,6 +44,7 @@ type KuzzleRequest struct { Limit string `json:"limit,omitempty"` Count int `json:"count,omitempty"` Match string `json:"match,omitempty"` + Reset bool `json:"reset,omitempty"` } type SubscribeQuery struct { diff --git a/types/query_options.go b/types/query_options.go index a8f7d453..7b063b4d 100644 --- a/types/query_options.go +++ b/types/query_options.go @@ -63,6 +63,8 @@ type QueryOptions interface { SetWithdist(bool) *queryOptions Withcoord() bool SetWithcoord(bool) *queryOptions + Reset() bool + ID() string } type queryOptions struct { @@ -97,6 +99,8 @@ type queryOptions struct { unit string withcoord bool withdist bool + reset bool + _id string } func (qo queryOptions) Queuable() bool { @@ -378,6 +382,14 @@ func (qo *queryOptions) SetWithdist(withdist bool) *queryOptions { return qo } +func (qo *queryOptions) Reset() bool { + return qo.reset +} + +func (qo *queryOptions) ID() string { + return qo._id +} + func NewQueryOptions() *queryOptions { return &queryOptions{ size: 10, From affe59d94c827115bde927106d776f4a870b954d Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 27 Mar 2018 16:34:05 +0200 Subject: [PATCH 077/363] Security Controller CGO --- internal/wrappers/cgo/kuzzle/errors.go | 4 + internal/wrappers/cgo/kuzzle/go_to_c.go | 21 ++ internal/wrappers/cgo/kuzzle/security.go | 435 ++++++++++++++--------- internal/wrappers/headers/kuzzlesdk.h | 8 + 4 files changed, 307 insertions(+), 161 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index f4b9dacd..7e2899d8 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -131,6 +131,10 @@ func Set_profiles_result_error(s *C.profiles_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } +func Set_roles_result_error(s *C.roles_result, err error) { + setErr(&s.status, &s.error, &s.stack, err) +} + func Set_user_rights_error(s *C.user_rights_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 2ba32d67..ac0bd299 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -645,6 +645,27 @@ func goToCProfilesResult(k *C.kuzzle, profiles []*security.Profile, err error) * return result } +func goToCRolesResult(k *C.kuzzle, roles []*security.Role, err error) *C.roles_result { + result := (*C.roles_result)(C.calloc(1, C.sizeof_roles_result)) + if err != nil { + Set_roles_result_error(result, err) + return result + } + + result.roles_length = C.size_t(len(roles)) + + if roles != nil { + result.roles = (*C.role)(C.calloc(C.size_t(len(roles)), C.sizeof_role)) + carray := (*[1<<30 - 1]C.role)(unsafe.Pointer(result.roles))[:len(roles):len(roles)] + + for i, role := range roles { + goToCRole(k, role, &carray[i]) + } + } + + return result +} + func goToCUserRight(right *types.UserRights, dest *C.user_right) *C.user_right { if right == nil { return nil diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index af84459e..d4ae9610 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -60,52 +60,47 @@ func kuzzle_security_destroy_profile(p *C.profile) { C.free(unsafe.Pointer(p)) } -//export kuzzle_security_fetch_profile -func kuzzle_security_fetch_profile(k *C.kuzzle, id *C.char, o *C.query_options) *C.profile_result { - result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) - options := SetQueryOptions(o) - - profile, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfile(C.GoString(id), options) - if err != nil { - Set_profile_result_error(result, err) - return result - } - - result.profile = goToCProfile(k, profile, nil) - - return result -} +// --- user -//export kuzzle_security_search_profiles -func kuzzle_security_search_profiles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_profiles_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchProfiles(C.GoString(body), options) +//export kuzzle_security_new_user +func kuzzle_security_new_user(k *C.kuzzle, id *C.char, d *C.user_data) *C.user { + cuser := (*C.user)(C.calloc(1, C.sizeof_user)) - return goToCProfileSearchResult(k, res, err) -} + cuser.id = id + cuser.kuzzle = k -//export kuzzle_security_profile_add_policy -func kuzzle_security_profile_add_policy(p *C.profile, policy *C.policy) *C.profile { - profile := cToGoProfile(p).AddPolicy(cToGoPolicy(policy)) + if d != nil { + cuser.content = d.content + cuser.profile_ids = d.profile_ids + cuser.profile_ids_length = d.profile_ids_length + } - // @TODO: check if this method is useful and if so, the original pointer to p should be returned instead of a new allocated struct - return goToCProfile(p.kuzzle, profile, nil) + return cuser } -//export kuzzle_security_profile_delete -func kuzzle_security_profile_delete(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteProfile(C.GoString(id), options) +//export kuzzle_security_destroy_user +func kuzzle_security_destroy_user(u *C.user) { + if u == nil { + return + } - return goToCStringResult(&res, err) -} + if u.id != nil { + C.free(unsafe.Pointer(u.id)) + } + if u.content != nil { + C.json_object_put(u.content) + } + if u.profile_ids != nil { + size := int(u.profile_ids_length) + carray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(u.profile_ids))[:size:size] -//export kuzzle_security_profile_create -func kuzzle_security_profile_create(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.profile_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateProfile(C.GoString(id), C.GoString(body), options) + for i := 0; i < size; i++ { + C.free(unsafe.Pointer(carray[i])) + } + C.free(unsafe.Pointer(u.profile_ids)) + } - return goToCProfileResult(k, res, err) + C.free(unsafe.Pointer(u)) } // --- role @@ -136,6 +131,34 @@ func kuzzle_security_destroy_role(r *C.role) { C.free(unsafe.Pointer(r)) } +//export kuzzle_security_get_profile +func kuzzle_security_get_profile(k *C.kuzzle, id *C.char, o *C.query_options) *C.profile_result { + result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) + options := SetQueryOptions(o) + + profile, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfile(C.GoString(id), options) + if err != nil { + Set_profile_result_error(result, err) + return result + } + + result.profile = goToCProfile(k, profile, nil) + + return result +} + +//export kuzzle_security_get_profile_rights +func kuzzle_security_get_profile_rights(k *C.kuzzle, id *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfileRights(C.GoString(id), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + +//export kuzzle_security_get_profile_mapping +func kuzzle_security_get_profile_mapping(k *C.kuzzle, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfileMapping(SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + //export kuzzle_security_get_role func kuzzle_security_get_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.role_result { result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) @@ -152,6 +175,62 @@ func kuzzle_security_get_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.ro return result } +//export kuzzle_security_get_role_mapping +func kuzzle_security_get_role_mapping(k *C.kuzzle, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetRoleMapping(SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + +//export kuzzle_security_get_user +func kuzzle_security_get_user(k *C.kuzzle, id *C.char, o *C.query_options) *C.user_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetUser(C.GoString(id), SetQueryOptions(o)) + return goToCUserResult(k, res, err) +} + +//export kuzzle_security_get_user_rights +func kuzzle_security_get_user_rights(k *C.kuzzle, id *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetUserRights(C.GoString(id), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + +//export kuzzle_security_get_user_mapping +func kuzzle_security_get_user_mapping(k *C.kuzzle, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetUserMapping(SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + +//export kuzzle_security_get_credential_fields +func kuzzle_security_get_credential_fields(k *C.kuzzle, strategy *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentialFields(C.GoString(strategy), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + +//export kuzzle_security_get_all_credential_fields +func kuzzle_security_get_all_credential_fields(k *C.kuzzle, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetAllCredentialFields(SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + +//export kuzzle_security_get_credential +func kuzzle_security_get_credential(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentials(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + +//export kuzzle_security_get_credential_by_id +func kuzzle_security_get_credential_by_id(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentialsByID(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} + +//export kuzzle_security_search_profiles +func kuzzle_security_search_profiles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_profiles_result { + options := SetQueryOptions(o) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchProfiles(C.GoString(body), options) + + return goToCProfileSearchResult(k, res, err) +} + //export kuzzle_security_search_roles func kuzzle_security_search_roles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_roles_result { options := SetQueryOptions(o) @@ -160,190 +239,224 @@ func kuzzle_security_search_roles(k *C.kuzzle, body *C.char, o *C.query_options) return goToCRoleSearchResult(k, res, err) } -//export kuzzle_security_role_delete -func kuzzle_security_role_delete(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { +//export kuzzle_security_search_users +func kuzzle_security_search_users(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_users_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchUsers(C.GoString(body), SetQueryOptions(o)) + return goToCUserSearchResult(k, res, err) +} + +//export kuzzle_security_delete_role +func kuzzle_security_delete_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { options := SetQueryOptions(o) res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteRole(C.GoString(id), options) return goToCStringResult(&res, err) } -//export kuzzle_security_role_save -func kuzzle_security_role_save(r *C.role, o *C.query_options) *C.role_result { +//export kuzzle_security_delete_profile +func kuzzle_security_delete_profile(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { + options := SetQueryOptions(o) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteProfile(C.GoString(id), options) + + return goToCStringResult(&res, err) +} + +//export kuzzle_security_delete_user +func kuzzle_security_delete_user(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteUser(C.GoString(id), SetQueryOptions(o)) + return goToCStringResult(&res, err) +} + +//export kuzzle_security_delete_credentials +func kuzzle_security_delete_credentials(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.void_result { + err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteCredentials(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) + return goToCVoidResult(err) +} + +//export kuzzle_security_create_profile +func kuzzle_security_create_profile(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.profile_result { + options := SetQueryOptions(o) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateProfile(C.GoString(id), C.GoString(body), options) + + return goToCProfileResult(k, res, err) +} + +//export kuzzle_security_create_role +func kuzzle_security_create_role(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.role_result { result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) options := SetQueryOptions(o) - role, err := cToGoRole(r) - if err != nil { - Set_role_result_error(result, err) - return result - } - res, err := role.Save(options) + role, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateRole(C.GoString(id), C.GoString(body), options) if err != nil { Set_role_result_error(result, err) return result } - result.role = goToCRole(r.kuzzle, res, nil) + result.role = goToCRole(k, role, nil) return result } -// --- user +//export kuzzle_security_create_user +func kuzzle_security_create_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateUser(C.GoString(body), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} -//export kuzzle_security_new_user -func kuzzle_security_new_user(k *C.kuzzle, id *C.char, d *C.user_data) *C.user { - cuser := (*C.user)(C.calloc(1, C.sizeof_user)) +//export kuzzle_security_create_credentials +func kuzzle_security_create_credentials(k *C.kuzzle, cstrategy, id, body *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateCredentials(C.GoString(cstrategy), C.GoString(id), C.GoString(body), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} - cuser.id = id - cuser.kuzzle = k +//export kuzzle_security_create_restricted_user +func kuzzle_security_create_restricted_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateRestrictedUser(C.GoString(body), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} - if d != nil { - cuser.content = d.content - cuser.profile_ids = d.profile_ids - cuser.profile_ids_length = d.profile_ids_length - } +//export kuzzle_security_create_first_admin +func kuzzle_security_create_first_admin(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateFirstAdmin(C.GoString(body), SetQueryOptions(o)) + return goToCJsonResult(res, err) +} - return cuser +//export kuzzle_security_create_or_replace_profile +func kuzzle_security_create_or_replace_profile(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.profile_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateOrReplaceProfile(C.GoString(id), C.GoString(body), SetQueryOptions(o)) + return goToCProfileResult(k, res, err) } -//export kuzzle_security_destroy_user -func kuzzle_security_destroy_user(u *C.user) { - if u == nil { - return +//export kuzzle_security_create_or_replace_role +func kuzzle_security_create_or_replace_role(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.role_result { + result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) + role, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateOrReplaceRole(C.GoString(id), C.GoString(body), SetQueryOptions(o)) + if err != nil { + Set_role_result_error(result, err) + return result } - if u.id != nil { - C.free(unsafe.Pointer(u.id)) - } - if u.content != nil { - C.json_object_put(u.content) - } - if u.profile_ids != nil { - size := int(u.profile_ids_length) - carray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(u.profile_ids))[:size:size] + result.role = goToCRole(k, role, nil) - for i := 0; i < size; i++ { - C.free(unsafe.Pointer(carray[i])) - } - C.free(unsafe.Pointer(u.profile_ids)) - } + return result +} - C.free(unsafe.Pointer(u)) +//export kuzzle_security_has_credentials +func kuzzle_security_has_credentials(k *C.kuzzle, strategy *C.char, id *C.char, o *C.query_options) *C.bool_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.HasCredentials(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) + return goToCBoolResult(res, err) } -//export kuzzle_security_fetch_user -func kuzzle_security_fetch_user(k *C.kuzzle, id *C.char, o *C.query_options) *C.user_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.FetchUser(C.GoString(id), SetQueryOptions(o)) +//export kuzzle_security_replace_user +func kuzzle_security_replace_user(k *C.kuzzle, id, content *C.char, o *C.query_options) *C.user_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.ReplaceUser(C.GoString(id), C.GoString(content), SetQueryOptions(o)) return goToCUserResult(k, res, err) } -//export kuzzle_security_scroll_users -func kuzzle_security_scroll_users(k *C.kuzzle, s *C.char, o *C.query_options) *C.search_users_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.ScrollUsers(C.GoString(s), SetQueryOptions(o)) - return goToCUserSearchResult(k, res, err) +//export kuzzle_security_update_credentials +func kuzzle_security_update_credentials(k *C.kuzzle, strategy *C.char, id *C.char, body *C.char, o *C.query_options) *C.void_result { + err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateCredentials(C.GoString(strategy), C.GoString(id), C.GoString(body), SetQueryOptions(o)) + return goToCVoidResult(err) } -//export kuzzle_security_search_users -func kuzzle_security_search_users(k *C.kuzzle, f *C.search_filters, o *C.query_options) *C.search_users_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchUsers(cToGoSearchFilters(f), SetQueryOptions(o)) - return goToCUserSearchResult(k, res, err) -} +//export kuzzle_security_update_profile +func kuzzle_security_update_profile(k *C.kuzzle, id *C.char, body *C.char, o *C.query_options) *C.profile_result { + result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) + options := SetQueryOptions(o) -//export kuzzle_security_user_create -func kuzzle_security_user_create(u *C.user, o *C.query_options) *C.user_result { - res, err := cToGoUser(u).Create(SetQueryOptions(o)) - return goToCUserResult(u.kuzzle, res, err) -} + profile, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfile(C.GoString(id), C.GoString(body), options) + if err != nil { + Set_profile_result_error(result, err) + return result + } -//export kuzzle_security_user_create_credentials -func kuzzle_security_user_create_credentials(u *C.user, cstrategy *C.char, ccredentials *C.json_object, o *C.query_options) *C.json_result { - strategy := C.GoString(cstrategy) - credentials := JsonCConvert(ccredentials) - res, err := cToGoUser(u).CreateCredentials(strategy, credentials, SetQueryOptions(o)) + result.profile = goToCProfile(k, profile, nil) - return goToCJsonResult(res, err) + return result } -//export kuzzle_security_user_create_with_credentials -func kuzzle_security_user_create_with_credentials(u *C.user, ccredentials *C.json_object, o *C.query_options) *C.user_result { - credentials, ok := JsonCConvert(ccredentials).(types.Credentials) - if !ok { - return goToCUserResult(u.kuzzle, nil, types.NewError("Invalid credentials given", 400)) +//export kuzzle_security_update_profile_mapping +func kuzzle_security_update_profile_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { + options := SetQueryOptions(o) + err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfileMapping(C.GoString(body), options) + return goToCVoidResult(err) +} + +//export kuzzle_security_update_role +func kuzzle_security_update_role(k *C.kuzzle, id *C.char, body *C.char, o *C.query_options) *C.role_result { + result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) + options := SetQueryOptions(o) + + role, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRole(C.GoString(id), C.GoString(body), options) + if err != nil { + Set_role_result_error(result, err) + return result } - res, err := cToGoUser(u).CreateWithCredentials(credentials, SetQueryOptions(o)) + result.role = goToCRole(k, role, nil) - return goToCUserResult(u.kuzzle, res, err) + return result } -//export kuzzle_security_user_delete -func kuzzle_security_user_delete(u *C.user, o *C.query_options) *C.string_result { - res, err := cToGoUser(u).Delete(SetQueryOptions(o)) - return goToCStringResult(&res, err) +//export kuzzle_security_update_role_mapping +func kuzzle_security_update_role_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { + options := SetQueryOptions(o) + err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRoleMapping(C.GoString(body), options) + return goToCVoidResult(err) } -//export kuzzle_security_user_delete_credentials -func kuzzle_security_user_delete_credentials(u *C.user, strategy *C.char, o *C.query_options) *C.bool_result { - res, err := cToGoUser(u).DeleteCredentials(C.GoString(strategy), SetQueryOptions(o)) - return goToCBoolResult(res, err) +//export kuzzle_security_update_user +func kuzzle_security_update_user(k *C.kuzzle, id *C.char, body *C.char, o *C.query_options) *C.user_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUser(C.GoString(id), C.GoString(body), SetQueryOptions(o)) + return goToCUserResult(k, res, err) } -//export kuzzle_security_user_get_credentials_info -func kuzzle_security_user_get_credentials_info(u *C.user, strategy *C.char, o *C.query_options) *C.json_result { - res, err := cToGoUser(u).GetCredentialsInfo(C.GoString(strategy), SetQueryOptions(o)) - return goToCJsonResult(res, err) +//export kuzzle_security_update_user_mapping +func kuzzle_security_update_user_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { + options := SetQueryOptions(o) + err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUserMapping(C.GoString(body), options) + return goToCVoidResult(err) } -//export kuzzle_security_user_get_profiles -func kuzzle_security_user_get_profiles(u *C.user, o *C.query_options) *C.profiles_result { - res, err := cToGoUser(u).GetProfiles(SetQueryOptions(o)) - return goToCProfilesResult(u.kuzzle, res, err) -} +//export kuzzle_security_is_action_allowed +func kuzzle_security_is_action_allowed(crights **C.user_right, crlength C.uint, controller *C.char, action *C.char, index *C.char, collection *C.char) C.uint { + rights := make([]*types.UserRights, int(crlength)) -//export kuzzle_security_user_get_rights -func kuzzle_security_user_get_rights(u *C.user, o *C.query_options) *C.user_rights_result { - res, err := cToGoUser(u).GetRights(SetQueryOptions(o)) - return goToCUserRightsResult(res, err) -} + carray := (*[1<<30 - 1]*C.user_right)(unsafe.Pointer(crights))[:int(crlength):int(crlength)] + for i := 0; i < int(crlength); i++ { + rights[i] = cToGoUserRigh(carray[i]) + } -//export kuzzle_security_user_has_credentials -func kuzzle_security_user_has_credentials(u *C.user, strategy *C.char, o *C.query_options) *C.bool_result { - res, err := cToGoUser(u).HasCredentials(C.GoString(strategy), SetQueryOptions(o)) - return goToCBoolResult(res, err) + res := security.IsActionAllowed(rights, C.GoString(controller), C.GoString(action), C.GoString(index), C.GoString(collection)) + return C.uint(res) } -//export kuzzle_security_user_replace -func kuzzle_security_user_replace(u *C.user, o *C.query_options) *C.user_result { - res, err := cToGoUser(u).Replace(SetQueryOptions(o)) - return goToCUserResult(u.kuzzle, res, err) +//export kuzzle_security_mdelete_credentials +func kuzzle_security_mdelete_credentials(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.string_array_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.MDeleteCredentials(cToGoStrings(ids, idsSize), SetQueryOptions(o)) + return goToCStringArrayResult(res, err) } -func kuzzle_security_save_restricted(u *C.user, ccredentials *C.json_object, o *C.query_options) *C.user_result { - credentials, ok := JsonCConvert(ccredentials).(types.Credentials) - if !ok { - return goToCUserResult(u.kuzzle, nil, types.NewError("Invalid credentials", 400)) - } - - res, err := cToGoUser(u).SaveRestricted(credentials, SetQueryOptions(o)) - return goToCUserResult(u.kuzzle, res, err) +//export kuzzle_security_mdelete_roles +func kuzzle_security_mdelete_roles(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.string_array_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.MDeleteRoles(cToGoStrings(ids, idsSize), SetQueryOptions(o)) + return goToCStringArrayResult(res, err) } -//export kuzzle_security_update_credentials -func kuzzle_security_update_credentials(u *C.user, strategy *C.char, credentials *C.json_object, o *C.query_options) *C.json_result { - res, err := cToGoUser(u).UpdateCredentials(C.GoString(strategy), JsonCConvert(credentials), SetQueryOptions(o)) - return goToCJsonResult(res, err) +//export kuzzle_security_mdelete_users +func kuzzle_security_mdelete_users(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.string_array_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.MDeleteUsers(cToGoStrings(ids, idsSize), SetQueryOptions(o)) + return goToCStringArrayResult(res, err) } -//export kuzzle_security_is_action_allowed -func kuzzle_security_is_action_allowed(crights **C.user_right, crights_length C.uint, controller *C.char, action *C.char, index *C.char, collection *C.char) C.uint { - rights := make([]*types.UserRights, int(crights_length)) - - carray := (*[1<<30 - 1]*C.user_right)(unsafe.Pointer(crights))[:int(crights_length):int(crights_length)] - for i := 0; i < int(crights_length); i++ { - rights[i] = cToGoUserRigh(carray[i]) - } +//export kuzzle_security_mget_profiles +func kuzzle_security_mget_profiles(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.profiles_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.MGetProfiles(cToGoStrings(ids, idsSize), SetQueryOptions(o)) + return goToCProfilesResult(k, res, err) +} - res := security.IsActionAllowed(rights, C.GoString(controller), C.GoString(action), C.GoString(index), C.GoString(collection)) - return C.uint(res) +//export kuzzle_security_mget_roles +func kuzzle_security_mget_roles(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.roles_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.MGetRoles(cToGoStrings(ids, idsSize), SetQueryOptions(o)) + return goToCRolesResult(k, res, err) } diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 6ab71d90..7394c5c6 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -291,6 +291,14 @@ typedef struct role_result { char *stack; } role_result; +typedef struct roles_result { + role *roles; + size_t roles_length; + int status; + char *error; + char *stack; +} roles_result; + typedef struct { char *controller; char *action; From 15ee5234fd64e532a0f536cdba48e49e391ad231 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 27 Mar 2018 17:44:58 +0200 Subject: [PATCH 078/363] Add query options argument in all Go/CGO/C++ functions --- index/create.go | 4 +-- index/create_test.go | 8 +++--- index/delete.go | 4 +-- index/delete_test.go | 10 ++++---- index/exists.go | 4 +-- index/exists_test.go | 10 ++++---- index/getAutoRefresh.go | 2 +- index/getAutoRefresh_test.go | 10 ++++---- index/list.go | 4 +-- index/list_test.go | 6 ++--- index/mDelete.go | 4 +-- index/mDelete_test.go | 12 ++++----- index/refresh.go | 4 +-- index/refreshInternal.go | 4 +-- index/refreshInternal_test.go | 6 ++--- index/refresh_test.go | 10 ++++---- index/setAutoRefresh.go | 4 +-- index/setAutoRefresh_test.go | 8 +++--- internal/wrappers/cgo/kuzzle/index.go | 36 +++++++++++++-------------- internal/wrappers/cpp/index.cpp | 36 +++++++++++++-------------- internal/wrappers/headers/index.hpp | 18 +++++++------- 21 files changed, 102 insertions(+), 102 deletions(-) diff --git a/index/create.go b/index/create.go index 64771fba..954a8b7b 100644 --- a/index/create.go +++ b/index/create.go @@ -5,7 +5,7 @@ import ( ) // Create a new empty data index, with no associated mapping. -func (i *Index) Create(index string) error { +func (i *Index) Create(index string, options types.QueryOptions) error { if index == "" { return types.NewError("Index.Create: index required", 400) } @@ -17,7 +17,7 @@ func (i *Index) Create(index string) error { Controller: "index", Action: "create", } - go i.kuzzle.Query(query, nil, result) + go i.kuzzle.Query(query, options, result) res := <-result diff --git a/index/create_test.go b/index/create_test.go index 28a162da..6edfc753 100644 --- a/index/create_test.go +++ b/index/create_test.go @@ -16,7 +16,7 @@ import ( func TestCreateNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) i := index.NewIndex(k) - err := i.Create("") + err := i.Create("", nil) assert.NotNil(t, err) } @@ -28,7 +28,7 @@ func TestCreateQueryError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.Create("index") + err := i.Create("index", nil) assert.NotNil(t, err) } @@ -52,7 +52,7 @@ func TestCreate(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.Create("index") + err := i.Create("index", nil) assert.Nil(t, err) } @@ -61,7 +61,7 @@ func ExampleIndex_Create() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) - err := i.Create("index") + err := i.Create("index", nil) if err != nil { fmt.Println(err.Error()) return diff --git a/index/delete.go b/index/delete.go index 0b6ef849..2d86609f 100644 --- a/index/delete.go +++ b/index/delete.go @@ -3,7 +3,7 @@ package index import "github.com/kuzzleio/sdk-go/types" // Delete the given index -func (i *Index) Delete(index string) error { +func (i *Index) Delete(index string, options types.QueryOptions) error { if index == "" { return types.NewError("Index.Delete: index required", 400) } @@ -15,7 +15,7 @@ func (i *Index) Delete(index string) error { Controller: "index", Action: "delete", } - go i.kuzzle.Query(query, nil, result) + go i.kuzzle.Query(query, options, result) res := <-result diff --git a/index/delete_test.go b/index/delete_test.go index c502eccd..a810ad43 100644 --- a/index/delete_test.go +++ b/index/delete_test.go @@ -16,7 +16,7 @@ import ( func TestDeleteNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) i := index.NewIndex(k) - err := i.Delete("") + err := i.Delete("", nil) assert.NotNil(t, err) } @@ -28,7 +28,7 @@ func TestDeleteQueryError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.Delete("index") + err := i.Delete("index", nil) assert.NotNil(t, err) } @@ -52,7 +52,7 @@ func TestDelete(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.Delete("index") + err := i.Delete("index", nil) assert.Nil(t, err) } @@ -61,8 +61,8 @@ func ExampleIndex_Delete() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) - i.Create("index") - err := i.Delete("index") + i.Create("index", nil) + err := i.Delete("index", nil) if err != nil { fmt.Println(err.Error()) return diff --git a/index/exists.go b/index/exists.go index cc1134fa..a955f30e 100644 --- a/index/exists.go +++ b/index/exists.go @@ -8,7 +8,7 @@ import ( ) // Exists check if the index exists -func (i *Index) Exists(index string) (bool, error) { +func (i *Index) Exists(index string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Index.Exists: index required", 400) } @@ -21,7 +21,7 @@ func (i *Index) Exists(index string) (bool, error) { Action: "exists", } - go i.kuzzle.Query(query, nil, result) + go i.kuzzle.Query(query, options, result) res := <-result diff --git a/index/exists_test.go b/index/exists_test.go index 8f37fea0..2f4b42eb 100644 --- a/index/exists_test.go +++ b/index/exists_test.go @@ -16,7 +16,7 @@ import ( func TestExistsNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) i := index.NewIndex(k) - _, err := i.Exists("") + _, err := i.Exists("", nil) assert.NotNil(t, err) } @@ -28,7 +28,7 @@ func TestExistsQueryError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - _, err := i.Exists("index") + _, err := i.Exists("index", nil) assert.NotNil(t, err) } @@ -53,7 +53,7 @@ func TestExists(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - res, err := i.Exists("index") + res, err := i.Exists("index", nil) assert.Nil(t, err) assert.NotNil(t, res) @@ -64,8 +64,8 @@ func ExampleIndex_Exists() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) - i.Create("index") - _, err := i.Exists("index") + i.Create("index", nil) + _, err := i.Exists("index", nil) if err != nil { fmt.Println(err.Error()) return diff --git a/index/getAutoRefresh.go b/index/getAutoRefresh.go index 14d9b639..adf3c556 100644 --- a/index/getAutoRefresh.go +++ b/index/getAutoRefresh.go @@ -7,7 +7,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (i *Index) GetAutoRefresh(index string) (bool, error) { +func (i *Index) GetAutoRefresh(index string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Index.GetAutoRefresh: index required", 400) } diff --git a/index/getAutoRefresh_test.go b/index/getAutoRefresh_test.go index 00ffdc37..7bd0216b 100644 --- a/index/getAutoRefresh_test.go +++ b/index/getAutoRefresh_test.go @@ -16,7 +16,7 @@ import ( func TestGetAutoRefreshNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) i := index.NewIndex(k) - _, err := i.GetAutoRefresh("") + _, err := i.GetAutoRefresh("", nil) assert.NotNil(t, err) } @@ -28,7 +28,7 @@ func TestGetAutoRefreshQueryError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - _, err := i.GetAutoRefresh("index") + _, err := i.GetAutoRefresh("index", nil) assert.NotNil(t, err) } @@ -53,7 +53,7 @@ func TestGetAutoRefresh(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - _, err := i.GetAutoRefresh("index") + _, err := i.GetAutoRefresh("index", nil) assert.Nil(t, err) } @@ -62,8 +62,8 @@ func ExampleIndex_GetAutoRefresh() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) - i.Create("index") - _, err := i.GetAutoRefresh("index") + i.Create("index", nil) + _, err := i.GetAutoRefresh("index", nil) if err != nil { fmt.Println(err.Error()) return diff --git a/index/list.go b/index/list.go index de86e9b3..d6e1214e 100644 --- a/index/list.go +++ b/index/list.go @@ -8,7 +8,7 @@ import ( ) // List list all index -func (i *Index) List() ([]string, error) { +func (i *Index) List(options types.QueryOptions) ([]string, error) { result := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ @@ -16,7 +16,7 @@ func (i *Index) List() ([]string, error) { Action: "list", } - go i.kuzzle.Query(query, nil, result) + go i.kuzzle.Query(query, options, result) res := <-result diff --git a/index/list_test.go b/index/list_test.go index 82bf0105..87880e56 100644 --- a/index/list_test.go +++ b/index/list_test.go @@ -21,7 +21,7 @@ func TestListError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - _, err := i.List() + _, err := i.List(nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -44,7 +44,7 @@ func TestList(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - res, err := i.List() + res, err := i.List(nil) expectedResponse := []string{"index_1", "index_2"} assert.Nil(t, err) assert.NotNil(t, res) @@ -56,7 +56,7 @@ func ExampleIndex_List() { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - res, err := i.List() + res, err := i.List(nil) if err != nil { fmt.Println(err.Error()) diff --git a/index/mDelete.go b/index/mDelete.go index f2c3ed6e..47cc8f4f 100644 --- a/index/mDelete.go +++ b/index/mDelete.go @@ -8,7 +8,7 @@ import ( ) // Delete delete the index -func (i *Index) MDelete(indexes []string) ([]string, error) { +func (i *Index) MDelete(indexes []string, options types.QueryOptions) ([]string, error) { if len(indexes) == 0 { return nil, types.NewError("Index.MDelete: at least one index required", 400) } @@ -20,7 +20,7 @@ func (i *Index) MDelete(indexes []string) ([]string, error) { Action: "mDelete", Body: indexes, } - go i.kuzzle.Query(query, nil, result) + go i.kuzzle.Query(query, options, result) res := <-result diff --git a/index/mDelete_test.go b/index/mDelete_test.go index c8974d73..ffcc64b3 100644 --- a/index/mDelete_test.go +++ b/index/mDelete_test.go @@ -17,7 +17,7 @@ func TestMDeleteNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) i := index.NewIndex(k) indexes := []string{} - _, err := i.MDelete(indexes) + _, err := i.MDelete(indexes, nil) assert.NotNil(t, err) } @@ -30,7 +30,7 @@ func TestMDeleteQueryError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) indexes := []string{"index"} - _, err := i.MDelete(indexes) + _, err := i.MDelete(indexes, nil) assert.NotNil(t, err) } @@ -55,7 +55,7 @@ func TestMDelete(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) indexes := []string{"index1"} - res, err := i.MDelete(indexes) + res, err := i.MDelete(indexes, nil) assert.Nil(t, err) assert.NotNil(t, res) @@ -66,13 +66,13 @@ func ExampleIndex_MDelete() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) - i.Create("index1") - i.Create("index2") + i.Create("index1", nil) + i.Create("index2", nil) indexes := []string{ "index1", "index2", } - _, err := i.MDelete(indexes) + _, err := i.MDelete(indexes, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/index/refresh.go b/index/refresh.go index 66be1b10..f955db4b 100644 --- a/index/refresh.go +++ b/index/refresh.go @@ -4,7 +4,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (i *Index) Refresh(index string) error { +func (i *Index) Refresh(index string, options types.QueryOptions) error { if index == "" { return types.NewError("Index.Refresh: index required", 400) } @@ -16,7 +16,7 @@ func (i *Index) Refresh(index string) error { Action: "refresh", Index: index, } - go i.kuzzle.Query(query, nil, result) + go i.kuzzle.Query(query, options, result) res := <-result diff --git a/index/refreshInternal.go b/index/refreshInternal.go index 2fd7522c..bb96136b 100644 --- a/index/refreshInternal.go +++ b/index/refreshInternal.go @@ -2,7 +2,7 @@ package index import "github.com/kuzzleio/sdk-go/types" -func (i *Index) RefreshInternal() error { +func (i *Index) RefreshInternal(options types.QueryOptions) error { result := make(chan *types.KuzzleResponse) @@ -10,7 +10,7 @@ func (i *Index) RefreshInternal() error { Controller: "index", Action: "refreshInternal", } - go i.kuzzle.Query(query, nil, result) + go i.kuzzle.Query(query, options, result) res := <-result diff --git a/index/refreshInternal_test.go b/index/refreshInternal_test.go index 536cbe9f..df0c19b0 100644 --- a/index/refreshInternal_test.go +++ b/index/refreshInternal_test.go @@ -21,7 +21,7 @@ func TestRefreshInternalQueryError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.RefreshInternal() + err := i.RefreshInternal(nil) assert.NotNil(t, err) } @@ -44,7 +44,7 @@ func TestRefreshInternal(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.RefreshInternal() + err := i.RefreshInternal(nil) assert.Nil(t, err) } @@ -53,7 +53,7 @@ func ExampleIndex_RefreshInternal() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) - err := i.RefreshInternal() + err := i.RefreshInternal(nil) if err != nil { fmt.Println(err.Error()) return diff --git a/index/refresh_test.go b/index/refresh_test.go index 826da00f..70c9b41e 100644 --- a/index/refresh_test.go +++ b/index/refresh_test.go @@ -16,7 +16,7 @@ import ( func TestRefreshNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) i := index.NewIndex(k) - err := i.Refresh("") + err := i.Refresh("", nil) assert.NotNil(t, err) } @@ -28,7 +28,7 @@ func TestRefreshQueryError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.Refresh("index") + err := i.Refresh("index", nil) assert.NotNil(t, err) } @@ -52,7 +52,7 @@ func TestRefresh(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.Refresh("index") + err := i.Refresh("index", nil) assert.Nil(t, err) } @@ -61,8 +61,8 @@ func ExampleIndex_Refresh() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) - i.Create("index") - err := i.Refresh("index") + i.Create("index", nil) + err := i.Refresh("index", nil) if err != nil { fmt.Println(err.Error()) return diff --git a/index/setAutoRefresh.go b/index/setAutoRefresh.go index 38027581..18e28f10 100644 --- a/index/setAutoRefresh.go +++ b/index/setAutoRefresh.go @@ -2,7 +2,7 @@ package index import "github.com/kuzzleio/sdk-go/types" -func (i *Index) SetAutoRefresh(index string, autoRefresh bool) error { +func (i *Index) SetAutoRefresh(index string, autoRefresh bool, options types.QueryOptions) error { if index == "" { return types.NewError("Index.SetAutoRefresh: index required", 400) } @@ -18,7 +18,7 @@ func (i *Index) SetAutoRefresh(index string, autoRefresh bool) error { }{autoRefresh}, } - go i.kuzzle.Query(query, nil, result) + go i.kuzzle.Query(query, options, result) res := <-result diff --git a/index/setAutoRefresh_test.go b/index/setAutoRefresh_test.go index 1f832a94..d81a4172 100644 --- a/index/setAutoRefresh_test.go +++ b/index/setAutoRefresh_test.go @@ -16,7 +16,7 @@ import ( func TestSetAutoRefreshNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) i := index.NewIndex(k) - err := i.SetAutoRefresh("", true) + err := i.SetAutoRefresh("", true, nil) assert.NotNil(t, err) } @@ -28,7 +28,7 @@ func TestSetAutoRefreshQueryError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.SetAutoRefresh("index", true) + err := i.SetAutoRefresh("index", true, nil) assert.NotNil(t, err) } @@ -52,7 +52,7 @@ func TestSetAutoRefresh(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) i := index.NewIndex(k) - err := i.SetAutoRefresh("index", true) + err := i.SetAutoRefresh("index", true, nil) assert.Nil(t, err) } @@ -61,7 +61,7 @@ func ExampleIndex_SetAutoRefresh() { conn := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) - err := i.SetAutoRefresh("index", true) + err := i.SetAutoRefresh("index", true, nil) if err != nil { fmt.Println(err.Error()) return diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index 15e8b9d6..251dfb45 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -46,55 +46,55 @@ func kuzzle_new_index(i *C.kuzzle_index, k *C.kuzzle) { } //export kuzzle_index_create -func kuzzle_index_create(i *C.kuzzle_index, index *C.char) *C.void_result { - err := (*indexPkg.Index)(i.instance).Create(C.GoString(index)) +func kuzzle_index_create(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.void_result { + err := (*indexPkg.Index)(i.instance).Create(C.GoString(index), SetQueryOptions(options)) return goToCVoidResult(err) } //export kuzzle_index_delete -func kuzzle_index_delete(i *C.kuzzle_index, index *C.char) *C.void_result { - err := (*indexPkg.Index)(i.instance).Delete(C.GoString(index)) +func kuzzle_index_delete(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.void_result { + err := (*indexPkg.Index)(i.instance).Delete(C.GoString(index), SetQueryOptions(options)) return goToCVoidResult(err) } //export kuzzle_index_mdelete -func kuzzle_index_mdelete(i *C.kuzzle_index, indexes **C.char, l C.size_t) *C.string_array_result { - res, err := (*indexPkg.Index)(i.instance).MDelete(cToGoStrings(indexes, l)) +func kuzzle_index_mdelete(i *C.kuzzle_index, indexes **C.char, l C.size_t, options *C.query_options) *C.string_array_result { + res, err := (*indexPkg.Index)(i.instance).MDelete(cToGoStrings(indexes, l), SetQueryOptions(options)) return goToCStringArrayResult(res, err) } //export kuzzle_index_exists -func kuzzle_index_exists(i *C.kuzzle_index, index *C.char) *C.bool_result { - res, err := (*indexPkg.Index)(i.instance).Exists(C.GoString(index)) +func kuzzle_index_exists(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.bool_result { + res, err := (*indexPkg.Index)(i.instance).Exists(C.GoString(index), SetQueryOptions(options)) return goToCBoolResult(res, err) } //export kuzzle_index_refresh -func kuzzle_index_refresh(i *C.kuzzle_index, index *C.char) *C.void_result { - err := (*indexPkg.Index)(i.instance).Refresh(C.GoString(index)) +func kuzzle_index_refresh(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.void_result { + err := (*indexPkg.Index)(i.instance).Refresh(C.GoString(index), SetQueryOptions(options)) return goToCVoidResult(err) } //export kuzzle_index_refresh_internal -func kuzzle_index_refresh_internal(i *C.kuzzle_index) *C.void_result { - err := (*indexPkg.Index)(i.instance).RefreshInternal() +func kuzzle_index_refresh_internal(i *C.kuzzle_index, options *C.query_options) *C.void_result { + err := (*indexPkg.Index)(i.instance).RefreshInternal(SetQueryOptions(options)) return goToCVoidResult(err) } //export kuzzle_index_set_auto_refresh -func kuzzle_index_set_auto_refresh(i *C.kuzzle_index, index *C.char, autoRefresh C.bool) *C.void_result { - err := (*indexPkg.Index)(i.instance).SetAutoRefresh(C.GoString(index), bool(autoRefresh)) +func kuzzle_index_set_auto_refresh(i *C.kuzzle_index, index *C.char, autoRefresh C.bool, options *C.query_options) *C.void_result { + err := (*indexPkg.Index)(i.instance).SetAutoRefresh(C.GoString(index), bool(autoRefresh), SetQueryOptions(options)) return goToCVoidResult(err) } //export kuzzle_index_get_auto_refresh -func kuzzle_index_get_auto_refresh(i *C.kuzzle_index, index *C.char) *C.bool_result { - res, err := (*indexPkg.Index)(i.instance).GetAutoRefresh(C.GoString(index)) +func kuzzle_index_get_auto_refresh(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.bool_result { + res, err := (*indexPkg.Index)(i.instance).GetAutoRefresh(C.GoString(index), SetQueryOptions(options)) return goToCBoolResult(res, err) } //export kuzzle_index_list -func kuzzle_index_list(i *C.kuzzle_index) *C.string_array_result { - res, err := (*indexPkg.Index)(i.instance).List() +func kuzzle_index_list(i *C.kuzzle_index, options *C.query_options) *C.string_array_result { + res, err := (*indexPkg.Index)(i.instance).List(SetQueryOptions(options)) return goToCStringArrayResult(res, err) } diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index a4c392a4..135b484f 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -19,28 +19,28 @@ namespace kuzzleio { delete(_index); } - void Index::create(const std::string& index) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_create(_index, const_cast(index.c_str())); + void Index::create(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_create(_index, const_cast(index.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } - void Index::delete_(const std::string& index) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_delete(_index, const_cast(index.c_str())); + void Index::delete_(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_delete(_index, const_cast(index.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } - std::vector Index::mDelete(const std::vector& indexes) Kuz_Throw_KuzzleException { + std::vector Index::mDelete(const std::vector& indexes, query_options *options) Kuz_Throw_KuzzleException { char **indexesArray = new char *[indexes.size()]; int i = 0; for (auto const& index : indexes) { indexesArray[i] = const_cast(index.c_str()); i++; } - string_array_result *r = kuzzle_index_mdelete(_index, indexesArray, indexes.size()); + string_array_result *r = kuzzle_index_mdelete(_index, indexesArray, indexes.size(), options); delete[] indexesArray; if (r->error != NULL) @@ -54,8 +54,8 @@ namespace kuzzleio { return v; } - bool Index::exists(const std::string& index) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_index_exists(_index, const_cast(index.c_str())); + bool Index::exists(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_index_exists(_index, const_cast(index.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; @@ -63,29 +63,29 @@ namespace kuzzleio { return ret; } - void Index::refresh(const std::string& index) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str())); + void Index::refresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } - void Index::refreshInternal() Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_refresh_internal(_index); + void Index::refreshInternal(query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_refresh_internal(_index, options); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } - void Index::setAutoRefresh(const std::string& index, bool autoRefresh) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh); + void Index::setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh, options); if (r->error != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } - bool Index::getAutoRefresh(const std::string& index) Kuz_Throw_KuzzleException { - bool_result *r = kuzzle_index_get_auto_refresh(_index, const_cast(index.c_str())); + bool Index::getAutoRefresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { + bool_result *r = kuzzle_index_get_auto_refresh(_index, const_cast(index.c_str()), options); if (r->error != NULL) throwExceptionFromStatus(r); bool ret = r->result; @@ -93,8 +93,8 @@ namespace kuzzleio { return ret; } - std::vector Index::list() Kuz_Throw_KuzzleException { - string_array_result *r = kuzzle_index_list(_index); + std::vector Index::list(query_options *options) Kuz_Throw_KuzzleException { + string_array_result *r = kuzzle_index_list(_index, options); if (r->error != NULL) throwExceptionFromStatus(r); diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp index 32393bcf..7f252561 100644 --- a/internal/wrappers/headers/index.hpp +++ b/internal/wrappers/headers/index.hpp @@ -13,15 +13,15 @@ namespace kuzzleio { Index(Kuzzle* kuzzle); Index(Kuzzle* kuzzle, kuzzle_index *index); virtual ~Index(); - void create(const std::string& index) Kuz_Throw_KuzzleException; - void delete_(const std::string& index) Kuz_Throw_KuzzleException; - std::vector mDelete(const std::vector& indexes) Kuz_Throw_KuzzleException; - bool exists(const std::string& index) Kuz_Throw_KuzzleException; - void refresh(const std::string& index) Kuz_Throw_KuzzleException; - void refreshInternal() Kuz_Throw_KuzzleException; - void setAutoRefresh(const std::string& index, bool autoRefresh) Kuz_Throw_KuzzleException; - bool getAutoRefresh(const std::string& index) Kuz_Throw_KuzzleException; - std::vector list() Kuz_Throw_KuzzleException; + void create(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; + void delete_(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; + std::vector mDelete(const std::vector& indexes, query_options *options) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; + void refresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; + void refreshInternal(query_options *options) Kuz_Throw_KuzzleException; + void setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options) Kuz_Throw_KuzzleException; + bool getAutoRefresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; + std::vector list(query_options *options) Kuz_Throw_KuzzleException; }; } From 141b45ddd8bf874f914d1a855f9651b5eb88c4a4 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 28 Mar 2018 13:28:14 +0200 Subject: [PATCH 079/363] Apply changes requested by kblondel --- internal/wrappers/cgo/kuzzle/c_to_go.go | 7 +- internal/wrappers/cgo/kuzzle/security.go | 119 ++++++++++++++--------- security/createCredentials.go | 4 +- security/createCredentials_test.go | 11 +-- security/createFirstAdmin.go | 4 +- security/createFirstAdmin_test.go | 7 +- security/createOrReplaceProfile.go | 4 +- security/createOrReplaceProfile_test.go | 7 +- security/createOrReplaceRole.go | 4 +- security/createOrReplaceRole_test.go | 7 +- security/createProfile.go | 4 +- security/createProfile_test.go | 9 +- security/createRestrictedUser.go | 4 +- security/createRestrictedUser_test.go | 7 +- security/createRole.go | 4 +- security/createRole_test.go | 9 +- security/createUser.go | 4 +- security/createUser_test.go | 7 +- security/getProfile.go | 2 +- security/getRole.go | 2 +- security/getRole_test.go | 2 +- security/getUser.go | 2 +- security/json_profile.go | 6 +- security/json_role.go | 6 +- security/json_user.go | 6 +- security/mGetProfiles.go | 2 +- security/mGetRoles.go | 2 +- security/profile.go | 4 +- security/replaceUser.go | 8 +- security/replaceUser_test.go | 9 +- security/role.go | 6 +- security/searchProfiles.go | 5 +- security/searchProfiles_test.go | 8 +- security/searchRoles.go | 4 +- security/searchRoles_test.go | 8 +- security/searchUsers.go | 4 +- security/searchUsers_test.go | 8 +- security/updateCredentials.go | 4 +- security/updateCredentials_test.go | 10 +- security/updateProfile.go | 4 +- security/updateProfileMapping.go | 6 +- security/updateProfileMapping_test.go | 7 +- security/updateProfile_test.go | 9 +- security/updateRole.go | 4 +- security/updateRoleMapping.go | 6 +- security/updateRoleMapping_test.go | 7 +- security/updateRole_test.go | 9 +- security/updateUser.go | 8 +- security/updateUserMapping.go | 6 +- security/updateUserMapping_test.go | 7 +- security/updateUser_test.go | 9 +- security/user.go | 6 +- security/validateCredentials.go | 10 +- security/validateCredentials_test.go | 10 +- 54 files changed, 224 insertions(+), 214 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 4082233c..69909778 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -70,7 +70,7 @@ func cToGoRole(crole *C.role) (*security.Role, error) { controllers = c } - role := (*kuzzle.Kuzzle)(crole.kuzzle.instance).Security.NewRole(id, controllers) + role := security.NewRole(id, controllers) return role, nil } @@ -161,8 +161,7 @@ func cToGoPolicy(p *C.policy) *types.Policy { func cToGoProfile(p *C.profile) *security.Profile { profile := &security.Profile{ - Id: C.GoString(p.id), - Security: (*kuzzle.Kuzzle)(p.kuzzle.instance).Security, + Id: C.GoString(p.id), } if p.policies == nil { @@ -207,7 +206,7 @@ func cToGoUser(u *C.user) *security.User { return nil } - user := (*kuzzle.Kuzzle)(u.kuzzle.instance).Security.NewUser(C.GoString(u.id), nil) + user := security.NewUser(C.GoString(u.id), nil) return user } diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index d4ae9610..45ebe688 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -10,6 +10,7 @@ package main import "C" import ( + "encoding/json" "unsafe" "github.com/kuzzleio/sdk-go/kuzzle" @@ -148,15 +149,19 @@ func kuzzle_security_get_profile(k *C.kuzzle, id *C.char, o *C.query_options) *C } //export kuzzle_security_get_profile_rights -func kuzzle_security_get_profile_rights(k *C.kuzzle, id *C.char, o *C.query_options) *C.json_result { +func kuzzle_security_get_profile_rights(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfileRights(C.GoString(id), SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_get_profile_mapping -func kuzzle_security_get_profile_mapping(k *C.kuzzle, o *C.query_options) *C.json_result { +func kuzzle_security_get_profile_mapping(k *C.kuzzle, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfileMapping(SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_get_role @@ -176,9 +181,11 @@ func kuzzle_security_get_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.ro } //export kuzzle_security_get_role_mapping -func kuzzle_security_get_role_mapping(k *C.kuzzle, o *C.query_options) *C.json_result { +func kuzzle_security_get_role_mapping(k *C.kuzzle, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetRoleMapping(SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_get_user @@ -188,45 +195,57 @@ func kuzzle_security_get_user(k *C.kuzzle, id *C.char, o *C.query_options) *C.us } //export kuzzle_security_get_user_rights -func kuzzle_security_get_user_rights(k *C.kuzzle, id *C.char, o *C.query_options) *C.json_result { +func kuzzle_security_get_user_rights(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetUserRights(C.GoString(id), SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_get_user_mapping -func kuzzle_security_get_user_mapping(k *C.kuzzle, o *C.query_options) *C.json_result { +func kuzzle_security_get_user_mapping(k *C.kuzzle, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetUserMapping(SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_get_credential_fields -func kuzzle_security_get_credential_fields(k *C.kuzzle, strategy *C.char, o *C.query_options) *C.json_result { +func kuzzle_security_get_credential_fields(k *C.kuzzle, strategy *C.char, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentialFields(C.GoString(strategy), SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_get_all_credential_fields -func kuzzle_security_get_all_credential_fields(k *C.kuzzle, o *C.query_options) *C.json_result { +func kuzzle_security_get_all_credential_fields(k *C.kuzzle, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetAllCredentialFields(SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_get_credential -func kuzzle_security_get_credential(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.json_result { +func kuzzle_security_get_credential(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentials(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_get_credential_by_id -func kuzzle_security_get_credential_by_id(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.json_result { +func kuzzle_security_get_credential_by_id(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentialsByID(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) - return goToCJsonResult(res, err) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_search_profiles func kuzzle_security_search_profiles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_profiles_result { options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchProfiles(C.GoString(body), options) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchProfiles(json.RawMessage(C.GoString(body)), options) return goToCProfileSearchResult(k, res, err) } @@ -234,14 +253,14 @@ func kuzzle_security_search_profiles(k *C.kuzzle, body *C.char, o *C.query_optio //export kuzzle_security_search_roles func kuzzle_security_search_roles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_roles_result { options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchRoles(C.GoString(body), options) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchRoles(json.RawMessage(C.GoString(body)), options) return goToCRoleSearchResult(k, res, err) } //export kuzzle_security_search_users func kuzzle_security_search_users(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_users_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchUsers(C.GoString(body), SetQueryOptions(o)) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchUsers(json.RawMessage(C.GoString(body)), SetQueryOptions(o)) return goToCUserSearchResult(k, res, err) } @@ -249,7 +268,6 @@ func kuzzle_security_search_users(k *C.kuzzle, body *C.char, o *C.query_options) func kuzzle_security_delete_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { options := SetQueryOptions(o) res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteRole(C.GoString(id), options) - return goToCStringResult(&res, err) } @@ -257,7 +275,6 @@ func kuzzle_security_delete_role(k *C.kuzzle, id *C.char, o *C.query_options) *C func kuzzle_security_delete_profile(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { options := SetQueryOptions(o) res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteProfile(C.GoString(id), options) - return goToCStringResult(&res, err) } @@ -276,7 +293,7 @@ func kuzzle_security_delete_credentials(k *C.kuzzle, strategy, id *C.char, o *C. //export kuzzle_security_create_profile func kuzzle_security_create_profile(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.profile_result { options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateProfile(C.GoString(id), C.GoString(body), options) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateProfile(C.GoString(id), json.RawMessage(C.GoString(body)), options) return goToCProfileResult(k, res, err) } @@ -286,7 +303,7 @@ func kuzzle_security_create_role(k *C.kuzzle, id, body *C.char, o *C.query_optio result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) options := SetQueryOptions(o) - role, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateRole(C.GoString(id), C.GoString(body), options) + role, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateRole(C.GoString(id), json.RawMessage(C.GoString(body)), options) if err != nil { Set_role_result_error(result, err) return result @@ -298,39 +315,47 @@ func kuzzle_security_create_role(k *C.kuzzle, id, body *C.char, o *C.query_optio } //export kuzzle_security_create_user -func kuzzle_security_create_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateUser(C.GoString(body), SetQueryOptions(o)) - return goToCJsonResult(res, err) +func kuzzle_security_create_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.string_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateUser(json.RawMessage(C.GoString(body)), SetQueryOptions(o)) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_create_credentials -func kuzzle_security_create_credentials(k *C.kuzzle, cstrategy, id, body *C.char, o *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateCredentials(C.GoString(cstrategy), C.GoString(id), C.GoString(body), SetQueryOptions(o)) - return goToCJsonResult(res, err) +func kuzzle_security_create_credentials(k *C.kuzzle, cstrategy, id, body *C.char, o *C.query_options) *C.string_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateCredentials(C.GoString(cstrategy), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_create_restricted_user -func kuzzle_security_create_restricted_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateRestrictedUser(C.GoString(body), SetQueryOptions(o)) - return goToCJsonResult(res, err) +func kuzzle_security_create_restricted_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.string_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateRestrictedUser(json.RawMessage(C.GoString(body)), SetQueryOptions(o)) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_create_first_admin -func kuzzle_security_create_first_admin(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateFirstAdmin(C.GoString(body), SetQueryOptions(o)) - return goToCJsonResult(res, err) +func kuzzle_security_create_first_admin(k *C.kuzzle, body *C.char, o *C.query_options) *C.string_result { + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateFirstAdmin(json.RawMessage(C.GoString(body)), SetQueryOptions(o)) + var result string + json.Unmarshal(res, result) + return goToCStringResult(&result, err) } //export kuzzle_security_create_or_replace_profile func kuzzle_security_create_or_replace_profile(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.profile_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateOrReplaceProfile(C.GoString(id), C.GoString(body), SetQueryOptions(o)) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateOrReplaceProfile(C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) return goToCProfileResult(k, res, err) } //export kuzzle_security_create_or_replace_role func kuzzle_security_create_or_replace_role(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.role_result { result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) - role, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateOrReplaceRole(C.GoString(id), C.GoString(body), SetQueryOptions(o)) + role, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateOrReplaceRole(C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) if err != nil { Set_role_result_error(result, err) return result @@ -349,13 +374,13 @@ func kuzzle_security_has_credentials(k *C.kuzzle, strategy *C.char, id *C.char, //export kuzzle_security_replace_user func kuzzle_security_replace_user(k *C.kuzzle, id, content *C.char, o *C.query_options) *C.user_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.ReplaceUser(C.GoString(id), C.GoString(content), SetQueryOptions(o)) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.ReplaceUser(C.GoString(id), json.RawMessage(C.GoString(content)), SetQueryOptions(o)) return goToCUserResult(k, res, err) } //export kuzzle_security_update_credentials func kuzzle_security_update_credentials(k *C.kuzzle, strategy *C.char, id *C.char, body *C.char, o *C.query_options) *C.void_result { - err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateCredentials(C.GoString(strategy), C.GoString(id), C.GoString(body), SetQueryOptions(o)) + err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateCredentials(C.GoString(strategy), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) return goToCVoidResult(err) } @@ -364,7 +389,7 @@ func kuzzle_security_update_profile(k *C.kuzzle, id *C.char, body *C.char, o *C. result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) options := SetQueryOptions(o) - profile, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfile(C.GoString(id), C.GoString(body), options) + profile, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfile(C.GoString(id), json.RawMessage(C.GoString(body)), options) if err != nil { Set_profile_result_error(result, err) return result @@ -378,7 +403,7 @@ func kuzzle_security_update_profile(k *C.kuzzle, id *C.char, body *C.char, o *C. //export kuzzle_security_update_profile_mapping func kuzzle_security_update_profile_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { options := SetQueryOptions(o) - err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfileMapping(C.GoString(body), options) + err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfileMapping(json.RawMessage(C.GoString(body)), options) return goToCVoidResult(err) } @@ -387,7 +412,7 @@ func kuzzle_security_update_role(k *C.kuzzle, id *C.char, body *C.char, o *C.que result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) options := SetQueryOptions(o) - role, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRole(C.GoString(id), C.GoString(body), options) + role, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRole(C.GoString(id), json.RawMessage(C.GoString(body)), options) if err != nil { Set_role_result_error(result, err) return result @@ -401,20 +426,20 @@ func kuzzle_security_update_role(k *C.kuzzle, id *C.char, body *C.char, o *C.que //export kuzzle_security_update_role_mapping func kuzzle_security_update_role_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { options := SetQueryOptions(o) - err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRoleMapping(C.GoString(body), options) + err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRoleMapping(json.RawMessage(C.GoString(body)), options) return goToCVoidResult(err) } //export kuzzle_security_update_user func kuzzle_security_update_user(k *C.kuzzle, id *C.char, body *C.char, o *C.query_options) *C.user_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUser(C.GoString(id), C.GoString(body), SetQueryOptions(o)) + res, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUser(C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) return goToCUserResult(k, res, err) } //export kuzzle_security_update_user_mapping func kuzzle_security_update_user_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { options := SetQueryOptions(o) - err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUserMapping(C.GoString(body), options) + err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUserMapping(json.RawMessage(C.GoString(body)), options) return goToCVoidResult(err) } diff --git a/security/createCredentials.go b/security/createCredentials.go index 4e6cc8d3..8da699f7 100644 --- a/security/createCredentials.go +++ b/security/createCredentials.go @@ -7,8 +7,8 @@ import ( ) // CreateCredentials create credentials of the specified strategy with given body infos. -func (s *Security) CreateCredentials(strategy, id, body string, options types.QueryOptions) (json.RawMessage, error) { - if strategy == "" || id == "" || body == "" { +func (s *Security) CreateCredentials(strategy, id string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { + if strategy == "" || id == "" || body == nil { return nil, types.NewError("Kuzzle.CreateCredentials: strategy, id and body are required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/createCredentials_test.go b/security/createCredentials_test.go index 67ab83ca..74ce0151 100644 --- a/security/createCredentials_test.go +++ b/security/createCredentials_test.go @@ -12,19 +12,19 @@ import ( func TestCreateCredentialsStrategyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateCredentials("", "userid", "myCredentials", nil) + _, err := k.Security.CreateCredentials("", "userid", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } func TestCreateCredentialsIDNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateCredentials("strategy", "", "myCredentials", nil) + _, err := k.Security.CreateCredentials("strategy", "", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } func TestCreateCredentialsBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateCredentials("strategy", "userId", "", nil) + _, err := k.Security.CreateCredentials("strategy", "userId", nil, nil) assert.Error(t, err) } @@ -36,7 +36,7 @@ func TestCreateCredentialsError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateCredentials("strategy", "userId", "body", nil) + _, err := k.Security.CreateCredentials("strategy", "userId", []byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -50,14 +50,13 @@ func TestCreateCredentials(t *testing.T) { assert.Equal(t, "createCredentials", parsedQuery.Action) assert.Equal(t, "strategy", parsedQuery.Strategy) assert.Equal(t, "userid", parsedQuery.Id) - assert.Equal(t, "myCredentials", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte{}} }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateCredentials("strategy", "userid", "myCredentials", nil) + _, err := k.Security.CreateCredentials("strategy", "userid", []byte(`{"body": "test"}`), nil) assert.Nil(t, err) } diff --git a/security/createFirstAdmin.go b/security/createFirstAdmin.go index b255089a..2d33c8fe 100644 --- a/security/createFirstAdmin.go +++ b/security/createFirstAdmin.go @@ -7,8 +7,8 @@ import ( ) // CreateFirstAdmin create credentials of the specified strategy with given body infos. -func (s *Security) CreateFirstAdmin(body string, options types.QueryOptions) (json.RawMessage, error) { - if body == "" { +func (s *Security) CreateFirstAdmin(body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { + if body == nil { return nil, types.NewError("Kuzzle.CreateFirstAdmin: strategy, id and body are required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/createFirstAdmin_test.go b/security/createFirstAdmin_test.go index 9fde4b39..5323fa88 100644 --- a/security/createFirstAdmin_test.go +++ b/security/createFirstAdmin_test.go @@ -12,7 +12,7 @@ import ( func TestCreateFirstAdminBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateFirstAdmin("", nil) + _, err := k.Security.CreateFirstAdmin(nil, nil) assert.Error(t, err) } @@ -24,7 +24,7 @@ func TestCreateFirstAdminError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateFirstAdmin("body", nil) + _, err := k.Security.CreateFirstAdmin([]byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -36,14 +36,13 @@ func TestCreateFirstAdmin(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "createFirstAdmin", parsedQuery.Action) - assert.Equal(t, "myFirstAdmin", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte{}} }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateFirstAdmin("myFirstAdmin", nil) + _, err := k.Security.CreateFirstAdmin([]byte(`{"body": "test"}`), nil) assert.Nil(t, err) } diff --git a/security/createOrReplaceProfile.go b/security/createOrReplaceProfile.go index 9d33e65e..12671ed2 100644 --- a/security/createOrReplaceProfile.go +++ b/security/createOrReplaceProfile.go @@ -7,8 +7,8 @@ import ( ) // CreateOrReplaceProfile creates or replaces (if _id matches an existing one) a profile with a list of policies. -func (s *Security) CreateOrReplaceProfile(id, body string, options types.QueryOptions) (*Profile, error) { - if body == "" { +func (s *Security) CreateOrReplaceProfile(id string, body json.RawMessage, options types.QueryOptions) (*Profile, error) { + if body == nil { return nil, types.NewError("Kuzzle.CreateOrReplaceProfile: body is required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/createOrReplaceProfile_test.go b/security/createOrReplaceProfile_test.go index 26616e8d..19180d44 100644 --- a/security/createOrReplaceProfile_test.go +++ b/security/createOrReplaceProfile_test.go @@ -12,7 +12,7 @@ import ( func TestCreateOrReplaceProfileBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateOrReplaceProfile("id", "", nil) + _, err := k.Security.CreateOrReplaceProfile("id", nil, nil) assert.Error(t, err) } @@ -24,7 +24,7 @@ func TestCreateOrReplaceProfileError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateOrReplaceProfile("id", "body", nil) + _, err := k.Security.CreateOrReplaceProfile("id", []byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,6 @@ func TestCreateOrReplaceProfile(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "createOrReplaceProfile", parsedQuery.Action) assert.Equal(t, "id", parsedQuery.Id) - assert.Equal(t, "newProfile", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "_id": "id", @@ -50,7 +49,7 @@ func TestCreateOrReplaceProfile(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.CreateOrReplaceProfile("id", "newProfile", nil) + res, err := k.Security.CreateOrReplaceProfile("id", []byte(`{"body": "test"}`), nil) assert.Equal(t, "id", res.Id) assert.Nil(t, err) } diff --git a/security/createOrReplaceRole.go b/security/createOrReplaceRole.go index 5a5c0e9f..6e90df44 100644 --- a/security/createOrReplaceRole.go +++ b/security/createOrReplaceRole.go @@ -7,8 +7,8 @@ import ( ) // CreateOrReplaceRole creates or replaces (if _id matches an existing one) a Role with a list of policies. -func (s *Security) CreateOrReplaceRole(id, body string, options types.QueryOptions) (*Role, error) { - if body == "" { +func (s *Security) CreateOrReplaceRole(id string, body json.RawMessage, options types.QueryOptions) (*Role, error) { + if body == nil { return nil, types.NewError("Kuzzle.CreateOrReplaceRole: body is required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/createOrReplaceRole_test.go b/security/createOrReplaceRole_test.go index def54e24..c16ec44d 100644 --- a/security/createOrReplaceRole_test.go +++ b/security/createOrReplaceRole_test.go @@ -12,7 +12,7 @@ import ( func TestCreateOrReplaceRoleBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateOrReplaceRole("id", "", nil) + _, err := k.Security.CreateOrReplaceRole("id", nil, nil) assert.Error(t, err) } @@ -24,7 +24,7 @@ func TestCreateOrReplaceRoleError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateOrReplaceRole("id", "body", nil) + _, err := k.Security.CreateOrReplaceRole("id", []byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,6 @@ func TestCreateOrReplaceRole(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "createOrReplaceRole", parsedQuery.Action) assert.Equal(t, "id", parsedQuery.Id) - assert.Equal(t, "newRole", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "_id": "id", @@ -49,7 +48,7 @@ func TestCreateOrReplaceRole(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.CreateOrReplaceRole("id", "newRole", nil) + res, err := k.Security.CreateOrReplaceRole("id", []byte(`{"body": "test"}`), nil) assert.NotNil(t, res) assert.Nil(t, err) diff --git a/security/createProfile.go b/security/createProfile.go index 7341366d..e44dc25c 100644 --- a/security/createProfile.go +++ b/security/createProfile.go @@ -7,8 +7,8 @@ import ( ) // CreateProfile creates or replaces (if _id matches an existing one) a profile with a list of policies. -func (s *Security) CreateProfile(id, body string, options types.QueryOptions) (*Profile, error) { - if id == "" || body == "" { +func (s *Security) CreateProfile(id string, body json.RawMessage, options types.QueryOptions) (*Profile, error) { + if id == "" || body == nil { return nil, types.NewError("Kuzzle.CreateProfile: id and body are required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/createProfile_test.go b/security/createProfile_test.go index dea065ce..289caaba 100644 --- a/security/createProfile_test.go +++ b/security/createProfile_test.go @@ -12,13 +12,13 @@ import ( func TestCreateProfileIDNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateProfile("", "body", nil) + _, err := k.Security.CreateProfile("", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } func TestCreateProfileBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateProfile("id", "", nil) + _, err := k.Security.CreateProfile("id", nil, nil) assert.Error(t, err) } @@ -30,7 +30,7 @@ func TestCreateProfileError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateProfile("id", "body", nil) + _, err := k.Security.CreateProfile("id", []byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -43,7 +43,6 @@ func TestCreateProfile(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "createProfile", parsedQuery.Action) assert.Equal(t, "id", parsedQuery.Id) - assert.Equal(t, "newProfile", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "_id": "id", @@ -56,7 +55,7 @@ func TestCreateProfile(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.CreateProfile("id", "newProfile", nil) + res, err := k.Security.CreateProfile("id", []byte(`{"body": "test"}`), nil) assert.NotNil(t, res) assert.Nil(t, err) assert.Equal(t, "id", res.Id) diff --git a/security/createRestrictedUser.go b/security/createRestrictedUser.go index a55e1669..2fa62577 100644 --- a/security/createRestrictedUser.go +++ b/security/createRestrictedUser.go @@ -7,8 +7,8 @@ import ( ) // CreateRestrictedUser create credentials of the specified strategy with given body infos. -func (s *Security) CreateRestrictedUser(body string, options types.QueryOptions) (json.RawMessage, error) { - if body == "" { +func (s *Security) CreateRestrictedUser(body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { + if body == nil { return nil, types.NewError("Kuzzle.CreateRestrictedUser: strategy, id and body are required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/createRestrictedUser_test.go b/security/createRestrictedUser_test.go index c02fa95a..08c3f96e 100644 --- a/security/createRestrictedUser_test.go +++ b/security/createRestrictedUser_test.go @@ -12,7 +12,7 @@ import ( func TestCreateRestrictedUserBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateRestrictedUser("", nil) + _, err := k.Security.CreateRestrictedUser(nil, nil) assert.Error(t, err) } @@ -24,7 +24,7 @@ func TestCreateRestrictedUserError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateRestrictedUser("body", nil) + _, err := k.Security.CreateRestrictedUser([]byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -36,14 +36,13 @@ func TestCreateRestrictedUser(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "createRestrictedUser", parsedQuery.Action) - assert.Equal(t, "myRestrictedUser", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte{}} }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateRestrictedUser("myRestrictedUser", nil) + _, err := k.Security.CreateRestrictedUser([]byte(`{"body": "test"}`), nil) assert.Nil(t, err) } diff --git a/security/createRole.go b/security/createRole.go index 7d278f97..d6d3e58a 100644 --- a/security/createRole.go +++ b/security/createRole.go @@ -7,8 +7,8 @@ import ( ) // CreateRole creates or replaces (if _id matches an existing one) a Role with a list of policies. -func (s *Security) CreateRole(id, body string, options types.QueryOptions) (*Role, error) { - if id == "" || body == "" { +func (s *Security) CreateRole(id string, body json.RawMessage, options types.QueryOptions) (*Role, error) { + if id == "" || body == nil { return nil, types.NewError("Kuzzle.CreateRole: id and body are required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/createRole_test.go b/security/createRole_test.go index 1a293a7e..954d1273 100644 --- a/security/createRole_test.go +++ b/security/createRole_test.go @@ -12,13 +12,13 @@ import ( func TestCreateRoleIDNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateRole("", "body", nil) + _, err := k.Security.CreateRole("", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } func TestCreateRoleBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateRole("id", "", nil) + _, err := k.Security.CreateRole("id", nil, nil) assert.Error(t, err) } @@ -30,7 +30,7 @@ func TestCreateRoleError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateRole("id", "body", nil) + _, err := k.Security.CreateRole("id", []byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -43,14 +43,13 @@ func TestCreateRole(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "createRole", parsedQuery.Action) assert.Equal(t, "id", parsedQuery.Id) - assert.Equal(t, "newRole", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte{}} }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateRole("id", "newRole", nil) + _, err := k.Security.CreateRole("id", []byte(`{"body": "test"}`), nil) assert.Nil(t, err) } diff --git a/security/createUser.go b/security/createUser.go index 0f2c24bb..0c69db2b 100644 --- a/security/createUser.go +++ b/security/createUser.go @@ -7,8 +7,8 @@ import ( ) // CreateUser creates or replaces (if _id matches an existing one) a User with a list of policies. -func (s *Security) CreateUser(body string, options types.QueryOptions) (json.RawMessage, error) { - if body == "" { +func (s *Security) CreateUser(body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { + if body == nil { return nil, types.NewError("Kuzzle.CreateUser: body is required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/createUser_test.go b/security/createUser_test.go index 03eb856f..cb9a4a88 100644 --- a/security/createUser_test.go +++ b/security/createUser_test.go @@ -12,7 +12,7 @@ import ( func TestCreateUserBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.CreateUser("", nil) + _, err := k.Security.CreateUser(nil, nil) assert.Error(t, err) } @@ -24,7 +24,7 @@ func TestCreateUserError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.CreateUser("body", nil) + _, err := k.Security.CreateUser([]byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -36,14 +36,13 @@ func TestCreateUser(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "createUser", parsedQuery.Action) - assert.Equal(t, "newUser", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte{}} }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.CreateUser("newUser", nil) + res, err := k.Security.CreateUser([]byte(`{"body": "test"}`), nil) assert.NotNil(t, res) assert.Nil(t, err) } diff --git a/security/getProfile.go b/security/getProfile.go index 6c0d4578..657f77f8 100644 --- a/security/getProfile.go +++ b/security/getProfile.go @@ -30,5 +30,5 @@ func (s *Security) GetProfile(id string, options types.QueryOptions) (*Profile, jsonProfile := &jsonProfile{} json.Unmarshal(res.Result, jsonProfile) - return s.jsonProfileToProfile(jsonProfile), nil + return jsonProfile.jsonProfileToProfile(), nil } diff --git a/security/getRole.go b/security/getRole.go index 171a9a09..67c8e73f 100644 --- a/security/getRole.go +++ b/security/getRole.go @@ -29,5 +29,5 @@ func (s *Security) GetRole(id string, options types.QueryOptions) (*Role, error) jsonRole := &jsonRole{} json.Unmarshal(res.Result, jsonRole) - return s.jsonRoleToRole(jsonRole), nil + return jsonRole.jsonRoleToRole(), nil } diff --git a/security/getRole_test.go b/security/getRole_test.go index 6b062e34..b706f3f2 100644 --- a/security/getRole_test.go +++ b/security/getRole_test.go @@ -65,7 +65,7 @@ func TestGetRole(t *testing.T) { }, }, } - r, _ := security.RoleToJson(&res) + r, _ := (&res).RoleToJson() return &types.KuzzleResponse{Result: r} }, } diff --git a/security/getUser.go b/security/getUser.go index 6065a00f..375dfe1d 100644 --- a/security/getUser.go +++ b/security/getUser.go @@ -29,5 +29,5 @@ func (s *Security) GetUser(id string, options types.QueryOptions) (*User, error) jsonUser := &jsonUser{} json.Unmarshal(res.Result, jsonUser) - return s.jsonUserToUser(jsonUser), nil + return jsonUser.jsonUserToUser(), nil } diff --git a/security/json_profile.go b/security/json_profile.go index 11c668ae..d1406a92 100644 --- a/security/json_profile.go +++ b/security/json_profile.go @@ -17,22 +17,22 @@ type jsonProfileSearchResult struct { ScrollId string `json:"scrollId"` } -func (s *Security) jsonProfileToProfile(j *jsonProfile) *Profile { +func (j *jsonProfile) jsonProfileToProfile() *Profile { p := &Profile{ Id: j.Id, Policies: j.Source.Policies, } - p.Security = s return p } -func ProfileToJson(p *Profile) ([]byte, error) { +func (p *Profile) ProfileToJson() ([]byte, error) { j := &jsonProfile{ Id: p.Id, Source: types.Policies{ Policies: p.Policies, }, } + return json.Marshal(j) } diff --git a/security/json_role.go b/security/json_role.go index 8420b7c6..aa5e3952 100644 --- a/security/json_role.go +++ b/security/json_role.go @@ -2,6 +2,7 @@ package security import ( "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) @@ -16,16 +17,15 @@ type jsonRoleSearchResult struct { ScrollId string `json:"scrollId"` } -func (s *Security) jsonRoleToRole(j *jsonRole) *Role { +func (j *jsonRole) jsonRoleToRole() *Role { r := &Role{} r.Id = j.Id r.Controllers = j.Source.Controllers - r.Security = s return r } -func RoleToJson(r *Role) ([]byte, error) { +func (r *Role) RoleToJson() ([]byte, error) { j := &jsonRole{ Id: r.Id, Source: types.Controllers{ diff --git a/security/json_user.go b/security/json_user.go index c06428a3..f42935c6 100644 --- a/security/json_user.go +++ b/security/json_user.go @@ -2,6 +2,7 @@ package security import ( "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) @@ -16,10 +17,9 @@ type jsonUserSearchResult struct { ScrollId string `json:"scrollId"` } -func (s *Security) jsonUserToUser(j *jsonUser) *User { +func (j *jsonUser) jsonUserToUser() *User { u := &User{ - Id: j.Id, - Security: s, + Id: j.Id, } userData := &types.UserData{} diff --git a/security/mGetProfiles.go b/security/mGetProfiles.go index f6b3faaf..86d3e426 100644 --- a/security/mGetProfiles.go +++ b/security/mGetProfiles.go @@ -34,7 +34,7 @@ func (s *Security) MGetProfiles(ids []string, options types.QueryOptions) ([]*Pr json.Unmarshal(res.Result, &fetchedRaw) for _, jsonProfileRaw := range fetchedRaw.Hits { - fetchedProfiles = append(fetchedProfiles, s.jsonProfileToProfile(jsonProfileRaw)) + fetchedProfiles = append(fetchedProfiles, jsonProfileRaw.jsonProfileToProfile()) } return fetchedProfiles, nil diff --git a/security/mGetRoles.go b/security/mGetRoles.go index 90b8c83d..8d9841f0 100644 --- a/security/mGetRoles.go +++ b/security/mGetRoles.go @@ -34,7 +34,7 @@ func (s *Security) MGetRoles(ids []string, options types.QueryOptions) ([]*Role, json.Unmarshal(res.Result, &fetchedRaw) for _, jsonRoleRaw := range fetchedRaw.Hits { - fetchedRoles = append(fetchedRoles, s.jsonRoleToRole(jsonRoleRaw)) + fetchedRoles = append(fetchedRoles, jsonRoleRaw.jsonRoleToRole()) } return fetchedRoles, nil diff --git a/security/profile.go b/security/profile.go index c616763e..16b897fa 100644 --- a/security/profile.go +++ b/security/profile.go @@ -7,7 +7,6 @@ import ( type Profile struct { Id string `json:"_id"` Policies []*types.Policy - Security *Security } type ProfileSearchResult struct { @@ -16,10 +15,9 @@ type ProfileSearchResult struct { ScrollId string `json:"scrollId"` } -func (s *Security) NewProfile(id string, policies []*types.Policy) *Profile { +func NewProfile(id string, policies []*types.Policy) *Profile { return &Profile{ Id: id, Policies: policies, - Security: s, } } diff --git a/security/replaceUser.go b/security/replaceUser.go index a992bc02..3a03ea66 100644 --- a/security/replaceUser.go +++ b/security/replaceUser.go @@ -7,8 +7,8 @@ import ( ) // ReplaceUser replaces the matching user with the given one -func (s *Security) ReplaceUser(id, content string, options types.QueryOptions) (*User, error) { - if id == "" || content == "" { +func (s *Security) ReplaceUser(id string, content json.RawMessage, options types.QueryOptions) (*User, error) { + if id == "" || content == nil { return nil, types.NewError("Security.ReplaceUser: id and content are required", 400) } @@ -29,7 +29,9 @@ func (s *Security) ReplaceUser(id, content string, options types.QueryOptions) ( } var replaced *User - json.Unmarshal(res.Result, &replaced) + var rawReplaced *jsonUser + json.Unmarshal(res.Result, &rawReplaced) + replaced = rawReplaced.jsonUserToUser() return replaced, nil diff --git a/security/replaceUser_test.go b/security/replaceUser_test.go index ccdaa3ad..21417561 100644 --- a/security/replaceUser_test.go +++ b/security/replaceUser_test.go @@ -12,14 +12,14 @@ import ( func TestReplaceUserIDNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - res, err := k.Security.ReplaceUser("", "content", nil) + res, err := k.Security.ReplaceUser("", []byte(`{"body": "test"}`), nil) assert.Nil(t, res) assert.Error(t, err) } func TestReplaceUserContentNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - res, err := k.Security.ReplaceUser("id", "", nil) + res, err := k.Security.ReplaceUser("id", nil, nil) assert.Nil(t, res) assert.Error(t, err) } @@ -31,7 +31,7 @@ func TestReplaceUserError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.ReplaceUser("id", "content", nil) + res, err := k.Security.ReplaceUser("id", []byte(`{"body": "test"}`), nil) assert.Nil(t, res) assert.Error(t, err) } @@ -45,7 +45,6 @@ func TestReplaceUser(t *testing.T) { assert.Equal(t, "security", request.Controller) assert.Equal(t, "replaceUser", request.Action) assert.Equal(t, "id", request.Id) - assert.Equal(t, "content", request.Body) return &types.KuzzleResponse{Result: []byte(`{ "_id": "id", @@ -59,7 +58,7 @@ func TestReplaceUser(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.ReplaceUser("id", "content", nil) + res, err := k.Security.ReplaceUser("id", []byte(`{"body": "test"}`), nil) assert.NoError(t, err) assert.Equal(t, "id", res.Id) } diff --git a/security/role.go b/security/role.go index 341c530e..8d1063ea 100644 --- a/security/role.go +++ b/security/role.go @@ -7,7 +7,6 @@ import ( type Role struct { Id string `json:"_id"` Controllers map[string]*types.Controller - Security *Security } type RoleSearchResult struct { @@ -15,10 +14,9 @@ type RoleSearchResult struct { Total int } -func (s *Security) NewRole(id string, controllers *types.Controllers) *Role { +func NewRole(id string, controllers *types.Controllers) *Role { r := &Role{ - Id: id, - Security: s, + Id: id, } if controllers != nil { r.Controllers = controllers.Controllers diff --git a/security/searchProfiles.go b/security/searchProfiles.go index 8e2458c5..1affd558 100644 --- a/security/searchProfiles.go +++ b/security/searchProfiles.go @@ -6,7 +6,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) SearchProfiles(body string, options types.QueryOptions) (*ProfileSearchResult, error) { +func (s *Security) SearchProfiles(body json.RawMessage, options types.QueryOptions) (*ProfileSearchResult, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ @@ -41,8 +41,7 @@ func (s *Security) SearchProfiles(body string, options types.QueryOptions) (*Pro Total: jsonSearchResult.Total, } for _, j := range jsonSearchResult.Hits { - p := s.jsonProfileToProfile(j) - p.Security = s + p := j.jsonProfileToProfile() searchResult.Hits = append(searchResult.Hits, p) } diff --git a/security/searchProfiles_test.go b/security/searchProfiles_test.go index 422192cf..0b7b170b 100644 --- a/security/searchProfiles_test.go +++ b/security/searchProfiles_test.go @@ -21,7 +21,7 @@ func TestSearchProfileError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.SearchProfiles("", nil) + _, err := k.Security.SearchProfiles(nil, nil) assert.NotNil(t, err) } @@ -43,7 +43,7 @@ func TestSearchProfile(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.SearchProfiles("", nil) + res, _ := k.Security.SearchProfiles(nil, nil) assert.Equal(t, 42, res.Total) assert.Equal(t, "profile42", res.Hits[0].Id) @@ -55,7 +55,7 @@ func TestSearchProfile(t *testing.T) { func ExampleSearchProfiles() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.SearchProfiles("", nil) + res, err := k.Security.SearchProfiles(nil, nil) if err != nil { fmt.Println(err.Error()) @@ -90,7 +90,7 @@ func TestSearchProfileWithScroll(t *testing.T) { opts.SetSize(4) opts.SetScroll("1m") - res, _ := k.Security.SearchProfiles("", opts) + res, _ := k.Security.SearchProfiles(nil, opts) assert.Equal(t, 42, res.Total) assert.Equal(t, 1, len(res.Hits)) assert.Equal(t, []*types.Policy{ diff --git a/security/searchRoles.go b/security/searchRoles.go index b85a99bd..8ce89418 100644 --- a/security/searchRoles.go +++ b/security/searchRoles.go @@ -6,7 +6,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) SearchRoles(body string, options types.QueryOptions) (*RoleSearchResult, error) { +func (s *Security) SearchRoles(body json.RawMessage, options types.QueryOptions) (*RoleSearchResult, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ @@ -39,7 +39,7 @@ func (s *Security) SearchRoles(body string, options types.QueryOptions) (*RoleSe Total: jsonSearchResult.Total, } for _, j := range jsonSearchResult.Hits { - r := s.jsonRoleToRole(j) + r := j.jsonRoleToRole() searchResult.Hits = append(searchResult.Hits, r) } diff --git a/security/searchRoles_test.go b/security/searchRoles_test.go index def67397..23152a6f 100644 --- a/security/searchRoles_test.go +++ b/security/searchRoles_test.go @@ -19,7 +19,7 @@ func TestSearchRolesError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.SearchRoles("", nil) + _, err := k.Security.SearchRoles(nil, nil) assert.NotNil(t, err) } @@ -39,7 +39,7 @@ func TestSearchRoles(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.SearchRoles("", nil) + res, _ := k.Security.SearchRoles(nil, nil) assert.Equal(t, 42, res.Total) assert.Equal(t, 1, len(res.Hits)) @@ -49,7 +49,7 @@ func TestSearchRoles(t *testing.T) { func ExampleSecurityRole_Search() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.SearchRoles("", nil) + res, err := k.Security.SearchRoles(nil, nil) if err != nil { fmt.Println(err.Error()) @@ -96,7 +96,7 @@ func TestSearchWithOptions(t *testing.T) { opts.SetSize(4) opts.SetScroll("1m") - res, _ := k.Security.SearchRoles("", opts) + res, _ := k.Security.SearchRoles(nil, opts) assert.Equal(t, 42, res.Total) assert.Equal(t, res.Hits[0].Id, "role42") assert.Equal(t, 1, len(res.Hits)) diff --git a/security/searchUsers.go b/security/searchUsers.go index dbf0a6b9..3e642b1d 100644 --- a/security/searchUsers.go +++ b/security/searchUsers.go @@ -6,7 +6,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) SearchUsers(body string, options types.QueryOptions) (*UserSearchResult, error) { +func (s *Security) SearchUsers(body json.RawMessage, options types.QueryOptions) (*UserSearchResult, error) { ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ @@ -42,7 +42,7 @@ func (s *Security) SearchUsers(body string, options types.QueryOptions) (*UserSe } for _, j := range jsonSearchResult.Hits { - searchResult.Hits = append(searchResult.Hits, s.jsonUserToUser(j)) + searchResult.Hits = append(searchResult.Hits, j.jsonUserToUser()) } return searchResult, nil diff --git a/security/searchUsers_test.go b/security/searchUsers_test.go index 76ee1113..be0ae6db 100644 --- a/security/searchUsers_test.go +++ b/security/searchUsers_test.go @@ -19,7 +19,7 @@ func TestSearchUsersError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.SearchUsers("", nil) + _, err := k.Security.SearchUsers(nil, nil) assert.NotNil(t, err) } @@ -41,7 +41,7 @@ func TestSearchUsers(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - res, _ := k.Security.SearchUsers("", nil) + res, _ := k.Security.SearchUsers(nil, nil) assert.Equal(t, 42, res.Total) assert.Equal(t, 1, len(res.Hits)) @@ -53,7 +53,7 @@ func TestSearchUsers(t *testing.T) { func ExampleSearchUsers() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.SearchUsers("", nil) + res, err := k.Security.SearchUsers(nil, nil) if err != nil { fmt.Println(err.Error()) @@ -89,5 +89,5 @@ func TestSearchUsersWithScroll(t *testing.T) { opts.SetSize(4) opts.SetScroll("1m") - k.Security.SearchUsers("", opts) + k.Security.SearchUsers(nil, opts) } diff --git a/security/updateCredentials.go b/security/updateCredentials.go index b3ea1674..a7bbf717 100644 --- a/security/updateCredentials.go +++ b/security/updateCredentials.go @@ -1,11 +1,13 @@ package security import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) // UpdateCredentials updates credentials of the specified strategy for the given user. -func (s *Security) UpdateCredentials(strategy string, kuid string, body string, options types.QueryOptions) error { +func (s *Security) UpdateCredentials(strategy string, kuid string, body json.RawMessage, options types.QueryOptions) error { if strategy == "" || kuid == "" { return types.NewError("Security.UpdateCredentials: strategy and kuid are required", 400) } diff --git a/security/updateCredentials_test.go b/security/updateCredentials_test.go index cc8655f4..7158bdb4 100644 --- a/security/updateCredentials_test.go +++ b/security/updateCredentials_test.go @@ -23,7 +23,7 @@ func TestUpdateCredentialsQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateCredentials("local", "someId", "", nil) + err := k.Security.UpdateCredentials("local", "someId", nil, nil) assert.NotNil(t, err) } @@ -34,7 +34,7 @@ func TestUpdateCredentialsEmptyStrategy(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateCredentials("", "someId", "", nil) + err := k.Security.UpdateCredentials("", "someId", nil, nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestUpdateCredentialsEmptyKuid(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateCredentials("local", "", "", nil) + err := k.Security.UpdateCredentials("local", "", nil, nil) assert.NotNil(t, err) } @@ -63,14 +63,14 @@ func TestUpdateCredentials(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateCredentials("local", "someId", "body", nil) + err := k.Security.UpdateCredentials("local", "someId", []byte(`{"body": "test"}`), nil) assert.Nil(t, err) } func ExampleSecurity_UpdateCredentials() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateCredentials("local", "someId", "body", nil) + err := k.Security.UpdateCredentials("local", "someId", []byte(`{"body": "test"}`), nil) if err != nil { fmt.Println(err.Error()) diff --git a/security/updateProfile.go b/security/updateProfile.go index 093b58c6..e0666370 100644 --- a/security/updateProfile.go +++ b/security/updateProfile.go @@ -6,8 +6,8 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) UpdateProfile(id, body string, options types.QueryOptions) (*Profile, error) { - if id == "" || body == "" { +func (s *Security) UpdateProfile(id string, body json.RawMessage, options types.QueryOptions) (*Profile, error) { + if id == "" || body == nil { return nil, types.NewError("Security.UpdateProfile: id and body are required", 400) } diff --git a/security/updateProfileMapping.go b/security/updateProfileMapping.go index 710f86e3..97f3f640 100644 --- a/security/updateProfileMapping.go +++ b/security/updateProfileMapping.go @@ -1,11 +1,13 @@ package security import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) UpdateProfileMapping(body string, options types.QueryOptions) error { - if body == "" { +func (s *Security) UpdateProfileMapping(body json.RawMessage, options types.QueryOptions) error { + if body == nil { return types.NewError("Security.UpdateProfileMapping: body is required", 400) } diff --git a/security/updateProfileMapping_test.go b/security/updateProfileMapping_test.go index 6a36b5e9..074da0c3 100644 --- a/security/updateProfileMapping_test.go +++ b/security/updateProfileMapping_test.go @@ -12,7 +12,7 @@ import ( func TestUpdateProfileMappingBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - err := k.Security.UpdateProfileMapping("", nil) + err := k.Security.UpdateProfileMapping(nil, nil) assert.Error(t, err) } @@ -25,7 +25,7 @@ func TestUpdateProfileMappingError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateProfileMapping("body", nil) + err := k.Security.UpdateProfileMapping([]byte(`{"body": "test"}`), nil) assert.Error(t, err) } @@ -37,13 +37,12 @@ func TestUpdateProfileMapping(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "updateProfileMapping", parsedQuery.Action) - assert.Equal(t, "body", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "acknowledged" : true}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateProfileMapping("body", nil) + err := k.Security.UpdateProfileMapping([]byte(`{"body": "test"}`), nil) assert.NoError(t, err) } diff --git a/security/updateProfile_test.go b/security/updateProfile_test.go index 4736c2a1..a01a5b86 100644 --- a/security/updateProfile_test.go +++ b/security/updateProfile_test.go @@ -12,13 +12,13 @@ import ( func TestUpdateProfileIDNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.UpdateProfile("", "body", nil) + _, err := k.Security.UpdateProfile("", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } func TestUpdateProfileBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.UpdateProfile("id", "", nil) + _, err := k.Security.UpdateProfile("id", nil, nil) assert.Error(t, err) } @@ -31,7 +31,7 @@ func TestUpdateProfileError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.UpdateProfile("id", "body", nil) + _, err := k.Security.UpdateProfile("id", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } @@ -44,7 +44,6 @@ func TestUpdateProfile(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "updateProfile", parsedQuery.Action) assert.Equal(t, "id", parsedQuery.Id) - assert.Equal(t, "body", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "_id": "id", @@ -57,7 +56,7 @@ func TestUpdateProfile(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.UpdateProfile("id", "body", nil) + res, err := k.Security.UpdateProfile("id", []byte(`{"body": "test"}`), nil) assert.NoError(t, err) assert.NotNil(t, res) assert.Equal(t, "id", res.Id) diff --git a/security/updateRole.go b/security/updateRole.go index 26da59f3..bccc1f1e 100644 --- a/security/updateRole.go +++ b/security/updateRole.go @@ -6,8 +6,8 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) UpdateRole(id, body string, options types.QueryOptions) (*Role, error) { - if id == "" || body == "" { +func (s *Security) UpdateRole(id string, body json.RawMessage, options types.QueryOptions) (*Role, error) { + if id == "" || body == nil { return nil, types.NewError("Security.UpdateRole: id and body are required", 400) } diff --git a/security/updateRoleMapping.go b/security/updateRoleMapping.go index 94348dfc..57433ef2 100644 --- a/security/updateRoleMapping.go +++ b/security/updateRoleMapping.go @@ -1,11 +1,13 @@ package security import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) UpdateRoleMapping(body string, options types.QueryOptions) error { - if body == "" { +func (s *Security) UpdateRoleMapping(body json.RawMessage, options types.QueryOptions) error { + if body == nil { return types.NewError("Security.UpdateRoleMapping: body is required", 400) } diff --git a/security/updateRoleMapping_test.go b/security/updateRoleMapping_test.go index b3db1d4d..83157b80 100644 --- a/security/updateRoleMapping_test.go +++ b/security/updateRoleMapping_test.go @@ -12,7 +12,7 @@ import ( func TestUpdateRoleMappingBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - err := k.Security.UpdateRoleMapping("", nil) + err := k.Security.UpdateRoleMapping(nil, nil) assert.Error(t, err) } @@ -25,7 +25,7 @@ func TestUpdateRoleMappingError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateRoleMapping("body", nil) + err := k.Security.UpdateRoleMapping([]byte(`{"body": "test"}`), nil) assert.Error(t, err) } @@ -37,13 +37,12 @@ func TestUpdateRoleMapping(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "updateRoleMapping", parsedQuery.Action) - assert.Equal(t, "body", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "acknowledged" : true}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateRoleMapping("body", nil) + err := k.Security.UpdateRoleMapping([]byte(`{"body": "test"}`), nil) assert.NoError(t, err) } diff --git a/security/updateRole_test.go b/security/updateRole_test.go index 0c709ba9..75c0c473 100644 --- a/security/updateRole_test.go +++ b/security/updateRole_test.go @@ -12,13 +12,13 @@ import ( func TestUpdateRoleIDNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.UpdateRole("", "body", nil) + _, err := k.Security.UpdateRole("", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } func TestUpdateRoleBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.UpdateRole("id", "", nil) + _, err := k.Security.UpdateRole("id", nil, nil) assert.Error(t, err) } @@ -31,7 +31,7 @@ func TestUpdateRoleError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.UpdateRole("id", "body", nil) + _, err := k.Security.UpdateRole("id", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } @@ -44,7 +44,6 @@ func TestUpdateRole(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "updateRole", parsedQuery.Action) assert.Equal(t, "id", parsedQuery.Id) - assert.Equal(t, "body", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "_id": "id", @@ -57,7 +56,7 @@ func TestUpdateRole(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.UpdateRole("id", "body", nil) + res, err := k.Security.UpdateRole("id", []byte(`{"body": "test"}`), nil) assert.NoError(t, err) assert.NotNil(t, res) assert.Equal(t, "id", res.Id) diff --git a/security/updateUser.go b/security/updateUser.go index 688031be..18ac82f8 100644 --- a/security/updateUser.go +++ b/security/updateUser.go @@ -6,8 +6,8 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) UpdateUser(id, body string, options types.QueryOptions) (*User, error) { - if id == "" || body == "" { +func (s *Security) UpdateUser(id string, body json.RawMessage, options types.QueryOptions) (*User, error) { + if id == "" || body == nil { return nil, types.NewError("Security.UpdateUser: id and body are required", 400) } @@ -27,8 +27,10 @@ func (s *Security) UpdateUser(id, body string, options types.QueryOptions) (*Use return nil, res.Error } + var rawUpdated *jsonUser var updated *User - json.Unmarshal(res.Result, &updated) + json.Unmarshal(res.Result, &rawUpdated) + updated = rawUpdated.jsonUserToUser() return updated, nil } diff --git a/security/updateUserMapping.go b/security/updateUserMapping.go index 8b2adb0a..c1d511f1 100644 --- a/security/updateUserMapping.go +++ b/security/updateUserMapping.go @@ -1,11 +1,13 @@ package security import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/types" ) -func (s *Security) UpdateUserMapping(body string, options types.QueryOptions) error { - if body == "" { +func (s *Security) UpdateUserMapping(body json.RawMessage, options types.QueryOptions) error { + if body == nil { return types.NewError("Security.UpdateUserMapping: body is required", 400) } diff --git a/security/updateUserMapping_test.go b/security/updateUserMapping_test.go index 1636739a..aaff4105 100644 --- a/security/updateUserMapping_test.go +++ b/security/updateUserMapping_test.go @@ -12,7 +12,7 @@ import ( func TestUpdateUserMappingBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - err := k.Security.UpdateUserMapping("", nil) + err := k.Security.UpdateUserMapping(nil, nil) assert.Error(t, err) } @@ -25,7 +25,7 @@ func TestUpdateUserMappingError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateUserMapping("body", nil) + err := k.Security.UpdateUserMapping([]byte(`{"body": "test"}`), nil) assert.Error(t, err) } @@ -37,13 +37,12 @@ func TestUpdateUserMapping(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "updateUserMapping", parsedQuery.Action) - assert.Equal(t, "body", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "acknowledged" : true}`)} }, } k, _ := kuzzle.NewKuzzle(c, nil) - err := k.Security.UpdateUserMapping("body", nil) + err := k.Security.UpdateUserMapping([]byte(`{"body": "test"}`), nil) assert.NoError(t, err) } diff --git a/security/updateUser_test.go b/security/updateUser_test.go index 24f02bcf..6b9a5a09 100644 --- a/security/updateUser_test.go +++ b/security/updateUser_test.go @@ -12,13 +12,13 @@ import ( func TestUpdateUserIDNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.UpdateUser("", "body", nil) + _, err := k.Security.UpdateUser("", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } func TestUpdateUserBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - _, err := k.Security.UpdateUser("id", "", nil) + _, err := k.Security.UpdateUser("id", nil, nil) assert.Error(t, err) } @@ -31,7 +31,7 @@ func TestUpdateUserError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.UpdateUser("id", "body", nil) + _, err := k.Security.UpdateUser("id", []byte(`{"body": "test"}`), nil) assert.Error(t, err) } @@ -44,7 +44,6 @@ func TestUpdateUser(t *testing.T) { assert.Equal(t, "security", parsedQuery.Controller) assert.Equal(t, "updateUser", parsedQuery.Action) assert.Equal(t, "id", parsedQuery.Id) - assert.Equal(t, "body", parsedQuery.Body) return &types.KuzzleResponse{Result: []byte(`{ "_id": "id", @@ -57,7 +56,7 @@ func TestUpdateUser(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.UpdateUser("id", "body", nil) + res, err := k.Security.UpdateUser("id", []byte(`{"body": "test"}`), nil) assert.NoError(t, err) assert.NotNil(t, res) assert.Equal(t, "id", res.Id) diff --git a/security/user.go b/security/user.go index 8bf63b27..5221d497 100644 --- a/security/user.go +++ b/security/user.go @@ -8,7 +8,6 @@ type User struct { Id string `json:"_id"` Content map[string]interface{} `json:"_source"` ProfileIds []string - Security *Security } type UserSearchResult struct { @@ -17,10 +16,9 @@ type UserSearchResult struct { ScrollId string } -func (s *Security) NewUser(id string, content *types.UserData) *User { +func NewUser(id string, content *types.UserData) *User { u := &User{ - Id: id, - Security: s, + Id: id, } if content != nil { diff --git a/security/validateCredentials.go b/security/validateCredentials.go index d9d144a5..e931d019 100644 --- a/security/validateCredentials.go +++ b/security/validateCredentials.go @@ -7,13 +7,9 @@ import ( ) // ValidateCredentials validates credentials of the specified strategy for the given user. -func (s *Security) ValidateCredentials(strategy string, kuid string, body string, options types.QueryOptions) (bool, error) { - if strategy == "" { - return false, types.NewError("Security.ValidateCredentials: strategy is required", 400) - } - - if kuid == "" { - return false, types.NewError("Security.ValidateCredentials: kuid is required", 400) +func (s *Security) ValidateCredentials(strategy string, kuid string, body json.RawMessage, options types.QueryOptions) (bool, error) { + if strategy == "" || kuid == "" { + return false, types.NewError("Security.ValidateCredentials: strategy and kuid are required", 400) } result := make(chan *types.KuzzleResponse) diff --git a/security/validateCredentials_test.go b/security/validateCredentials_test.go index f249085f..d90b8170 100644 --- a/security/validateCredentials_test.go +++ b/security/validateCredentials_test.go @@ -23,7 +23,7 @@ func TestValidateCredentialsQueryError(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ValidateCredentials("local", "someId", "body", nil) + _, err := k.Security.ValidateCredentials("local", "someId", []byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -34,7 +34,7 @@ func TestValidateCredentialsEmptyStrategy(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ValidateCredentials("", "someId", "body", nil) + _, err := k.Security.ValidateCredentials("", "someId", []byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestValidateCredentialsEmptyKuid(t *testing.T) { }, } k, _ := kuzzle.NewKuzzle(c, nil) - _, err := k.Security.ValidateCredentials("local", "", "body", nil) + _, err := k.Security.ValidateCredentials("local", "", []byte(`{"body": "test"}`), nil) assert.NotNil(t, err) } @@ -67,7 +67,7 @@ func TestValidateCredentials(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.ValidateCredentials("local", "someId", "body", nil) + res, err := k.Security.ValidateCredentials("local", "someId", []byte(`{"body": "test"}`), nil) assert.Nil(t, err) assert.Equal(t, true, res) } @@ -75,7 +75,7 @@ func TestValidateCredentials(t *testing.T) { func ExampleSecurity_ValidateCredentials() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) - res, err := k.Security.ValidateCredentials("local", "someId", "body", nil) + res, err := k.Security.ValidateCredentials("local", "someId", []byte(`{"body": "test"}`), nil) if err != nil { fmt.Println(err.Error()) From 29e9bc666436d60cd12592a95a6beb33c07435ac Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 4 Apr 2018 15:15:40 +0200 Subject: [PATCH 080/363] C++ query_options optional --- internal/wrappers/headers/collection.hpp | 22 +++++++-------- internal/wrappers/headers/document.hpp | 34 ++++++++++++------------ internal/wrappers/headers/index.hpp | 18 ++++++------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index fedd3902..12e45819 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -15,17 +15,17 @@ namespace kuzzleio { Collection(Kuzzle* kuzzle); Collection(Kuzzle* kuzzle, collection *collection); virtual ~Collection(); - void create(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; - bool exists(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; - std::string list(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; - void truncate(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; - std::string getMapping(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; - void updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::string getSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; - search_result* searchSpecifications(query_options *options) Kuz_Throw_KuzzleException; - std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - bool validateSpecifications(const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - void deleteSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException; + void create(const std::string& index, const std::string& collection, query_options *options=NULL) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, const std::string& collection, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string list(const std::string& index, query_options *options=NULL) Kuz_Throw_KuzzleException; + void truncate(const std::string& index, const std::string& collection, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string getMapping(const std::string& index, const std::string& collection, query_options *options=NULL) Kuz_Throw_KuzzleException; + void updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string getSpecifications(const std::string& index, const std::string& collection, query_options *options=NULL) Kuz_Throw_KuzzleException; + search_result* searchSpecifications(query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + bool validateSpecifications(const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + void deleteSpecifications(const std::string& index, const std::string& collection, query_options *options=NULL) Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp index 7de49bed..08247af9 100644 --- a/internal/wrappers/headers/document.hpp +++ b/internal/wrappers/headers/document.hpp @@ -14,23 +14,23 @@ namespace kuzzleio { Document(Kuzzle* kuzzle); Document(Kuzzle* kuzzle, document *document); virtual ~Document(); - int count_(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - bool exists(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException; - std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::string createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::string delete_(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException; - std::vector deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::string get(const std::string& index, const std::string& collection, const std::string& id, query_options *options) Kuz_Throw_KuzzleException; - std::string replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::string update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - bool validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - search_result* search(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::string mCreate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::string mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::vector mDelete(const std::string& index, const std::string& collection, const std::vector& ids, query_options *options) Kuz_Throw_KuzzleException; - std::string mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options) Kuz_Throw_KuzzleException; - std::string mReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; - std::string mUpdate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException; + int count_(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, const std::string& collection, const std::string& id, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string delete_(const std::string& index, const std::string& collection, const std::string& id, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::vector deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string get(const std::string& index, const std::string& collection, const std::string& id, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + bool validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + search_result* search(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string mCreate(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::vector mDelete(const std::string& index, const std::string& collection, const std::vector& ids, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string mReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string mUpdate(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; }; } diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp index 7f252561..092d4388 100644 --- a/internal/wrappers/headers/index.hpp +++ b/internal/wrappers/headers/index.hpp @@ -13,15 +13,15 @@ namespace kuzzleio { Index(Kuzzle* kuzzle); Index(Kuzzle* kuzzle, kuzzle_index *index); virtual ~Index(); - void create(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; - void delete_(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; - std::vector mDelete(const std::vector& indexes, query_options *options) Kuz_Throw_KuzzleException; - bool exists(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; - void refresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; - void refreshInternal(query_options *options) Kuz_Throw_KuzzleException; - void setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options) Kuz_Throw_KuzzleException; - bool getAutoRefresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException; - std::vector list(query_options *options) Kuz_Throw_KuzzleException; + void create(const std::string& index, query_options *options=NULL) Kuz_Throw_KuzzleException; + void delete_(const std::string& index, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::vector mDelete(const std::vector& indexes, query_options *options=NULL) Kuz_Throw_KuzzleException; + bool exists(const std::string& index, query_options *options=NULL) Kuz_Throw_KuzzleException; + void refresh(const std::string& index, query_options *options=NULL) Kuz_Throw_KuzzleException; + void refreshInternal(query_options *options=NULL) Kuz_Throw_KuzzleException; + void setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options=NULL) Kuz_Throw_KuzzleException; + bool getAutoRefresh(const std::string& index, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::vector list(query_options *options=NULL) Kuz_Throw_KuzzleException; }; } From 59220afad020e2e73410ece86809a1f85070589d Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 6 Apr 2018 10:39:34 +0200 Subject: [PATCH 081/363] added callback for subscribe and join in cpp --- internal/wrappers/cgo/kuzzle/c_to_go.go | 2 +- internal/wrappers/cgo/kuzzle/realtime.go | 27 +++++++++++++++++++----- internal/wrappers/cpp/realtime.cpp | 26 +++++++++++++++++------ internal/wrappers/headers/realtime.hpp | 8 +++++-- 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index a2f7ef38..f52e6ee6 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -248,7 +248,7 @@ func cToGoSearchResult(s *C.search_result) *types.SearchResult { } } -func cToGoKuzzleNotificationChannel(c *C.callback) chan<- types.KuzzleNotification { +func cToGoKuzzleNotificationChannel(c *C.kuzzle_notification_listener) chan<- types.KuzzleNotification { return make(chan<- types.KuzzleNotification) } diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index ef74a2a6..4bacc4d3 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -13,6 +13,7 @@ import ( "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/realtime" + "github.com/kuzzleio/sdk-go/types" ) // map which stores instances to keep references in case the gc passes @@ -72,14 +73,30 @@ func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result } //export kuzzle_realtime_subscribe -func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback *C.callback, options *C.room_options) *C.string_result { - res, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), cToGoKuzzleNotificationChannel(callback), cToGoRoomOptions(options)) - return goToCStringResult(&res, err) +func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.string_result { + c := make(chan types.KuzzleNotification) + + roomId, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, cToGoRoomOptions(options)) + + go func() { + res := <-c + C.kuzzle_notify(callback, goToCNotificationResult(&res), data) + }() + + return goToCStringResult(&roomId, err) } //export kuzzle_realtime_join -func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, options *C.room_options, callback *C.callback) *C.void_result { - err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), cToGoRoomOptions(options), cToGoKuzzleNotificationChannel(callback)) +func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, options *C.room_options, callback C.kuzzle_notification_listener, data unsafe.Pointer) *C.void_result { + c := make(chan types.KuzzleNotification) + + err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), cToGoRoomOptions(options), c) + + go func() { + res := <-c + C.kuzzle_notify(callback, goToCNotificationResult(&res), data) + }() + return goToCVoidResult(err) } diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index cef52985..895e3115 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -25,10 +25,20 @@ namespace kuzzleio { return ret; } - void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, callback cb) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), options, cb); + NotificationListener* Realtime::getListener(const std::string& roomId) { + return _listener_instances[roomId]; + } + + void call_subscribe_cb(notification_result* res, void* data) { + ((Realtime*)data)->getListener(res->room_id)->onMessage(res); + } + + void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, NotificationListener* cb) Kuz_Throw_KuzzleException { + void_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), options, call_subscribe_cb, this); if (r->error != NULL) throwExceptionFromStatus(r); + + _listener_instances[roomId] = cb; kuzzle_free_void_result(r); } @@ -48,19 +58,23 @@ namespace kuzzleio { kuzzle_free_void_result(r); } - std::string Realtime::subscribe(const std::string& index, const std::string collection, const std::string body, callback cb, room_options* options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), cb, options); + std::string Realtime::subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options) Kuz_Throw_KuzzleException { + string_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), call_subscribe_cb, this, options); if (r->error != NULL) throwExceptionFromStatus(r); - std::string ret = r->result; + std::string roomId = r->result; + + _listener_instances[roomId] = cb; kuzzle_free_string_result(r); - return ret; + return roomId; } void Realtime::unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException { void_result *r = kuzzle_realtime_unsubscribe(_realtime, const_cast(roomId.c_str())); if (r->error != NULL) throwExceptionFromStatus(r); + + _listener_instances[roomId] = NULL; kuzzle_free_void_result(r); } diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp index 40d6c1a9..9f17aefe 100644 --- a/internal/wrappers/headers/realtime.hpp +++ b/internal/wrappers/headers/realtime.hpp @@ -3,10 +3,12 @@ #include "exceptions.hpp" #include "core.hpp" +#include namespace kuzzleio { class Realtime { realtime *_realtime; + std::map _listener_instances; Realtime(); public: @@ -14,12 +16,14 @@ namespace kuzzleio { Realtime(Kuzzle* kuzzle, realtime* realtime); virtual ~Realtime(); int count(const std::string& index, const std::string collection, const std::string roomId) Kuz_Throw_KuzzleException; - void join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, callback cb) Kuz_Throw_KuzzleException; + void join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, NotificationListener* cb) Kuz_Throw_KuzzleException; std::string list(const std::string& index, const std::string collection) Kuz_Throw_KuzzleException; void publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; - std::string subscribe(const std::string& index, const std::string collection, const std::string body, callback cb, room_options* options) Kuz_Throw_KuzzleException; + std::string subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options) Kuz_Throw_KuzzleException; void unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException; bool validate(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; + + NotificationListener* getListener(const std::string& roomId); }; } From 482d99fa7b96c315be2380a0934fd0aec3ad8838 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 6 Apr 2018 10:49:38 +0200 Subject: [PATCH 082/363] Add documentation and Apache2 license header * Add Go documentation in controllers and some important types. * Add license header in all source code files * Remove old methods from Kuzzle (GetAutoRefresh, ListIndex, ListCollections) --- auth/auth.go | 16 ++++++ auth/checkToken.go | 15 +++++ auth/checkToken_test.go | 14 +++++ auth/createMyCredentials.go | 14 +++++ auth/createMyCredentials_test.go | 14 +++++ auth/credentialsExist.go | 16 +++++- auth/credentialsExist_test.go | 14 +++++ auth/deleteMyCredentials.go | 14 +++++ auth/deleteMyCredentials_test.go | 14 +++++ auth/getCurrentUser.go | 15 +++++ auth/getCurrentUser_test.go | 14 +++++ auth/getMyCredentials.go | 14 +++++ auth/getMyCredentials_test.go | 14 +++++ auth/getMyRights.go | 14 +++++ auth/getMyRights_test.go | 14 +++++ auth/getStrategies.go | 14 +++++ auth/getStrategies_test.go | 14 +++++ auth/login.go | 14 +++++ auth/login_test.go | 14 +++++ auth/logout.go | 14 +++++ auth/logout_test.go | 14 +++++ auth/update_my_credentials.go | 14 +++++ auth/update_my_credentials_test.go | 14 +++++ auth/update_self.go | 16 +++++- auth/update_self_test.go | 14 +++++ auth/validate_my_credentials.go | 14 +++++ auth/validate_my_credentials_test.go | 14 +++++ collection/collection.go | 18 +++++- collection/create.go | 14 +++++ collection/create_test.go | 14 +++++ collection/delete_specifications.go | 14 +++++ collection/delete_specifications_test.go | 14 +++++ collection/exists.go | 16 +++++- collection/exists_test.go | 14 +++++ collection/get_mapping.go | 14 +++++ collection/get_mapping_test.go | 14 +++++ collection/get_specifications.go | 14 +++++ collection/get_specifications_test.go | 14 +++++ collection/list.go | 14 +++++ collection/list_test.go | 14 +++++ collection/search_specifications.go | 14 +++++ collection/search_specifications_test.go | 14 +++++ collection/truncate.go | 14 +++++ collection/truncate_test.go | 14 +++++ collection/update_mapping.go | 14 +++++ collection/update_mapping_test.go | 14 +++++ collection/update_specifications.go | 14 +++++ collection/update_specifications_test.go | 14 +++++ collection/validate_specifications.go | 14 +++++ collection/validate_specifications_test.go | 14 +++++ connection/connection.go | 15 +++++ connection/websocket/web_socket.go | 15 +++++ connection/websocket/web_socket_test.go | 14 +++++ document/count.go | 18 ++++++ document/count_test.go | 14 +++++ document/create.go | 22 ++++++++ document/createOrReplace.go | 22 ++++++++ document/createOrReplace_test.go | 14 +++++ document/create_test.go | 14 +++++ document/delete.go | 15 +++++ document/deleteByQuery.go | 15 +++++ document/deleteByQuery_test.go | 14 +++++ document/delete_test.go | 14 +++++ document/document.go | 18 +++++- document/exists.go | 15 +++++ document/exists_test.go | 14 +++++ document/get.go | 15 +++++ document/get_test.go | 14 +++++ document/mCreate.go | 15 +++++ document/mCreateOrReplace.go | 15 +++++ document/mCreateOrReplace_test.go | 14 +++++ document/mCreate_test.go | 14 +++++ document/mDelete.go | 15 +++++ document/mDelete_test.go | 14 +++++ document/mGet.go | 15 +++++ document/mGet_test.go | 14 +++++ document/mReplace.go | 16 +++++- document/mReplace_test.go | 14 +++++ document/mUpdate.go | 16 +++++- document/mUpdate_test.go | 14 +++++ document/replace.go | 16 +++++- document/replace_test.go | 14 +++++ document/search.go | 14 +++++ document/search_test.go | 14 +++++ document/update.go | 16 +++++- document/update_test.go | 14 +++++ document/validate.go | 16 +++++- document/validate_test.go | 14 +++++ event/Event.go | 14 +++++ index/create.go | 14 +++++ index/create_test.go | 14 +++++ index/delete.go | 14 +++++ index/delete_test.go | 14 +++++ index/exists.go | 14 +++++ index/exists_test.go | 14 +++++ index/getAutoRefresh.go | 15 +++++ index/getAutoRefresh_test.go | 14 +++++ index/index.go | 16 ++++++ index/list.go | 16 +++++- index/list_test.go | 14 +++++ index/mDelete.go | 16 +++++- index/mDelete_test.go | 14 +++++ index/refresh.go | 15 +++++ index/refreshInternal.go | 16 ++++++ index/refreshInternal_test.go | 14 +++++ index/refresh_test.go | 14 +++++ index/setAutoRefresh.go | 15 +++++ index/setAutoRefresh_test.go | 14 +++++ internal/mock_connection.go | 14 +++++ internal/mock_room.go | 56 +++++++++++++++++++ internal/wrappers/cgo/kuzzle/auth.go | 14 +++++ internal/wrappers/cgo/kuzzle/c_to_go.go | 14 +++++ internal/wrappers/cgo/kuzzle/collection.go | 14 +++++ internal/wrappers/cgo/kuzzle/destructors.go | 14 +++++ internal/wrappers/cgo/kuzzle/document.go | 14 +++++ internal/wrappers/cgo/kuzzle/errors.go | 14 +++++ internal/wrappers/cgo/kuzzle/go_to_c.go | 14 +++++ internal/wrappers/cgo/kuzzle/index.go | 14 +++++ internal/wrappers/cgo/kuzzle/jsonc_wrapper.go | 14 +++++ internal/wrappers/cgo/kuzzle/kuzzle.go | 14 +++++ .../wrappers/cgo/kuzzle/memory_storage.go | 14 +++++ internal/wrappers/cgo/kuzzle/options.go | 14 +++++ internal/wrappers/cgo/kuzzle/query.go | 14 +++++ internal/wrappers/cgo/kuzzle/security.go | 14 +++++ internal/wrappers/cgo/kuzzle/server.go | 14 +++++ internal/wrappers/cpp/auth.cpp | 14 +++++ internal/wrappers/cpp/collection.cpp | 14 +++++ internal/wrappers/cpp/document.cpp | 14 +++++ internal/wrappers/cpp/index.cpp | 14 +++++ internal/wrappers/cpp/kuzzle.cpp | 14 +++++ internal/wrappers/cpp/server.cpp | 14 +++++ internal/wrappers/headers/auth.hpp | 14 +++++ internal/wrappers/headers/collection.hpp | 14 +++++ internal/wrappers/headers/core.hpp | 14 +++++ internal/wrappers/headers/document.hpp | 14 +++++ internal/wrappers/headers/event_emitter.hpp | 14 +++++ internal/wrappers/headers/exceptions.hpp | 14 +++++ internal/wrappers/headers/index.hpp | 14 +++++ internal/wrappers/headers/kuzzle.hpp | 16 +++++- internal/wrappers/headers/kuzzlesdk.h | 14 +++++ internal/wrappers/headers/listeners.hpp | 14 +++++ .../wrappers/headers/sdk_wrappers_internal.h | 14 +++++ internal/wrappers/headers/server.hpp | 14 +++++ internal/wrappers/headers/swig.h | 14 +++++ kuzzle/disconnect.go | 14 +++++ kuzzle/disconnect_test.go | 14 +++++ kuzzle/event_emitter.go | 14 +++++ kuzzle/kuzzle.go | 39 ++++++++++++- kuzzle/kuzzle_test.go | 14 +++++ kuzzle/listener.go | 16 +++++- kuzzle/listener_test.go | 14 +++++ kuzzle/query.go | 14 +++++ kuzzle/query_test.go | 14 +++++ kuzzle/queue.go | 19 ++++++- kuzzle/queue_test.go | 14 +++++ ms/append.go | 14 +++++ ms/append_test.go | 14 +++++ ms/bitcount.go | 14 +++++ ms/bitcount_test.go | 14 +++++ ms/bitop.go | 14 +++++ ms/bitop_test.go | 14 +++++ ms/bitpos.go | 14 +++++ ms/bitpos_test.go | 14 +++++ ms/dbsize.go | 14 +++++ ms/dbsize_test.go | 14 +++++ ms/decr.go | 14 +++++ ms/decr_test.go | 14 +++++ ms/decrby.go | 14 +++++ ms/decrby_test.go | 14 +++++ ms/del.go | 14 +++++ ms/del_test.go | 14 +++++ ms/exists.go | 14 +++++ ms/exists_test.go | 14 +++++ ms/expire.go | 14 +++++ ms/expire_test.go | 14 +++++ ms/expireat.go | 14 +++++ ms/expireat_test.go | 14 +++++ ms/flushdb.go | 14 +++++ ms/flushdb_test.go | 14 +++++ ms/geoadd.go | 14 +++++ ms/geoadd_test.go | 14 +++++ ms/geodist.go | 14 +++++ ms/geodist_test.go | 14 +++++ ms/geohash.go | 14 +++++ ms/geohash_test.go | 14 +++++ ms/geopos.go | 14 +++++ ms/geopos_test.go | 14 +++++ ms/georadius.go | 14 +++++ ms/georadius_test.go | 14 +++++ ms/georadiusbymember.go | 14 +++++ ms/georadiusbymember_test.go | 14 +++++ ms/get.go | 14 +++++ ms/get_test.go | 14 +++++ ms/getbit.go | 14 +++++ ms/getbit_test.go | 14 +++++ ms/getrange.go | 14 +++++ ms/getrange_test.go | 14 +++++ ms/getset.go | 14 +++++ ms/getset_test.go | 14 +++++ ms/hdel.go | 14 +++++ ms/hdel_test.go | 14 +++++ ms/hexists.go | 14 +++++ ms/hexists_test.go | 14 +++++ ms/hget.go | 14 +++++ ms/hget_test.go | 14 +++++ ms/hgetall.go | 14 +++++ ms/hgetall_test.go | 14 +++++ ms/hincrby.go | 14 +++++ ms/hincrby_test.go | 14 +++++ ms/hincrbyfloat.go | 14 +++++ ms/hincrbyfloat_test.go | 14 +++++ ms/hkeys.go | 14 +++++ ms/hkeys_test.go | 14 +++++ ms/hlen.go | 14 +++++ ms/hlen_test.go | 14 +++++ ms/hmget.go | 14 +++++ ms/hmget_test.go | 14 +++++ ms/hmset.go | 14 +++++ ms/hmset_test.go | 14 +++++ ms/hscan.go | 14 +++++ ms/hscan_test.go | 14 +++++ ms/hset.go | 14 +++++ ms/hset_test.go | 14 +++++ ms/hsetnx.go | 14 +++++ ms/hsetnx_test.go | 14 +++++ ms/hstrlen.go | 14 +++++ ms/hstrlen_test.go | 14 +++++ ms/hvals.go | 14 +++++ ms/hvals_test.go | 14 +++++ ms/incr.go | 14 +++++ ms/incr_test.go | 14 +++++ ms/incrby.go | 14 +++++ ms/incrby_test.go | 14 +++++ ms/incrbyfloat.go | 14 +++++ ms/incrbyfloat_test.go | 14 +++++ ms/keys.go | 14 +++++ ms/keys_test.go | 14 +++++ ms/lindex.go | 14 +++++ ms/lindex_test.go | 14 +++++ ms/linsert.go | 14 +++++ ms/linsert_test.go | 14 +++++ ms/llen.go | 14 +++++ ms/llen_test.go | 14 +++++ ms/lpop.go | 14 +++++ ms/lpop_test.go | 14 +++++ ms/lpush.go | 14 +++++ ms/lpush_test.go | 14 +++++ ms/lpushx.go | 14 +++++ ms/lpushx_test.go | 14 +++++ ms/lrange.go | 14 +++++ ms/lrange_test.go | 14 +++++ ms/lrem.go | 14 +++++ ms/lrem_test.go | 14 +++++ ms/lset.go | 14 +++++ ms/lset_test.go | 14 +++++ ms/ltrim.go | 14 +++++ ms/ltrim_test.go | 14 +++++ ms/mget.go | 14 +++++ ms/mget_test.go | 14 +++++ ms/ms.go | 14 +++++ ms/mset.go | 14 +++++ ms/mset_test.go | 14 +++++ ms/msetnx.go | 14 +++++ ms/msetnx_test.go | 14 +++++ ms/object.go | 14 +++++ ms/object_test.go | 14 +++++ ms/persist.go | 14 +++++ ms/persist_test.go | 14 +++++ ms/pexpire.go | 14 +++++ ms/pexpire_test.go | 14 +++++ ms/pexpireat.go | 14 +++++ ms/pexpireat_test.go | 14 +++++ ms/pfadd.go | 14 +++++ ms/pfadd_test.go | 14 +++++ ms/pfcount.go | 14 +++++ ms/pfcount_test.go | 14 +++++ ms/pfmerge.go | 14 +++++ ms/pfmerge_test.go | 14 +++++ ms/ping.go | 14 +++++ ms/ping_test.go | 14 +++++ ms/psetex.go | 14 +++++ ms/psetex_test.go | 14 +++++ ms/pttl.go | 14 +++++ ms/pttl_test.go | 14 +++++ ms/randomkey.go | 14 +++++ ms/randomkey_test.go | 14 +++++ ms/rename.go | 14 +++++ ms/rename_test.go | 14 +++++ ms/renamenx.go | 14 +++++ ms/renamenx_test.go | 14 +++++ ms/rpop.go | 14 +++++ ms/rpop_test.go | 14 +++++ ms/rpoplpush.go | 14 +++++ ms/rpoplpush_test.go | 14 +++++ ms/rpush.go | 14 +++++ ms/rpush_test.go | 14 +++++ ms/rpushx.go | 14 +++++ ms/rpushx_test.go | 14 +++++ ms/sadd.go | 14 +++++ ms/sadd_test.go | 14 +++++ ms/scan.go | 14 +++++ ms/scan_test.go | 14 +++++ ms/scard.go | 14 +++++ ms/scard_test.go | 14 +++++ ms/sdiff.go | 14 +++++ ms/sdiff_test.go | 14 +++++ ms/sdiffstore.go | 14 +++++ ms/sdiffstore_test.go | 14 +++++ ms/set.go | 14 +++++ ms/set_test.go | 14 +++++ ms/setex.go | 14 +++++ ms/setex_test.go | 14 +++++ ms/setnx.go | 14 +++++ ms/setnx_test.go | 14 +++++ ms/sinter.go | 14 +++++ ms/sinter_test.go | 14 +++++ ms/sinterstore.go | 14 +++++ ms/sinterstore_test.go | 14 +++++ ms/sismember.go | 14 +++++ ms/sismember_test.go | 14 +++++ ms/smembers.go | 14 +++++ ms/smembers_test.go | 14 +++++ ms/smove.go | 14 +++++ ms/smove_test.go | 14 +++++ ms/sort.go | 14 +++++ ms/sort_test.go | 14 +++++ ms/spop.go | 14 +++++ ms/spop_test.go | 14 +++++ ms/srandmember.go | 14 +++++ ms/srandmember_test.go | 14 +++++ ms/srem.go | 14 +++++ ms/srem_test.go | 14 +++++ ms/sscan.go | 14 +++++ ms/sscan_test.go | 14 +++++ ms/strlen.go | 14 +++++ ms/strlen_test.go | 14 +++++ ms/sunion.go | 14 +++++ ms/sunion_test.go | 14 +++++ ms/sunionstore.go | 14 +++++ ms/sunionstore_test.go | 14 +++++ ms/time.go | 14 +++++ ms/time_test.go | 14 +++++ ms/touch.go | 14 +++++ ms/touch_test.go | 14 +++++ ms/ttl.go | 14 +++++ ms/ttl_test.go | 14 +++++ ms/type.go | 14 +++++ ms/type_test.go | 14 +++++ ms/zadd.go | 14 +++++ ms/zadd_test.go | 14 +++++ ms/zcard.go | 14 +++++ ms/zcard_test.go | 14 +++++ ms/zcount.go | 14 +++++ ms/zcount_test.go | 14 +++++ ms/zincrby.go | 14 +++++ ms/zincrby_test.go | 14 +++++ ms/zinterstore.go | 14 +++++ ms/zinterstore_test.go | 14 +++++ ms/zlexcount.go | 14 +++++ ms/zlexcount_test.go | 14 +++++ ms/zrange.go | 14 +++++ ms/zrange_test.go | 14 +++++ ms/zrangebylex.go | 14 +++++ ms/zrangebylex_test.go | 14 +++++ ms/zrangebyscore.go | 14 +++++ ms/zrangebyscore_test.go | 14 +++++ ms/zrank.go | 14 +++++ ms/zrank_test.go | 14 +++++ ms/zrem.go | 14 +++++ ms/zrem_test.go | 14 +++++ ms/zremrangebylex.go | 14 +++++ ms/zremrangebylex_test.go | 14 +++++ ms/zremrangebyrank.go | 14 +++++ ms/zremrangebyrank_test.go | 14 +++++ ms/zremrangebyscore.go | 14 +++++ ms/zremrangebyscore_test.go | 14 +++++ ms/zrevrange.go | 14 +++++ ms/zrevrange_test.go | 14 +++++ ms/zrevrangebylex.go | 14 +++++ ms/zrevrangebylex_test.go | 14 +++++ ms/zrevrangebyscore.go | 14 +++++ ms/zrevrangebyscore_test.go | 14 +++++ ms/zrevrank.go | 14 +++++ ms/zrevrank_test.go | 14 +++++ ms/zscan.go | 14 +++++ ms/zscan_test.go | 14 +++++ ms/zscore.go | 14 +++++ ms/zscore_test.go | 14 +++++ ms/zunionstore.go | 14 +++++ ms/zunionstore_test.go | 14 +++++ realtime/count.go | 16 +++++- realtime/count_test.go | 14 +++++ realtime/join.go | 14 +++++ realtime/join_test.go | 14 +++++ realtime/list.go | 14 +++++ realtime/list_test.go | 14 +++++ realtime/publish.go | 14 +++++ realtime/publish_test.go | 14 +++++ realtime/realtime.go | 18 +++++- realtime/subscribe.go | 14 +++++ realtime/subscribe_test.go | 14 +++++ realtime/unsubscribe.go | 14 +++++ realtime/unsubscribe_test.go | 14 +++++ realtime/validate.go | 14 +++++ realtime/validate_test.go | 14 +++++ security/createCredentials.go | 14 +++++ security/createCredentials_test.go | 14 +++++ security/createFirstAdmin.go | 14 +++++ security/createFirstAdmin_test.go | 14 +++++ security/createOrReplaceProfile.go | 14 +++++ security/createOrReplaceProfile_test.go | 14 +++++ security/createOrReplaceRole.go | 14 +++++ security/createOrReplaceRole_test.go | 14 +++++ security/createProfile.go | 14 +++++ security/createProfile_test.go | 14 +++++ security/createRestrictedUser.go | 14 +++++ security/createRestrictedUser_test.go | 14 +++++ security/createRole.go | 14 +++++ security/createRole_test.go | 14 +++++ security/createUser.go | 14 +++++ security/createUser_test.go | 14 +++++ security/deleteCredentials.go | 14 +++++ security/deleteCredentials_test.go | 14 +++++ security/deleteProfile.go | 14 +++++ security/deleteProfile_test.go | 14 +++++ security/deleteRole.go | 14 +++++ security/deleteRole_test.go | 14 +++++ security/deleteUser.go | 14 +++++ security/deleteUser_test.go | 14 +++++ security/getAllCredentialFields.go | 14 +++++ security/getAllCredentialFields_test.go | 14 +++++ security/getCredentialFields.go | 14 +++++ security/getCredentialFields_test.go | 14 +++++ security/getCredentials.go | 14 +++++ security/getCredentialsById.go | 14 +++++ security/getCredentialsById_test.go | 14 +++++ security/getCredentials_test.go | 14 +++++ security/getProfile.go | 14 +++++ security/getProfileMapping.go | 14 +++++ security/getProfileMapping_test.go | 14 +++++ security/getProfileRights.go | 14 +++++ security/getProfileRights_test.go | 14 +++++ security/getProfile_test.go | 14 +++++ security/getRole.go | 14 +++++ security/getRoleMapping.go | 14 +++++ security/getRoleMapping_test.go | 14 +++++ security/getRole_test.go | 14 +++++ security/getUser.go | 14 +++++ security/getUserMapping.go | 14 +++++ security/getUserMapping_test.go | 14 +++++ security/getUserRights.go | 14 +++++ security/getUserRights_test.go | 14 +++++ security/getUser_test.go | 14 +++++ security/hasCredentials.go | 14 +++++ security/hasCredentials_test.go | 14 +++++ security/is_action_allowed.go | 14 +++++ security/is_action_allowed_test.go | 14 +++++ security/json_profile.go | 14 +++++ security/json_role.go | 14 +++++ security/json_user.go | 14 +++++ security/mDeleteCredentials.go | 14 +++++ security/mDeleteCredentials_test.go | 14 +++++ security/mDeleteRoles.go | 14 +++++ security/mDeleteRoles_test.go | 14 +++++ security/mDeleteUsers.go | 14 +++++ security/mDeleteUsers_test.go | 14 +++++ security/mGetProfiles.go | 14 +++++ security/mGetProfiles_test.go | 14 +++++ security/mGetRoles.go | 14 +++++ security/mGetRoles_test.go | 14 +++++ security/profile.go | 14 +++++ security/replaceUser.go | 14 +++++ security/replaceUser_test.go | 14 +++++ security/role.go | 14 +++++ security/searchProfiles.go | 14 +++++ security/searchProfiles_test.go | 14 +++++ security/searchRoles.go | 14 +++++ security/searchRoles_test.go | 14 +++++ security/searchUsers.go | 14 +++++ security/searchUsers_test.go | 14 +++++ security/security.go | 14 +++++ security/updateCredentials.go | 14 +++++ security/updateCredentials_test.go | 14 +++++ security/updateProfile.go | 14 +++++ security/updateProfileMapping.go | 14 +++++ security/updateProfileMapping_test.go | 14 +++++ security/updateProfile_test.go | 14 +++++ security/updateRole.go | 14 +++++ security/updateRoleMapping.go | 14 +++++ security/updateRoleMapping_test.go | 14 +++++ security/updateRole_test.go | 14 +++++ security/updateUser.go | 14 +++++ security/updateUserMapping.go | 14 +++++ security/updateUserMapping_test.go | 14 +++++ security/updateUser_test.go | 14 +++++ security/user.go | 14 +++++ security/validateCredentials.go | 14 +++++ security/validateCredentials_test.go | 14 +++++ server/adminExists.go | 16 +++++- server/adminExists_test.go | 14 +++++ server/getAllStats.go | 16 +++++- server/getAllStats_test.go | 14 +++++ server/getConfig.go | 16 +++++- server/getConfig_test.go | 14 +++++ server/getLastStats.go | 16 +++++- server/getLastStats_test.go | 14 +++++ server/getStats.go | 16 +++++- server/getStats_test.go | 14 +++++ server/info.go | 16 +++++- server/info_test.go | 14 +++++ server/now.go | 14 +++++ server/now_test.go | 14 +++++ server/server.go | 16 ++++++ state/state.go | 14 +++++ types/consts.go | 14 +++++ types/ikuzzle.go | 14 +++++ types/kuzzle_request.go | 14 +++++ types/kuzzle_response.go | 20 +++++++ types/options.go | 16 ++++++ types/query_object.go | 15 +++++ types/query_options.go | 16 ++++++ types/room.go | 38 +++++++++++++ types/room_options.go | 16 ++++++ types/search_result.go | 17 +++++- 524 files changed, 7512 insertions(+), 29 deletions(-) create mode 100644 internal/mock_room.go create mode 100644 types/room.go diff --git a/auth/auth.go b/auth/auth.go index 4581797c..03e94e49 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -1,11 +1,27 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import "github.com/kuzzleio/sdk-go/types" +// Auth controller type Auth struct { kuzzle types.IKuzzle } +// NewAuth instanciates a new auth controller func NewAuth(k types.IKuzzle) *Auth { return &Auth{k} } diff --git a/auth/checkToken.go b/auth/checkToken.go index 88118ed6..8c7db868 100644 --- a/auth/checkToken.go +++ b/auth/checkToken.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// TokenValidity provides a representation for JWT validity type TokenValidity struct { Valid bool `json:"valid"` State string `json:"state"` diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go index 5d0882f1..1f465760 100644 --- a/auth/checkToken_test.go +++ b/auth/checkToken_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/createMyCredentials.go b/auth/createMyCredentials.go index 41d3161f..cdb394f0 100644 --- a/auth/createMyCredentials.go +++ b/auth/createMyCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/createMyCredentials_test.go b/auth/createMyCredentials_test.go index a702307b..8285ac4e 100644 --- a/auth/createMyCredentials_test.go +++ b/auth/createMyCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/credentialsExist.go b/auth/credentialsExist.go index c720a0ee..57203459 100644 --- a/auth/credentialsExist.go +++ b/auth/credentialsExist.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//CredentialsExist check the existence of the specified 's credentials for the current user. +// CredentialsExist check the existence of the specified 's credentials for the current user. func (a *Auth) CredentialsExist(strategy string, options types.QueryOptions) (bool, error) { if strategy == "" { return false, types.NewError("Auth.CredentialsExist: strategy is required", 400) diff --git a/auth/credentialsExist_test.go b/auth/credentialsExist_test.go index 0a496d45..8bdbf354 100644 --- a/auth/credentialsExist_test.go +++ b/auth/credentialsExist_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/deleteMyCredentials.go b/auth/deleteMyCredentials.go index ae475f79..2697d8cc 100644 --- a/auth/deleteMyCredentials.go +++ b/auth/deleteMyCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/deleteMyCredentials_test.go b/auth/deleteMyCredentials_test.go index c5861a2a..d4b8d5d3 100644 --- a/auth/deleteMyCredentials_test.go +++ b/auth/deleteMyCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/getCurrentUser.go b/auth/getCurrentUser.go index eff47f08..51966638 100644 --- a/auth/getCurrentUser.go +++ b/auth/getCurrentUser.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( @@ -7,6 +21,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// GetCurrentUser retrieves user linked to JWT func (a *Auth) GetCurrentUser() (*security.User, error) { result := make(chan *types.KuzzleResponse) diff --git a/auth/getCurrentUser_test.go b/auth/getCurrentUser_test.go index a713f578..e97ac068 100644 --- a/auth/getCurrentUser_test.go +++ b/auth/getCurrentUser_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/getMyCredentials.go b/auth/getMyCredentials.go index 51f0d712..0e66bc0a 100644 --- a/auth/getMyCredentials.go +++ b/auth/getMyCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/getMyCredentials_test.go b/auth/getMyCredentials_test.go index da2f54bd..ecf33ddb 100644 --- a/auth/getMyCredentials_test.go +++ b/auth/getMyCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/getMyRights.go b/auth/getMyRights.go index ab292b51..e2847c30 100644 --- a/auth/getMyRights.go +++ b/auth/getMyRights.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/getMyRights_test.go b/auth/getMyRights_test.go index 671fc5b8..97cedff7 100644 --- a/auth/getMyRights_test.go +++ b/auth/getMyRights_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/getStrategies.go b/auth/getStrategies.go index 0ffc983c..a58fee21 100644 --- a/auth/getStrategies.go +++ b/auth/getStrategies.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/getStrategies_test.go b/auth/getStrategies_test.go index bb14f59b..d7d56453 100644 --- a/auth/getStrategies_test.go +++ b/auth/getStrategies_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/login.go b/auth/login.go index 6184a791..49f1469f 100644 --- a/auth/login.go +++ b/auth/login.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/login_test.go b/auth/login_test.go index 7d06bb22..a906367a 100644 --- a/auth/login_test.go +++ b/auth/login_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/logout.go b/auth/logout.go index 5ac9593f..75bed61f 100644 --- a/auth/logout.go +++ b/auth/logout.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/logout_test.go b/auth/logout_test.go index 3eccc56b..743c1b29 100644 --- a/auth/logout_test.go +++ b/auth/logout_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/update_my_credentials.go b/auth/update_my_credentials.go index f217a015..ac6d761e 100644 --- a/auth/update_my_credentials.go +++ b/auth/update_my_credentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/update_my_credentials_test.go b/auth/update_my_credentials_test.go index 3bc5c24e..3488238f 100644 --- a/auth/update_my_credentials_test.go +++ b/auth/update_my_credentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/update_self.go b/auth/update_self.go index fb21ec5e..2c45d0f2 100644 --- a/auth/update_self.go +++ b/auth/update_self.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( @@ -7,7 +21,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//UpdateSelf updates the current User object in Kuzzle's database layer. +// UpdateSelf updates the current User object in Kuzzle's database layer. func (a *Auth) UpdateSelf(data json.RawMessage, options types.QueryOptions) (*security.User, error) { if options == nil { options = types.NewQueryOptions() diff --git a/auth/update_self_test.go b/auth/update_self_test.go index 016e09bf..ee9c918e 100644 --- a/auth/update_self_test.go +++ b/auth/update_self_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/auth/validate_my_credentials.go b/auth/validate_my_credentials.go index 0d7988ee..97774bb5 100644 --- a/auth/validate_my_credentials.go +++ b/auth/validate_my_credentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth import ( diff --git a/auth/validate_my_credentials_test.go b/auth/validate_my_credentials_test.go index acc8e0b2..4c0a4cbb 100644 --- a/auth/validate_my_credentials_test.go +++ b/auth/validate_my_credentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package auth_test import ( diff --git a/collection/collection.go b/collection/collection.go index e277a477..799d9cd1 100644 --- a/collection/collection.go +++ b/collection/collection.go @@ -1,15 +1,29 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( "github.com/kuzzleio/sdk-go/types" ) -//Collection controller +// Collection controller type Collection struct { Kuzzle types.IKuzzle } -// NewCollection instanciates a new collection +// NewCollection instanciates a new collection controller func NewCollection(kuzzle types.IKuzzle) *Collection { return &Collection{ Kuzzle: kuzzle, diff --git a/collection/create.go b/collection/create.go index d4f3df0c..cccc8464 100644 --- a/collection/create.go +++ b/collection/create.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/create_test.go b/collection/create_test.go index 90a5d463..b1e21012 100644 --- a/collection/create_test.go +++ b/collection/create_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/delete_specifications.go b/collection/delete_specifications.go index 9f828960..7ea8b01e 100644 --- a/collection/delete_specifications.go +++ b/collection/delete_specifications.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import "github.com/kuzzleio/sdk-go/types" diff --git a/collection/delete_specifications_test.go b/collection/delete_specifications_test.go index 08872e98..16aa09e1 100644 --- a/collection/delete_specifications_test.go +++ b/collection/delete_specifications_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/exists.go b/collection/exists.go index 08803e6e..933eba45 100644 --- a/collection/exists.go +++ b/collection/exists.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( @@ -7,7 +21,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// Exists check if a collection exists. +// Exists checks if a collection exists. func (dc *Collection) Exists(index string, collection string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Collection.Exists: index required", 400) diff --git a/collection/exists_test.go b/collection/exists_test.go index 6f30c562..cbd7bd5a 100644 --- a/collection/exists_test.go +++ b/collection/exists_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/get_mapping.go b/collection/get_mapping.go index 14254caa..5994ec53 100644 --- a/collection/get_mapping.go +++ b/collection/get_mapping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/get_mapping_test.go b/collection/get_mapping_test.go index ad707209..46f2e0ef 100644 --- a/collection/get_mapping_test.go +++ b/collection/get_mapping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/get_specifications.go b/collection/get_specifications.go index 570a0c2a..5cc54e6f 100644 --- a/collection/get_specifications.go +++ b/collection/get_specifications.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/get_specifications_test.go b/collection/get_specifications_test.go index b6f14989..863cbafa 100644 --- a/collection/get_specifications_test.go +++ b/collection/get_specifications_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/list.go b/collection/list.go index cd17357b..35307553 100644 --- a/collection/list.go +++ b/collection/list.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/list_test.go b/collection/list_test.go index 395cfcd5..fda61153 100644 --- a/collection/list_test.go +++ b/collection/list_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/search_specifications.go b/collection/search_specifications.go index 06fcc59d..3a6a672c 100644 --- a/collection/search_specifications.go +++ b/collection/search_specifications.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go index f459cb13..b7cd70aa 100644 --- a/collection/search_specifications_test.go +++ b/collection/search_specifications_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/truncate.go b/collection/truncate.go index dcaa0a4a..4e7d075c 100644 --- a/collection/truncate.go +++ b/collection/truncate.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/truncate_test.go b/collection/truncate_test.go index 38537e0b..394e0855 100644 --- a/collection/truncate_test.go +++ b/collection/truncate_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/update_mapping.go b/collection/update_mapping.go index c28271a9..7f24a5d3 100644 --- a/collection/update_mapping.go +++ b/collection/update_mapping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index fba6706c..fa898e0d 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/update_specifications.go b/collection/update_specifications.go index aa3e32f1..67b63f57 100644 --- a/collection/update_specifications.go +++ b/collection/update_specifications.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go index 74e1e3ef..0c8dbb21 100644 --- a/collection/update_specifications_test.go +++ b/collection/update_specifications_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go index 317f2014..7d6a87b1 100644 --- a/collection/validate_specifications.go +++ b/collection/validate_specifications.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection import ( diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index f55c1cba..f5b63d31 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package collection_test import ( diff --git a/connection/connection.go b/connection/connection.go index 70d3ebd5..bbf1f6b5 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package connection import ( @@ -7,6 +21,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// Connection provides functions to manage many connection type (websocket...) type Connection interface { AddListener(event int, channel chan<- interface{}) RemoveListener(event int, channel chan<- interface{}) diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 476c7f98..1c740ba9 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package websocket import ( @@ -63,6 +77,7 @@ type webSocket struct { var defaultQueueFilter connection.QueueFilter +// NewWebSocket instanciates a new webSocket connection object func NewWebSocket(host string, options types.Options) connection.Connection { defaultQueueFilter = func([]byte) bool { return true diff --git a/connection/websocket/web_socket_test.go b/connection/websocket/web_socket_test.go index fb57e1d8..98763cfa 100644 --- a/connection/websocket/web_socket_test.go +++ b/connection/websocket/web_socket_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package websocket import ( diff --git a/document/count.go b/document/count.go index dca69fac..652a3f17 100644 --- a/document/count.go +++ b/document/count.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -7,6 +21,10 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// Count returns the number of documents matching the provided set of filters. +// There is a small delay between documents creation and their existence in our advanced search layer, +// usually a couple of seconds. +// That means that a document that was just been created won’t be returned by this function func (d *Document) Count(index string, collection string, body string, options types.QueryOptions) (int, error) { if index == "" { return 0, types.NewError("Document.Count: index required", 400) diff --git a/document/count_test.go b/document/count_test.go index df7dc309..a4919c02 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/create.go b/document/create.go index f58fd96f..13cfa78a 100644 --- a/document/create.go +++ b/document/create.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,14 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// Create a new document in Kuzzle. +// Takes an optional argument object with the following properties: +// - volatile (object, default: null): +// Additional information passed to notifications to other users +// - ifExist (string, allowed values: "error" (default), "replace"): +// If the same document already exists: +// - resolves with an error if set to "error". +// - replaces the existing document if set to "replace" func (d *Document) Create(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Create: index required", 400) diff --git a/document/createOrReplace.go b/document/createOrReplace.go index 6ff0a514..c0c1f7bf 100644 --- a/document/createOrReplace.go +++ b/document/createOrReplace.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,14 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// CreateOrReplace a document in Kuzzle. +// Takes an optional argument object with the following properties: +// - volatile (object, default: null): +// Additional information passed to notifications to other users +// - ifExist (string, allowed values: "error" (default), "replace"): +// If the same document already exists: +// - resolves with an error if set to "error". +// - replaces the existing document if set to "replace" func (d *Document) CreateOrReplace(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.CreateOrReplace: index required", 400) diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go index 448578cc..1c39ad85 100644 --- a/document/createOrReplace_test.go +++ b/document/createOrReplace_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/create_test.go b/document/create_test.go index dc1f6d12..98de94ac 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/delete.go b/document/delete.go index d263030f..ad5cf25a 100644 --- a/document/delete.go +++ b/document/delete.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// Delete deletes the Document using its provided unique id. func (d *Document) Delete(index string, collection string, _id string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Delete: index required", 400) diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go index ce0cb1fb..f6c81973 100644 --- a/document/deleteByQuery.go +++ b/document/deleteByQuery.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// DeleteByQuery deletes all the documents from Kuzzle that match the given filter or query. func (d *Document) DeleteByQuery(index string, collection string, body string, options types.QueryOptions) ([]string, error) { if index == "" { return nil, types.NewError("Document.MCreate: index required", 400) diff --git a/document/deleteByQuery_test.go b/document/deleteByQuery_test.go index c86b6a4f..66341bcb 100644 --- a/document/deleteByQuery_test.go +++ b/document/deleteByQuery_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/delete_test.go b/document/delete_test.go index 84a9c31a..85c6b48c 100644 --- a/document/delete_test.go +++ b/document/delete_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/document.go b/document/document.go index a91de300..a031db48 100644 --- a/document/document.go +++ b/document/document.go @@ -1,15 +1,29 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( "github.com/kuzzleio/sdk-go/types" ) -// Document is a Controller +// Document controller type Document struct { Kuzzle types.IKuzzle } -// NewDocument is a Document Controller constructor +// NewDocument instanciates a new collection controller func NewDocument(kuzzle types.IKuzzle) *Document { return &Document{ Kuzzle: kuzzle, diff --git a/document/exists.go b/document/exists.go index 6dd30e2f..d9a88ab4 100644 --- a/document/exists.go +++ b/document/exists.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// Exists returns a boolean indicating whether or not a document with provided ID exists. func (d *Document) Exists(index string, collection string, _id string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Document.Exists: index required", 400) diff --git a/document/exists_test.go b/document/exists_test.go index 799184d9..b90bed5e 100644 --- a/document/exists_test.go +++ b/document/exists_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/get.go b/document/get.go index 625129d5..161e8552 100644 --- a/document/get.go +++ b/document/get.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// Get retrieves a Document using its provided unique id. func (d *Document) Get(index string, collection string, _id string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Get: index required", 400) diff --git a/document/get_test.go b/document/get_test.go index b19a4527..4e6a03d4 100644 --- a/document/get_test.go +++ b/document/get_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/mCreate.go b/document/mCreate.go index c92591a5..763ebd48 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// MCreate creates the provided documents. func (d *Document) MCreate(index string, collection string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MCreate: index required", 400) diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index bbfd499a..8a1590b0 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// MCreateOrReplace creates or replaces the provided documents. func (d *Document) MCreateOrReplace(index string, collection string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MCreateOrReplace: index required", 400) diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index 64356958..5409be8d 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/mCreate_test.go b/document/mCreate_test.go index 54635812..300e36c7 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/mDelete.go b/document/mDelete.go index 2053141b..5ff59bf0 100644 --- a/document/mDelete.go +++ b/document/mDelete.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// MDelete deletes multiple documents at once func (d *Document) MDelete(index string, collection string, ids []string, options types.QueryOptions) ([]string, error) { if index == "" { return nil, types.NewError("Document.MDelete: index required", 400) diff --git a/document/mDelete_test.go b/document/mDelete_test.go index 3980a925..b4399c17 100644 --- a/document/mDelete_test.go +++ b/document/mDelete_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/mGet.go b/document/mGet.go index 5b7e0e8c..ec4dcd67 100644 --- a/document/mGet.go +++ b/document/mGet.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// MGet fetches multiple documents at once func (d *Document) MGet(index string, collection string, ids []string, includeTrash bool, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MGet: index required", 400) diff --git a/document/mGet_test.go b/document/mGet_test.go index 2ee750f0..254e98d6 100644 --- a/document/mGet_test.go +++ b/document/mGet_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/mReplace.go b/document/mReplace.go index 5267ff49..690306c0 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// MReplaceDocument mReplaces a document in Kuzzle. +// MReplace replaces multiple documents at once. func (d *Document) MReplace(index string, collection string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MReplace: index required", 400) diff --git a/document/mReplace_test.go b/document/mReplace_test.go index 5fce09a5..4af96989 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/mUpdate.go b/document/mUpdate.go index 6674f224..b27fcece 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// MUpdateDocument mUpdates a document in Kuzzle. +// MUpdate updates multiple documents at once func (d *Document) MUpdate(index string, collection string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MUpdate: index required", 400) diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index 030534ad..4118d5fe 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/replace.go b/document/replace.go index fd1382e9..b671bc2a 100644 --- a/document/replace.go +++ b/document/replace.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// ReplaceDocument replaces a document in Kuzzle. +// Replace replaces a document in Kuzzle. func (d *Document) Replace(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Replace: index required", 400) diff --git a/document/replace_test.go b/document/replace_test.go index e8aa0c4d..f3b3678b 100644 --- a/document/replace_test.go +++ b/document/replace_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/search.go b/document/search.go index 8e0f835a..9d06fbf9 100644 --- a/document/search.go +++ b/document/search.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( diff --git a/document/search_test.go b/document/search_test.go index 3c0c932b..47770d4d 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/update.go b/document/update.go index 42164410..cd295928 100644 --- a/document/update.go +++ b/document/update.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// UpdateDocument updates a document in Kuzzle. +// Update updates a document in Kuzzle. func (d *Document) Update(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Update: index required", 400) diff --git a/document/update_test.go b/document/update_test.go index a584d527..4c6e0b4f 100644 --- a/document/update_test.go +++ b/document/update_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/document/validate.go b/document/validate.go index 9c84056a..8d1f7557 100644 --- a/document/validate.go +++ b/document/validate.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// Validate validates a document +// Validate validates data against existing validation rules. func (d *Document) Validate(index string, collection string, body string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Document.Validate: index required", 400) diff --git a/document/validate_test.go b/document/validate_test.go index 919dfe46..dcadf25f 100644 --- a/document/validate_test.go +++ b/document/validate_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package document_test import ( diff --git a/event/Event.go b/event/Event.go index 56170d11..b3b1a7ba 100644 --- a/event/Event.go +++ b/event/Event.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package event // Consts for event diff --git a/index/create.go b/index/create.go index 954a8b7b..c6114cda 100644 --- a/index/create.go +++ b/index/create.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import ( diff --git a/index/create_test.go b/index/create_test.go index 6edfc753..dd881b97 100644 --- a/index/create_test.go +++ b/index/create_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/index/delete.go b/index/delete.go index 2d86609f..e06dc9dd 100644 --- a/index/delete.go +++ b/index/delete.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import "github.com/kuzzleio/sdk-go/types" diff --git a/index/delete_test.go b/index/delete_test.go index a810ad43..d36ee38e 100644 --- a/index/delete_test.go +++ b/index/delete_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/index/exists.go b/index/exists.go index a955f30e..b61abead 100644 --- a/index/exists.go +++ b/index/exists.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import ( diff --git a/index/exists_test.go b/index/exists_test.go index 2f4b42eb..edca4a25 100644 --- a/index/exists_test.go +++ b/index/exists_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/index/getAutoRefresh.go b/index/getAutoRefresh.go index adf3c556..fee0ae9e 100644 --- a/index/getAutoRefresh.go +++ b/index/getAutoRefresh.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import ( @@ -7,6 +21,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// GetAutoRefresh returns the current autoRefresh status for the given index. func (i *Index) GetAutoRefresh(index string, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Index.GetAutoRefresh: index required", 400) diff --git a/index/getAutoRefresh_test.go b/index/getAutoRefresh_test.go index 7bd0216b..793ec953 100644 --- a/index/getAutoRefresh_test.go +++ b/index/getAutoRefresh_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/index/index.go b/index/index.go index 62bee6b0..c210eae0 100644 --- a/index/index.go +++ b/index/index.go @@ -1,13 +1,29 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import ( "github.com/kuzzleio/sdk-go/types" ) +// Index controller type Index struct { kuzzle types.IKuzzle } +// NewIndex instanciates a new index controller func NewIndex(k types.IKuzzle) *Index { return &Index{k} } diff --git a/index/list.go b/index/list.go index d6e1214e..f4516a76 100644 --- a/index/list.go +++ b/index/list.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import ( @@ -7,7 +21,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// List list all index +// List all index func (i *Index) List(options types.QueryOptions) ([]string, error) { result := make(chan *types.KuzzleResponse) diff --git a/index/list_test.go b/index/list_test.go index 87880e56..16b115ed 100644 --- a/index/list_test.go +++ b/index/list_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/index/mDelete.go b/index/mDelete.go index 47cc8f4f..0edeab75 100644 --- a/index/mDelete.go +++ b/index/mDelete.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import ( @@ -7,7 +21,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// Delete delete the index +// MDelete deletes all matching indices at once func (i *Index) MDelete(indexes []string, options types.QueryOptions) ([]string, error) { if len(indexes) == 0 { return nil, types.NewError("Index.MDelete: at least one index required", 400) diff --git a/index/mDelete_test.go b/index/mDelete_test.go index ffcc64b3..fa69a345 100644 --- a/index/mDelete_test.go +++ b/index/mDelete_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/index/refresh.go b/index/refresh.go index f955db4b..6bce1ba5 100644 --- a/index/refresh.go +++ b/index/refresh.go @@ -1,9 +1,24 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import ( "github.com/kuzzleio/sdk-go/types" ) +// Refresh forces the provided data index to refresh on each modification func (i *Index) Refresh(index string, options types.QueryOptions) error { if index == "" { return types.NewError("Index.Refresh: index required", 400) diff --git a/index/refreshInternal.go b/index/refreshInternal.go index bb96136b..bd9df7a6 100644 --- a/index/refreshInternal.go +++ b/index/refreshInternal.go @@ -1,7 +1,23 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import "github.com/kuzzleio/sdk-go/types" +// RefreshInternal action forces a refresh, on the internal index, +// making the documents available to search immediately. func (i *Index) RefreshInternal(options types.QueryOptions) error { result := make(chan *types.KuzzleResponse) diff --git a/index/refreshInternal_test.go b/index/refreshInternal_test.go index df0c19b0..34916d0b 100644 --- a/index/refreshInternal_test.go +++ b/index/refreshInternal_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/index/refresh_test.go b/index/refresh_test.go index 70c9b41e..b48fc5d3 100644 --- a/index/refresh_test.go +++ b/index/refresh_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/index/setAutoRefresh.go b/index/setAutoRefresh.go index 18e28f10..9537a1bd 100644 --- a/index/setAutoRefresh.go +++ b/index/setAutoRefresh.go @@ -1,7 +1,22 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index import "github.com/kuzzleio/sdk-go/types" +// SetAutoRefresh is an autorefresh status setter for the provided data index name func (i *Index) SetAutoRefresh(index string, autoRefresh bool, options types.QueryOptions) error { if index == "" { return types.NewError("Index.SetAutoRefresh: index required", 400) diff --git a/index/setAutoRefresh_test.go b/index/setAutoRefresh_test.go index d81a4172..4b09edbc 100644 --- a/index/setAutoRefresh_test.go +++ b/index/setAutoRefresh_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package index_test import ( diff --git a/internal/mock_connection.go b/internal/mock_connection.go index 7cead302..2f713fd3 100644 --- a/internal/mock_connection.go +++ b/internal/mock_connection.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package internal import ( diff --git a/internal/mock_room.go b/internal/mock_room.go new file mode 100644 index 00000000..f5f0d909 --- /dev/null +++ b/internal/mock_room.go @@ -0,0 +1,56 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import "github.com/kuzzleio/sdk-go/types" + +type MockedRoom struct { + MockedSubscribe func() +} + +func (m MockedRoom) Subscribe(realtimeNotificationChannel chan<- *types.KuzzleNotification) { + m.MockedSubscribe() +} +func (m MockedRoom) Unsubscribe() error { + return nil +} + +func (m MockedRoom) GetRealtimeChannel() chan<- *types.KuzzleNotification { + return make(chan<- *types.KuzzleNotification) +} + +func (m MockedRoom) GetResponseChannel() chan<- *types.SubscribeResponse { + return make(chan<- *types.SubscribeResponse) +} + +func (m MockedRoom) RoomId() string { + return "" +} + +func (m MockedRoom) Filters() interface{} { + return nil +} + +func (m MockedRoom) Channel() string { + return "" +} + +func (m MockedRoom) Id() string { + return "" +} + +func (m MockedRoom) SubscribeToSelf() bool { + return true +} diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index d504101e..3989a5b8 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 8df009da..67f8b893 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 014766a5..905b6669 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index e779d674..0cef8b17 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index 11774b0c..22d4a511 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index 7e2899d8..a267cfcb 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index ac0bd299..67404928 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index 251dfb45..49621a4a 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go b/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go index 8e2eba04..8e788794 100644 --- a/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go +++ b/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 6883daba..151faa07 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go index 76b8a279..30231975 100644 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ b/internal/wrappers/cgo/kuzzle/memory_storage.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/options.go b/internal/wrappers/cgo/kuzzle/options.go index 67018257..3450ff3e 100644 --- a/internal/wrappers/cgo/kuzzle/options.go +++ b/internal/wrappers/cgo/kuzzle/options.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/query.go b/internal/wrappers/cgo/kuzzle/query.go index f12ef408..aed3eb9b 100644 --- a/internal/wrappers/cgo/kuzzle/query.go +++ b/internal/wrappers/cgo/kuzzle/query.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index 45ebe688..d122e328 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cgo/kuzzle/server.go b/internal/wrappers/cgo/kuzzle/server.go index 5cfc5f16..1a568b1b 100644 --- a/internal/wrappers/cgo/kuzzle/server.go +++ b/internal/wrappers/cgo/kuzzle/server.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main /* diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 4ce46c4b..836faa9e 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "auth.hpp" namespace kuzzleio { diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 05846d05..30df65b5 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "kuzzle.hpp" #include "collection.hpp" diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index b9a901f2..42982907 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "kuzzle.hpp" #include "document.hpp" diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index 135b484f..43be3c8d 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "index.hpp" #include #include diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 9a82af00..1f0d5cd3 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include #include #include "kuzzle.hpp" diff --git a/internal/wrappers/cpp/server.cpp b/internal/wrappers/cpp/server.cpp index 6f973bfb..8a62a056 100644 --- a/internal/wrappers/cpp/server.cpp +++ b/internal/wrappers/cpp/server.cpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "server.hpp" namespace kuzzleio { diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index fe09e6b2..f18bd651 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _AUTH_HPP #define _AUTH_HPP diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index 12e45819..a02b78f6 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _COLLECTION_HPP_ #define _COLLECTION_HPP_ diff --git a/internal/wrappers/headers/core.hpp b/internal/wrappers/headers/core.hpp index 07f97a2b..1bb53937 100644 --- a/internal/wrappers/headers/core.hpp +++ b/internal/wrappers/headers/core.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _CORE_HPP_ #define _CORE_HPP_ diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp index 08247af9..e6c7fd88 100644 --- a/internal/wrappers/headers/document.hpp +++ b/internal/wrappers/headers/document.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _DOCUMENT_HPP_ #define _DOCUMENT_HPP_ diff --git a/internal/wrappers/headers/event_emitter.hpp b/internal/wrappers/headers/event_emitter.hpp index 384d5ea7..807c7293 100644 --- a/internal/wrappers/headers/event_emitter.hpp +++ b/internal/wrappers/headers/event_emitter.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _EVENT_EMITTER_HPP_ #define _EVENT_EMITTER_HPP_ diff --git a/internal/wrappers/headers/exceptions.hpp b/internal/wrappers/headers/exceptions.hpp index 3d06071e..156bd037 100644 --- a/internal/wrappers/headers/exceptions.hpp +++ b/internal/wrappers/headers/exceptions.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _EXCEPTIONS_HPP_ #define _EXCEPTIONS_HPP_ diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp index 092d4388..c05f7a44 100644 --- a/internal/wrappers/headers/index.hpp +++ b/internal/wrappers/headers/index.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _KUZZLE_INDEX_HPP #define _KUZZLE_INDEX_HPP diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 0c772c5b..de066f42 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _KUZZLE_HPP_ #define _KUZZLE_HPP_ @@ -37,8 +51,6 @@ namespace kuzzleio { char* connect(); bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; - - statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 5bff77d8..9e09cc43 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _KUZZLESDK_H_ #define _KUZZLESDK_H_ diff --git a/internal/wrappers/headers/listeners.hpp b/internal/wrappers/headers/listeners.hpp index 89abe9de..d0904903 100644 --- a/internal/wrappers/headers/listeners.hpp +++ b/internal/wrappers/headers/listeners.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _LISTENERS_HPP #define _LISTENERS_HPP diff --git a/internal/wrappers/headers/sdk_wrappers_internal.h b/internal/wrappers/headers/sdk_wrappers_internal.h index 0a492139..c93e9c6f 100644 --- a/internal/wrappers/headers/sdk_wrappers_internal.h +++ b/internal/wrappers/headers/sdk_wrappers_internal.h @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef __SDK_WRAPPERS_INTERNAL #define __SDK_WRAPPERS_INTERNAL diff --git a/internal/wrappers/headers/server.hpp b/internal/wrappers/headers/server.hpp index b7cad1de..6fe1cc31 100644 --- a/internal/wrappers/headers/server.hpp +++ b/internal/wrappers/headers/server.hpp @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef _KUZZLE_SERVER_HPP #define _KUZZLE_SERVER_HPP diff --git a/internal/wrappers/headers/swig.h b/internal/wrappers/headers/swig.h index 802ad1ba..156c5ef7 100644 --- a/internal/wrappers/headers/swig.h +++ b/internal/wrappers/headers/swig.h @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef SWIG_H_ #define SWIG_H_ diff --git a/kuzzle/disconnect.go b/kuzzle/disconnect.go index 13f67ecb..06d55a64 100644 --- a/kuzzle/disconnect.go +++ b/kuzzle/disconnect.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle import "github.com/kuzzleio/sdk-go/types" diff --git a/kuzzle/disconnect_test.go b/kuzzle/disconnect_test.go index ebc9cab8..de9730ba 100644 --- a/kuzzle/disconnect_test.go +++ b/kuzzle/disconnect_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle_test import ( diff --git a/kuzzle/event_emitter.go b/kuzzle/event_emitter.go index 84629392..2498d9ba 100644 --- a/kuzzle/event_emitter.go +++ b/kuzzle/event_emitter.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle // KuzzleEventEmitter Is an interface used by Kuzzle and Room instances to emit and listen to events (see Event Handling section). diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index be93b47b..b47b588f 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -1,4 +1,18 @@ -// Kuzzle Entry point and main struct for the entire SDK +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package kuzzle provides a Kuzzle Entry point and main struct for the entire SDK package kuzzle import ( @@ -142,94 +156,117 @@ func (k *Kuzzle) UnregisterSub(roomId string) { k.socket.UnregisterSub(roomId) } +// State returns the Kuzzle socket state func (k *Kuzzle) State() int { return k.socket.State() } +// AutoQueue returns the Kuzzle socket AutoQueue field value func (k *Kuzzle) AutoQueue() bool { return k.socket.AutoQueue() } +// AutoReconnect returns the Kuzzle socket AutoReconnect field value func (k *Kuzzle) AutoReconnect() bool { return k.socket.AutoReconnect() } +// AutoResubscribe returns the Kuzzle socket AutoQueue field value func (k *Kuzzle) AutoResubscribe() bool { return k.socket.AutoResubscribe() } +// AutoReplay returns the Kuzzle socket AutoReplay field value func (k *Kuzzle) AutoReplay() bool { return k.socket.AutoReplay() } +// Host returns the Kuzzle socket Host field value func (k *Kuzzle) Host() string { return k.socket.Host() } +// OfflineQueue returns the Kuzzle socket OfflineQueue field value func (k *Kuzzle) OfflineQueue() []*types.QueryObject { return k.socket.OfflineQueue() } +// OfflineQueueLoader returns the Kuzzle socket OfflineQueueLoader field value func (k *Kuzzle) OfflineQueueLoader() connection.OfflineQueueLoader { return k.socket.OfflineQueueLoader() } +// Port returns the Kuzzle socket Port field value func (k *Kuzzle) Port() int { return k.socket.Port() } +// QueueFilter returns the Kuzzle socket QueueFilter field value func (k *Kuzzle) QueueFilter() connection.QueueFilter { return k.socket.QueueFilter() } +// QueueMaxSize returns the Kuzzle socket QueueMaxSize field value func (k *Kuzzle) QueueMaxSize() int { return k.socket.QueueMaxSize() } +// QueueTTL returns the Kuzzle socket QueueTTL field value func (k *Kuzzle) QueueTTL() time.Duration { return k.socket.QueueTTL() } +// ReplayInterval returns the Kuzzle socket ReplayInterval field value func (k *Kuzzle) ReplayInterval() time.Duration { return k.socket.ReplayInterval() } +// ReconnectionDelay returns the Kuzzle socket ReconnectionDelay field value func (k *Kuzzle) ReconnectionDelay() time.Duration { return k.socket.ReconnectionDelay() } +// SslConnection returns the Kuzzle socket SslConnection field value func (k *Kuzzle) SslConnection() bool { return k.socket.SslConnection() } +// SetAutoQueue sets the Kuzzle socket AutoQueue field with the given value func (k *Kuzzle) SetAutoQueue(v bool) { k.socket.SetAutoQueue(v) } +// SetAutoReplay sets the Kuzzle socket AutoReplay field with the given value func (k *Kuzzle) SetAutoReplay(v bool) { k.socket.SetAutoReplay(v) } +// SetOfflineQueueLoader sets the Kuzzle socket OfflineQueueLoader field with given value func (k *Kuzzle) SetOfflineQueueLoader(v connection.OfflineQueueLoader) { k.socket.SetOfflineQueueLoader(v) } +// SetQueueFilter sets the Kuzzle socket QueueFilter field with given value func (k *Kuzzle) SetQueueFilter(v connection.QueueFilter) { k.socket.SetQueueFilter(v) } +// SetQueueMaxSize sets the Kuzzle socket QueueMaxSize field with the given value func (k *Kuzzle) SetQueueMaxSize(v int) { k.socket.SetQueueMaxSize(v) } +// SetQueueTTL sets the Kuzzle socket QueueTTL field with the given value func (k *Kuzzle) SetQueueTTL(v time.Duration) { k.socket.SetQueueTTL(v) } +// SetReplayInterval sets the Kuzzle socket ReplayInterval field with the given value func (k *Kuzzle) SetReplayInterval(v time.Duration) { k.socket.SetReplayInterval(v) } +// DefaultIndex returns the Kuzzle default index name func (k *Kuzzle) DefaultIndex() string { return k.defaultIndex } diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index c4f290f0..8585c86b 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle_test import ( diff --git a/kuzzle/listener.go b/kuzzle/listener.go index fe588045..0eb32896 100644 --- a/kuzzle/listener.go +++ b/kuzzle/listener.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle // AddListener Adds a listener to a Kuzzle global event. When an event is fired, listeners are called in the order of their insertion. @@ -10,7 +24,7 @@ func (k *Kuzzle) On(event int, channel chan<- interface{}) { k.socket.AddListener(event, channel) } -// Remove all listener by event type or all listener if event == -1 +// RemoveAllListeners removes all listener by event type or all listener if event == -1 func (k *Kuzzle) RemoveAllListeners(event int) { k.socket.RemoveAllListeners(event) } diff --git a/kuzzle/listener_test.go b/kuzzle/listener_test.go index 197c7f98..ed111482 100644 --- a/kuzzle/listener_test.go +++ b/kuzzle/listener_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle_test import ( diff --git a/kuzzle/query.go b/kuzzle/query.go index fbf4575a..732a1a68 100644 --- a/kuzzle/query.go +++ b/kuzzle/query.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle import ( diff --git a/kuzzle/query_test.go b/kuzzle/query_test.go index 1143a934..67d5d9ee 100644 --- a/kuzzle/query_test.go +++ b/kuzzle/query_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle_test import ( diff --git a/kuzzle/queue.go b/kuzzle/queue.go index e6fd39b7..59c4e722 100644 --- a/kuzzle/queue.go +++ b/kuzzle/queue.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle // FlushQueue empties the offline queue without replaying it. @@ -5,15 +19,18 @@ func (k *Kuzzle) FlushQueue() { k.socket.ClearQueue() } -// ReplayQueue replays the requests queued during offline mode. Works only if the SDK is not in a disconnected state, and if the autoReplay option is set to false. +// ReplayQueue replays the requests queued during offline mode. +// Works only if the SDK is not in a disconnected state, and if the autoReplay option is set to false. func (k *Kuzzle) ReplayQueue() { k.socket.ReplayQueue() } +// StartQueuing start the requests queuing. func (k *Kuzzle) StartQueuing() { k.socket.StartQueuing() } +// StopQueuing stop the requests queuing. func (k *Kuzzle) StopQueuing() { k.socket.StopQueuing() } diff --git a/kuzzle/queue_test.go b/kuzzle/queue_test.go index cc05809d..0a33bf3d 100644 --- a/kuzzle/queue_test.go +++ b/kuzzle/queue_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package kuzzle_test import ( diff --git a/ms/append.go b/ms/append.go index 694f5ab7..06a9a6d1 100755 --- a/ms/append.go +++ b/ms/append.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/append_test.go b/ms/append_test.go index e0758ab3..505f7f5e 100755 --- a/ms/append_test.go +++ b/ms/append_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/bitcount.go b/ms/bitcount.go index effd5c2e..3ed0c776 100755 --- a/ms/bitcount.go +++ b/ms/bitcount.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/bitcount_test.go b/ms/bitcount_test.go index 6b3f0dad..40ad0e21 100755 --- a/ms/bitcount_test.go +++ b/ms/bitcount_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/bitop.go b/ms/bitop.go index 02a49a14..ed5b6a97 100755 --- a/ms/bitop.go +++ b/ms/bitop.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/bitop_test.go b/ms/bitop_test.go index 848eaf28..72220a2b 100755 --- a/ms/bitop_test.go +++ b/ms/bitop_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/bitpos.go b/ms/bitpos.go index f9e3b8e3..758d44a1 100755 --- a/ms/bitpos.go +++ b/ms/bitpos.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/bitpos_test.go b/ms/bitpos_test.go index 6c0f9786..925c244b 100755 --- a/ms/bitpos_test.go +++ b/ms/bitpos_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/dbsize.go b/ms/dbsize.go index 213d3b8a..b101acc3 100755 --- a/ms/dbsize.go +++ b/ms/dbsize.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/dbsize_test.go b/ms/dbsize_test.go index 626a81cf..ce38f98a 100755 --- a/ms/dbsize_test.go +++ b/ms/dbsize_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/decr.go b/ms/decr.go index 9e7b9fa6..6edf534e 100755 --- a/ms/decr.go +++ b/ms/decr.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/decr_test.go b/ms/decr_test.go index 7e38c876..fe2bc794 100755 --- a/ms/decr_test.go +++ b/ms/decr_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/decrby.go b/ms/decrby.go index 69c6d452..3a88fb41 100755 --- a/ms/decrby.go +++ b/ms/decrby.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/decrby_test.go b/ms/decrby_test.go index 6ca1e088..88603fe8 100755 --- a/ms/decrby_test.go +++ b/ms/decrby_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/del.go b/ms/del.go index dbd4e4e2..b3b3b808 100755 --- a/ms/del.go +++ b/ms/del.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/del_test.go b/ms/del_test.go index 051409b4..fd2bd8f0 100755 --- a/ms/del_test.go +++ b/ms/del_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/exists.go b/ms/exists.go index 98af639b..c082e54b 100755 --- a/ms/exists.go +++ b/ms/exists.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/exists_test.go b/ms/exists_test.go index faf6f73c..d3f6150c 100755 --- a/ms/exists_test.go +++ b/ms/exists_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/expire.go b/ms/expire.go index 5c1a3636..1696ea9e 100755 --- a/ms/expire.go +++ b/ms/expire.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/expire_test.go b/ms/expire_test.go index f9acb265..1cfff4cc 100755 --- a/ms/expire_test.go +++ b/ms/expire_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/expireat.go b/ms/expireat.go index 68724a90..a2e9ab9e 100755 --- a/ms/expireat.go +++ b/ms/expireat.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/expireat_test.go b/ms/expireat_test.go index 94e7306d..5b7c52cf 100755 --- a/ms/expireat_test.go +++ b/ms/expireat_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/flushdb.go b/ms/flushdb.go index ec198978..1f24f15d 100755 --- a/ms/flushdb.go +++ b/ms/flushdb.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/flushdb_test.go b/ms/flushdb_test.go index 33013031..8754ab9c 100755 --- a/ms/flushdb_test.go +++ b/ms/flushdb_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/geoadd.go b/ms/geoadd.go index 546779c2..c41f33c5 100755 --- a/ms/geoadd.go +++ b/ms/geoadd.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/geoadd_test.go b/ms/geoadd_test.go index e1daefad..897231a6 100755 --- a/ms/geoadd_test.go +++ b/ms/geoadd_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/geodist.go b/ms/geodist.go index 0865406b..57dfbd91 100755 --- a/ms/geodist.go +++ b/ms/geodist.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/geodist_test.go b/ms/geodist_test.go index 1f9f21e9..ee0ec04c 100755 --- a/ms/geodist_test.go +++ b/ms/geodist_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/geohash.go b/ms/geohash.go index 1df9f3f2..3a4f9b5b 100755 --- a/ms/geohash.go +++ b/ms/geohash.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/geohash_test.go b/ms/geohash_test.go index f428d0f9..7a68c24e 100755 --- a/ms/geohash_test.go +++ b/ms/geohash_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/geopos.go b/ms/geopos.go index 357f01ec..fefbec6d 100755 --- a/ms/geopos.go +++ b/ms/geopos.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/geopos_test.go b/ms/geopos_test.go index 7ffda058..1841b4b7 100755 --- a/ms/geopos_test.go +++ b/ms/geopos_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/georadius.go b/ms/georadius.go index f080707e..6c2bbbd0 100755 --- a/ms/georadius.go +++ b/ms/georadius.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/georadius_test.go b/ms/georadius_test.go index 8b3d6581..5a135256 100755 --- a/ms/georadius_test.go +++ b/ms/georadius_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/georadiusbymember.go b/ms/georadiusbymember.go index 57e188e4..3d7d5104 100755 --- a/ms/georadiusbymember.go +++ b/ms/georadiusbymember.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/georadiusbymember_test.go b/ms/georadiusbymember_test.go index 77702bc8..413dd46b 100755 --- a/ms/georadiusbymember_test.go +++ b/ms/georadiusbymember_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/get.go b/ms/get.go index a1a73646..a8ed00f1 100755 --- a/ms/get.go +++ b/ms/get.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/get_test.go b/ms/get_test.go index 54388f00..2ec3a2d6 100755 --- a/ms/get_test.go +++ b/ms/get_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/getbit.go b/ms/getbit.go index 4799a078..4b865e36 100755 --- a/ms/getbit.go +++ b/ms/getbit.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/getbit_test.go b/ms/getbit_test.go index bb8477ae..8ceb14d0 100755 --- a/ms/getbit_test.go +++ b/ms/getbit_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/getrange.go b/ms/getrange.go index f922bb46..7bcfc1c2 100755 --- a/ms/getrange.go +++ b/ms/getrange.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/getrange_test.go b/ms/getrange_test.go index 85b3a4c0..e7668bd9 100755 --- a/ms/getrange_test.go +++ b/ms/getrange_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/getset.go b/ms/getset.go index bbd71d11..badc03f4 100755 --- a/ms/getset.go +++ b/ms/getset.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/getset_test.go b/ms/getset_test.go index 69bac6f2..def70498 100755 --- a/ms/getset_test.go +++ b/ms/getset_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hdel.go b/ms/hdel.go index 284c7084..681c8659 100755 --- a/ms/hdel.go +++ b/ms/hdel.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hdel_test.go b/ms/hdel_test.go index a053f527..88db905a 100755 --- a/ms/hdel_test.go +++ b/ms/hdel_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hexists.go b/ms/hexists.go index 58febb9d..50967349 100755 --- a/ms/hexists.go +++ b/ms/hexists.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hexists_test.go b/ms/hexists_test.go index 3353c5f9..0e5da70c 100755 --- a/ms/hexists_test.go +++ b/ms/hexists_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hget.go b/ms/hget.go index f58a3947..f1492dd7 100755 --- a/ms/hget.go +++ b/ms/hget.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hget_test.go b/ms/hget_test.go index 945c4535..179e0b14 100755 --- a/ms/hget_test.go +++ b/ms/hget_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hgetall.go b/ms/hgetall.go index c5098b03..4dafc7af 100755 --- a/ms/hgetall.go +++ b/ms/hgetall.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hgetall_test.go b/ms/hgetall_test.go index 0b8fb04e..7d55014c 100755 --- a/ms/hgetall_test.go +++ b/ms/hgetall_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hincrby.go b/ms/hincrby.go index 4b1dabdf..3a591de2 100755 --- a/ms/hincrby.go +++ b/ms/hincrby.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hincrby_test.go b/ms/hincrby_test.go index 4fecf9d5..7b8837bb 100755 --- a/ms/hincrby_test.go +++ b/ms/hincrby_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hincrbyfloat.go b/ms/hincrbyfloat.go index 9ff56c44..9cf36de3 100755 --- a/ms/hincrbyfloat.go +++ b/ms/hincrbyfloat.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hincrbyfloat_test.go b/ms/hincrbyfloat_test.go index 2fd58d4d..69aaba56 100755 --- a/ms/hincrbyfloat_test.go +++ b/ms/hincrbyfloat_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hkeys.go b/ms/hkeys.go index abb37387..54f885b2 100755 --- a/ms/hkeys.go +++ b/ms/hkeys.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hkeys_test.go b/ms/hkeys_test.go index 1451a33a..40654c7a 100755 --- a/ms/hkeys_test.go +++ b/ms/hkeys_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hlen.go b/ms/hlen.go index 4f997d8f..0f8cbecf 100755 --- a/ms/hlen.go +++ b/ms/hlen.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hlen_test.go b/ms/hlen_test.go index 68606497..373e7006 100755 --- a/ms/hlen_test.go +++ b/ms/hlen_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hmget.go b/ms/hmget.go index f40e74a0..2dda4e11 100755 --- a/ms/hmget.go +++ b/ms/hmget.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hmget_test.go b/ms/hmget_test.go index 0f3dcd49..0cd04c65 100755 --- a/ms/hmget_test.go +++ b/ms/hmget_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hmset.go b/ms/hmset.go index 60527cbb..651e150b 100755 --- a/ms/hmset.go +++ b/ms/hmset.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hmset_test.go b/ms/hmset_test.go index 4809ea4d..444f8d50 100755 --- a/ms/hmset_test.go +++ b/ms/hmset_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hscan.go b/ms/hscan.go index 9b6a86ee..2ac46da8 100755 --- a/ms/hscan.go +++ b/ms/hscan.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hscan_test.go b/ms/hscan_test.go index e01dfd8e..be3203f7 100755 --- a/ms/hscan_test.go +++ b/ms/hscan_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hset.go b/ms/hset.go index 2df484b0..fe0dfc9a 100755 --- a/ms/hset.go +++ b/ms/hset.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hset_test.go b/ms/hset_test.go index 120d69ad..9487e77a 100755 --- a/ms/hset_test.go +++ b/ms/hset_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hsetnx.go b/ms/hsetnx.go index 2df77daa..aa4bb0a9 100755 --- a/ms/hsetnx.go +++ b/ms/hsetnx.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hsetnx_test.go b/ms/hsetnx_test.go index 76bbe7f9..1e9ac11e 100755 --- a/ms/hsetnx_test.go +++ b/ms/hsetnx_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hstrlen.go b/ms/hstrlen.go index 62a56065..c80629a7 100755 --- a/ms/hstrlen.go +++ b/ms/hstrlen.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hstrlen_test.go b/ms/hstrlen_test.go index 3296990f..5d2ca689 100755 --- a/ms/hstrlen_test.go +++ b/ms/hstrlen_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/hvals.go b/ms/hvals.go index d5e63472..b5d88592 100755 --- a/ms/hvals.go +++ b/ms/hvals.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/hvals_test.go b/ms/hvals_test.go index 120ac952..c9a116f0 100755 --- a/ms/hvals_test.go +++ b/ms/hvals_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/incr.go b/ms/incr.go index 8dd4122a..67b78ecc 100755 --- a/ms/incr.go +++ b/ms/incr.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/incr_test.go b/ms/incr_test.go index baa83d44..2de475ab 100755 --- a/ms/incr_test.go +++ b/ms/incr_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/incrby.go b/ms/incrby.go index dff60880..1b1900f1 100755 --- a/ms/incrby.go +++ b/ms/incrby.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/incrby_test.go b/ms/incrby_test.go index 188c0880..c44ca049 100755 --- a/ms/incrby_test.go +++ b/ms/incrby_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/incrbyfloat.go b/ms/incrbyfloat.go index b805691d..d12ce6e6 100755 --- a/ms/incrbyfloat.go +++ b/ms/incrbyfloat.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/incrbyfloat_test.go b/ms/incrbyfloat_test.go index d448a4e7..f534469d 100755 --- a/ms/incrbyfloat_test.go +++ b/ms/incrbyfloat_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/keys.go b/ms/keys.go index fbf2a55f..19a302e1 100755 --- a/ms/keys.go +++ b/ms/keys.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/keys_test.go b/ms/keys_test.go index 6e1d76b0..b58dc57e 100755 --- a/ms/keys_test.go +++ b/ms/keys_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/lindex.go b/ms/lindex.go index a2dff2b7..8d2acaaa 100755 --- a/ms/lindex.go +++ b/ms/lindex.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/lindex_test.go b/ms/lindex_test.go index 4bba805f..f1184808 100755 --- a/ms/lindex_test.go +++ b/ms/lindex_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/linsert.go b/ms/linsert.go index 7118f4f8..bb172953 100755 --- a/ms/linsert.go +++ b/ms/linsert.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/linsert_test.go b/ms/linsert_test.go index 0d291cca..7cda3468 100755 --- a/ms/linsert_test.go +++ b/ms/linsert_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/llen.go b/ms/llen.go index 57d872e7..74bdfb08 100755 --- a/ms/llen.go +++ b/ms/llen.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/llen_test.go b/ms/llen_test.go index a330251e..1be8bcf7 100755 --- a/ms/llen_test.go +++ b/ms/llen_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/lpop.go b/ms/lpop.go index 5fee04b5..2065f3e8 100755 --- a/ms/lpop.go +++ b/ms/lpop.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/lpop_test.go b/ms/lpop_test.go index 49aa0d60..aabd06b0 100755 --- a/ms/lpop_test.go +++ b/ms/lpop_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/lpush.go b/ms/lpush.go index 9bdd53de..294e3d98 100755 --- a/ms/lpush.go +++ b/ms/lpush.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/lpush_test.go b/ms/lpush_test.go index 8661e2b9..b0790234 100755 --- a/ms/lpush_test.go +++ b/ms/lpush_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/lpushx.go b/ms/lpushx.go index 9dea6c8e..c41b9213 100755 --- a/ms/lpushx.go +++ b/ms/lpushx.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/lpushx_test.go b/ms/lpushx_test.go index 75085afc..d956f1a2 100755 --- a/ms/lpushx_test.go +++ b/ms/lpushx_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/lrange.go b/ms/lrange.go index ef05365a..46d325df 100755 --- a/ms/lrange.go +++ b/ms/lrange.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/lrange_test.go b/ms/lrange_test.go index 1ecdadaa..3cf74514 100755 --- a/ms/lrange_test.go +++ b/ms/lrange_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/lrem.go b/ms/lrem.go index 508d607a..3e34778b 100755 --- a/ms/lrem.go +++ b/ms/lrem.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/lrem_test.go b/ms/lrem_test.go index 0a4f6917..96d86414 100755 --- a/ms/lrem_test.go +++ b/ms/lrem_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/lset.go b/ms/lset.go index e837887c..1b3df115 100755 --- a/ms/lset.go +++ b/ms/lset.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/lset_test.go b/ms/lset_test.go index 1c627d1a..8c90088f 100755 --- a/ms/lset_test.go +++ b/ms/lset_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/ltrim.go b/ms/ltrim.go index 4a32bc2f..7ad496cc 100755 --- a/ms/ltrim.go +++ b/ms/ltrim.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/ltrim_test.go b/ms/ltrim_test.go index c95a9ef3..3e7a3eb4 100755 --- a/ms/ltrim_test.go +++ b/ms/ltrim_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/mget.go b/ms/mget.go index ba1014f0..0a1c80a0 100755 --- a/ms/mget.go +++ b/ms/mget.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/mget_test.go b/ms/mget_test.go index 784fef49..b982ea5e 100755 --- a/ms/mget_test.go +++ b/ms/mget_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/ms.go b/ms/ms.go index f1849758..494dfcd4 100755 --- a/ms/ms.go +++ b/ms/ms.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Package ms provides methods to interact with the Kuzzle memory storage package ms diff --git a/ms/mset.go b/ms/mset.go index cf788cd8..04f4ec2d 100755 --- a/ms/mset.go +++ b/ms/mset.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/mset_test.go b/ms/mset_test.go index 2bfbbd23..07cbf491 100755 --- a/ms/mset_test.go +++ b/ms/mset_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/msetnx.go b/ms/msetnx.go index 9646f139..7d9b43cb 100755 --- a/ms/msetnx.go +++ b/ms/msetnx.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/msetnx_test.go b/ms/msetnx_test.go index 16c9503e..498d0a6b 100755 --- a/ms/msetnx_test.go +++ b/ms/msetnx_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/object.go b/ms/object.go index 2a6c524a..3bcf702b 100755 --- a/ms/object.go +++ b/ms/object.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/object_test.go b/ms/object_test.go index 188dadc5..ddc30ec6 100755 --- a/ms/object_test.go +++ b/ms/object_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/persist.go b/ms/persist.go index 1c180ab5..31aa39be 100755 --- a/ms/persist.go +++ b/ms/persist.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/persist_test.go b/ms/persist_test.go index 6e4aab4b..58135e59 100755 --- a/ms/persist_test.go +++ b/ms/persist_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/pexpire.go b/ms/pexpire.go index 9ed3134b..604763b5 100755 --- a/ms/pexpire.go +++ b/ms/pexpire.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/pexpire_test.go b/ms/pexpire_test.go index a38d795d..2e6701a3 100755 --- a/ms/pexpire_test.go +++ b/ms/pexpire_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/pexpireat.go b/ms/pexpireat.go index 90df3437..06b9ad2a 100755 --- a/ms/pexpireat.go +++ b/ms/pexpireat.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/pexpireat_test.go b/ms/pexpireat_test.go index 5b61bcc8..80dcc547 100755 --- a/ms/pexpireat_test.go +++ b/ms/pexpireat_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/pfadd.go b/ms/pfadd.go index 72eb5812..c3db6e02 100755 --- a/ms/pfadd.go +++ b/ms/pfadd.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/pfadd_test.go b/ms/pfadd_test.go index 93619505..1aaa429b 100755 --- a/ms/pfadd_test.go +++ b/ms/pfadd_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/pfcount.go b/ms/pfcount.go index 84092726..1367de88 100755 --- a/ms/pfcount.go +++ b/ms/pfcount.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/pfcount_test.go b/ms/pfcount_test.go index 5dc87af0..424a4198 100755 --- a/ms/pfcount_test.go +++ b/ms/pfcount_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/pfmerge.go b/ms/pfmerge.go index 4d404ca3..afbe7428 100755 --- a/ms/pfmerge.go +++ b/ms/pfmerge.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/pfmerge_test.go b/ms/pfmerge_test.go index 000bd48c..4eb8041f 100755 --- a/ms/pfmerge_test.go +++ b/ms/pfmerge_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/ping.go b/ms/ping.go index 4b51f4a3..426f2635 100755 --- a/ms/ping.go +++ b/ms/ping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/ping_test.go b/ms/ping_test.go index cd7f8b10..bf3951b7 100755 --- a/ms/ping_test.go +++ b/ms/ping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/psetex.go b/ms/psetex.go index 13ea36b7..053bcc09 100755 --- a/ms/psetex.go +++ b/ms/psetex.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/psetex_test.go b/ms/psetex_test.go index 8a931577..0cff49c5 100755 --- a/ms/psetex_test.go +++ b/ms/psetex_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/pttl.go b/ms/pttl.go index f96c31b5..a45f1703 100755 --- a/ms/pttl.go +++ b/ms/pttl.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/pttl_test.go b/ms/pttl_test.go index cfd2fbd3..09c426df 100755 --- a/ms/pttl_test.go +++ b/ms/pttl_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/randomkey.go b/ms/randomkey.go index 186b86d6..423892f7 100755 --- a/ms/randomkey.go +++ b/ms/randomkey.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/randomkey_test.go b/ms/randomkey_test.go index 5ad952df..ac67f2ab 100755 --- a/ms/randomkey_test.go +++ b/ms/randomkey_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/rename.go b/ms/rename.go index e3f85932..c7b07ae2 100755 --- a/ms/rename.go +++ b/ms/rename.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/rename_test.go b/ms/rename_test.go index f774515b..211fc996 100755 --- a/ms/rename_test.go +++ b/ms/rename_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/renamenx.go b/ms/renamenx.go index b3e45978..21d0f6a6 100755 --- a/ms/renamenx.go +++ b/ms/renamenx.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/renamenx_test.go b/ms/renamenx_test.go index efad4e59..ab355f5e 100755 --- a/ms/renamenx_test.go +++ b/ms/renamenx_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/rpop.go b/ms/rpop.go index 47f54363..dcfafd84 100755 --- a/ms/rpop.go +++ b/ms/rpop.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/rpop_test.go b/ms/rpop_test.go index 88ea50e4..998c1770 100755 --- a/ms/rpop_test.go +++ b/ms/rpop_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/rpoplpush.go b/ms/rpoplpush.go index 227a9345..b2be7190 100755 --- a/ms/rpoplpush.go +++ b/ms/rpoplpush.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/rpoplpush_test.go b/ms/rpoplpush_test.go index 9ab505de..389e7cb0 100755 --- a/ms/rpoplpush_test.go +++ b/ms/rpoplpush_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/rpush.go b/ms/rpush.go index daddade1..5715221f 100755 --- a/ms/rpush.go +++ b/ms/rpush.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/rpush_test.go b/ms/rpush_test.go index 3a2848d2..eddff84d 100755 --- a/ms/rpush_test.go +++ b/ms/rpush_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/rpushx.go b/ms/rpushx.go index 7641c92c..79c0045f 100755 --- a/ms/rpushx.go +++ b/ms/rpushx.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/rpushx_test.go b/ms/rpushx_test.go index 4c5fcf06..ea320706 100755 --- a/ms/rpushx_test.go +++ b/ms/rpushx_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sadd.go b/ms/sadd.go index 364af02d..07164d84 100755 --- a/ms/sadd.go +++ b/ms/sadd.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sadd_test.go b/ms/sadd_test.go index f19a8606..be9d4a55 100755 --- a/ms/sadd_test.go +++ b/ms/sadd_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/scan.go b/ms/scan.go index 58ce56de..81c416a2 100755 --- a/ms/scan.go +++ b/ms/scan.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/scan_test.go b/ms/scan_test.go index 152a390d..883f1377 100755 --- a/ms/scan_test.go +++ b/ms/scan_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/scard.go b/ms/scard.go index 08231656..fdcc64f9 100755 --- a/ms/scard.go +++ b/ms/scard.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/scard_test.go b/ms/scard_test.go index b740eb8c..a76afdbf 100755 --- a/ms/scard_test.go +++ b/ms/scard_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sdiff.go b/ms/sdiff.go index 1fd2a37f..bcdae67b 100755 --- a/ms/sdiff.go +++ b/ms/sdiff.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sdiff_test.go b/ms/sdiff_test.go index 371343d7..28693fe0 100755 --- a/ms/sdiff_test.go +++ b/ms/sdiff_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sdiffstore.go b/ms/sdiffstore.go index 070873eb..bbab8922 100755 --- a/ms/sdiffstore.go +++ b/ms/sdiffstore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sdiffstore_test.go b/ms/sdiffstore_test.go index 4b32bc86..c614c228 100755 --- a/ms/sdiffstore_test.go +++ b/ms/sdiffstore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/set.go b/ms/set.go index 39662ac4..41ce01ca 100755 --- a/ms/set.go +++ b/ms/set.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/set_test.go b/ms/set_test.go index 868946e5..8a925eb2 100755 --- a/ms/set_test.go +++ b/ms/set_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/setex.go b/ms/setex.go index 69a95ecd..02dc7717 100755 --- a/ms/setex.go +++ b/ms/setex.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/setex_test.go b/ms/setex_test.go index cc07f526..6c564455 100755 --- a/ms/setex_test.go +++ b/ms/setex_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/setnx.go b/ms/setnx.go index 68d9f72c..ab31a781 100755 --- a/ms/setnx.go +++ b/ms/setnx.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/setnx_test.go b/ms/setnx_test.go index 2ea75bbd..9d5a99e3 100755 --- a/ms/setnx_test.go +++ b/ms/setnx_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sinter.go b/ms/sinter.go index 02ba6bfc..3faf5695 100755 --- a/ms/sinter.go +++ b/ms/sinter.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sinter_test.go b/ms/sinter_test.go index d4ef5161..8a3e17a2 100755 --- a/ms/sinter_test.go +++ b/ms/sinter_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sinterstore.go b/ms/sinterstore.go index 5ea967f4..35fcea30 100755 --- a/ms/sinterstore.go +++ b/ms/sinterstore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sinterstore_test.go b/ms/sinterstore_test.go index ee92e120..4bad90aa 100755 --- a/ms/sinterstore_test.go +++ b/ms/sinterstore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sismember.go b/ms/sismember.go index 2e7c1eed..e41f506f 100755 --- a/ms/sismember.go +++ b/ms/sismember.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sismember_test.go b/ms/sismember_test.go index 6a372e75..8c435701 100755 --- a/ms/sismember_test.go +++ b/ms/sismember_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/smembers.go b/ms/smembers.go index ff2ed2bb..085b3b68 100755 --- a/ms/smembers.go +++ b/ms/smembers.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/smembers_test.go b/ms/smembers_test.go index 2071d830..6c808230 100755 --- a/ms/smembers_test.go +++ b/ms/smembers_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/smove.go b/ms/smove.go index cf2c54df..c7e09b38 100755 --- a/ms/smove.go +++ b/ms/smove.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/smove_test.go b/ms/smove_test.go index 010f8283..edd29299 100755 --- a/ms/smove_test.go +++ b/ms/smove_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sort.go b/ms/sort.go index 950be335..4193c495 100755 --- a/ms/sort.go +++ b/ms/sort.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sort_test.go b/ms/sort_test.go index 75b77924..b211b371 100755 --- a/ms/sort_test.go +++ b/ms/sort_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/spop.go b/ms/spop.go index 222a011a..cd038d1a 100755 --- a/ms/spop.go +++ b/ms/spop.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/spop_test.go b/ms/spop_test.go index 78ca8372..5db40f1c 100755 --- a/ms/spop_test.go +++ b/ms/spop_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/srandmember.go b/ms/srandmember.go index c90e65bb..44233fe3 100755 --- a/ms/srandmember.go +++ b/ms/srandmember.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/srandmember_test.go b/ms/srandmember_test.go index 3b4dd811..2519a42b 100755 --- a/ms/srandmember_test.go +++ b/ms/srandmember_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/srem.go b/ms/srem.go index 928cb628..7cfca649 100755 --- a/ms/srem.go +++ b/ms/srem.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/srem_test.go b/ms/srem_test.go index 4f119604..7cd5d62c 100755 --- a/ms/srem_test.go +++ b/ms/srem_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sscan.go b/ms/sscan.go index e3ef1643..9ad371d6 100755 --- a/ms/sscan.go +++ b/ms/sscan.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sscan_test.go b/ms/sscan_test.go index db25edd9..42174fb5 100755 --- a/ms/sscan_test.go +++ b/ms/sscan_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/strlen.go b/ms/strlen.go index 57daf498..6be3d8ec 100755 --- a/ms/strlen.go +++ b/ms/strlen.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/strlen_test.go b/ms/strlen_test.go index ff7dc97e..3f219c0a 100755 --- a/ms/strlen_test.go +++ b/ms/strlen_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sunion.go b/ms/sunion.go index 2a3a907e..b47507cd 100755 --- a/ms/sunion.go +++ b/ms/sunion.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sunion_test.go b/ms/sunion_test.go index 88f1c00d..a88610ac 100755 --- a/ms/sunion_test.go +++ b/ms/sunion_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/sunionstore.go b/ms/sunionstore.go index c91b9b02..76c91fa9 100755 --- a/ms/sunionstore.go +++ b/ms/sunionstore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/sunionstore_test.go b/ms/sunionstore_test.go index 578f583a..a7420101 100755 --- a/ms/sunionstore_test.go +++ b/ms/sunionstore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/time.go b/ms/time.go index c096bcf0..a44cf04f 100755 --- a/ms/time.go +++ b/ms/time.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/time_test.go b/ms/time_test.go index a588ca55..7bc3d3b3 100755 --- a/ms/time_test.go +++ b/ms/time_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/touch.go b/ms/touch.go index f7c2b5ec..67e03f88 100755 --- a/ms/touch.go +++ b/ms/touch.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/touch_test.go b/ms/touch_test.go index a9773857..c9230dcc 100755 --- a/ms/touch_test.go +++ b/ms/touch_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/ttl.go b/ms/ttl.go index 171717ba..77cfb54e 100755 --- a/ms/ttl.go +++ b/ms/ttl.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/ttl_test.go b/ms/ttl_test.go index 0249eda1..fc7c281e 100755 --- a/ms/ttl_test.go +++ b/ms/ttl_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/type.go b/ms/type.go index ae90f7db..6cdc657c 100755 --- a/ms/type.go +++ b/ms/type.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/type_test.go b/ms/type_test.go index b4daaa79..1c3d3cc7 100755 --- a/ms/type_test.go +++ b/ms/type_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zadd.go b/ms/zadd.go index b0173c8e..b9a19e54 100755 --- a/ms/zadd.go +++ b/ms/zadd.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zadd_test.go b/ms/zadd_test.go index e163ed0a..b4d9fbb4 100755 --- a/ms/zadd_test.go +++ b/ms/zadd_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zcard.go b/ms/zcard.go index 03e47148..83030dbb 100755 --- a/ms/zcard.go +++ b/ms/zcard.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zcard_test.go b/ms/zcard_test.go index bda1e0dd..edb53b25 100755 --- a/ms/zcard_test.go +++ b/ms/zcard_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zcount.go b/ms/zcount.go index 5f09a620..761bb620 100755 --- a/ms/zcount.go +++ b/ms/zcount.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zcount_test.go b/ms/zcount_test.go index bc816bcf..dbb99bda 100755 --- a/ms/zcount_test.go +++ b/ms/zcount_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zincrby.go b/ms/zincrby.go index 907434a3..54575d6c 100755 --- a/ms/zincrby.go +++ b/ms/zincrby.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zincrby_test.go b/ms/zincrby_test.go index d51732db..688135d2 100755 --- a/ms/zincrby_test.go +++ b/ms/zincrby_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zinterstore.go b/ms/zinterstore.go index 1a3cb415..580c1877 100755 --- a/ms/zinterstore.go +++ b/ms/zinterstore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zinterstore_test.go b/ms/zinterstore_test.go index e16c9ed9..05b11aa5 100755 --- a/ms/zinterstore_test.go +++ b/ms/zinterstore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zlexcount.go b/ms/zlexcount.go index 7445999a..e8a153e6 100755 --- a/ms/zlexcount.go +++ b/ms/zlexcount.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zlexcount_test.go b/ms/zlexcount_test.go index f7ca4ae4..db0234fa 100755 --- a/ms/zlexcount_test.go +++ b/ms/zlexcount_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrange.go b/ms/zrange.go index a3c672cf..93157c10 100755 --- a/ms/zrange.go +++ b/ms/zrange.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrange_test.go b/ms/zrange_test.go index 7b78b4ee..3d4adece 100755 --- a/ms/zrange_test.go +++ b/ms/zrange_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrangebylex.go b/ms/zrangebylex.go index 5a94f5df..e0c2966d 100755 --- a/ms/zrangebylex.go +++ b/ms/zrangebylex.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrangebylex_test.go b/ms/zrangebylex_test.go index 908f66a6..eeeca540 100755 --- a/ms/zrangebylex_test.go +++ b/ms/zrangebylex_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrangebyscore.go b/ms/zrangebyscore.go index b2f74b94..22b286fc 100755 --- a/ms/zrangebyscore.go +++ b/ms/zrangebyscore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrangebyscore_test.go b/ms/zrangebyscore_test.go index 815219f7..a3edd5fe 100755 --- a/ms/zrangebyscore_test.go +++ b/ms/zrangebyscore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrank.go b/ms/zrank.go index eb6a0499..f7873882 100755 --- a/ms/zrank.go +++ b/ms/zrank.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrank_test.go b/ms/zrank_test.go index fffa4aa4..954663e9 100755 --- a/ms/zrank_test.go +++ b/ms/zrank_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrem.go b/ms/zrem.go index 1ec136b5..38d26e1b 100755 --- a/ms/zrem.go +++ b/ms/zrem.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrem_test.go b/ms/zrem_test.go index f693c141..0f842cf3 100755 --- a/ms/zrem_test.go +++ b/ms/zrem_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zremrangebylex.go b/ms/zremrangebylex.go index 4d0567cf..78fe1cca 100755 --- a/ms/zremrangebylex.go +++ b/ms/zremrangebylex.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zremrangebylex_test.go b/ms/zremrangebylex_test.go index c586a880..12cf70de 100755 --- a/ms/zremrangebylex_test.go +++ b/ms/zremrangebylex_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zremrangebyrank.go b/ms/zremrangebyrank.go index cfb48f10..f0bf4556 100755 --- a/ms/zremrangebyrank.go +++ b/ms/zremrangebyrank.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zremrangebyrank_test.go b/ms/zremrangebyrank_test.go index 803bd46c..d8e10bb2 100755 --- a/ms/zremrangebyrank_test.go +++ b/ms/zremrangebyrank_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zremrangebyscore.go b/ms/zremrangebyscore.go index ac094db4..4f79236b 100755 --- a/ms/zremrangebyscore.go +++ b/ms/zremrangebyscore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zremrangebyscore_test.go b/ms/zremrangebyscore_test.go index 4002242b..21d194a1 100755 --- a/ms/zremrangebyscore_test.go +++ b/ms/zremrangebyscore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrevrange.go b/ms/zrevrange.go index af18a237..c7354fd5 100755 --- a/ms/zrevrange.go +++ b/ms/zrevrange.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrevrange_test.go b/ms/zrevrange_test.go index 8597e11b..82b42f44 100755 --- a/ms/zrevrange_test.go +++ b/ms/zrevrange_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrevrangebylex.go b/ms/zrevrangebylex.go index 143ae9f4..db9488d4 100755 --- a/ms/zrevrangebylex.go +++ b/ms/zrevrangebylex.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrevrangebylex_test.go b/ms/zrevrangebylex_test.go index c7a4879e..400e7a9b 100755 --- a/ms/zrevrangebylex_test.go +++ b/ms/zrevrangebylex_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrevrangebyscore.go b/ms/zrevrangebyscore.go index b8139098..58aee6c6 100755 --- a/ms/zrevrangebyscore.go +++ b/ms/zrevrangebyscore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrevrangebyscore_test.go b/ms/zrevrangebyscore_test.go index 57f1a3eb..408423d5 100755 --- a/ms/zrevrangebyscore_test.go +++ b/ms/zrevrangebyscore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zrevrank.go b/ms/zrevrank.go index d4777df1..40549013 100755 --- a/ms/zrevrank.go +++ b/ms/zrevrank.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zrevrank_test.go b/ms/zrevrank_test.go index dcbdf920..e4305121 100755 --- a/ms/zrevrank_test.go +++ b/ms/zrevrank_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zscan.go b/ms/zscan.go index 7b3f7712..35050058 100755 --- a/ms/zscan.go +++ b/ms/zscan.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zscan_test.go b/ms/zscan_test.go index 4fbd2f88..4c973b12 100755 --- a/ms/zscan_test.go +++ b/ms/zscan_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zscore.go b/ms/zscore.go index 13b2ae2b..bd37b568 100755 --- a/ms/zscore.go +++ b/ms/zscore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zscore_test.go b/ms/zscore_test.go index bc37e2e4..6f367801 100755 --- a/ms/zscore_test.go +++ b/ms/zscore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/ms/zunionstore.go b/ms/zunionstore.go index 12b3c80b..5b185514 100755 --- a/ms/zunionstore.go +++ b/ms/zunionstore.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms import ( diff --git a/ms/zunionstore_test.go b/ms/zunionstore_test.go index c7627836..26b66941 100755 --- a/ms/zunionstore_test.go +++ b/ms/zunionstore_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ms_test import ( diff --git a/realtime/count.go b/realtime/count.go index 2341e5d0..4e68dd62 100644 --- a/realtime/count.go +++ b/realtime/count.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//Count returns the number of other subscriptions on that room. +// Count returns the number of other subscriptions on that room. func (r *Realtime) Count(index, collection, roomID string) (int, error) { if index == "" || collection == "" || roomID == "" { return -1, types.NewError("Realtime.Count: index, collection and roomID required", 400) diff --git a/realtime/count_test.go b/realtime/count_test.go index 12bb8279..933db29a 100644 --- a/realtime/count_test.go +++ b/realtime/count_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime_test import ( diff --git a/realtime/join.go b/realtime/join.go index 80082ad8..0476d181 100644 --- a/realtime/join.go +++ b/realtime/join.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime import ( diff --git a/realtime/join_test.go b/realtime/join_test.go index b78039e3..e12bafa0 100644 --- a/realtime/join_test.go +++ b/realtime/join_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime_test import ( diff --git a/realtime/list.go b/realtime/list.go index a770f8b8..a3449fd6 100644 --- a/realtime/list.go +++ b/realtime/list.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime import ( diff --git a/realtime/list_test.go b/realtime/list_test.go index 2756857e..4726a35d 100644 --- a/realtime/list_test.go +++ b/realtime/list_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime_test import ( diff --git a/realtime/publish.go b/realtime/publish.go index 24f52229..4eb539a8 100644 --- a/realtime/publish.go +++ b/realtime/publish.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime import "github.com/kuzzleio/sdk-go/types" diff --git a/realtime/publish_test.go b/realtime/publish_test.go index 8d070c41..cd13511d 100644 --- a/realtime/publish_test.go +++ b/realtime/publish_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime_test import ( diff --git a/realtime/realtime.go b/realtime/realtime.go index 2a8b96c1..12d5b576 100644 --- a/realtime/realtime.go +++ b/realtime/realtime.go @@ -1,13 +1,27 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime import "github.com/kuzzleio/sdk-go/types" -// Realtime is a realtime controller +// Realtime controller type Realtime struct { k types.IKuzzle } -// NewRealtime is a realtime controller constructor +// NewRealtime instanciates a new realtime controller func NewRealtime(k types.IKuzzle) *Realtime { return &Realtime{k} } diff --git a/realtime/subscribe.go b/realtime/subscribe.go index df2e018b..03326341 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime import ( diff --git a/realtime/subscribe_test.go b/realtime/subscribe_test.go index 04264e51..94a53a8e 100644 --- a/realtime/subscribe_test.go +++ b/realtime/subscribe_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime_test import ( diff --git a/realtime/unsubscribe.go b/realtime/unsubscribe.go index 50e6368d..63544ba2 100644 --- a/realtime/unsubscribe.go +++ b/realtime/unsubscribe.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime import ( diff --git a/realtime/unsubscribe_test.go b/realtime/unsubscribe_test.go index bf01b18d..b913f604 100644 --- a/realtime/unsubscribe_test.go +++ b/realtime/unsubscribe_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime_test import ( diff --git a/realtime/validate.go b/realtime/validate.go index fc0e132e..f761e401 100644 --- a/realtime/validate.go +++ b/realtime/validate.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime import ( diff --git a/realtime/validate_test.go b/realtime/validate_test.go index a2bd065a..f0c3c65c 100644 --- a/realtime/validate_test.go +++ b/realtime/validate_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package realtime_test import ( diff --git a/security/createCredentials.go b/security/createCredentials.go index 8da699f7..09da3952 100644 --- a/security/createCredentials.go +++ b/security/createCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/createCredentials_test.go b/security/createCredentials_test.go index 74ce0151..fa39bc9d 100644 --- a/security/createCredentials_test.go +++ b/security/createCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/createFirstAdmin.go b/security/createFirstAdmin.go index 2d33c8fe..9e3bdd26 100644 --- a/security/createFirstAdmin.go +++ b/security/createFirstAdmin.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/createFirstAdmin_test.go b/security/createFirstAdmin_test.go index 5323fa88..8a48c48f 100644 --- a/security/createFirstAdmin_test.go +++ b/security/createFirstAdmin_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/createOrReplaceProfile.go b/security/createOrReplaceProfile.go index 12671ed2..aa6f5363 100644 --- a/security/createOrReplaceProfile.go +++ b/security/createOrReplaceProfile.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/createOrReplaceProfile_test.go b/security/createOrReplaceProfile_test.go index 19180d44..86897eb8 100644 --- a/security/createOrReplaceProfile_test.go +++ b/security/createOrReplaceProfile_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/createOrReplaceRole.go b/security/createOrReplaceRole.go index 6e90df44..e345a161 100644 --- a/security/createOrReplaceRole.go +++ b/security/createOrReplaceRole.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/createOrReplaceRole_test.go b/security/createOrReplaceRole_test.go index c16ec44d..a0fa73e2 100644 --- a/security/createOrReplaceRole_test.go +++ b/security/createOrReplaceRole_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/createProfile.go b/security/createProfile.go index e44dc25c..d9f613b1 100644 --- a/security/createProfile.go +++ b/security/createProfile.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/createProfile_test.go b/security/createProfile_test.go index 289caaba..149759bb 100644 --- a/security/createProfile_test.go +++ b/security/createProfile_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/createRestrictedUser.go b/security/createRestrictedUser.go index 2fa62577..b44493e4 100644 --- a/security/createRestrictedUser.go +++ b/security/createRestrictedUser.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/createRestrictedUser_test.go b/security/createRestrictedUser_test.go index 08c3f96e..71f5cadd 100644 --- a/security/createRestrictedUser_test.go +++ b/security/createRestrictedUser_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/createRole.go b/security/createRole.go index d6d3e58a..78dde2bf 100644 --- a/security/createRole.go +++ b/security/createRole.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/createRole_test.go b/security/createRole_test.go index 954d1273..2f193918 100644 --- a/security/createRole_test.go +++ b/security/createRole_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/createUser.go b/security/createUser.go index 0c69db2b..a1780fad 100644 --- a/security/createUser.go +++ b/security/createUser.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/createUser_test.go b/security/createUser_test.go index cb9a4a88..7045d893 100644 --- a/security/createUser_test.go +++ b/security/createUser_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/deleteCredentials.go b/security/deleteCredentials.go index 49783d01..a3ba5fae 100644 --- a/security/deleteCredentials.go +++ b/security/deleteCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/deleteCredentials_test.go b/security/deleteCredentials_test.go index e5ef0f7d..d190bb22 100644 --- a/security/deleteCredentials_test.go +++ b/security/deleteCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/deleteProfile.go b/security/deleteProfile.go index c2d0273c..6aaa901c 100644 --- a/security/deleteProfile.go +++ b/security/deleteProfile.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/deleteProfile_test.go b/security/deleteProfile_test.go index 2085ed42..c384896b 100644 --- a/security/deleteProfile_test.go +++ b/security/deleteProfile_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/deleteRole.go b/security/deleteRole.go index 6ec7dee4..35be04f2 100644 --- a/security/deleteRole.go +++ b/security/deleteRole.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/deleteRole_test.go b/security/deleteRole_test.go index f76cdbe7..ca69b472 100644 --- a/security/deleteRole_test.go +++ b/security/deleteRole_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/deleteUser.go b/security/deleteUser.go index 1dfecd17..bd3a516f 100644 --- a/security/deleteUser.go +++ b/security/deleteUser.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/deleteUser_test.go b/security/deleteUser_test.go index 096fffa4..1f170c6f 100644 --- a/security/deleteUser_test.go +++ b/security/deleteUser_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getAllCredentialFields.go b/security/getAllCredentialFields.go index c4eaf887..74cdd609 100644 --- a/security/getAllCredentialFields.go +++ b/security/getAllCredentialFields.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getAllCredentialFields_test.go b/security/getAllCredentialFields_test.go index 011b7b31..77a61fbd 100644 --- a/security/getAllCredentialFields_test.go +++ b/security/getAllCredentialFields_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getCredentialFields.go b/security/getCredentialFields.go index 02089078..36b327e6 100644 --- a/security/getCredentialFields.go +++ b/security/getCredentialFields.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getCredentialFields_test.go b/security/getCredentialFields_test.go index 1ac3ee29..1c9a8a90 100644 --- a/security/getCredentialFields_test.go +++ b/security/getCredentialFields_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getCredentials.go b/security/getCredentials.go index 5b604fea..2c782de4 100644 --- a/security/getCredentials.go +++ b/security/getCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getCredentialsById.go b/security/getCredentialsById.go index bfa94422..5f983e20 100644 --- a/security/getCredentialsById.go +++ b/security/getCredentialsById.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getCredentialsById_test.go b/security/getCredentialsById_test.go index b10f5201..9dee3d19 100644 --- a/security/getCredentialsById_test.go +++ b/security/getCredentialsById_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getCredentials_test.go b/security/getCredentials_test.go index c0a54d70..35327c86 100644 --- a/security/getCredentials_test.go +++ b/security/getCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getProfile.go b/security/getProfile.go index 657f77f8..e5955b83 100644 --- a/security/getProfile.go +++ b/security/getProfile.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getProfileMapping.go b/security/getProfileMapping.go index 26f2e3ca..304977c5 100644 --- a/security/getProfileMapping.go +++ b/security/getProfileMapping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getProfileMapping_test.go b/security/getProfileMapping_test.go index 9c018144..90b48086 100644 --- a/security/getProfileMapping_test.go +++ b/security/getProfileMapping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getProfileRights.go b/security/getProfileRights.go index edb0367e..b313762d 100644 --- a/security/getProfileRights.go +++ b/security/getProfileRights.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getProfileRights_test.go b/security/getProfileRights_test.go index 1ee62877..a78d5bae 100644 --- a/security/getProfileRights_test.go +++ b/security/getProfileRights_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getProfile_test.go b/security/getProfile_test.go index 81815607..5383f633 100644 --- a/security/getProfile_test.go +++ b/security/getProfile_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getRole.go b/security/getRole.go index 67c8e73f..2ac7c9c0 100644 --- a/security/getRole.go +++ b/security/getRole.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getRoleMapping.go b/security/getRoleMapping.go index 3cb19369..f043cb4f 100644 --- a/security/getRoleMapping.go +++ b/security/getRoleMapping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getRoleMapping_test.go b/security/getRoleMapping_test.go index 6d072bc9..89c8b02f 100644 --- a/security/getRoleMapping_test.go +++ b/security/getRoleMapping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getRole_test.go b/security/getRole_test.go index b706f3f2..a11649cf 100644 --- a/security/getRole_test.go +++ b/security/getRole_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getUser.go b/security/getUser.go index 375dfe1d..d59aeed8 100644 --- a/security/getUser.go +++ b/security/getUser.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getUserMapping.go b/security/getUserMapping.go index 767e6d30..bd905c21 100644 --- a/security/getUserMapping.go +++ b/security/getUserMapping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getUserMapping_test.go b/security/getUserMapping_test.go index 7cea93e0..839cf558 100644 --- a/security/getUserMapping_test.go +++ b/security/getUserMapping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getUserRights.go b/security/getUserRights.go index 4ae66cdb..d982bd15 100644 --- a/security/getUserRights.go +++ b/security/getUserRights.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/getUserRights_test.go b/security/getUserRights_test.go index e142422e..a75d23ea 100644 --- a/security/getUserRights_test.go +++ b/security/getUserRights_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/getUser_test.go b/security/getUser_test.go index afe58afe..f8ec030e 100644 --- a/security/getUser_test.go +++ b/security/getUser_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/hasCredentials.go b/security/hasCredentials.go index 90d440ad..83a12ee9 100644 --- a/security/hasCredentials.go +++ b/security/hasCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/hasCredentials_test.go b/security/hasCredentials_test.go index 0deb8752..35eafeb9 100644 --- a/security/hasCredentials_test.go +++ b/security/hasCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/is_action_allowed.go b/security/is_action_allowed.go index e912dd92..182c5700 100644 --- a/security/is_action_allowed.go +++ b/security/is_action_allowed.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/is_action_allowed_test.go b/security/is_action_allowed_test.go index 31fbdf87..3822d71e 100644 --- a/security/is_action_allowed_test.go +++ b/security/is_action_allowed_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/json_profile.go b/security/json_profile.go index d1406a92..daf490c0 100644 --- a/security/json_profile.go +++ b/security/json_profile.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/json_role.go b/security/json_role.go index aa5e3952..55691ef3 100644 --- a/security/json_role.go +++ b/security/json_role.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/json_user.go b/security/json_user.go index f42935c6..4ac5b317 100644 --- a/security/json_user.go +++ b/security/json_user.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/mDeleteCredentials.go b/security/mDeleteCredentials.go index d3b77df8..3e86795b 100644 --- a/security/mDeleteCredentials.go +++ b/security/mDeleteCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/mDeleteCredentials_test.go b/security/mDeleteCredentials_test.go index 0ce262d3..379a3be5 100644 --- a/security/mDeleteCredentials_test.go +++ b/security/mDeleteCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/mDeleteRoles.go b/security/mDeleteRoles.go index 0ef8e556..e1b9fae2 100644 --- a/security/mDeleteRoles.go +++ b/security/mDeleteRoles.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/mDeleteRoles_test.go b/security/mDeleteRoles_test.go index 882c9206..2034879a 100644 --- a/security/mDeleteRoles_test.go +++ b/security/mDeleteRoles_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/mDeleteUsers.go b/security/mDeleteUsers.go index d84dcb16..04c59299 100644 --- a/security/mDeleteUsers.go +++ b/security/mDeleteUsers.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/mDeleteUsers_test.go b/security/mDeleteUsers_test.go index b427c81b..d8e1b14d 100644 --- a/security/mDeleteUsers_test.go +++ b/security/mDeleteUsers_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/mGetProfiles.go b/security/mGetProfiles.go index 86d3e426..692758cc 100644 --- a/security/mGetProfiles.go +++ b/security/mGetProfiles.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/mGetProfiles_test.go b/security/mGetProfiles_test.go index fee96ae2..ed061067 100644 --- a/security/mGetProfiles_test.go +++ b/security/mGetProfiles_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/mGetRoles.go b/security/mGetRoles.go index 8d9841f0..ec3b4bc0 100644 --- a/security/mGetRoles.go +++ b/security/mGetRoles.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/mGetRoles_test.go b/security/mGetRoles_test.go index 62ca433f..f92fa3f7 100644 --- a/security/mGetRoles_test.go +++ b/security/mGetRoles_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/profile.go b/security/profile.go index 16b897fa..7a8cb0a2 100644 --- a/security/profile.go +++ b/security/profile.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/replaceUser.go b/security/replaceUser.go index 3a03ea66..bb15e783 100644 --- a/security/replaceUser.go +++ b/security/replaceUser.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/replaceUser_test.go b/security/replaceUser_test.go index 21417561..74c8f35a 100644 --- a/security/replaceUser_test.go +++ b/security/replaceUser_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/role.go b/security/role.go index 8d1063ea..b05128d2 100644 --- a/security/role.go +++ b/security/role.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/searchProfiles.go b/security/searchProfiles.go index 1affd558..e703726a 100644 --- a/security/searchProfiles.go +++ b/security/searchProfiles.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/searchProfiles_test.go b/security/searchProfiles_test.go index 0b7b170b..d26a2cab 100644 --- a/security/searchProfiles_test.go +++ b/security/searchProfiles_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/searchRoles.go b/security/searchRoles.go index 8ce89418..5ec694c9 100644 --- a/security/searchRoles.go +++ b/security/searchRoles.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/searchRoles_test.go b/security/searchRoles_test.go index 23152a6f..a3f73432 100644 --- a/security/searchRoles_test.go +++ b/security/searchRoles_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/searchUsers.go b/security/searchUsers.go index 3e642b1d..6f3c6534 100644 --- a/security/searchUsers.go +++ b/security/searchUsers.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/searchUsers_test.go b/security/searchUsers_test.go index be0ae6db..cc7049f5 100644 --- a/security/searchUsers_test.go +++ b/security/searchUsers_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/security.go b/security/security.go index d4ff112c..a2f9fc72 100644 --- a/security/security.go +++ b/security/security.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/updateCredentials.go b/security/updateCredentials.go index a7bbf717..70cf528f 100644 --- a/security/updateCredentials.go +++ b/security/updateCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/updateCredentials_test.go b/security/updateCredentials_test.go index 7158bdb4..13d5edd2 100644 --- a/security/updateCredentials_test.go +++ b/security/updateCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/updateProfile.go b/security/updateProfile.go index e0666370..d1930a86 100644 --- a/security/updateProfile.go +++ b/security/updateProfile.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/updateProfileMapping.go b/security/updateProfileMapping.go index 97f3f640..bcd09103 100644 --- a/security/updateProfileMapping.go +++ b/security/updateProfileMapping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/updateProfileMapping_test.go b/security/updateProfileMapping_test.go index 074da0c3..e62fce93 100644 --- a/security/updateProfileMapping_test.go +++ b/security/updateProfileMapping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/updateProfile_test.go b/security/updateProfile_test.go index a01a5b86..32178f46 100644 --- a/security/updateProfile_test.go +++ b/security/updateProfile_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/updateRole.go b/security/updateRole.go index bccc1f1e..94274d58 100644 --- a/security/updateRole.go +++ b/security/updateRole.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/updateRoleMapping.go b/security/updateRoleMapping.go index 57433ef2..dc3dfbe5 100644 --- a/security/updateRoleMapping.go +++ b/security/updateRoleMapping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/updateRoleMapping_test.go b/security/updateRoleMapping_test.go index 83157b80..0f4beffb 100644 --- a/security/updateRoleMapping_test.go +++ b/security/updateRoleMapping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/updateRole_test.go b/security/updateRole_test.go index 75c0c473..3d870704 100644 --- a/security/updateRole_test.go +++ b/security/updateRole_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/updateUser.go b/security/updateUser.go index 18ac82f8..3bcc0f69 100644 --- a/security/updateUser.go +++ b/security/updateUser.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/updateUserMapping.go b/security/updateUserMapping.go index c1d511f1..86c37acc 100644 --- a/security/updateUserMapping.go +++ b/security/updateUserMapping.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/updateUserMapping_test.go b/security/updateUserMapping_test.go index aaff4105..e06a0fe0 100644 --- a/security/updateUserMapping_test.go +++ b/security/updateUserMapping_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/updateUser_test.go b/security/updateUser_test.go index 6b9a5a09..be789cef 100644 --- a/security/updateUser_test.go +++ b/security/updateUser_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/security/user.go b/security/user.go index 5221d497..762fc051 100644 --- a/security/user.go +++ b/security/user.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/validateCredentials.go b/security/validateCredentials.go index e931d019..ae5dc95e 100644 --- a/security/validateCredentials.go +++ b/security/validateCredentials.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security import ( diff --git a/security/validateCredentials_test.go b/security/validateCredentials_test.go index d90b8170..2d840a56 100644 --- a/security/validateCredentials_test.go +++ b/security/validateCredentials_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package security_test import ( diff --git a/server/adminExists.go b/server/adminExists.go index 100a6f79..975c9545 100644 --- a/server/adminExists.go +++ b/server/adminExists.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//AdminExists checks if an administrator account has been created, and return a boolean as a result. +// AdminExists checks if an administrator account has been created, and return a boolean as a result. func (s *Server) AdminExists(options types.QueryOptions) (bool, error) { result := make(chan *types.KuzzleResponse) diff --git a/server/adminExists_test.go b/server/adminExists_test.go index 8a1a6c2d..b3205cb0 100644 --- a/server/adminExists_test.go +++ b/server/adminExists_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server_test import ( diff --git a/server/getAllStats.go b/server/getAllStats.go index 1bdc21ee..551378eb 100644 --- a/server/getAllStats.go +++ b/server/getAllStats.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//GetAllStats get all Kuzzle usage statistics frames +// GetAllStats get all Kuzzle usage statistics frames func (s *Server) GetAllStats(options types.QueryOptions) (json.RawMessage, error) { result := make(chan *types.KuzzleResponse) diff --git a/server/getAllStats_test.go b/server/getAllStats_test.go index 116255aa..dfdb0fd6 100644 --- a/server/getAllStats_test.go +++ b/server/getAllStats_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server_test import ( diff --git a/server/getConfig.go b/server/getConfig.go index cc312225..52e7a8a9 100644 --- a/server/getConfig.go +++ b/server/getConfig.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//GetConfig returns the current Kuzzle configuration. +// GetConfig returns the current Kuzzle configuration. func (s *Server) GetConfig(options types.QueryOptions) (json.RawMessage, error) { result := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ diff --git a/server/getConfig_test.go b/server/getConfig_test.go index 4a9ad6cb..a698007a 100644 --- a/server/getConfig_test.go +++ b/server/getConfig_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server_test import ( diff --git a/server/getLastStats.go b/server/getLastStats.go index c07d3088..3ed13540 100644 --- a/server/getLastStats.go +++ b/server/getLastStats.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//GetLastStats get Kuzzle usage statistics +// GetLastStats get Kuzzle usage statistics func (s *Server) GetLastStats(options types.QueryOptions) (json.RawMessage, error) { result := make(chan *types.KuzzleResponse) diff --git a/server/getLastStats_test.go b/server/getLastStats_test.go index 0a7c63dd..4d4b4a9e 100644 --- a/server/getLastStats_test.go +++ b/server/getLastStats_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server_test import ( diff --git a/server/getStats.go b/server/getStats.go index a7b85c94..8267621e 100644 --- a/server/getStats.go +++ b/server/getStats.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( @@ -7,7 +21,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//GetStats get Kuzzle usage statistics +// GetStats get Kuzzle usage statistics func (s *Server) GetStats(startTime *time.Time, stopTime *time.Time, options types.QueryOptions) (json.RawMessage, error) { result := make(chan *types.KuzzleResponse) diff --git a/server/getStats_test.go b/server/getStats_test.go index 2b78897c..153d1f2a 100644 --- a/server/getStats_test.go +++ b/server/getStats_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server_test import ( diff --git a/server/info.go b/server/info.go index dda630bb..03717897 100644 --- a/server/info.go +++ b/server/info.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( @@ -6,7 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -//Info retrieves information about Kuzzle, its plugins and active services. +// Info retrieves information about Kuzzle, its plugins and active services. func (s *Server) Info(options types.QueryOptions) (json.RawMessage, error) { result := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ diff --git a/server/info_test.go b/server/info_test.go index 6d3d513c..bbda6aea 100644 --- a/server/info_test.go +++ b/server/info_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server_test import ( diff --git a/server/now.go b/server/now.go index f6e45642..0b5bcca2 100644 --- a/server/now.go +++ b/server/now.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( diff --git a/server/now_test.go b/server/now_test.go index e506a152..f4035446 100644 --- a/server/now_test.go +++ b/server/now_test.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server_test import ( diff --git a/server/server.go b/server/server.go index 9e2e94bf..4c130ba4 100644 --- a/server/server.go +++ b/server/server.go @@ -1,13 +1,29 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package server import ( "github.com/kuzzleio/sdk-go/types" ) +// Server controller type Server struct { k types.IKuzzle } +// NewServer instanciates a new server controller func NewServer(k types.IKuzzle) *Server { return &Server{k} } diff --git a/state/state.go b/state/state.go index 77c4ea06..2f77233c 100644 --- a/state/state.go +++ b/state/state.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package state const ( diff --git a/types/consts.go b/types/consts.go index eed0bb84..c837182b 100644 --- a/types/consts.go +++ b/types/consts.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types // Scopes constants diff --git a/types/ikuzzle.go b/types/ikuzzle.go index 641919b9..4af9d962 100644 --- a/types/ikuzzle.go +++ b/types/ikuzzle.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types import ( diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index 48f3232e..6d946c3c 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types type KuzzleRequest struct { diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index 5a6b9cf5..ec50fcb5 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types import ( @@ -6,12 +20,14 @@ import ( ) type ( + // KuzzleError is a custom Error type for Kuzzle KuzzleError struct { Message string `json:"message"` Stack string `json:"stack"` Status int `json:"status"` } + // Meta contains metadata Meta struct { Author string `json:"author"` CreatedAt int `json:"createdAt"` @@ -21,6 +37,7 @@ type ( DeletedAt int `json:"deletedAt"` } + // NotificationResult contains NotificationResult struct { Id string `json:"_id"` Meta *Meta `json:"_meta"` @@ -28,6 +45,7 @@ type ( Count int `json:"count"` } + // KuzzleNotification is a notification from Kuzzle KuzzleNotification struct { RequestId string `json:"requestId"` Result *NotificationResult `json:"result"` @@ -47,6 +65,7 @@ type ( Error *KuzzleError `json:"error"` } + // KuzzleResponse is a response to a KuzzleRequest KuzzleResponse struct { RequestId string `json:"requestId"` Result json.RawMessage `json:"result"` @@ -252,6 +271,7 @@ func (e *KuzzleError) Error() string { return msg } +// NewError instanciates a new KuzzleError func NewError(msg string, status ...int) *KuzzleError { err := &KuzzleError{Message: msg} diff --git a/types/options.go b/types/options.go index 89dc7806..5708dba5 100644 --- a/types/options.go +++ b/types/options.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types import ( @@ -9,6 +23,7 @@ const ( Manual ) +// Options provides a public access to options private struct type Options interface { QueueTTL() time.Duration SetQueueTTL(time.Duration) *options @@ -183,6 +198,7 @@ func (o *options) SetSslConnection(v bool) *options { return o } +// NewOptions instanciates new Options with default values func NewOptions() *options { return &options{ queueTTL: 120000, diff --git a/types/query_object.go b/types/query_object.go index 92d67ab8..611e594d 100644 --- a/types/query_object.go +++ b/types/query_object.go @@ -1,9 +1,24 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types import ( "time" ) +// QueryObject contains items to perform queries type QueryObject struct { Query []byte Options QueryOptions diff --git a/types/query_options.go b/types/query_options.go index 7b063b4d..2f46111d 100644 --- a/types/query_options.go +++ b/types/query_options.go @@ -1,5 +1,20 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types +// QueryOptions provides a public access to queryOptions private struct type QueryOptions interface { Queuable() bool SetQueuable(bool) *queryOptions @@ -390,6 +405,7 @@ func (qo *queryOptions) ID() string { return qo._id } +// NewQueryOptions instanciates a new QueryOptions with default values func NewQueryOptions() *queryOptions { return &queryOptions{ size: 10, diff --git a/types/room.go b/types/room.go new file mode 100644 index 00000000..f183bc1d --- /dev/null +++ b/types/room.go @@ -0,0 +1,38 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package types + +import "sync" + +// SubscribeResponse is a response given after a new subscriptions +type SubscribeResponse struct { + Room IRoom + Error error +} + +// IRoom provides functions to manage Room +type IRoom interface { + Subscribe(realtimeNotificationChannel chan<- KuzzleNotification) + Unsubscribe() error + RealtimeChannel() chan<- KuzzleNotification + ResponseChannel() chan SubscribeResponse + RoomId() string + Filters() interface{} + Channel() string + Id() string + SubscribeToSelf() bool +} + +type RoomList = sync.Map diff --git a/types/room_options.go b/types/room_options.go index 1781e8bb..9d74e3de 100644 --- a/types/room_options.go +++ b/types/room_options.go @@ -1,3 +1,17 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types type roomOptions struct { @@ -9,6 +23,7 @@ type roomOptions struct { autoResubscribe bool } +// RoomOptions provides a public access to roomOptions private struct type RoomOptions interface { Scope() string SetScope(string) *roomOptions @@ -77,6 +92,7 @@ func (ro *roomOptions) SetAutoResubscribe(v bool) { ro.autoResubscribe = v } +// NewRoomOptions instanciates a new RoomOptions func NewRoomOptions() RoomOptions { return &roomOptions{ scope: SCOPE_ALL, diff --git a/types/search_result.go b/types/search_result.go index 55bb0865..7142bdd7 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -1,9 +1,24 @@ +// Copyright 2015-2017 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types import ( "encoding/json" ) +// SearchResult is a search result representation type SearchResult struct { Collection json.RawMessage Documents json.RawMessage @@ -14,7 +29,7 @@ type SearchResult struct { Filters *SearchFilters } -//NewSearchResult Search Result constructor +// NewSearchResult Search Result constructor func NewSearchResult(collection json.RawMessage, filters *SearchFilters, options QueryOptions, raw *KuzzleResponse) *SearchResult { type ParseSearchResult struct { Documents json.RawMessage `json:"hits"` From 7a4f02464a96f335774175e7cbf52b0941a8c993 Mon Sep 17 00:00:00 2001 From: jenow Date: Sun, 8 Apr 2018 20:05:50 +0200 Subject: [PATCH 083/363] wip remove json dependencies --- internal/wrappers/Makefile | 2 +- internal/wrappers/cgo/kuzzle/c_to_go.go | 107 +----------------- internal/wrappers/cgo/kuzzle/destructors.go | 71 +++++------- internal/wrappers/cgo/kuzzle/go_to_c.go | 69 +---------- internal/wrappers/cgo/kuzzle/kuzzle.go | 24 ++-- internal/wrappers/cgo/kuzzle/security.go | 4 +- internal/wrappers/headers/kuzzlesdk.h | 67 ++++++----- .../wrappers/headers/sdk_wrappers_internal.h | 3 +- kuzzle/query.go | 13 ++- types/kuzzle_request.go | 12 +- types/kuzzle_response.go | 2 +- 11 files changed, 97 insertions(+), 277 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index e15de116..80c6a1ca 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -16,7 +16,7 @@ CPP = g++ CPPFLAGS = -g -fPIC -std=c++11 INCS = -I$(HEADERSDIR) -I$(CPPDIR) -I$(ROOT_DIR)templates -I$(GOTARGETDIR) LDFLAGS = -L$(GOTARGETDIR) -LIBS = -lkuzzlesdk -ljson-c +LIBS = -lkuzzlesdk SRCS = kcore_wrap.cxx OBJS = $(SRCS:.cxx=.o) diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 8df009da..ed7d8436 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -16,74 +16,15 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func cToGoControllers(c *C.controllers) (*types.Controllers, error) { - if c == nil { - return nil, nil - } - - if JsonCType(c) != C.json_type_object { - return nil, types.NewError("Invalid controller structure", 400) - } - j := JsonCConvert(c) - controllers := &types.Controllers{} - - for controller, val := range j.(map[string]interface{}) { - rawController, ok := val.(map[string]interface{}) - if !ok { - return nil, types.NewError("Invalid controllers structure", 400) - } - - rawActions, ok := rawController["Actions"] - if !ok { - return nil, types.NewError("Invalid controllers structure", 400) - } - - actionsMap, ok := rawActions.(map[string]interface{}) - if !ok { - return nil, types.NewError("Invalid controllers structure", 400) - } - - controllers.Controllers[controller] = &types.Controller{} - for action, value := range actionsMap { - boolValue, ok := value.(bool) - if !ok { - return nil, types.NewError("Invalid controllers structure", 400) - } - - controllers.Controllers[controller].Actions[action] = boolValue - } - } - - return controllers, nil -} - -func cToGoRole(crole *C.role) (*security.Role, error) { - id := C.GoString(crole.id) - var controllers *types.Controllers - - if crole.controllers != nil { - c, err := cToGoControllers(crole.controllers) - - if err != nil { - return nil, err - } - controllers = c - } - - role := security.NewRole(id, controllers) - - return role, nil -} - func cToGoSearchFilters(searchFilters *C.search_filters) *types.SearchFilters { if searchFilters == nil { return nil } return &types.SearchFilters{ - Query: JsonCConvert(searchFilters.query), - Sort: JsonCConvert(searchFilters.sort).([]interface{}), - Aggregations: JsonCConvert(searchFilters.aggregations), - SearchAfter: JsonCConvert(searchFilters.search_after).([]interface{}), + Query: json.RawMessage(C.GoString(searchFilters.query)), + Sort: json.RawMessage(C.GoString(searchFilters.sort)), + Aggregations: json.RawMessage(C.GoString(searchFilters.aggregations)), + SearchAfter: json.RawMessage(C.GoString(searchFilters.search_after)), } } @@ -176,31 +117,6 @@ func cToGoProfile(p *C.profile) *security.Profile { return profile } -func cToGoUserData(cdata *C.user_data) (*types.UserData, error) { - if cdata == nil { - return nil, nil - } - - data := &types.UserData{} - - if cdata.content != nil { - err := json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(cdata.content))), data.Content) - if err != nil { - return nil, types.NewError(err.Error(), 400) - } - } - - if cdata.profile_ids_length > 0 { - size := int(cdata.profile_ids_length) - carray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(cdata.profile_ids))[:size:size] - for i := 0; i < size; i++ { - data.ProfileIds = append(data.ProfileIds, C.GoString(carray[i])) - } - } - - return data, nil -} - func cToGoUser(u *C.user) *security.User { if u == nil { return nil @@ -250,18 +166,3 @@ func cToGoSearchResult(s *C.search_result) *types.SearchResult { func cToGoKuzzleNotificationChannel(c *C.kuzzle_notification_listener) chan<- types.KuzzleNotification { return make(chan<- types.KuzzleNotification) } - -func cToGoRoomOptions(ro *C.room_options) types.RoomOptions { - var volatiles map[string]interface{} - - json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(ro.volatiles))), &volatiles) - - newOpt := types.NewRoomOptions() - newOpt.SetScope(C.GoString(ro.scope)) - newOpt.SetState(C.GoString(ro.state)) - newOpt.SetUsers(C.GoString(ro.user)) - newOpt.SetVolatile(volatiles) - newOpt.SetSubscribeToSelf(bool(ro.subscribe_to_self)) - - return newOpt -} diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index e779d674..8e0edad0 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -54,9 +54,9 @@ func kuzzle_free_kuzzle_request(st *C.kuzzle_request) { C.free_char_array(st.keys, st.keys_length) C.free_char_array(st.fields, st.fields_length) - kuzzle_free_json_object(st.body) - kuzzle_free_json_object(st.volatiles) - kuzzle_free_json_object(st.options) + C.free(unsafe.Pointer(st.body)) + C.free(unsafe.Pointer(st.volatiles)) + C.free(unsafe.Pointer(st.options)) C.free(unsafe.Pointer(st)) } @@ -66,7 +66,7 @@ func kuzzle_free_kuzzle_request(st *C.kuzzle_request) { //export kuzzle_free_query_object func kuzzle_free_query_object(st *C.query_object) { if st != nil { - kuzzle_free_json_object(st.query) + C.free(unsafe.Pointer(st.query)) C.free(unsafe.Pointer(st.request_id)) C.free(unsafe.Pointer(st)) @@ -95,7 +95,7 @@ func kuzzle_free_query_options(st *C.query_options) { C.free(unsafe.Pointer(st.scroll_id)) C.free(unsafe.Pointer(st.refresh)) C.free(unsafe.Pointer(st.if_exist)) - kuzzle_free_json_object(st.volatiles) + C.free(unsafe.Pointer(st.volatiles)) C.free(unsafe.Pointer(st)) } @@ -107,7 +107,7 @@ func kuzzle_free_room_options(st *C.room_options) { C.free(unsafe.Pointer(st.scope)) C.free(unsafe.Pointer(st.state)) C.free(unsafe.Pointer(st.user)) - kuzzle_free_json_object(st.volatiles) + C.free(unsafe.Pointer(st.volatiles)) C.free(unsafe.Pointer(st)) } } @@ -197,7 +197,7 @@ func kuzzle_free_profile(st *C.profile) { func _free_role(st *C.role) { if st != nil { C.free(unsafe.Pointer(st.id)) - kuzzle_free_json_object(st.controllers) + C.free(unsafe.Pointer(st.controllers)) } } @@ -211,7 +211,7 @@ func kuzzle_free_role(st *C.role) { func _free_user(st *C.user) { if st != nil { C.free(unsafe.Pointer(st.id)) - kuzzle_free_json_object(st.content) + C.free(unsafe.Pointer(st.content)) C.free_char_array(st.profile_ids, st.profile_ids_length) } } @@ -225,7 +225,7 @@ func kuzzle_free_user(st *C.user) { //export kuzzle_free_user_data func kuzzle_free_user_data(st *C.user_data) { if st != nil { - kuzzle_free_json_object(st.content) + C.free(unsafe.Pointer(st.content)) C.free_char_array(st.profile_ids, st.profile_ids_length) C.free(unsafe.Pointer(st)) } @@ -252,7 +252,7 @@ func kuzzle_free_notification_content(st *C.notification_content) { if st != nil { C.free(unsafe.Pointer(st.id)) kuzzle_free_meta(st.meta) - kuzzle_free_json_object(st.content) + C.free(unsafe.Pointer(st.content)) C.free(unsafe.Pointer(st)) } } @@ -274,7 +274,7 @@ func kuzzle_free_notification_result(st *C.notification_result) { C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) - kuzzle_free_json_object(st.volatiles) + C.free(unsafe.Pointer(st.volatiles)) kuzzle_free_notification_content(st.result) @@ -372,10 +372,10 @@ func kuzzle_free_user_result(st *C.user_result) { // and not the structure itself func _free_statistics(st *C.statistics) { if st != nil { - kuzzle_free_json_object(st.completed_requests) - kuzzle_free_json_object(st.connections) - kuzzle_free_json_object(st.failed_requests) - kuzzle_free_json_object(st.ongoing_requests) + C.free(unsafe.Pointer(st.completed_requests)) + C.free(unsafe.Pointer(st.connections)) + C.free(unsafe.Pointer(st.failed_requests)) + C.free(unsafe.Pointer(st.ongoing_requests)) } } @@ -447,8 +447,8 @@ func kuzzle_free_kuzzle_response(st *C.kuzzle_response) { C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) - kuzzle_free_json_object(st.result) - kuzzle_free_json_object(st.volatiles) + C.free(unsafe.Pointer(st.result)) + C.free(unsafe.Pointer(st.volatiles)) C.free(unsafe.Pointer(st)) } @@ -457,26 +457,7 @@ func kuzzle_free_kuzzle_response(st *C.kuzzle_response) { //export kuzzle_free_json_result func kuzzle_free_json_result(st *C.json_result) { if st != nil { - kuzzle_free_json_object(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_json_array_result -func kuzzle_free_json_array_result(st *C.json_array_result) { - if st != nil { - if st.result != nil { - jobjects := (*[1<<30 - 1]*C.json_object)(unsafe.Pointer(st.result))[:int(st.result_length):int(st.result_length)] - - for _, jobject := range jobjects { - kuzzle_free_json_object(jobject) - } - - C.free(unsafe.Pointer(st.result)) - } - + C.free(unsafe.Pointer(st.result)) C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) C.free(unsafe.Pointer(st)) @@ -543,10 +524,10 @@ func kuzzle_free_string_array_result(st *C.string_array_result) { //export kuzzle_free_search_filters func kuzzle_free_search_filters(st *C.search_filters) { if st != nil { - kuzzle_free_json_object(st.query) - kuzzle_free_json_object(st.sort) - kuzzle_free_json_object(st.aggregations) - kuzzle_free_json_object(st.search_after) + C.free(unsafe.Pointer(st.query)) + C.free(unsafe.Pointer(st.sort)) + C.free(unsafe.Pointer(st.aggregations)) + C.free(unsafe.Pointer(st.search_after)) C.free(unsafe.Pointer(st)) } } @@ -609,8 +590,8 @@ func kuzzle_free_shards_result(st *C.shards_result) { //export kuzzle_free_specification func kuzzle_free_specification(st *C.specification) { if st != nil { - kuzzle_free_json_object(st.fields) - kuzzle_free_json_object(st.validators) + C.free(unsafe.Pointer(st.fields)) + C.free(unsafe.Pointer(st.validators)) C.free(unsafe.Pointer(st)) } } @@ -644,7 +625,7 @@ func kuzzle_free_specification_result(st *C.specification_result) { func kuzzle_free_search_result(st *C.search_result) { if st != nil { kuzzle_free_query_options(st.options) - kuzzle_free_json_object(st.aggregations) + C.free(unsafe.Pointer(st.aggregations)) kuzzle_free_search_filters(st.filters) C.free(unsafe.Pointer(st.error)) @@ -703,7 +684,7 @@ func kuzzle_free_specification_search_result(st *C.specification_search_result) //export kuzzle_free_mapping func kuzzle_free_mapping(st *C.mapping) { if st != nil { - kuzzle_free_json_object(st.mapping) + C.free(unsafe.Pointer(st.mapping)) kuzzle_free_collection(st.collection) C.free(unsafe.Pointer(st)) } diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index ac0bd299..e5888207 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -61,7 +61,7 @@ func goToCNotificationContent(gNotifContent *types.NotificationResult) *C.notifi result.id = C.CString(gNotifContent.Id) result.meta = goToCMeta(gNotifContent.Meta) result.count = C.int(gNotifContent.Count) - result.content, _ = goToCJson(gNotifContent) + result.content = C.char(gNotifContent) return result } @@ -75,7 +75,7 @@ func goToCNotificationResult(gNotif *types.KuzzleNotification) *C.notification_r return result } - result.volatiles, _ = goToCJson(gNotif.Volatile) + result.volatiles = json.RawMessage(gNotif.Volatile) result.request_id = C.CString(gNotif.RequestId) result.result = goToCNotificationContent(gNotif.Result) result.index = C.CString(gNotif.Index) @@ -100,7 +100,7 @@ func goToCKuzzleResponse(gRes *types.KuzzleResponse) *C.kuzzle_response { result.request_id = C.CString(gRes.RequestId) bufResult := C.CString(string(gRes.Result)) - result.result = C.json_tokener_parse(bufResult) + result.result = C.CString(string(bufResult)) C.free(unsafe.Pointer(bufResult)) result.volatiles, _ = goToCJson(gRes.Volatile) @@ -468,69 +468,6 @@ func goToCSpecificationSearchResult(goRes *types.SpecificationSearchResult, err return result } -func goToCJson(data interface{}) (*C.json_object, error) { - r, err := json.Marshal(data) - if err != nil { - return nil, types.NewError(err.Error(), 400) - } - - buffer := C.CString(string(r)) - defer C.free(unsafe.Pointer(buffer)) - - tok := C.json_tokener_new() - defer C.json_tokener_free(tok) - - j := C.json_tokener_parse_ex(tok, buffer, C.int(C.strlen(buffer))) - jerr := C.json_tokener_get_error(tok) - if jerr != C.json_tokener_success { - return nil, types.NewError(C.GoString(C.json_tokener_error_desc(jerr)), 400) - } - - return j, nil -} - -func goToCJsonResult(goRes interface{}, err error) *C.json_result { - result := (*C.json_result)(C.calloc(1, C.sizeof_json_result)) - - if err != nil { - Set_json_result_error(result, err) - return result - } - - result.result, err = goToCJson(goRes) - if err != nil { - Set_json_result_error(result, err) - return result - } - - return result -} - -func goToCJsonArrayResult(goRes []interface{}, err error) *C.json_array_result { - result := (*C.json_array_result)(C.calloc(1, C.sizeof_json_array_result)) - - if err != nil { - Set_json_array_result_error(result, err) - return result - } - - result.result_length = C.size_t(len(goRes)) - if goRes != nil { - result.result = (**C.json_object)(C.calloc(result.result_length, C.sizeof_json_object_ptr)) - cArray := (*[1<<30 - 1]*C.json_object)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] - - for i, res := range goRes { - cArray[i], err = goToCJson(res) - if err != nil { - Set_json_array_result_error(result, err) - return result - } - } - } - - return result -} - func goToCProfileResult(k *C.kuzzle, res *security.Profile, err error) *C.profile_result { result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) if err != nil { diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 6883daba..110bc447 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -144,10 +144,10 @@ func kuzzle_get_offline_queue(k *C.kuzzle) *C.offline_queue { mquery, _ := json.Marshal(queryObject.Query) buffer := C.CString(string(mquery)) - queryObjects[idx].query = C.json_tokener_parse(buffer) + queryObjects[idx].query = C.GoString(buffer) C.free(unsafe.Pointer(buffer)) - idx += 1 + idx++ } return result @@ -183,14 +183,9 @@ func kuzzle_add_listener(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data go func() { res := <-c - var jsonRes *C.json_object r, _ := json.Marshal(res) - buffer := C.CString(string(r)) - jsonRes = C.json_tokener_parse(buffer) - C.free(unsafe.Pointer(buffer)) - - C.kuzzle_trigger_event(e, cb, jsonRes, data) + C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) }() } @@ -203,14 +198,11 @@ func kuzzle_once(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data unsafe.P go func() { res := <-c - var jsonRes *C.json_object r, _ := json.Marshal(res) - buffer := C.CString(string(r)) - jsonRes = C.json_tokener_parse(buffer) C.free(unsafe.Pointer(buffer)) - C.kuzzle_trigger_event(e, cb, jsonRes, data) + C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) }() } @@ -340,14 +332,14 @@ func kuzzle_get_ssl_connection(k *C.kuzzle) C.bool { } //export kuzzle_get_volatile -func kuzzle_get_volatile(k *C.kuzzle) *C.json_object { - r, _ := goToCJson((*kuzzle.Kuzzle)(k.instance).Volatile()) +func kuzzle_get_volatile(k *C.kuzzle) *C.char { + r, _ := C.char((*kuzzle.Kuzzle)(k.instance).Volatile()) return r } //export kuzzle_set_volatile -func kuzzle_set_volatile(k *C.kuzzle, v *C.json_object) { - (*kuzzle.Kuzzle)(k.instance).SetVolatile(JsonCConvert(v).(map[string]interface{})) +func kuzzle_set_volatile(k *C.kuzzle, v *C.char) { + (*kuzzle.Kuzzle)(k.instance).SetVolatile(json.RawMessage(string(v))) } func main() { diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index 45ebe688..2b06e6f2 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -89,7 +89,7 @@ func kuzzle_security_destroy_user(u *C.user) { C.free(unsafe.Pointer(u.id)) } if u.content != nil { - C.json_object_put(u.content) + C.free(u.content) } if u.profile_ids != nil { size := int(u.profile_ids_length) @@ -128,7 +128,7 @@ func kuzzle_security_destroy_role(r *C.role) { return } - C.json_object_put(r.controllers) + C.free(r.controllers) C.free(unsafe.Pointer(r)) } diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 5bff77d8..94e57f7a 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -1,14 +1,13 @@ #ifndef _KUZZLESDK_H_ #define _KUZZLESDK_H_ -#include #include #include #include //query object used by query() typedef struct { - json_object *query; + char *query; unsigned long long timestamp; char *request_id; } query_object; @@ -32,7 +31,7 @@ enum Event { ERROR }; -typedef void (*kuzzle_event_listener)(int, json_object*, void*); +typedef void (*kuzzle_event_listener)(int, char*, void*); //define a request typedef struct { @@ -41,7 +40,7 @@ typedef struct { char *action; char *index; char *collection; - json_object *body; + char *body; char *id; long from; long size; @@ -49,7 +48,7 @@ typedef struct { char *scroll_id; char *strategy; unsigned long long expires_in; - json_object *volatiles; + char *volatiles; char *scope; char *state; char *user; @@ -66,7 +65,7 @@ typedef struct { double lat; double distance; char *unit; - json_object *options; + char *options; char **keys; size_t keys_length; long cursor; @@ -126,12 +125,12 @@ typedef struct { char *state; char *user; bool subscribe_to_self; - json_object *volatiles; + char *volatiles; } room_options; typedef struct { void *instance; - json_object *filters; + char *filters; room_options *options; } room; @@ -156,7 +155,7 @@ typedef struct { char *refresh; char *if_exist; int retry_on_conflict; - json_object *volatiles; + char *volatiles; } query_options; enum Mode {AUTO, MANUAL}; @@ -188,7 +187,7 @@ typedef struct { /* === Security === */ -typedef json_object controllers; +typedef char controllers; typedef struct { char *index; @@ -211,14 +210,14 @@ typedef struct { typedef struct { char *id; - json_object *controllers; + char *controllers; kuzzle *kuzzle; } role; //kuzzle user typedef struct { char *id; - json_object *content; + char *content; char **profile_ids; size_t profile_ids_length; kuzzle *kuzzle; @@ -226,7 +225,7 @@ typedef struct { // user content passed to user constructor typedef struct { - json_object *content; + char *content; char **profile_ids; size_t profile_ids_length; } user_data; @@ -252,14 +251,14 @@ typedef struct { typedef struct { char *id; meta *meta; - json_object *content; + char *content; int count; } notification_content; typedef struct notification_result { char *request_id; notification_content *result; - json_object *volatiles; + char *volatiles; char *index; char *collection; char *controller; @@ -337,10 +336,10 @@ enum is_action_allowed { //statistics typedef struct { - json_object* completed_requests; - json_object* connections; - json_object* failed_requests; - json_object* ongoing_requests; + char* completed_requests; + char* connections; + char* failed_requests; + char* ongoing_requests; unsigned long long timestamp; } statistics; @@ -383,8 +382,8 @@ typedef struct token_validity { // raw Kuzzle response typedef struct kuzzle_response { char *request_id; - json_object *result; - json_object *volatiles; + char *result; + char *volatiles; char *index; char *collection; char *controller; @@ -405,15 +404,15 @@ typedef struct void_result { //any json result typedef struct json_result { - json_object *result; + char *result; int status; char *error; char *stack; } json_result; -//any array of json_object result +//any array of char result typedef struct json_array_result { - json_object **result; + char **result; size_t result_length; int status; char *error; @@ -478,10 +477,10 @@ typedef struct string_array_result { } string_array_result; typedef struct { - json_object* query; - json_object* sort; - json_object* aggregations; - json_object* search_after; + char* query; + char* sort; + char* aggregations; + char* search_after; } search_filters; typedef struct { @@ -522,8 +521,8 @@ typedef struct shards_result { typedef struct { bool strict; - json_object *fields; - json_object *validators; + char *fields; + char *validators; } specification; typedef struct { @@ -540,13 +539,13 @@ typedef struct specification_result { } specification_result; typedef struct search_result { - json_object *documents; + char *documents; unsigned fetched; unsigned total; - json_object *aggregations; + char *aggregations; search_filters *filters; query_options *options; - json_object *collection; + char *collection; int status; char *error; char *stack; @@ -588,7 +587,7 @@ typedef struct specification_search_result { } specification_search_result; typedef struct { - json_object *mapping; + char *mapping; collection *collection; } mapping; diff --git a/internal/wrappers/headers/sdk_wrappers_internal.h b/internal/wrappers/headers/sdk_wrappers_internal.h index 0a492139..33ec497f 100644 --- a/internal/wrappers/headers/sdk_wrappers_internal.h +++ b/internal/wrappers/headers/sdk_wrappers_internal.h @@ -4,7 +4,6 @@ typedef char *char_ptr; typedef policy *policy_ptr; typedef policy_restriction *policy_restriction_ptr; -typedef json_object *json_object_ptr; typedef query_object *query_object_ptr; // used by memory_storage.geopos @@ -18,7 +17,7 @@ static void kuzzle_notify(kuzzle_notification_listener f, notification_result* r f(res, data); } -static void kuzzle_trigger_event(int event, kuzzle_event_listener f, json_object* res, void* data) { +static void kuzzle_trigger_event(int event, kuzzle_event_listener f, char* res, void* data) { f(event, res, data); } diff --git a/kuzzle/query.go b/kuzzle/query.go index fbf4575a..9d251a95 100644 --- a/kuzzle/query.go +++ b/kuzzle/query.go @@ -2,6 +2,7 @@ package kuzzle import ( "encoding/json" + "fmt" "github.com/kuzzleio/sdk-go/state" "github.com/kuzzleio/sdk-go/types" @@ -34,9 +35,17 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r if options.Volatile() != nil { query.Volatile = options.Volatile() - query.Volatile["sdkVersion"] = version + + var mapped map[string]interface{} + json.Unmarshal(query.Volatile, &mapped) + + mapped["sdkVersion"] = version + + query.Volatile, _ = json.Marshal(mapped) + } else { - query.Volatile = types.VolatileData{"sdkVersion": version} + vol := fmt.Sprintf(`{"sdkVersion": "%s"}`, version) + query.Volatile = types.VolatileData(vol) } jsonRequest, _ := json.Marshal(query) diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index 48f3232e..ca9a84c8 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -1,5 +1,7 @@ package types +import "encoding/json" + type KuzzleRequest struct { RequestId string `json:"requestId,omitempty"` Controller string `json:"controller,omitempty"` @@ -54,7 +56,7 @@ type SubscribeQuery struct { Body interface{} `json:"body"` } -type VolatileData map[string]interface{} +type VolatileData json.RawMessage type UserData struct { ProfileIds []string `json:"profileIds"` @@ -97,8 +99,8 @@ type MSSortedSet struct { } type SearchFilters struct { - Query interface{} `json:"query,omitempty"` - Sort []interface{} `json:"sort,omitempty"` - Aggregations interface{} `json:"aggregations,omitempty"` - SearchAfter []interface{} `json:"search_after,omitempty"` + Query json.RawMessage `json:"query,omitempty"` + Sort json.RawMessage `json:"sort,omitempty"` + Aggregations json.RawMessage `json:"aggregations,omitempty"` + SearchAfter json.RawMessage `json:"search_after,omitempty"` } diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index 5a6b9cf5..e63e51d5 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -31,7 +31,7 @@ type ( KuzzleNotification struct { RequestId string `json:"requestId"` Result *NotificationResult `json:"result"` - Volatile VolatileData `json:"volatile"` + Volatile json.RawMessage `json:"volatile"` Index string `json:"index"` Collection string `json:"collection"` Controller string `json:"controller"` From 33cb988f780510bebb4a4ac517e04fa45b14f780 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 10 Apr 2018 17:27:20 +0200 Subject: [PATCH 084/363] Java Build CI (amd64, i386, armv7) * Fix C array lenght for 32bits compatibility --- buildspec-build-java_amd64.yml | 15 +++++++++++ buildspec-build-java_armv7.yml | 16 +++++++++++ buildspec-build-java_i686.yml | 15 +++++++++++ internal/wrappers/Makefile | 10 +++---- internal/wrappers/cgo/kuzzle/c_to_go.go | 10 +++---- internal/wrappers/cgo/kuzzle/destructors.go | 24 ++++++++--------- internal/wrappers/cgo/kuzzle/go_to_c.go | 30 ++++++++++----------- internal/wrappers/cgo/kuzzle/kuzzle.go | 2 +- internal/wrappers/cgo/kuzzle/security.go | 10 +++---- 9 files changed, 89 insertions(+), 43 deletions(-) create mode 100644 buildspec-build-java_amd64.yml create mode 100644 buildspec-build-java_armv7.yml create mode 100644 buildspec-build-java_i686.yml diff --git a/buildspec-build-java_amd64.yml b/buildspec-build-java_amd64.yml new file mode 100644 index 00000000..60e81be8 --- /dev/null +++ b/buildspec-build-java_amd64.yml @@ -0,0 +1,15 @@ +version: 0.2 + +phases: + install: + commands: + - docker pull kuzzleio/cgo-cross:amd64 + build: + commands: + - docker run --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/cgo-cross:amd64 & + - sleep 5 + - docker exec build-machine /build.sh + - docker kill build-machine +artifacts: + files: + - internal/wrappers/build/java/io/kuzzle/sdk/kuzzlesdk.jar diff --git a/buildspec-build-java_armv7.yml b/buildspec-build-java_armv7.yml new file mode 100644 index 00000000..f4b4be09 --- /dev/null +++ b/buildspec-build-java_armv7.yml @@ -0,0 +1,16 @@ +version: 0.2 + +phases: + install: + commands: + - docker run --rm --privileged multiarch/qemu-user-static:register + - docker pull kuzzleio/cgo-cross:armv7 + build: + commands: + - docker run --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/cgo-cross:armv7 & + - sleep 5 + - docker exec build-machine /build.sh + - docker kill build-machine +artifacts: + files: + - internal/wrappers/build/java/io/kuzzle/sdk/kuzzlesdk.jar diff --git a/buildspec-build-java_i686.yml b/buildspec-build-java_i686.yml new file mode 100644 index 00000000..ff1e1225 --- /dev/null +++ b/buildspec-build-java_i686.yml @@ -0,0 +1,15 @@ +version: 0.2 + +phases: + install: + commands: + - docker pull kuzzleio/cgo-cross:i386 + build: + commands: + - docker run --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/cgo-cross:i386 & + - sleep 5 + - docker exec build-machine /build.sh + - docker kill build-machine +artifacts: + files: + - internal/wrappers/build/java/io/kuzzle/sdk/kuzzlesdk.jar diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index e15de116..00538a42 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -1,6 +1,6 @@ ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) ROOTOUTDIR = $(ROOT_DIR)build -GOROOT ?= /usr/local +GOROOT ?= /usr/local/go GOCC = $(GOROOT)/bin/go JAVA_HOME ?= /usr/local PYTHON_INCLUDE_DIR ?= /usr/include/python3.5 @@ -12,7 +12,7 @@ GOTARGETSO = $(GOTARGETDIR)/libkuzzlesdk.so CPPDIR = $(ROOT_DIR)cpp HEADERSDIR = $(ROOT_DIR)headers -CPP = g++ +CPP = $(CXX) CPPFLAGS = -g -fPIC -std=c++11 INCS = -I$(HEADERSDIR) -I$(CPPDIR) -I$(ROOT_DIR)templates -I$(GOTARGETDIR) LDFLAGS = -L$(GOTARGETDIR) @@ -63,15 +63,15 @@ swig: $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i makedir: - mkdir -p $(OUTDIR) + mkdir -p $(OUTDIR) java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask - $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - $(JAVA_HOME)/bin/jar cf $(OUTDIR)/kuzzlesdk.jar $(OUTDIR)/*.class + taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java + taskset -c 1 $(JAVA_HOME)/bin/jar cf $(OUTDIR)/kuzzlesdk.jar $(OUTDIR)/*.class #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 67f8b893..5ee4a7b9 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -107,7 +107,7 @@ func cToGoStrings(arr **C.char, len C.size_t) []string { return nil } - tmpslice := (*[1 << 30]*C.char)(unsafe.Pointer(arr))[:len:len] + tmpslice := (*[1 << 27]*C.char)(unsafe.Pointer(arr))[:len:len] goStrings := make([]string, len) for i, s := range tmpslice { goStrings[i] = C.GoString(s) @@ -148,7 +148,7 @@ func cToGoPolicyRestriction(r *C.policy_restriction) *types.PolicyRestriction { return restriction } - slice := (*[1<<30 - 1]*C.char)(unsafe.Pointer(r.collections))[:r.collections_length:r.collections_length] + slice := (*[1<<28 - 1]*C.char)(unsafe.Pointer(r.collections))[:r.collections_length:r.collections_length] for _, col := range slice { restriction.Collections = append(restriction.Collections, C.GoString(col)) } @@ -165,7 +165,7 @@ func cToGoPolicy(p *C.policy) *types.Policy { return policy } - slice := (*[1<<30 - 1]*C.policy_restriction)(unsafe.Pointer(p.restricted_to))[:p.restricted_to_length] + slice := (*[1<<28 - 1]*C.policy_restriction)(unsafe.Pointer(p.restricted_to))[:p.restricted_to_length] for _, crestriction := range slice { policy.RestrictedTo = append(policy.RestrictedTo, cToGoPolicyRestriction(crestriction)) } @@ -182,7 +182,7 @@ func cToGoProfile(p *C.profile) *security.Profile { return profile } - slice := (*[1<<30 - 1]*C.policy)(unsafe.Pointer(p.policies))[:p.policies_length] + slice := (*[1<<28 - 1]*C.policy)(unsafe.Pointer(p.policies))[:p.policies_length] for _, cpolicy := range slice { profile.Policies = append(profile.Policies, cToGoPolicy(cpolicy)) } @@ -206,7 +206,7 @@ func cToGoUserData(cdata *C.user_data) (*types.UserData, error) { if cdata.profile_ids_length > 0 { size := int(cdata.profile_ids_length) - carray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(cdata.profile_ids))[:size:size] + carray := (*[1<<28 - 1]*C.char)(unsafe.Pointer(cdata.profile_ids))[:size:size] for i := 0; i < size; i++ { data.ProfileIds = append(data.ProfileIds, C.GoString(carray[i])) } diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 0cef8b17..32347578 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -90,7 +90,7 @@ func kuzzle_free_query_object(st *C.query_object) { //export kuzzle_free_offline_queue func kuzzle_free_offline_queue(st *C.offline_queue) { if st != nil && st.queries != nil { - queries := (*[1<<30 - 1]*C.query_object)(unsafe.Pointer(st.queries))[:int(st.queries_length):int(st.queries_length)] + queries := (*[1<<28 - 1]*C.query_object)(unsafe.Pointer(st.queries))[:int(st.queries_length):int(st.queries_length)] for _, query := range queries { kuzzle_free_query_object(query) @@ -166,7 +166,7 @@ func _free_policy(st *C.policy) { C.free(unsafe.Pointer(st.role_id)) if st.restricted_to != nil { - restrictions := (*[1<<30 - 1]C.policy_restriction)(unsafe.Pointer(st.restricted_to))[:int(st.restricted_to_length):int(st.restricted_to_length)] + restrictions := (*[1<<27 - 1]C.policy_restriction)(unsafe.Pointer(st.restricted_to))[:int(st.restricted_to_length):int(st.restricted_to_length)] for _, restriction := range restrictions { _free_policy_restriction(&restriction) @@ -190,7 +190,7 @@ func _free_profile(st *C.profile) { C.free(unsafe.Pointer(st.id)) if st.policies != nil { - policies := (*[1<<30 - 1]C.policy)(unsafe.Pointer(st.policies))[:int(st.policies_length):int(st.policies_length)] + policies := (*[1<<27 - 1]C.policy)(unsafe.Pointer(st.policies))[:int(st.policies_length):int(st.policies_length)] for _, policy := range policies { _free_policy(&policy) @@ -310,7 +310,7 @@ func kuzzle_free_profile_result(st *C.profile_result) { func kuzzle_free_profiles_result(st *C.profiles_result) { if st != nil { if st.profiles != nil { - profiles := (*[1<<30 - 1]C.profile)(unsafe.Pointer(st.profiles))[:int(st.profiles_length):int(st.profiles_length)] + profiles := (*[1<<27 - 1]C.profile)(unsafe.Pointer(st.profiles))[:int(st.profiles_length):int(st.profiles_length)] for _, profile := range profiles { _free_profile(&profile) @@ -357,7 +357,7 @@ func kuzzle_free_user_right(st *C.user_right) { func kuzzle_free_user_rights_result(st *C.user_rights_result) { if st != nil { if st.result != nil { - rights := (*[1<<30 - 1]C.user_right)(unsafe.Pointer(st.result))[:int(st.user_rights_length):int(st.user_rights_length)] + rights := (*[1<<26 - 1]C.user_right)(unsafe.Pointer(st.result))[:int(st.user_rights_length):int(st.user_rights_length)] for _, right := range rights { _free_user_right(&right) @@ -413,7 +413,7 @@ func kuzzle_free_statistics_result(st *C.statistics_result) { func kuzzle_free_all_statistics_result(st *C.all_statistics_result) { if st != nil { if st.result != nil { - stats := (*[1<<30 - 1]C.statistics)(unsafe.Pointer(st.result)) + stats := (*[1<<26 - 1]C.statistics)(unsafe.Pointer(st.result)) for _, stat := range stats { _free_statistics(&stat) @@ -482,7 +482,7 @@ func kuzzle_free_json_result(st *C.json_result) { func kuzzle_free_json_array_result(st *C.json_array_result) { if st != nil { if st.result != nil { - jobjects := (*[1<<30 - 1]*C.json_object)(unsafe.Pointer(st.result))[:int(st.result_length):int(st.result_length)] + jobjects := (*[1<<28 - 1]*C.json_object)(unsafe.Pointer(st.result))[:int(st.result_length):int(st.result_length)] for _, jobject := range jobjects { kuzzle_free_json_object(jobject) @@ -571,7 +571,7 @@ func kuzzle_free_profile_search(st *C.profile_search) { C.free(unsafe.Pointer(st.scroll_id)) if st.hits != nil { - hits := (*[1<<30 - 1]C.profile)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] + hits := (*[1<<27 - 1]C.profile)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] for _, profile := range hits { _free_profile(&profile) @@ -588,7 +588,7 @@ func kuzzle_free_profile_search(st *C.profile_search) { func kuzzle_free_role_search(st *C.role_search) { if st != nil { if st.hits != nil { - hits := (*[1<<30 - 1]C.role)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] + hits := (*[1<<27 - 1]C.role)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] for _, role := range hits { _free_role(&role) @@ -691,7 +691,7 @@ func kuzzle_free_search_roles_result(st *C.search_roles_result) { func kuzzle_free_specification_search(st *C.specification_search) { if st != nil { if st.hits != nil { - hits := (*[1<<30 - 1]C.specification_entry)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] + hits := (*[1<<27 - 1]C.specification_entry)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] for _, entry := range hits { _free_specification_entry(&entry) @@ -759,7 +759,7 @@ func kuzzle_free_collection_entry(st *C.collection_entry) { func kuzzle_free_collection_entry_result(st *C.collection_entry_result) { if st != nil { if st.result != nil { - entries := (*[1<<30 - 1]C.collection_entry)(unsafe.Pointer(st.result))[:int(st.result_length):int(st.result_length)] + entries := (*[1<<27 - 1]C.collection_entry)(unsafe.Pointer(st.result))[:int(st.result_length):int(st.result_length)] for _, entry := range entries { _free_collection_entry(&entry) @@ -778,7 +778,7 @@ func kuzzle_free_collection_entry_result(st *C.collection_entry_result) { func kuzzle_free_user_search(st *C.user_search) { if st != nil { if st.hits != nil { - hits := (*[1<<30 - 1]C.user)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] + hits := (*[1<<26 - 1]C.user)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] for _, user := range hits { _free_user(&user) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 67404928..91bf5afb 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -146,7 +146,7 @@ func goToCPolicyRestriction(restriction *types.PolicyRestriction, dest *C.policy if restriction.Collections != nil { crestriction.collections = (**C.char)(C.calloc(C.size_t(len(restriction.Collections)), C.sizeof_char_ptr)) - collections := (*[1<<30 - 1]*C.char)(unsafe.Pointer(crestriction.collections))[:len(restriction.Collections)] + collections := (*[1<<28 - 1]*C.char)(unsafe.Pointer(crestriction.collections))[:len(restriction.Collections)] for i, col := range restriction.Collections { collections[i] = C.CString(col) @@ -184,7 +184,7 @@ func goToCStringArrayResult(goRes []string, err error) *C.string_array_result { result.result = (**C.char)(C.calloc(C.size_t(len(goRes)), C.sizeof_char_ptr)) result.result_length = C.size_t(len(goRes)) - cArray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] + cArray := (*[1<<28 - 1]*C.char)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] for i, substring := range goRes { cArray[i] = C.CString(substring) @@ -258,7 +258,7 @@ func goToCPolicy(policy *types.Policy, dest *C.policy) *C.policy { if policy.RestrictedTo != nil { cpolicy.restricted_to = (*C.policy_restriction)(C.calloc(C.size_t(len(policy.RestrictedTo)), C.sizeof_policy_restriction)) - restrictions := (*[1<<30 - 1]C.policy_restriction)(unsafe.Pointer(cpolicy.restricted_to))[:len(policy.RestrictedTo)] + restrictions := (*[1<<27 - 1]C.policy_restriction)(unsafe.Pointer(cpolicy.restricted_to))[:len(policy.RestrictedTo)] for i, restriction := range policy.RestrictedTo { goToCPolicyRestriction(restriction, &restrictions[i]) @@ -282,7 +282,7 @@ func goToCProfile(k *C.kuzzle, profile *security.Profile, dest *C.profile) *C.pr if profile.Policies != nil { cprofile.policies = (*C.policy)(C.calloc(C.size_t(len(profile.Policies)), C.sizeof_policy)) - policies := (*[1<<30 - 1]C.policy)(unsafe.Pointer(cprofile.policies))[:len(profile.Policies)] + policies := (*[1<<27 - 1]C.policy)(unsafe.Pointer(cprofile.policies))[:len(profile.Policies)] for i, policy := range profile.Policies { goToCPolicy(policy, &policies[i]) } @@ -308,7 +308,7 @@ func goToCProfileSearchResult(k *C.kuzzle, res *security.ProfileSearchResult, er if len(res.Hits) > 0 { result.result.hits = (*C.profile)(C.calloc(C.size_t(len(res.Hits)), C.sizeof_profile)) - profiles := (*[1<<30 - 1]C.profile)(unsafe.Pointer(result.result.hits))[:len(res.Hits)] + profiles := (*[1<<27 - 1]C.profile)(unsafe.Pointer(result.result.hits))[:len(res.Hits)] for i, profile := range res.Hits { goToCProfile(k, profile, &profiles[i]) @@ -332,7 +332,7 @@ func goToCRoleSearchResult(k *C.kuzzle, res *security.RoleSearchResult, err erro if len(res.Hits) > 0 { result.result.hits = (*C.role)(C.calloc(C.size_t(len(res.Hits)), C.sizeof_role)) - cArray := (*[1<<30 - 1]C.role)(unsafe.Pointer(result.result.hits))[:len(res.Hits):len(res.Hits)] + cArray := (*[1<<27 - 1]C.role)(unsafe.Pointer(result.result.hits))[:len(res.Hits):len(res.Hits)] for i, role := range res.Hits { goToCRole(k, role, &cArray[i]) @@ -472,7 +472,7 @@ func goToCSpecificationSearchResult(goRes *types.SpecificationSearchResult, err if len(goRes.Hits) > 0 { result.result.hits = (*C.specification_entry)(C.calloc(C.size_t(len(goRes.Hits)), C.sizeof_specification_entry)) - cArray := (*[1<<30 - 1]C.specification_entry)(unsafe.Pointer(result.result.hits))[:len(goRes.Hits):len(goRes.Hits)] + cArray := (*[1<<27 - 1]C.specification_entry)(unsafe.Pointer(result.result.hits))[:len(goRes.Hits):len(goRes.Hits)] for i, spec := range goRes.Hits { goToCSpecificationEntry(&spec.Source, &cArray[i]) @@ -531,7 +531,7 @@ func goToCJsonArrayResult(goRes []interface{}, err error) *C.json_array_result { result.result_length = C.size_t(len(goRes)) if goRes != nil { result.result = (**C.json_object)(C.calloc(result.result_length, C.sizeof_json_object_ptr)) - cArray := (*[1<<30 - 1]*C.json_object)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] + cArray := (*[1<<28 - 1]*C.json_object)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] for i, res := range goRes { cArray[i], err = goToCJson(res) @@ -574,7 +574,7 @@ func goToCUserData(data *types.UserData) (*C.user_data, error) { if data.ProfileIds != nil { cdata.profile_ids_length = C.size_t(len(data.ProfileIds)) cdata.profile_ids = (**C.char)(C.calloc(C.size_t(len(data.ProfileIds)), C.sizeof_char_ptr)) - carray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(cdata.profile_ids))[:len(data.ProfileIds):len(data.ProfileIds)] + carray := (*[1<<27 - 1]*C.char)(unsafe.Pointer(cdata.profile_ids))[:len(data.ProfileIds):len(data.ProfileIds)] for i, profileId := range data.ProfileIds { carray[i] = C.CString(profileId) @@ -610,7 +610,7 @@ func goToCUser(k *C.kuzzle, user *security.User, dest *C.user) (*C.user, error) if user.ProfileIds != nil { cuser.profile_ids_length = C.size_t(len(user.ProfileIds)) cuser.profile_ids = (**C.char)(C.calloc(C.size_t(len(user.ProfileIds)), C.sizeof_char_ptr)) - carray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(cuser.profile_ids))[:len(user.ProfileIds):len(user.ProfileIds)] + carray := (*[1<<28 - 1]*C.char)(unsafe.Pointer(cuser.profile_ids))[:len(user.ProfileIds):len(user.ProfileIds)] for i, profileId := range user.ProfileIds { carray[i] = C.CString(profileId) @@ -649,7 +649,7 @@ func goToCProfilesResult(k *C.kuzzle, profiles []*security.Profile, err error) * if profiles != nil { result.profiles = (*C.profile)(C.calloc(C.size_t(len(profiles)), C.sizeof_profile)) - carray := (*[1<<30 - 1]C.profile)(unsafe.Pointer(result.profiles))[:len(profiles):len(profiles)] + carray := (*[1<<27 - 1]C.profile)(unsafe.Pointer(result.profiles))[:len(profiles):len(profiles)] for i, profile := range profiles { goToCProfile(k, profile, &carray[i]) @@ -670,7 +670,7 @@ func goToCRolesResult(k *C.kuzzle, roles []*security.Role, err error) *C.roles_r if roles != nil { result.roles = (*C.role)(C.calloc(C.size_t(len(roles)), C.sizeof_role)) - carray := (*[1<<30 - 1]C.role)(unsafe.Pointer(result.roles))[:len(roles):len(roles)] + carray := (*[1<<27 - 1]C.role)(unsafe.Pointer(result.roles))[:len(roles):len(roles)] for i, role := range roles { goToCRole(k, role, &carray[i]) @@ -711,7 +711,7 @@ func goToCUserRightsResult(rights []*types.UserRights, err error) *C.user_rights result.user_rights_length = C.size_t(len(rights)) if rights != nil { result.result = (*C.user_right)(C.calloc(C.size_t(len(rights)), C.sizeof_user_right)) - carray := (*[1<<30 - 1]C.user_right)(unsafe.Pointer(result.result))[:len(rights):len(rights)] + carray := (*[1<<26 - 1]C.user_right)(unsafe.Pointer(result.result))[:len(rights):len(rights)] for i, right := range rights { goToCUserRight(right, &carray[i]) @@ -738,7 +738,7 @@ func goToCUserSearchResult(k *C.kuzzle, res *security.UserSearchResult, err erro if len(res.Hits) > 0 { result.result.hits = (*C.user)(C.calloc(C.size_t(len(res.Hits)), C.sizeof_user)) - users := (*[1<<30 - 1]C.user)(unsafe.Pointer(result.result.hits))[:len(res.Hits)] + users := (*[1<<26 - 1]C.user)(unsafe.Pointer(result.result.hits))[:len(res.Hits)] for i, user := range res.Hits { goToCUser(k, user, &users[i]) @@ -767,7 +767,7 @@ func goToCCollectionListResult(collections []*types.CollectionsList, err error) if collections != nil { result.result = (*C.collection_entry)(C.calloc(C.size_t(len(collections)), C.sizeof_collection_entry)) result.result_length = C.size_t(len(collections)) - carray := (*[1<<30 - 1]C.collection_entry)(unsafe.Pointer(result.result))[:len(collections):len(collections)] + carray := (*[1<<27 - 1]C.collection_entry)(unsafe.Pointer(result.result))[:len(collections):len(collections)] for i, collection := range collections { fillCollectionList(collection, &carray[i]) diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 151faa07..5f6a70f9 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -148,7 +148,7 @@ func kuzzle_get_offline_queue(k *C.kuzzle) *C.offline_queue { result.queries_length = C.size_t(len(offlineQueue)) result.queries = (**C.query_object)(C.calloc(result.queries_length, C.sizeof_query_object_ptr)) - queryObjects := (*[1<<30 - 1]*C.query_object)(unsafe.Pointer(result.queries))[:result.queries_length:result.queries_length] + queryObjects := (*[1<<28 - 1]*C.query_object)(unsafe.Pointer(result.queries))[:result.queries_length:result.queries_length] idx := 0 for _, queryObject := range offlineQueue { diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index d122e328..d9bfcccc 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -53,15 +53,15 @@ func kuzzle_security_destroy_profile(p *C.profile) { if p.policies != nil { size := int(p.policies_length) - policies := (*[1<<30 - 1]*C.policy)(unsafe.Pointer(p.policies))[:size:size] + policies := (*[1<<28 - 1]*C.policy)(unsafe.Pointer(p.policies))[:size:size] for _, policy := range policies { C.free(unsafe.Pointer(policy.role_id)) size = int(policy.restricted_to_length) - restrictions := (*[1<<30 - 1]*C.policy_restriction)(unsafe.Pointer(policy.restricted_to))[:size:size] + restrictions := (*[1<<28 - 1]*C.policy_restriction)(unsafe.Pointer(policy.restricted_to))[:size:size] for _, restriction := range restrictions { C.free(unsafe.Pointer(restriction.index)) size = int(restriction.collections_length) - collections := (*[1<<30 - 1]*C.char)(unsafe.Pointer(restriction.collections))[:size:size] + collections := (*[1<<28 - 1]*C.char)(unsafe.Pointer(restriction.collections))[:size:size] for _, collection := range collections { C.free(unsafe.Pointer(collection)) } @@ -107,7 +107,7 @@ func kuzzle_security_destroy_user(u *C.user) { } if u.profile_ids != nil { size := int(u.profile_ids_length) - carray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(u.profile_ids))[:size:size] + carray := (*[1<<28 - 1]*C.char)(unsafe.Pointer(u.profile_ids))[:size:size] for i := 0; i < size; i++ { C.free(unsafe.Pointer(carray[i])) @@ -461,7 +461,7 @@ func kuzzle_security_update_user_mapping(k *C.kuzzle, body *C.char, o *C.query_o func kuzzle_security_is_action_allowed(crights **C.user_right, crlength C.uint, controller *C.char, action *C.char, index *C.char, collection *C.char) C.uint { rights := make([]*types.UserRights, int(crlength)) - carray := (*[1<<30 - 1]*C.user_right)(unsafe.Pointer(crights))[:int(crlength):int(crlength)] + carray := (*[1<<28 - 1]*C.user_right)(unsafe.Pointer(crights))[:int(crlength):int(crlength)] for i := 0; i < int(crlength); i++ { rights[i] = cToGoUserRigh(carray[i]) } From 1fa8b290898376c38db0ab7fd605d98945f00b30 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 16 Apr 2018 11:01:40 +0200 Subject: [PATCH 085/363] remove dependency to any json object --- internal/wrappers/cgo/kuzzle/go_to_c.go | 46 +++--- internal/wrappers/cgo/kuzzle/kuzzle.go | 9 +- .../wrappers/cgo/kuzzle/memory_storage.go | 131 ++++++++---------- internal/wrappers/cgo/kuzzle/options.go | 6 +- internal/wrappers/cgo/kuzzle/query.go | 4 +- internal/wrappers/cgo/kuzzle/realtime.go | 4 +- internal/wrappers/cgo/kuzzle/security.go | 14 +- internal/wrappers/cpp/kuzzle.cpp | 10 +- internal/wrappers/headers/kuzzle.hpp | 6 +- internal/wrappers/headers/kuzzlesdk.h | 2 +- internal/wrappers/headers/listeners.hpp | 2 +- kuzzle/query_test.go | 15 +- types/kuzzle_response.go | 10 +- 13 files changed, 119 insertions(+), 140 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index e5888207..e75256fd 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -61,7 +61,8 @@ func goToCNotificationContent(gNotifContent *types.NotificationResult) *C.notifi result.id = C.CString(gNotifContent.Id) result.meta = goToCMeta(gNotifContent.Meta) result.count = C.int(gNotifContent.Count) - result.content = C.char(gNotifContent) + marshalled, _ := json.Marshal(gNotifContent) + result.content = C.CString(string(marshalled)) return result } @@ -75,7 +76,7 @@ func goToCNotificationResult(gNotif *types.KuzzleNotification) *C.notification_r return result } - result.volatiles = json.RawMessage(gNotif.Volatile) + result.volatiles = C.CString(string(gNotif.Volatile)) result.request_id = C.CString(gNotif.RequestId) result.result = goToCNotificationContent(gNotif.Result) result.index = C.CString(gNotif.Index) @@ -100,10 +101,10 @@ func goToCKuzzleResponse(gRes *types.KuzzleResponse) *C.kuzzle_response { result.request_id = C.CString(gRes.RequestId) bufResult := C.CString(string(gRes.Result)) - result.result = C.CString(string(bufResult)) + result.result = bufResult C.free(unsafe.Pointer(bufResult)) - result.volatiles, _ = goToCJson(gRes.Volatile) + result.volatiles = C.CString(string(gRes.Volatile)) result.index = C.CString(gRes.Index) result.collection = C.CString(gRes.Collection) result.controller = C.CString(gRes.Controller) @@ -345,10 +346,10 @@ func goToCBoolResult(goRes bool, err error) *C.bool_result { func goToCSearchFilters(filters *types.SearchFilters) *C.search_filters { result := (*C.search_filters)(C.calloc(1, C.sizeof_search_filters)) - result.query, _ = goToCJson(filters.Query) - result.sort, _ = goToCJson(filters.Sort) - result.aggregations, _ = goToCJson(filters.Aggregations) - result.search_after, _ = goToCJson(filters.SearchAfter) + result.query = C.CString(string(filters.Query)) + result.sort = C.CString(string(filters.Sort)) + result.aggregations = C.CString(string(filters.Aggregations)) + result.search_after = C.CString(string(filters.SearchAfter)) return result } @@ -356,8 +357,8 @@ func goToCSearchFilters(filters *types.SearchFilters) *C.search_filters { // Allocates memory func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { result := (*C.search_result)(C.calloc(1, C.sizeof_search_result)) - result.collection, _ = goToCJson(goRes.Collection) - result.documents, _ = goToCJson(goRes.Documents) + result.collection = C.CString(string(goRes.Collection)) + result.documents = C.CString(string(goRes.Documents)) result.fetched = C.uint(goRes.Fetched) result.total = C.uint(goRes.Total) @@ -375,7 +376,7 @@ func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { } if len(goRes.Aggregations) > 0 { - result.aggregations, _ = goToCJson(goRes.Aggregations) + result.aggregations = C.CString(string(goRes.Aggregations)) } return result @@ -393,7 +394,8 @@ func goToCRole(k *C.kuzzle, role *security.Role, dest *C.role) *C.role { crole.kuzzle = k if role.Controllers != nil { - crole.controllers, _ = goToCJson(role.Controllers) + ctrls, _ := json.Marshal(role.Controllers) + crole.controllers = C.CString(string(ctrls)) } return crole @@ -404,8 +406,9 @@ func goToCSpecification(goSpec *types.Specification) *C.specification { result := (*C.specification)(C.calloc(1, C.sizeof_specification)) result.strict = C.bool(goSpec.Strict) - result.fields, _ = goToCJson(goSpec.Fields) - result.validators, _ = goToCJson(goSpec.Validators) + flds, _ := json.Marshal(goSpec.Fields) + result.fields = C.CString(string(flds)) + result.validators = C.CString(string(goSpec.Validators)) return result } @@ -487,10 +490,11 @@ func goToCUserData(data *types.UserData) (*C.user_data, error) { cdata := (*C.user_data)(C.calloc(1, C.sizeof_user_data)) if data.Content != nil { - jsonO, err := goToCJson(data.Content) + cnt, err := json.Marshal(data.Content) if err != nil { return nil, err } + jsonO := C.CString(string(cnt)) cdata.content = jsonO } @@ -523,10 +527,12 @@ func goToCUser(k *C.kuzzle, user *security.User, dest *C.user) (*C.user, error) cuser.kuzzle = k if user.Content != nil { - jsonO, err := goToCJson(user.Content) + cnt, err := json.Marshal(user.Content) if err != nil { return nil, err } + jsonO := C.CString(string(cnt)) + cuser.content = jsonO } @@ -702,10 +708,10 @@ func goToCCollectionListResult(collections []*types.CollectionsList, err error) // Allocates memory func fillStatistics(src *types.Statistics, dest *C.statistics) { - dest.ongoing_requests, _ = goToCJson(src.OngoingRequests) - dest.completed_requests, _ = goToCJson(src.CompletedRequests) - dest.connections, _ = goToCJson(src.Connections) - dest.failed_requests, _ = goToCJson(src.FailedRequests) + dest.ongoing_requests = C.CString(string(src.OngoingRequests)) + dest.completed_requests = C.CString(string(src.CompletedRequests)) + dest.connections = C.CString(string(src.Connections)) + dest.failed_requests = C.CString(string(src.FailedRequests)) dest.timestamp = C.ulonglong(src.Timestamp) } diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 110bc447..32207730 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -16,6 +16,7 @@ import ( "github.com/kuzzleio/sdk-go/connection" "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" ) // map which stores instances to keep references in case the gc passes @@ -144,7 +145,7 @@ func kuzzle_get_offline_queue(k *C.kuzzle) *C.offline_queue { mquery, _ := json.Marshal(queryObject.Query) buffer := C.CString(string(mquery)) - queryObjects[idx].query = C.GoString(buffer) + queryObjects[idx].query = C.CString(C.GoString(buffer)) C.free(unsafe.Pointer(buffer)) idx++ @@ -200,8 +201,6 @@ func kuzzle_once(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data unsafe.P r, _ := json.Marshal(res) - C.free(unsafe.Pointer(buffer)) - C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) }() } @@ -333,13 +332,13 @@ func kuzzle_get_ssl_connection(k *C.kuzzle) C.bool { //export kuzzle_get_volatile func kuzzle_get_volatile(k *C.kuzzle) *C.char { - r, _ := C.char((*kuzzle.Kuzzle)(k.instance).Volatile()) + r := C.CString(string((*kuzzle.Kuzzle)(k.instance).Volatile())) return r } //export kuzzle_set_volatile func kuzzle_set_volatile(k *C.kuzzle, v *C.char) { - (*kuzzle.Kuzzle)(k.instance).SetVolatile(json.RawMessage(string(v))) + (*kuzzle.Kuzzle)(k.instance).SetVolatile(types.VolatileData(C.GoString(v))) } func main() { diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go index 76b8a279..68493bc4 100644 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ b/internal/wrappers/cgo/kuzzle/memory_storage.go @@ -18,9 +18,10 @@ package main import "C" import ( "encoding/json" + "unsafe" + "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" - "unsafe" ) //export kuzzle_ms_append @@ -205,7 +206,7 @@ func kuzzle_ms_geopos(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, } //export kuzzle_ms_georadius -func kuzzle_ms_georadius(k *C.kuzzle, key *C.char, lon C.double, lat C.double, dist C.double, unit *C.char, options *C.query_options) *C.json_array_result { +func kuzzle_ms_georadius(k *C.kuzzle, key *C.char, lon C.double, lat C.double, dist C.double, unit *C.char, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Georadius( C.GoString(key), float64(lon), @@ -214,19 +215,14 @@ func kuzzle_ms_georadius(k *C.kuzzle, key *C.char, lon C.double, lat C.double, d C.GoString(unit), SetQueryOptions(options)) - var ires []interface{} - if err == nil { - ires = make([]interface{}, len(res)) - for i, d := range res { - ires[i] = d - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(ires, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_georadiusbymember -func kuzzle_ms_georadiusbymember(k *C.kuzzle, key *C.char, member *C.char, dist C.double, unit *C.char, options *C.query_options) *C.json_array_result { +func kuzzle_ms_georadiusbymember(k *C.kuzzle, key *C.char, member *C.char, dist C.double, unit *C.char, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Georadiusbymember( C.GoString(key), C.GoString(member), @@ -234,15 +230,10 @@ func kuzzle_ms_georadiusbymember(k *C.kuzzle, key *C.char, member *C.char, dist C.GoString(unit), SetQueryOptions(options)) - var ires []interface{} - if err == nil { - ires = make([]interface{}, len(res)) - for i, d := range res { - ires[i] = d - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(ires, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_get @@ -316,12 +307,15 @@ func kuzzle_ms_hget(k *C.kuzzle, key *C.char, field *C.char, options *C.query_op } //export kuzzle_ms_hgetall -func kuzzle_ms_hgetall(k *C.kuzzle, key *C.char, options *C.query_options) *C.json_result { +func kuzzle_ms_hgetall(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hgetall( C.GoString(key), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_hincrby @@ -406,13 +400,16 @@ func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.json_object, elen C.s } //export kuzzle_ms_hscan -func kuzzle_ms_hscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.json_result { +func kuzzle_ms_hscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hscan( C.GoString(key), int(cursor), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_hset @@ -827,12 +824,15 @@ func kuzzle_ms_sadd(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, o } //export kuzzle_ms_scan -func kuzzle_ms_scan(k *C.kuzzle, cursor C.int, options *C.query_options) *C.json_result { +func kuzzle_ms_scan(k *C.kuzzle, cursor C.int, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Scan( int(cursor), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_scard @@ -983,13 +983,16 @@ func kuzzle_ms_srem(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, o } //export kuzzle_ms_sscan -func kuzzle_ms_sscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.json_result { +func kuzzle_ms_sscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sscan( C.GoString(key), int(cursor), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_strlen @@ -1127,24 +1130,17 @@ func kuzzle_ms_zlexcount(k *C.kuzzle, key *C.char, min *C.char, max *C.char, opt } //export kuzzle_ms_zrange -func kuzzle_ms_zrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.json_array_result { +func kuzzle_ms_zrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrange( C.GoString(key), int(start), int(stop), SetQueryOptions(options)) - var converted []interface{} - - if res != nil { - converted = make([]interface{}, len(res), len(res)) - - for i, val := range res { - converted[i] = *val - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(converted, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrangebylex @@ -1159,24 +1155,17 @@ func kuzzle_ms_zrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, o } //export kuzzle_ms_zrangebyscore -func kuzzle_ms_zrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.json_array_result { +func kuzzle_ms_zrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrangebyscore( C.GoString(key), float64(min), float64(max), SetQueryOptions(options)) - var converted []interface{} - - if res != nil { - converted = make([]interface{}, len(res), len(res)) + json0, _ := json.Marshal(res) - for i, val := range res { - converted[i] = *val - } - } - - return goToCJsonArrayResult(converted, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrank @@ -1233,56 +1222,45 @@ func kuzzle_ms_zremrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.do } //export kuzzle_ms_zrevrange -func kuzzle_ms_zrevrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.json_array_result { +func kuzzle_ms_zrevrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrange( C.GoString(key), int(start), int(stop), SetQueryOptions(options)) - var converted []interface{} - - if res != nil { - converted = make([]interface{}, len(res), len(res)) - - for i, val := range res { - converted[i] = *val - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(converted, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrevrangebylex -func kuzzle_ms_zrevrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, options *C.query_options) *C.string_array_result { +func kuzzle_ms_zrevrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrangebylex( C.GoString(key), C.GoString(min), C.GoString(max), SetQueryOptions(options)) - return goToCStringArrayResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrevrangebyscore -func kuzzle_ms_zrevrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.json_array_result { +func kuzzle_ms_zrevrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrangebyscore( C.GoString(key), float64(min), float64(max), SetQueryOptions(options)) - var converted []interface{} - - if res != nil { - converted = make([]interface{}, len(res), len(res)) - - for i, val := range res { - converted[i] = *val - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(converted, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrevrank @@ -1296,13 +1274,16 @@ func kuzzle_ms_zrevrank(k *C.kuzzle, key *C.char, member *C.char, options *C.que } //export kuzzle_ms_zscan -func kuzzle_ms_zscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.json_result { +func kuzzle_ms_zscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zscan( C.GoString(key), int(cursor), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zscore diff --git a/internal/wrappers/cgo/kuzzle/options.go b/internal/wrappers/cgo/kuzzle/options.go index 67018257..e703acd6 100644 --- a/internal/wrappers/cgo/kuzzle/options.go +++ b/internal/wrappers/cgo/kuzzle/options.go @@ -63,9 +63,9 @@ func SetQueryOptions(options *C.query_options) (opts types.QueryOptions) { opts.SetRefresh(C.GoString(options.refresh)) opts.SetIfExist(C.GoString(options.if_exist)) opts.SetRetryOnConflict(int(options.retry_on_conflict)) - volatiles := JsonCConvert(options.volatiles) + volatiles := types.VolatileData(C.GoString(options.volatiles)) if volatiles != nil { - opts.SetVolatile(volatiles.(map[string]interface{})) + opts.SetVolatile(volatiles) } return @@ -106,7 +106,7 @@ func SetRoomOptions(options *C.room_options) (opts types.RoomOptions) { opts.SetSubscribeToSelf(bool(options.subscribe_to_self)) if options.volatiles != nil { - opts.SetVolatile(JsonCConvert(options.volatiles).(map[string]interface{})) + opts.SetVolatile(types.VolatileData(C.GoString(options.volatiles))) } } return diff --git a/internal/wrappers/cgo/kuzzle/query.go b/internal/wrappers/cgo/kuzzle/query.go index f12ef408..4744eaf8 100644 --- a/internal/wrappers/cgo/kuzzle/query.go +++ b/internal/wrappers/cgo/kuzzle/query.go @@ -56,11 +56,11 @@ func kuzzle_query(k *C.kuzzle, request *C.kuzzle_request, options *C.query_optio } if request.body != nil { - req.Body = JsonCConvert(request.body) + req.Body = request.body } if request.volatiles != nil { - req.Volatile = JsonCConvert(request.volatiles).(map[string]interface{}) + req.Volatile = types.VolatileData(C.GoString(request.volatiles)) } start := int(request.start) diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index 4bacc4d3..d4ddb189 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -76,7 +76,7 @@ func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.string_result { c := make(chan types.KuzzleNotification) - roomId, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, cToGoRoomOptions(options)) + roomId, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) go func() { res := <-c @@ -90,7 +90,7 @@ func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, options *C.room_options, callback C.kuzzle_notification_listener, data unsafe.Pointer) *C.void_result { c := make(chan types.KuzzleNotification) - err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), cToGoRoomOptions(options), c) + err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), SetRoomOptions(options), c) go func() { res := <-c diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index 2b06e6f2..3e8be7dc 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -89,7 +89,7 @@ func kuzzle_security_destroy_user(u *C.user) { C.free(unsafe.Pointer(u.id)) } if u.content != nil { - C.free(u.content) + C.free(unsafe.Pointer(u.content)) } if u.profile_ids != nil { size := int(u.profile_ids_length) @@ -107,18 +107,12 @@ func kuzzle_security_destroy_user(u *C.user) { // --- role //export kuzzle_security_new_role -func kuzzle_security_new_role(k *C.kuzzle, id *C.char, c *C.controllers) *C.role { +func kuzzle_security_new_role(k *C.kuzzle, id *C.char, c C.controllers) *C.role { crole := (*C.role)(C.calloc(1, C.sizeof_role)) crole.id = id - crole.controllers = c + crole.controllers = C.CString(C.GoString(c)) crole.kuzzle = k - _, err := cToGoRole(crole) - if err != nil { - C.set_errno(C.ENOKEY) - return nil - } - return crole } @@ -128,7 +122,7 @@ func kuzzle_security_destroy_role(r *C.role) { return } - C.free(r.controllers) + C.free(unsafe.Pointer(r.controllers)) C.free(unsafe.Pointer(r)) } diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 9a82af00..40482315 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -89,16 +89,16 @@ namespace kuzzleio { return this; } - Kuzzle* Kuzzle::setVolatile(json_object *volatiles) { - kuzzle_set_volatile(_kuzzle, volatiles); + Kuzzle* Kuzzle::setVolatile(const std::string& volatiles) { + kuzzle_set_volatile(_kuzzle, const_cast(volatiles.c_str())); return this; } - json_object* Kuzzle::getVolatile() { - return kuzzle_get_volatile(_kuzzle); + std::string Kuzzle::getVolatile() { + return std::string(kuzzle_get_volatile(_kuzzle)); } - void trigger_event_listener(int event, json_object* res, void* data) { + void trigger_event_listener(int event, char* res, void* data) { ((Kuzzle*)data)->getListeners()[event]->trigger(res); } diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 0c772c5b..b04087b3 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -36,7 +36,7 @@ namespace kuzzleio { char* connect(); bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; @@ -49,8 +49,8 @@ namespace kuzzleio { Kuzzle* startQueuing(); Kuzzle* stopQueuing(); Kuzzle* flushQueue(); - json_object* getVolatile(); - Kuzzle* setVolatile(json_object* volatiles); + std::string getVolatile(); + Kuzzle* setVolatile(const std::string& volatiles); std::map getListeners(); virtual KuzzleEventEmitter* addListener(Event event, EventListener* listener); diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 94e57f7a..bdd87fe0 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -187,7 +187,7 @@ typedef struct { /* === Security === */ -typedef char controllers; +typedef char *controllers; typedef struct { char *index; diff --git a/internal/wrappers/headers/listeners.hpp b/internal/wrappers/headers/listeners.hpp index 89abe9de..9098e3ad 100644 --- a/internal/wrappers/headers/listeners.hpp +++ b/internal/wrappers/headers/listeners.hpp @@ -13,7 +13,7 @@ namespace kuzzleio { class EventListener { public: virtual ~EventListener(){}; - virtual void trigger(json_object*) const = 0; + virtual void trigger(char*) const = 0; }; class SubscribeListener { diff --git a/kuzzle/query_test.go b/kuzzle/query_test.go index 1143a934..cc5e744b 100644 --- a/kuzzle/query_test.go +++ b/kuzzle/query_test.go @@ -3,12 +3,13 @@ package kuzzle_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestQueryDefaultOptions(t *testing.T) { @@ -19,7 +20,7 @@ func TestQueryDefaultOptions(t *testing.T) { request := types.KuzzleRequest{} json.Unmarshal(query, &request) - assert.NotNil(t, request.Volatile["sdkVersion"]) + assert.NotNil(t, request.Volatile) assert.Equal(t, 0, request.From) assert.Equal(t, 10, request.Size) assert.Equal(t, "", request.Scroll) @@ -44,7 +45,7 @@ func TestQueryWithOptions(t *testing.T) { request := types.KuzzleRequest{} json.Unmarshal(query, &request) - assert.NotNil(t, request.Volatile["sdkVersion"]) + assert.NotNil(t, request.Volatile) assert.Equal(t, 42, request.From) assert.Equal(t, 24, request.Size) assert.Equal(t, "5m", request.Scroll) @@ -78,18 +79,16 @@ func TestQueryWithOptions(t *testing.T) { func TestQueryWithVolatile(t *testing.T) { var k *kuzzle.Kuzzle - var volatileData = types.VolatileData{ - "modifiedBy": "awesome me", - "reason": "it needed to be modified", - } + var volatileData = types.VolatileData(`{"modifiedBy":"awesome me","reason":"it needed to be modified","sdkVersion":"1.0.0"}`) c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { request := types.KuzzleRequest{} json.Unmarshal(query, &request) + fmt.Printf("%s %s\n", request.Volatile, volatileData) assert.Equal(t, volatileData, request.Volatile) - assert.NotNil(t, request.Volatile["sdkVersion"]) + assert.NotNil(t, request.Volatile) return &types.KuzzleResponse{} }, diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index e63e51d5..eefdcd2f 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -181,11 +181,11 @@ type ( } Statistics struct { - CompletedRequests map[string]int `json:"completedRequests"` - Connections map[string]int `json:"connections"` - FailedRequests map[string]int `json:"failedRequests"` - OngoingRequests map[string]int `json:"ongoingRequests"` - Timestamp int `json:"timestamp"` + CompletedRequests json.RawMessage `json:"completedRequests"` + Connections json.RawMessage `json:"connections"` + FailedRequests json.RawMessage `json:"failedRequests"` + OngoingRequests json.RawMessage `json:"ongoingRequests"` + Timestamp int `json:"timestamp"` } LoginAttempt struct { From 15d6093a5c8cdfee507e3d637db7a00c274465f6 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 16 Apr 2018 11:26:34 +0200 Subject: [PATCH 086/363] remove wrapping of json_object in swig java template --- internal/wrappers/templates/java/core.i | 59 ------------------------- 1 file changed, 59 deletions(-) diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 612891cd..bce1a4a3 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -80,65 +80,6 @@ } } -struct json_object { }; - -%ignore json_object::ptr; -%extend json_object { - json_object() { - json_object *j = json_object_new_object(); - return j; - } - - ~json_object() { - kuzzle_free_json_object($self); - } - - json_object* put(char* key, char* content) { - kuzzle_json_put($self, key, content, 0); - return $self; - } - - json_object* put(char* key, int content) { - kuzzle_json_put($self, key, &content, 1); - return $self; - } - - json_object* put(char* key, double content) { - kuzzle_json_put($self, key, &content, 2); - return $self; - } - - json_object* put(char* key, bool content) { - kuzzle_json_put($self, key, &content, 3); - return $self; - } - - json_object* put(char* key, json_object* content) { - kuzzle_json_put($self, key, content, 4); - return $self; - } - - char* getString(char* key) { - return kuzzle_json_get_string($self, key); - } - - int getInt(char* key) { - return kuzzle_json_get_int($self, key); - } - - double getDouble(char* key) { - return kuzzle_json_get_double($self, key); - } - - bool getBoolean(char* key) { - return kuzzle_json_get_bool($self, key); - } - - json_object* getJsonObject(char* key) { - return kuzzle_json_get_json_object($self, key); - } -} - %include "kuzzle.cpp" %include "collection.cpp" %include "document.cpp" From e1ecc12f32f38b5d7df87ad94ae85d743b992cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Mon, 16 Apr 2018 11:31:34 +0200 Subject: [PATCH 087/363] Remove json dependencies (#144) * wip remove json dependencies * remove dependency to any json object * remove wrapping of json_object in swig java template --- internal/wrappers/Makefile | 2 +- internal/wrappers/cgo/kuzzle/c_to_go.go | 107 +------------- internal/wrappers/cgo/kuzzle/destructors.go | 71 ++++------ internal/wrappers/cgo/kuzzle/go_to_c.go | 109 ++++----------- internal/wrappers/cgo/kuzzle/kuzzle.go | 27 ++-- .../wrappers/cgo/kuzzle/memory_storage.go | 131 ++++++++---------- internal/wrappers/cgo/kuzzle/options.go | 6 +- internal/wrappers/cgo/kuzzle/query.go | 4 +- internal/wrappers/cgo/kuzzle/realtime.go | 4 +- internal/wrappers/cgo/kuzzle/security.go | 14 +- internal/wrappers/cpp/kuzzle.cpp | 10 +- internal/wrappers/headers/kuzzle.hpp | 6 +- internal/wrappers/headers/kuzzlesdk.h | 67 +++++---- internal/wrappers/headers/listeners.hpp | 2 +- .../wrappers/headers/sdk_wrappers_internal.h | 3 +- internal/wrappers/templates/java/core.i | 59 -------- kuzzle/query.go | 13 +- kuzzle/query_test.go | 15 +- types/kuzzle_request.go | 12 +- types/kuzzle_response.go | 12 +- 20 files changed, 207 insertions(+), 467 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index e15de116..80c6a1ca 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -16,7 +16,7 @@ CPP = g++ CPPFLAGS = -g -fPIC -std=c++11 INCS = -I$(HEADERSDIR) -I$(CPPDIR) -I$(ROOT_DIR)templates -I$(GOTARGETDIR) LDFLAGS = -L$(GOTARGETDIR) -LIBS = -lkuzzlesdk -ljson-c +LIBS = -lkuzzlesdk SRCS = kcore_wrap.cxx OBJS = $(SRCS:.cxx=.o) diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 67f8b893..ee92bf7b 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -30,74 +30,15 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func cToGoControllers(c *C.controllers) (*types.Controllers, error) { - if c == nil { - return nil, nil - } - - if JsonCType(c) != C.json_type_object { - return nil, types.NewError("Invalid controller structure", 400) - } - j := JsonCConvert(c) - controllers := &types.Controllers{} - - for controller, val := range j.(map[string]interface{}) { - rawController, ok := val.(map[string]interface{}) - if !ok { - return nil, types.NewError("Invalid controllers structure", 400) - } - - rawActions, ok := rawController["Actions"] - if !ok { - return nil, types.NewError("Invalid controllers structure", 400) - } - - actionsMap, ok := rawActions.(map[string]interface{}) - if !ok { - return nil, types.NewError("Invalid controllers structure", 400) - } - - controllers.Controllers[controller] = &types.Controller{} - for action, value := range actionsMap { - boolValue, ok := value.(bool) - if !ok { - return nil, types.NewError("Invalid controllers structure", 400) - } - - controllers.Controllers[controller].Actions[action] = boolValue - } - } - - return controllers, nil -} - -func cToGoRole(crole *C.role) (*security.Role, error) { - id := C.GoString(crole.id) - var controllers *types.Controllers - - if crole.controllers != nil { - c, err := cToGoControllers(crole.controllers) - - if err != nil { - return nil, err - } - controllers = c - } - - role := security.NewRole(id, controllers) - - return role, nil -} - func cToGoSearchFilters(searchFilters *C.search_filters) *types.SearchFilters { if searchFilters == nil { return nil } return &types.SearchFilters{ - Query: JsonCConvert(searchFilters.query), - Sort: JsonCConvert(searchFilters.sort).([]interface{}), - Aggregations: JsonCConvert(searchFilters.aggregations), - SearchAfter: JsonCConvert(searchFilters.search_after).([]interface{}), + Query: json.RawMessage(C.GoString(searchFilters.query)), + Sort: json.RawMessage(C.GoString(searchFilters.sort)), + Aggregations: json.RawMessage(C.GoString(searchFilters.aggregations)), + SearchAfter: json.RawMessage(C.GoString(searchFilters.search_after)), } } @@ -190,31 +131,6 @@ func cToGoProfile(p *C.profile) *security.Profile { return profile } -func cToGoUserData(cdata *C.user_data) (*types.UserData, error) { - if cdata == nil { - return nil, nil - } - - data := &types.UserData{} - - if cdata.content != nil { - err := json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(cdata.content))), data.Content) - if err != nil { - return nil, types.NewError(err.Error(), 400) - } - } - - if cdata.profile_ids_length > 0 { - size := int(cdata.profile_ids_length) - carray := (*[1<<30 - 1]*C.char)(unsafe.Pointer(cdata.profile_ids))[:size:size] - for i := 0; i < size; i++ { - data.ProfileIds = append(data.ProfileIds, C.GoString(carray[i])) - } - } - - return data, nil -} - func cToGoUser(u *C.user) *security.User { if u == nil { return nil @@ -264,18 +180,3 @@ func cToGoSearchResult(s *C.search_result) *types.SearchResult { func cToGoKuzzleNotificationChannel(c *C.kuzzle_notification_listener) chan<- types.KuzzleNotification { return make(chan<- types.KuzzleNotification) } - -func cToGoRoomOptions(ro *C.room_options) types.RoomOptions { - var volatiles map[string]interface{} - - json.Unmarshal([]byte(C.GoString(C.json_object_to_json_string(ro.volatiles))), &volatiles) - - newOpt := types.NewRoomOptions() - newOpt.SetScope(C.GoString(ro.scope)) - newOpt.SetState(C.GoString(ro.state)) - newOpt.SetUsers(C.GoString(ro.user)) - newOpt.SetVolatile(volatiles) - newOpt.SetSubscribeToSelf(bool(ro.subscribe_to_self)) - - return newOpt -} diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 0cef8b17..1281ca98 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -68,9 +68,9 @@ func kuzzle_free_kuzzle_request(st *C.kuzzle_request) { C.free_char_array(st.keys, st.keys_length) C.free_char_array(st.fields, st.fields_length) - kuzzle_free_json_object(st.body) - kuzzle_free_json_object(st.volatiles) - kuzzle_free_json_object(st.options) + C.free(unsafe.Pointer(st.body)) + C.free(unsafe.Pointer(st.volatiles)) + C.free(unsafe.Pointer(st.options)) C.free(unsafe.Pointer(st)) } @@ -80,7 +80,7 @@ func kuzzle_free_kuzzle_request(st *C.kuzzle_request) { //export kuzzle_free_query_object func kuzzle_free_query_object(st *C.query_object) { if st != nil { - kuzzle_free_json_object(st.query) + C.free(unsafe.Pointer(st.query)) C.free(unsafe.Pointer(st.request_id)) C.free(unsafe.Pointer(st)) @@ -109,7 +109,7 @@ func kuzzle_free_query_options(st *C.query_options) { C.free(unsafe.Pointer(st.scroll_id)) C.free(unsafe.Pointer(st.refresh)) C.free(unsafe.Pointer(st.if_exist)) - kuzzle_free_json_object(st.volatiles) + C.free(unsafe.Pointer(st.volatiles)) C.free(unsafe.Pointer(st)) } @@ -121,7 +121,7 @@ func kuzzle_free_room_options(st *C.room_options) { C.free(unsafe.Pointer(st.scope)) C.free(unsafe.Pointer(st.state)) C.free(unsafe.Pointer(st.user)) - kuzzle_free_json_object(st.volatiles) + C.free(unsafe.Pointer(st.volatiles)) C.free(unsafe.Pointer(st)) } } @@ -211,7 +211,7 @@ func kuzzle_free_profile(st *C.profile) { func _free_role(st *C.role) { if st != nil { C.free(unsafe.Pointer(st.id)) - kuzzle_free_json_object(st.controllers) + C.free(unsafe.Pointer(st.controllers)) } } @@ -225,7 +225,7 @@ func kuzzle_free_role(st *C.role) { func _free_user(st *C.user) { if st != nil { C.free(unsafe.Pointer(st.id)) - kuzzle_free_json_object(st.content) + C.free(unsafe.Pointer(st.content)) C.free_char_array(st.profile_ids, st.profile_ids_length) } } @@ -239,7 +239,7 @@ func kuzzle_free_user(st *C.user) { //export kuzzle_free_user_data func kuzzle_free_user_data(st *C.user_data) { if st != nil { - kuzzle_free_json_object(st.content) + C.free(unsafe.Pointer(st.content)) C.free_char_array(st.profile_ids, st.profile_ids_length) C.free(unsafe.Pointer(st)) } @@ -266,7 +266,7 @@ func kuzzle_free_notification_content(st *C.notification_content) { if st != nil { C.free(unsafe.Pointer(st.id)) kuzzle_free_meta(st.meta) - kuzzle_free_json_object(st.content) + C.free(unsafe.Pointer(st.content)) C.free(unsafe.Pointer(st)) } } @@ -288,7 +288,7 @@ func kuzzle_free_notification_result(st *C.notification_result) { C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) - kuzzle_free_json_object(st.volatiles) + C.free(unsafe.Pointer(st.volatiles)) kuzzle_free_notification_content(st.result) @@ -386,10 +386,10 @@ func kuzzle_free_user_result(st *C.user_result) { // and not the structure itself func _free_statistics(st *C.statistics) { if st != nil { - kuzzle_free_json_object(st.completed_requests) - kuzzle_free_json_object(st.connections) - kuzzle_free_json_object(st.failed_requests) - kuzzle_free_json_object(st.ongoing_requests) + C.free(unsafe.Pointer(st.completed_requests)) + C.free(unsafe.Pointer(st.connections)) + C.free(unsafe.Pointer(st.failed_requests)) + C.free(unsafe.Pointer(st.ongoing_requests)) } } @@ -461,8 +461,8 @@ func kuzzle_free_kuzzle_response(st *C.kuzzle_response) { C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) - kuzzle_free_json_object(st.result) - kuzzle_free_json_object(st.volatiles) + C.free(unsafe.Pointer(st.result)) + C.free(unsafe.Pointer(st.volatiles)) C.free(unsafe.Pointer(st)) } @@ -471,26 +471,7 @@ func kuzzle_free_kuzzle_response(st *C.kuzzle_response) { //export kuzzle_free_json_result func kuzzle_free_json_result(st *C.json_result) { if st != nil { - kuzzle_free_json_object(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_json_array_result -func kuzzle_free_json_array_result(st *C.json_array_result) { - if st != nil { - if st.result != nil { - jobjects := (*[1<<30 - 1]*C.json_object)(unsafe.Pointer(st.result))[:int(st.result_length):int(st.result_length)] - - for _, jobject := range jobjects { - kuzzle_free_json_object(jobject) - } - - C.free(unsafe.Pointer(st.result)) - } - + C.free(unsafe.Pointer(st.result)) C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) C.free(unsafe.Pointer(st)) @@ -557,10 +538,10 @@ func kuzzle_free_string_array_result(st *C.string_array_result) { //export kuzzle_free_search_filters func kuzzle_free_search_filters(st *C.search_filters) { if st != nil { - kuzzle_free_json_object(st.query) - kuzzle_free_json_object(st.sort) - kuzzle_free_json_object(st.aggregations) - kuzzle_free_json_object(st.search_after) + C.free(unsafe.Pointer(st.query)) + C.free(unsafe.Pointer(st.sort)) + C.free(unsafe.Pointer(st.aggregations)) + C.free(unsafe.Pointer(st.search_after)) C.free(unsafe.Pointer(st)) } } @@ -623,8 +604,8 @@ func kuzzle_free_shards_result(st *C.shards_result) { //export kuzzle_free_specification func kuzzle_free_specification(st *C.specification) { if st != nil { - kuzzle_free_json_object(st.fields) - kuzzle_free_json_object(st.validators) + C.free(unsafe.Pointer(st.fields)) + C.free(unsafe.Pointer(st.validators)) C.free(unsafe.Pointer(st)) } } @@ -658,7 +639,7 @@ func kuzzle_free_specification_result(st *C.specification_result) { func kuzzle_free_search_result(st *C.search_result) { if st != nil { kuzzle_free_query_options(st.options) - kuzzle_free_json_object(st.aggregations) + C.free(unsafe.Pointer(st.aggregations)) kuzzle_free_search_filters(st.filters) C.free(unsafe.Pointer(st.error)) @@ -717,7 +698,7 @@ func kuzzle_free_specification_search_result(st *C.specification_search_result) //export kuzzle_free_mapping func kuzzle_free_mapping(st *C.mapping) { if st != nil { - kuzzle_free_json_object(st.mapping) + C.free(unsafe.Pointer(st.mapping)) kuzzle_free_collection(st.collection) C.free(unsafe.Pointer(st)) } diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 67404928..03d6c1f4 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -75,7 +75,8 @@ func goToCNotificationContent(gNotifContent *types.NotificationResult) *C.notifi result.id = C.CString(gNotifContent.Id) result.meta = goToCMeta(gNotifContent.Meta) result.count = C.int(gNotifContent.Count) - result.content, _ = goToCJson(gNotifContent) + marshalled, _ := json.Marshal(gNotifContent) + result.content = C.CString(string(marshalled)) return result } @@ -89,7 +90,7 @@ func goToCNotificationResult(gNotif *types.KuzzleNotification) *C.notification_r return result } - result.volatiles, _ = goToCJson(gNotif.Volatile) + result.volatiles = C.CString(string(gNotif.Volatile)) result.request_id = C.CString(gNotif.RequestId) result.result = goToCNotificationContent(gNotif.Result) result.index = C.CString(gNotif.Index) @@ -114,10 +115,10 @@ func goToCKuzzleResponse(gRes *types.KuzzleResponse) *C.kuzzle_response { result.request_id = C.CString(gRes.RequestId) bufResult := C.CString(string(gRes.Result)) - result.result = C.json_tokener_parse(bufResult) + result.result = bufResult C.free(unsafe.Pointer(bufResult)) - result.volatiles, _ = goToCJson(gRes.Volatile) + result.volatiles = C.CString(string(gRes.Volatile)) result.index = C.CString(gRes.Index) result.collection = C.CString(gRes.Collection) result.controller = C.CString(gRes.Controller) @@ -359,10 +360,10 @@ func goToCBoolResult(goRes bool, err error) *C.bool_result { func goToCSearchFilters(filters *types.SearchFilters) *C.search_filters { result := (*C.search_filters)(C.calloc(1, C.sizeof_search_filters)) - result.query, _ = goToCJson(filters.Query) - result.sort, _ = goToCJson(filters.Sort) - result.aggregations, _ = goToCJson(filters.Aggregations) - result.search_after, _ = goToCJson(filters.SearchAfter) + result.query = C.CString(string(filters.Query)) + result.sort = C.CString(string(filters.Sort)) + result.aggregations = C.CString(string(filters.Aggregations)) + result.search_after = C.CString(string(filters.SearchAfter)) return result } @@ -370,8 +371,8 @@ func goToCSearchFilters(filters *types.SearchFilters) *C.search_filters { // Allocates memory func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { result := (*C.search_result)(C.calloc(1, C.sizeof_search_result)) - result.collection, _ = goToCJson(goRes.Collection) - result.documents, _ = goToCJson(goRes.Documents) + result.collection = C.CString(string(goRes.Collection)) + result.documents = C.CString(string(goRes.Documents)) result.fetched = C.uint(goRes.Fetched) result.total = C.uint(goRes.Total) @@ -389,7 +390,7 @@ func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { } if len(goRes.Aggregations) > 0 { - result.aggregations, _ = goToCJson(goRes.Aggregations) + result.aggregations = C.CString(string(goRes.Aggregations)) } return result @@ -407,7 +408,8 @@ func goToCRole(k *C.kuzzle, role *security.Role, dest *C.role) *C.role { crole.kuzzle = k if role.Controllers != nil { - crole.controllers, _ = goToCJson(role.Controllers) + ctrls, _ := json.Marshal(role.Controllers) + crole.controllers = C.CString(string(ctrls)) } return crole @@ -418,8 +420,9 @@ func goToCSpecification(goSpec *types.Specification) *C.specification { result := (*C.specification)(C.calloc(1, C.sizeof_specification)) result.strict = C.bool(goSpec.Strict) - result.fields, _ = goToCJson(goSpec.Fields) - result.validators, _ = goToCJson(goSpec.Validators) + flds, _ := json.Marshal(goSpec.Fields) + result.fields = C.CString(string(flds)) + result.validators = C.CString(string(goSpec.Validators)) return result } @@ -482,69 +485,6 @@ func goToCSpecificationSearchResult(goRes *types.SpecificationSearchResult, err return result } -func goToCJson(data interface{}) (*C.json_object, error) { - r, err := json.Marshal(data) - if err != nil { - return nil, types.NewError(err.Error(), 400) - } - - buffer := C.CString(string(r)) - defer C.free(unsafe.Pointer(buffer)) - - tok := C.json_tokener_new() - defer C.json_tokener_free(tok) - - j := C.json_tokener_parse_ex(tok, buffer, C.int(C.strlen(buffer))) - jerr := C.json_tokener_get_error(tok) - if jerr != C.json_tokener_success { - return nil, types.NewError(C.GoString(C.json_tokener_error_desc(jerr)), 400) - } - - return j, nil -} - -func goToCJsonResult(goRes interface{}, err error) *C.json_result { - result := (*C.json_result)(C.calloc(1, C.sizeof_json_result)) - - if err != nil { - Set_json_result_error(result, err) - return result - } - - result.result, err = goToCJson(goRes) - if err != nil { - Set_json_result_error(result, err) - return result - } - - return result -} - -func goToCJsonArrayResult(goRes []interface{}, err error) *C.json_array_result { - result := (*C.json_array_result)(C.calloc(1, C.sizeof_json_array_result)) - - if err != nil { - Set_json_array_result_error(result, err) - return result - } - - result.result_length = C.size_t(len(goRes)) - if goRes != nil { - result.result = (**C.json_object)(C.calloc(result.result_length, C.sizeof_json_object_ptr)) - cArray := (*[1<<30 - 1]*C.json_object)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] - - for i, res := range goRes { - cArray[i], err = goToCJson(res) - if err != nil { - Set_json_array_result_error(result, err) - return result - } - } - } - - return result -} - func goToCProfileResult(k *C.kuzzle, res *security.Profile, err error) *C.profile_result { result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) if err != nil { @@ -564,10 +504,11 @@ func goToCUserData(data *types.UserData) (*C.user_data, error) { cdata := (*C.user_data)(C.calloc(1, C.sizeof_user_data)) if data.Content != nil { - jsonO, err := goToCJson(data.Content) + cnt, err := json.Marshal(data.Content) if err != nil { return nil, err } + jsonO := C.CString(string(cnt)) cdata.content = jsonO } @@ -600,10 +541,12 @@ func goToCUser(k *C.kuzzle, user *security.User, dest *C.user) (*C.user, error) cuser.kuzzle = k if user.Content != nil { - jsonO, err := goToCJson(user.Content) + cnt, err := json.Marshal(user.Content) if err != nil { return nil, err } + jsonO := C.CString(string(cnt)) + cuser.content = jsonO } @@ -779,10 +722,10 @@ func goToCCollectionListResult(collections []*types.CollectionsList, err error) // Allocates memory func fillStatistics(src *types.Statistics, dest *C.statistics) { - dest.ongoing_requests, _ = goToCJson(src.OngoingRequests) - dest.completed_requests, _ = goToCJson(src.CompletedRequests) - dest.connections, _ = goToCJson(src.Connections) - dest.failed_requests, _ = goToCJson(src.FailedRequests) + dest.ongoing_requests = C.CString(string(src.OngoingRequests)) + dest.completed_requests = C.CString(string(src.CompletedRequests)) + dest.connections = C.CString(string(src.Connections)) + dest.failed_requests = C.CString(string(src.FailedRequests)) dest.timestamp = C.ulonglong(src.Timestamp) } diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 151faa07..ce0b6d6b 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -30,6 +30,7 @@ import ( "github.com/kuzzleio/sdk-go/connection" "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/types" ) // map which stores instances to keep references in case the gc passes @@ -158,10 +159,10 @@ func kuzzle_get_offline_queue(k *C.kuzzle) *C.offline_queue { mquery, _ := json.Marshal(queryObject.Query) buffer := C.CString(string(mquery)) - queryObjects[idx].query = C.json_tokener_parse(buffer) + queryObjects[idx].query = C.CString(C.GoString(buffer)) C.free(unsafe.Pointer(buffer)) - idx += 1 + idx++ } return result @@ -197,14 +198,9 @@ func kuzzle_add_listener(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data go func() { res := <-c - var jsonRes *C.json_object r, _ := json.Marshal(res) - buffer := C.CString(string(r)) - jsonRes = C.json_tokener_parse(buffer) - C.free(unsafe.Pointer(buffer)) - - C.kuzzle_trigger_event(e, cb, jsonRes, data) + C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) }() } @@ -217,14 +213,9 @@ func kuzzle_once(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data unsafe.P go func() { res := <-c - var jsonRes *C.json_object r, _ := json.Marshal(res) - buffer := C.CString(string(r)) - jsonRes = C.json_tokener_parse(buffer) - C.free(unsafe.Pointer(buffer)) - - C.kuzzle_trigger_event(e, cb, jsonRes, data) + C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) }() } @@ -354,14 +345,14 @@ func kuzzle_get_ssl_connection(k *C.kuzzle) C.bool { } //export kuzzle_get_volatile -func kuzzle_get_volatile(k *C.kuzzle) *C.json_object { - r, _ := goToCJson((*kuzzle.Kuzzle)(k.instance).Volatile()) +func kuzzle_get_volatile(k *C.kuzzle) *C.char { + r := C.CString(string((*kuzzle.Kuzzle)(k.instance).Volatile())) return r } //export kuzzle_set_volatile -func kuzzle_set_volatile(k *C.kuzzle, v *C.json_object) { - (*kuzzle.Kuzzle)(k.instance).SetVolatile(JsonCConvert(v).(map[string]interface{})) +func kuzzle_set_volatile(k *C.kuzzle, v *C.char) { + (*kuzzle.Kuzzle)(k.instance).SetVolatile(types.VolatileData(C.GoString(v))) } func main() { diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go index 30231975..5e786362 100644 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ b/internal/wrappers/cgo/kuzzle/memory_storage.go @@ -32,9 +32,10 @@ package main import "C" import ( "encoding/json" + "unsafe" + "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" - "unsafe" ) //export kuzzle_ms_append @@ -219,7 +220,7 @@ func kuzzle_ms_geopos(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, } //export kuzzle_ms_georadius -func kuzzle_ms_georadius(k *C.kuzzle, key *C.char, lon C.double, lat C.double, dist C.double, unit *C.char, options *C.query_options) *C.json_array_result { +func kuzzle_ms_georadius(k *C.kuzzle, key *C.char, lon C.double, lat C.double, dist C.double, unit *C.char, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Georadius( C.GoString(key), float64(lon), @@ -228,19 +229,14 @@ func kuzzle_ms_georadius(k *C.kuzzle, key *C.char, lon C.double, lat C.double, d C.GoString(unit), SetQueryOptions(options)) - var ires []interface{} - if err == nil { - ires = make([]interface{}, len(res)) - for i, d := range res { - ires[i] = d - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(ires, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_georadiusbymember -func kuzzle_ms_georadiusbymember(k *C.kuzzle, key *C.char, member *C.char, dist C.double, unit *C.char, options *C.query_options) *C.json_array_result { +func kuzzle_ms_georadiusbymember(k *C.kuzzle, key *C.char, member *C.char, dist C.double, unit *C.char, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Georadiusbymember( C.GoString(key), C.GoString(member), @@ -248,15 +244,10 @@ func kuzzle_ms_georadiusbymember(k *C.kuzzle, key *C.char, member *C.char, dist C.GoString(unit), SetQueryOptions(options)) - var ires []interface{} - if err == nil { - ires = make([]interface{}, len(res)) - for i, d := range res { - ires[i] = d - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(ires, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_get @@ -330,12 +321,15 @@ func kuzzle_ms_hget(k *C.kuzzle, key *C.char, field *C.char, options *C.query_op } //export kuzzle_ms_hgetall -func kuzzle_ms_hgetall(k *C.kuzzle, key *C.char, options *C.query_options) *C.json_result { +func kuzzle_ms_hgetall(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hgetall( C.GoString(key), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_hincrby @@ -420,13 +414,16 @@ func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.json_object, elen C.s } //export kuzzle_ms_hscan -func kuzzle_ms_hscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.json_result { +func kuzzle_ms_hscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hscan( C.GoString(key), int(cursor), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_hset @@ -841,12 +838,15 @@ func kuzzle_ms_sadd(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, o } //export kuzzle_ms_scan -func kuzzle_ms_scan(k *C.kuzzle, cursor C.int, options *C.query_options) *C.json_result { +func kuzzle_ms_scan(k *C.kuzzle, cursor C.int, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Scan( int(cursor), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_scard @@ -997,13 +997,16 @@ func kuzzle_ms_srem(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, o } //export kuzzle_ms_sscan -func kuzzle_ms_sscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.json_result { +func kuzzle_ms_sscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sscan( C.GoString(key), int(cursor), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_strlen @@ -1141,24 +1144,17 @@ func kuzzle_ms_zlexcount(k *C.kuzzle, key *C.char, min *C.char, max *C.char, opt } //export kuzzle_ms_zrange -func kuzzle_ms_zrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.json_array_result { +func kuzzle_ms_zrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrange( C.GoString(key), int(start), int(stop), SetQueryOptions(options)) - var converted []interface{} - - if res != nil { - converted = make([]interface{}, len(res), len(res)) - - for i, val := range res { - converted[i] = *val - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(converted, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrangebylex @@ -1173,24 +1169,17 @@ func kuzzle_ms_zrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, o } //export kuzzle_ms_zrangebyscore -func kuzzle_ms_zrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.json_array_result { +func kuzzle_ms_zrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrangebyscore( C.GoString(key), float64(min), float64(max), SetQueryOptions(options)) - var converted []interface{} - - if res != nil { - converted = make([]interface{}, len(res), len(res)) + json0, _ := json.Marshal(res) - for i, val := range res { - converted[i] = *val - } - } - - return goToCJsonArrayResult(converted, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrank @@ -1247,56 +1236,45 @@ func kuzzle_ms_zremrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.do } //export kuzzle_ms_zrevrange -func kuzzle_ms_zrevrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.json_array_result { +func kuzzle_ms_zrevrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrange( C.GoString(key), int(start), int(stop), SetQueryOptions(options)) - var converted []interface{} - - if res != nil { - converted = make([]interface{}, len(res), len(res)) - - for i, val := range res { - converted[i] = *val - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(converted, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrevrangebylex -func kuzzle_ms_zrevrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, options *C.query_options) *C.string_array_result { +func kuzzle_ms_zrevrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrangebylex( C.GoString(key), C.GoString(min), C.GoString(max), SetQueryOptions(options)) - return goToCStringArrayResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrevrangebyscore -func kuzzle_ms_zrevrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.json_array_result { +func kuzzle_ms_zrevrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrangebyscore( C.GoString(key), float64(min), float64(max), SetQueryOptions(options)) - var converted []interface{} - - if res != nil { - converted = make([]interface{}, len(res), len(res)) - - for i, val := range res { - converted[i] = *val - } - } + json0, _ := json.Marshal(res) - return goToCJsonArrayResult(converted, err) + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zrevrank @@ -1310,13 +1288,16 @@ func kuzzle_ms_zrevrank(k *C.kuzzle, key *C.char, member *C.char, options *C.que } //export kuzzle_ms_zscan -func kuzzle_ms_zscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.json_result { +func kuzzle_ms_zscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zscan( C.GoString(key), int(cursor), SetQueryOptions(options)) - return goToCJsonResult(res, err) + json0, _ := json.Marshal(res) + + str := string(json0) + return goToCStringResult(&str, err) } //export kuzzle_ms_zscore diff --git a/internal/wrappers/cgo/kuzzle/options.go b/internal/wrappers/cgo/kuzzle/options.go index 3450ff3e..bb0e9bce 100644 --- a/internal/wrappers/cgo/kuzzle/options.go +++ b/internal/wrappers/cgo/kuzzle/options.go @@ -77,9 +77,9 @@ func SetQueryOptions(options *C.query_options) (opts types.QueryOptions) { opts.SetRefresh(C.GoString(options.refresh)) opts.SetIfExist(C.GoString(options.if_exist)) opts.SetRetryOnConflict(int(options.retry_on_conflict)) - volatiles := JsonCConvert(options.volatiles) + volatiles := types.VolatileData(C.GoString(options.volatiles)) if volatiles != nil { - opts.SetVolatile(volatiles.(map[string]interface{})) + opts.SetVolatile(volatiles) } return @@ -120,7 +120,7 @@ func SetRoomOptions(options *C.room_options) (opts types.RoomOptions) { opts.SetSubscribeToSelf(bool(options.subscribe_to_self)) if options.volatiles != nil { - opts.SetVolatile(JsonCConvert(options.volatiles).(map[string]interface{})) + opts.SetVolatile(types.VolatileData(C.GoString(options.volatiles))) } } return diff --git a/internal/wrappers/cgo/kuzzle/query.go b/internal/wrappers/cgo/kuzzle/query.go index aed3eb9b..f7e12306 100644 --- a/internal/wrappers/cgo/kuzzle/query.go +++ b/internal/wrappers/cgo/kuzzle/query.go @@ -70,11 +70,11 @@ func kuzzle_query(k *C.kuzzle, request *C.kuzzle_request, options *C.query_optio } if request.body != nil { - req.Body = JsonCConvert(request.body) + req.Body = request.body } if request.volatiles != nil { - req.Volatile = JsonCConvert(request.volatiles).(map[string]interface{}) + req.Volatile = types.VolatileData(C.GoString(request.volatiles)) } start := int(request.start) diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index 4bacc4d3..d4ddb189 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -76,7 +76,7 @@ func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.string_result { c := make(chan types.KuzzleNotification) - roomId, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, cToGoRoomOptions(options)) + roomId, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) go func() { res := <-c @@ -90,7 +90,7 @@ func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, options *C.room_options, callback C.kuzzle_notification_listener, data unsafe.Pointer) *C.void_result { c := make(chan types.KuzzleNotification) - err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), cToGoRoomOptions(options), c) + err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), SetRoomOptions(options), c) go func() { res := <-c diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index d122e328..2c49c621 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -103,7 +103,7 @@ func kuzzle_security_destroy_user(u *C.user) { C.free(unsafe.Pointer(u.id)) } if u.content != nil { - C.json_object_put(u.content) + C.free(unsafe.Pointer(u.content)) } if u.profile_ids != nil { size := int(u.profile_ids_length) @@ -121,18 +121,12 @@ func kuzzle_security_destroy_user(u *C.user) { // --- role //export kuzzle_security_new_role -func kuzzle_security_new_role(k *C.kuzzle, id *C.char, c *C.controllers) *C.role { +func kuzzle_security_new_role(k *C.kuzzle, id *C.char, c C.controllers) *C.role { crole := (*C.role)(C.calloc(1, C.sizeof_role)) crole.id = id - crole.controllers = c + crole.controllers = C.CString(C.GoString(c)) crole.kuzzle = k - _, err := cToGoRole(crole) - if err != nil { - C.set_errno(C.ENOKEY) - return nil - } - return crole } @@ -142,7 +136,7 @@ func kuzzle_security_destroy_role(r *C.role) { return } - C.json_object_put(r.controllers) + C.free(unsafe.Pointer(r.controllers)) C.free(unsafe.Pointer(r)) } diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 1f0d5cd3..b3f69c2f 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -103,16 +103,16 @@ namespace kuzzleio { return this; } - Kuzzle* Kuzzle::setVolatile(json_object *volatiles) { - kuzzle_set_volatile(_kuzzle, volatiles); + Kuzzle* Kuzzle::setVolatile(const std::string& volatiles) { + kuzzle_set_volatile(_kuzzle, const_cast(volatiles.c_str())); return this; } - json_object* Kuzzle::getVolatile() { - return kuzzle_get_volatile(_kuzzle); + std::string Kuzzle::getVolatile() { + return std::string(kuzzle_get_volatile(_kuzzle)); } - void trigger_event_listener(int event, json_object* res, void* data) { + void trigger_event_listener(int event, char* res, void* data) { ((Kuzzle*)data)->getListeners()[event]->trigger(res); } diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index de066f42..8e5a9d65 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -50,7 +50,7 @@ namespace kuzzleio { char* connect(); bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; - json_object* createMyCredentials(const std::string& strategy, json_object* credentials, query_options* options=NULL) Kuz_Throw_KuzzleException; + statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); @@ -61,8 +61,8 @@ namespace kuzzleio { Kuzzle* startQueuing(); Kuzzle* stopQueuing(); Kuzzle* flushQueue(); - json_object* getVolatile(); - Kuzzle* setVolatile(json_object* volatiles); + std::string getVolatile(); + Kuzzle* setVolatile(const std::string& volatiles); std::map getListeners(); virtual KuzzleEventEmitter* addListener(Event event, EventListener* listener); diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 9e09cc43..ab7bd455 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -15,14 +15,13 @@ #ifndef _KUZZLESDK_H_ #define _KUZZLESDK_H_ -#include #include #include #include //query object used by query() typedef struct { - json_object *query; + char *query; unsigned long long timestamp; char *request_id; } query_object; @@ -46,7 +45,7 @@ enum Event { ERROR }; -typedef void (*kuzzle_event_listener)(int, json_object*, void*); +typedef void (*kuzzle_event_listener)(int, char*, void*); //define a request typedef struct { @@ -55,7 +54,7 @@ typedef struct { char *action; char *index; char *collection; - json_object *body; + char *body; char *id; long from; long size; @@ -63,7 +62,7 @@ typedef struct { char *scroll_id; char *strategy; unsigned long long expires_in; - json_object *volatiles; + char *volatiles; char *scope; char *state; char *user; @@ -80,7 +79,7 @@ typedef struct { double lat; double distance; char *unit; - json_object *options; + char *options; char **keys; size_t keys_length; long cursor; @@ -140,12 +139,12 @@ typedef struct { char *state; char *user; bool subscribe_to_self; - json_object *volatiles; + char *volatiles; } room_options; typedef struct { void *instance; - json_object *filters; + char *filters; room_options *options; } room; @@ -170,7 +169,7 @@ typedef struct { char *refresh; char *if_exist; int retry_on_conflict; - json_object *volatiles; + char *volatiles; } query_options; enum Mode {AUTO, MANUAL}; @@ -202,7 +201,7 @@ typedef struct { /* === Security === */ -typedef json_object controllers; +typedef char *controllers; typedef struct { char *index; @@ -225,14 +224,14 @@ typedef struct { typedef struct { char *id; - json_object *controllers; + char *controllers; kuzzle *kuzzle; } role; //kuzzle user typedef struct { char *id; - json_object *content; + char *content; char **profile_ids; size_t profile_ids_length; kuzzle *kuzzle; @@ -240,7 +239,7 @@ typedef struct { // user content passed to user constructor typedef struct { - json_object *content; + char *content; char **profile_ids; size_t profile_ids_length; } user_data; @@ -266,14 +265,14 @@ typedef struct { typedef struct { char *id; meta *meta; - json_object *content; + char *content; int count; } notification_content; typedef struct notification_result { char *request_id; notification_content *result; - json_object *volatiles; + char *volatiles; char *index; char *collection; char *controller; @@ -351,10 +350,10 @@ enum is_action_allowed { //statistics typedef struct { - json_object* completed_requests; - json_object* connections; - json_object* failed_requests; - json_object* ongoing_requests; + char* completed_requests; + char* connections; + char* failed_requests; + char* ongoing_requests; unsigned long long timestamp; } statistics; @@ -397,8 +396,8 @@ typedef struct token_validity { // raw Kuzzle response typedef struct kuzzle_response { char *request_id; - json_object *result; - json_object *volatiles; + char *result; + char *volatiles; char *index; char *collection; char *controller; @@ -419,15 +418,15 @@ typedef struct void_result { //any json result typedef struct json_result { - json_object *result; + char *result; int status; char *error; char *stack; } json_result; -//any array of json_object result +//any array of char result typedef struct json_array_result { - json_object **result; + char **result; size_t result_length; int status; char *error; @@ -492,10 +491,10 @@ typedef struct string_array_result { } string_array_result; typedef struct { - json_object* query; - json_object* sort; - json_object* aggregations; - json_object* search_after; + char* query; + char* sort; + char* aggregations; + char* search_after; } search_filters; typedef struct { @@ -536,8 +535,8 @@ typedef struct shards_result { typedef struct { bool strict; - json_object *fields; - json_object *validators; + char *fields; + char *validators; } specification; typedef struct { @@ -554,13 +553,13 @@ typedef struct specification_result { } specification_result; typedef struct search_result { - json_object *documents; + char *documents; unsigned fetched; unsigned total; - json_object *aggregations; + char *aggregations; search_filters *filters; query_options *options; - json_object *collection; + char *collection; int status; char *error; char *stack; @@ -602,7 +601,7 @@ typedef struct specification_search_result { } specification_search_result; typedef struct { - json_object *mapping; + char *mapping; collection *collection; } mapping; diff --git a/internal/wrappers/headers/listeners.hpp b/internal/wrappers/headers/listeners.hpp index d0904903..1a7d4ed4 100644 --- a/internal/wrappers/headers/listeners.hpp +++ b/internal/wrappers/headers/listeners.hpp @@ -27,7 +27,7 @@ namespace kuzzleio { class EventListener { public: virtual ~EventListener(){}; - virtual void trigger(json_object*) const = 0; + virtual void trigger(char*) const = 0; }; class SubscribeListener { diff --git a/internal/wrappers/headers/sdk_wrappers_internal.h b/internal/wrappers/headers/sdk_wrappers_internal.h index c93e9c6f..13fc5a31 100644 --- a/internal/wrappers/headers/sdk_wrappers_internal.h +++ b/internal/wrappers/headers/sdk_wrappers_internal.h @@ -18,7 +18,6 @@ typedef char *char_ptr; typedef policy *policy_ptr; typedef policy_restriction *policy_restriction_ptr; -typedef json_object *json_object_ptr; typedef query_object *query_object_ptr; // used by memory_storage.geopos @@ -32,7 +31,7 @@ static void kuzzle_notify(kuzzle_notification_listener f, notification_result* r f(res, data); } -static void kuzzle_trigger_event(int event, kuzzle_event_listener f, json_object* res, void* data) { +static void kuzzle_trigger_event(int event, kuzzle_event_listener f, char* res, void* data) { f(event, res, data); } diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 612891cd..bce1a4a3 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -80,65 +80,6 @@ } } -struct json_object { }; - -%ignore json_object::ptr; -%extend json_object { - json_object() { - json_object *j = json_object_new_object(); - return j; - } - - ~json_object() { - kuzzle_free_json_object($self); - } - - json_object* put(char* key, char* content) { - kuzzle_json_put($self, key, content, 0); - return $self; - } - - json_object* put(char* key, int content) { - kuzzle_json_put($self, key, &content, 1); - return $self; - } - - json_object* put(char* key, double content) { - kuzzle_json_put($self, key, &content, 2); - return $self; - } - - json_object* put(char* key, bool content) { - kuzzle_json_put($self, key, &content, 3); - return $self; - } - - json_object* put(char* key, json_object* content) { - kuzzle_json_put($self, key, content, 4); - return $self; - } - - char* getString(char* key) { - return kuzzle_json_get_string($self, key); - } - - int getInt(char* key) { - return kuzzle_json_get_int($self, key); - } - - double getDouble(char* key) { - return kuzzle_json_get_double($self, key); - } - - bool getBoolean(char* key) { - return kuzzle_json_get_bool($self, key); - } - - json_object* getJsonObject(char* key) { - return kuzzle_json_get_json_object($self, key); - } -} - %include "kuzzle.cpp" %include "collection.cpp" %include "document.cpp" diff --git a/kuzzle/query.go b/kuzzle/query.go index 732a1a68..40509a94 100644 --- a/kuzzle/query.go +++ b/kuzzle/query.go @@ -16,6 +16,7 @@ package kuzzle import ( "encoding/json" + "fmt" "github.com/kuzzleio/sdk-go/state" "github.com/kuzzleio/sdk-go/types" @@ -48,9 +49,17 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r if options.Volatile() != nil { query.Volatile = options.Volatile() - query.Volatile["sdkVersion"] = version + + var mapped map[string]interface{} + json.Unmarshal(query.Volatile, &mapped) + + mapped["sdkVersion"] = version + + query.Volatile, _ = json.Marshal(mapped) + } else { - query.Volatile = types.VolatileData{"sdkVersion": version} + vol := fmt.Sprintf(`{"sdkVersion": "%s"}`, version) + query.Volatile = types.VolatileData(vol) } jsonRequest, _ := json.Marshal(query) diff --git a/kuzzle/query_test.go b/kuzzle/query_test.go index 67d5d9ee..136de6a8 100644 --- a/kuzzle/query_test.go +++ b/kuzzle/query_test.go @@ -17,12 +17,13 @@ package kuzzle_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestQueryDefaultOptions(t *testing.T) { @@ -33,7 +34,7 @@ func TestQueryDefaultOptions(t *testing.T) { request := types.KuzzleRequest{} json.Unmarshal(query, &request) - assert.NotNil(t, request.Volatile["sdkVersion"]) + assert.NotNil(t, request.Volatile) assert.Equal(t, 0, request.From) assert.Equal(t, 10, request.Size) assert.Equal(t, "", request.Scroll) @@ -58,7 +59,7 @@ func TestQueryWithOptions(t *testing.T) { request := types.KuzzleRequest{} json.Unmarshal(query, &request) - assert.NotNil(t, request.Volatile["sdkVersion"]) + assert.NotNil(t, request.Volatile) assert.Equal(t, 42, request.From) assert.Equal(t, 24, request.Size) assert.Equal(t, "5m", request.Scroll) @@ -92,18 +93,16 @@ func TestQueryWithOptions(t *testing.T) { func TestQueryWithVolatile(t *testing.T) { var k *kuzzle.Kuzzle - var volatileData = types.VolatileData{ - "modifiedBy": "awesome me", - "reason": "it needed to be modified", - } + var volatileData = types.VolatileData(`{"modifiedBy":"awesome me","reason":"it needed to be modified","sdkVersion":"1.0.0"}`) c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { request := types.KuzzleRequest{} json.Unmarshal(query, &request) + fmt.Printf("%s %s\n", request.Volatile, volatileData) assert.Equal(t, volatileData, request.Volatile) - assert.NotNil(t, request.Volatile["sdkVersion"]) + assert.NotNil(t, request.Volatile) return &types.KuzzleResponse{} }, diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index 6d946c3c..9003dab0 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -14,6 +14,8 @@ package types +import "encoding/json" + type KuzzleRequest struct { RequestId string `json:"requestId,omitempty"` Controller string `json:"controller,omitempty"` @@ -68,7 +70,7 @@ type SubscribeQuery struct { Body interface{} `json:"body"` } -type VolatileData map[string]interface{} +type VolatileData json.RawMessage type UserData struct { ProfileIds []string `json:"profileIds"` @@ -111,8 +113,8 @@ type MSSortedSet struct { } type SearchFilters struct { - Query interface{} `json:"query,omitempty"` - Sort []interface{} `json:"sort,omitempty"` - Aggregations interface{} `json:"aggregations,omitempty"` - SearchAfter []interface{} `json:"search_after,omitempty"` + Query json.RawMessage `json:"query,omitempty"` + Sort json.RawMessage `json:"sort,omitempty"` + Aggregations json.RawMessage `json:"aggregations,omitempty"` + SearchAfter json.RawMessage `json:"search_after,omitempty"` } diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index ec50fcb5..9f771908 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -49,7 +49,7 @@ type ( KuzzleNotification struct { RequestId string `json:"requestId"` Result *NotificationResult `json:"result"` - Volatile VolatileData `json:"volatile"` + Volatile json.RawMessage `json:"volatile"` Index string `json:"index"` Collection string `json:"collection"` Controller string `json:"controller"` @@ -200,11 +200,11 @@ type ( } Statistics struct { - CompletedRequests map[string]int `json:"completedRequests"` - Connections map[string]int `json:"connections"` - FailedRequests map[string]int `json:"failedRequests"` - OngoingRequests map[string]int `json:"ongoingRequests"` - Timestamp int `json:"timestamp"` + CompletedRequests json.RawMessage `json:"completedRequests"` + Connections json.RawMessage `json:"connections"` + FailedRequests json.RawMessage `json:"failedRequests"` + OngoingRequests json.RawMessage `json:"ongoingRequests"` + Timestamp int `json:"timestamp"` } LoginAttempt struct { From 2245dc03f8d1640dafa3ad2a3fbbd1299c1fbdc4 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 16 Apr 2018 17:13:06 +0200 Subject: [PATCH 088/363] wip --- collection/create.go | 6 +- internal/wrappers/cgo/kuzzle/jsonc_wrapper.go | 169 ------------------ internal/wrappers/cgo/kuzzle/kuzzle.go | 36 +++- internal/wrappers/cgo/kuzzle/query.go | 4 +- internal/wrappers/cpp/auth.cpp | 2 +- internal/wrappers/cpp/collection.cpp | 8 +- internal/wrappers/cpp/index.cpp | 10 +- internal/wrappers/cpp/kuzzle.cpp | 7 +- internal/wrappers/cpp/realtime.cpp | 6 +- internal/wrappers/features/java/build.gradle | 34 ++++ .../test/java/gradle/cucumber/Logindefs.java | 141 +++++++++++++++ internal/wrappers/features/sdks.feature | 20 +++ internal/wrappers/headers/document.hpp | 2 +- internal/wrappers/headers/kuzzlesdk.h | 2 +- kuzzle/query.go | 8 +- kuzzle/query_test.go | 1 - types/kuzzle_request.go | 2 +- 17 files changed, 259 insertions(+), 199 deletions(-) delete mode 100644 internal/wrappers/cgo/kuzzle/jsonc_wrapper.go create mode 100644 internal/wrappers/features/java/build.gradle create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java create mode 100644 internal/wrappers/features/sdks.feature diff --git a/collection/create.go b/collection/create.go index cccc8464..c2e8f607 100644 --- a/collection/create.go +++ b/collection/create.go @@ -40,5 +40,9 @@ func (dc *Collection) Create(index string, collection string, options types.Quer res := <-ch - return res.Error + if res.Error != nil { + return res.Error + } + + return nil } diff --git a/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go b/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go deleted file mode 100644 index 8e788794..00000000 --- a/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2015-2017 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #cgo LDFLAGS: -ljson-c - - #include - #include "kuzzlesdk.h" -*/ -import "C" -import "unsafe" - -func JsonCType(jobj *C.json_object) C.json_type { - // Returning the value directly results in a type mismatch - switch C.json_object_get_type(jobj) { - case C.json_type_null: - return C.json_type_null - case C.json_type_boolean: - return C.json_type_boolean - case C.json_type_double: - return C.json_type_double - case C.json_type_int: - return C.json_type_int - case C.json_type_object: - return C.json_type_object - case C.json_type_array: - return C.json_type_array - default: - return C.json_type_null - } -} - -func JsonCConvert(jobj *C.json_object) interface{} { - if jobj == nil { - return nil - } - - jtype := C.json_object_get_type(jobj) - - switch jtype { - case C.json_type_null: - return nil - case C.json_type_boolean: - return int(C.json_object_get_boolean(jobj)) == 1 - case C.json_type_double: - return float64(C.json_object_get_double(jobj)) - case C.json_type_int: - return int(C.json_object_get_int(jobj)) - case C.json_type_string: - return C.GoString(C.json_object_get_string(jobj)) - case C.json_type_object: - table := C.json_object_get_object(jobj) - content := make(map[string]interface{}) - - if table == nil { - return content - } - - for field, nextField := table.head, table.head; field != nil; field = nextField { - nextField = field.next - - key := (*C.char)(field.k) - value := (*C.json_object)(field.v) - - content[C.GoString(key)] = JsonCConvert(value) - } - - return content - case C.json_type_array: - length := int(C.json_object_array_length(jobj)) - content := make([]interface{}, length) - - for i := 0; i < length; i++ { - content[i] = JsonCConvert(C.json_object_array_get_idx(jobj, C.size_t(i))) - } - - return content - } - - return nil -} - -//export kuzzle_json_new -func kuzzle_json_new(jobj *C.json_object) { - jobj = C.json_object_new_object() -} - -//export kuzzle_json_put -func kuzzle_json_put(jobj *C.json_object, key *C.char, content unsafe.Pointer, kind C.int) { - if kind == 0 { - //string - C.json_object_object_add(jobj, key, C.json_object_new_string((*C.char)(content))) - } else if kind == 1 { - //int - C.json_object_object_add(jobj, key, C.json_object_new_int64((C.int64_t)(*(*C.int)(content)))) - } else if kind == 2 { - //double - C.json_object_object_add(jobj, key, C.json_object_new_double(*(*C.double)(content))) - } else if kind == 3 { - //bool - C.json_object_object_add(jobj, key, C.json_object_new_boolean((C.json_bool)(*(*C.uchar)(content)))) - } else if kind == 4 { - //json_object - C.json_object_object_add(jobj, key, (*C.json_object)(content)) - } -} - -//export kuzzle_json_get_string -func kuzzle_json_get_string(jobj *C.json_object, key *C.char) *C.char { - var value *C.json_object - C.json_object_object_get_ex(jobj, key, &value) - - return C.json_object_get_string(value) -} - -//export kuzzle_json_get_int -func kuzzle_json_get_int(jobj *C.json_object, key *C.char) C.int { - var value *C.json_object - C.json_object_object_get_ex(jobj, key, &value) - - return C.int(C.json_object_get_int64(value)) -} - -//export kuzzle_json_get_double -func kuzzle_json_get_double(jobj *C.json_object, key *C.char) C.double { - var value *C.json_object - C.json_object_object_get_ex(jobj, key, &value) - - return C.json_object_get_double(value) -} - -//export kuzzle_json_get_bool -func kuzzle_json_get_bool(jobj *C.json_object, key *C.char) C.json_bool { - var value *C.json_object - C.json_object_object_get_ex(jobj, key, &value) - - return C.json_object_get_boolean(value) -} - -//export kuzzle_json_get_json_object -func kuzzle_json_get_json_object(jobj *C.json_object, key *C.char) *C.json_object { - var value *C.json_object - - C.json_object_object_get_ex(jobj, key, &value) - return value -} - -//export kuzzle_free_json_object -func kuzzle_free_json_object(jobj *C.json_object) { - if jobj != nil { - // json_object_put returns 1 when the json object is freed - for C.json_object_put(jobj) != 1 { - } - } -} diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index ce0b6d6b..c8506931 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -82,32 +82,56 @@ func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) //export kuzzle_get_document_controller func kuzzle_get_document_controller(k *C.kuzzle) *C.document { - return (*C.document)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Document)) + d := (*C.document)(C.calloc(1, C.sizeof_document)) + + d.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Document)) + d.kuzzle = k + return d } //export kuzzle_get_auth_controller func kuzzle_get_auth_controller(k *C.kuzzle) *C.auth { - return (*C.auth)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Auth)) + a := (*C.auth)(C.calloc(1, C.sizeof_auth)) + + a.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Auth)) + a.kuzzle = k + return a } //export kuzzle_get_index_controller func kuzzle_get_index_controller(k *C.kuzzle) *C.kuzzle_index { - return (*C.kuzzle_index)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Index)) + i := (*C.kuzzle_index)(C.calloc(1, C.sizeof_kuzzle_index)) + + i.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Index)) + i.kuzzle = k + return i } //export kuzzle_get_server_controller func kuzzle_get_server_controller(k *C.kuzzle) *C.server { - return (*C.server)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Server)) + s := (*C.server)(C.calloc(1, C.sizeof_server)) + + s.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Server)) + s.kuzzle = k + return s } //export kuzzle_get_collection_controller func kuzzle_get_collection_controller(k *C.kuzzle) *C.collection { - return (*C.collection)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Collection)) + c := (*C.collection)(C.calloc(1, C.sizeof_collection)) + + c.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Collection)) + c.kuzzle = k + return c } //export kuzzle_get_realtime_controller func kuzzle_get_realtime_controller(k *C.kuzzle) *C.realtime { - return (*C.realtime)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Realtime)) + rt := (*C.realtime)(C.calloc(1, C.sizeof_realtime)) + + rt.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Realtime)) + rt.kuzzle = k + return rt } // Allocates memory diff --git a/internal/wrappers/cgo/kuzzle/query.go b/internal/wrappers/cgo/kuzzle/query.go index f7e12306..c3e31dcf 100644 --- a/internal/wrappers/cgo/kuzzle/query.go +++ b/internal/wrappers/cgo/kuzzle/query.go @@ -21,6 +21,8 @@ package main */ import "C" import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" ) @@ -70,7 +72,7 @@ func kuzzle_query(k *C.kuzzle, request *C.kuzzle_request, options *C.query_optio } if request.body != nil { - req.Body = request.body + req.Body = json.RawMessage(C.GoString(request.body)) } if request.volatiles != nil { diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 836faa9e..835017db 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -54,7 +54,7 @@ namespace kuzzleio { void Auth::deleteMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_delete_my_credentials(_auth, const_cast(strategy.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); delete(r); } diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 30df65b5..1f8d8af2 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -33,7 +33,7 @@ namespace kuzzleio { void Collection::create(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_collection_create(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } @@ -60,7 +60,7 @@ namespace kuzzleio { void Collection::truncate(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); @@ -79,7 +79,7 @@ namespace kuzzleio { void Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); @@ -130,7 +130,7 @@ namespace kuzzleio { void Collection::deleteSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index 43be3c8d..a26f38f6 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -35,14 +35,14 @@ namespace kuzzleio { void Index::create(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_create(_index, const_cast(index.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } void Index::delete_(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_delete(_index, const_cast(index.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } @@ -79,21 +79,21 @@ namespace kuzzleio { void Index::refresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } void Index::refreshInternal(query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_refresh_internal(_index, options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } void Index::setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh, options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index b3f69c2f..2e3bd2db 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -20,9 +20,6 @@ #include "server.hpp" #include "collection.hpp" #include "document.hpp" -#include "auth.hpp" -#include "index.hpp" -#include "server.hpp" #include "realtime.hpp" #include #include @@ -38,13 +35,15 @@ namespace kuzzleio { Kuzzle::Kuzzle(const std::string& host, options *opts) { this->_kuzzle = new kuzzle(); + kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); + this->document = new Document(this, kuzzle_get_document_controller(this->_kuzzle)); this->auth = new Auth(this, kuzzle_get_auth_controller(_kuzzle)); this->index = new Index(this, kuzzle_get_index_controller(_kuzzle)); this->server = new Server(this, kuzzle_get_server_controller(_kuzzle)); this->collection = new Collection(this, kuzzle_get_collection_controller(this->_kuzzle)); + this->realtime = new Realtime(this, kuzzle_get_realtime_controller(this->_kuzzle)); - kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); } Kuzzle::~Kuzzle() { diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index 895e3115..45fd41a9 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -35,7 +35,7 @@ namespace kuzzleio { void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, NotificationListener* cb) Kuz_Throw_KuzzleException { void_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), options, call_subscribe_cb, this); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); _listener_instances[roomId] = cb; @@ -53,7 +53,7 @@ namespace kuzzleio { void Realtime::publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException { void_result *r = kuzzle_realtime_publish(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } @@ -71,7 +71,7 @@ namespace kuzzleio { void Realtime::unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException { void_result *r = kuzzle_realtime_unsubscribe(_realtime, const_cast(roomId.c_str())); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); _listener_instances[roomId] = NULL; diff --git a/internal/wrappers/features/java/build.gradle b/internal/wrappers/features/java/build.gradle new file mode 100644 index 00000000..93dbb793 --- /dev/null +++ b/internal/wrappers/features/java/build.gradle @@ -0,0 +1,34 @@ +apply plugin: 'java' + +configurations { + cucumberRuntime { + extendsFrom testRuntime + } +} + +compileTestJava { + classpath += files("../../build/java") +} + +task cucumber() { + dependsOn assemble, compileTestJava + doLast { + javaexec { + jvmArgs = ["-Djava.library.path=../../build/java/io/kuzzle/sdk"] + main = "cucumber.api.cli.Main" + classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output + files('../../build/java') + args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', '../'] + } + } +} + +dependencies { + testCompile 'io.cucumber:cucumber-java:2.3.1' + testCompile 'io.cucumber:cucumber-junit:2.3.1' + + testCompile 'junit:junit:4.12' +} + +repositories { + mavenCentral() +} \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java new file mode 100644 index 00000000..223ea8b6 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -0,0 +1,141 @@ +package gradle.cucumber; + +import cucumber.api.java.Before; +import cucumber.api.java.After; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.*; + +public class Logindefs { + private Kuzzle k; + + @Before + public void before() { + k = new Kuzzle("localhost", null); + + // @todo do this with fixture + try { + k.getIndex().create("index"); + k.getCollection().create("index", "collection"); + } catch(Exception e) { + e.printStackTrace(); + } + } + + @After + public void after() { + //@todo do this with fixture + KuzzleRequest request = new KuzzleRequest(); + request.setController("collection"); + request.setAction("truncate"); + request.setIndex("index"); + request.setCollection("collection"); + k.query(request); + + request.setController("security"); + request.setAction("deleteUser"); + request.setId("useradmin-id"); + k.query(request); + + k.disconnect(); + } + + @Given("^I create a user \"([^\"]*)\" with password \"([^\"]*)\" with id \"([^\"]*)\"$") + public void CreateUser(String user, String password, String id) { + k = new Kuzzle("localhost", null); + + String json = "{\n" + + " \"content\": {\n" + + " \"profileIds\": [\"default\"]" + + " },\n" + + " \"credentials\": {\n" + + " \"local\": {\n" + + " \"username\": \""+user+"\"," + + " \"password\": \""+password+"\"" + + " }\n" + + " }\n" + + "}"; + + KuzzleRequest request = new KuzzleRequest(); + request.setController("security"); + request.setAction("createUser"); + request.setBody(json); + request.setId(id); + + k.query(request); + } + + @When("^I try to create a document with id \"([^\"]*)\"$") + public void CreateDocument(String id) { + k.getDocument().create("index", "collection", "{\"foo\":\"bar\"}"); + } + + /* + + @Then("^I check if the document with id \"([^\"]*)\"( does not)? exists$") + public void GetDocument(String id, String does_not_exists) { + boolean raised = false; + Collection c = new Collection(k, "collection", "index"); + try { + c.fetchDocument(id); + } catch (Exception e) { + if (does_not_exists == null) { + Assert.fail("Exception raised: " + e.toString()); + } else { + raised = true; + } + } + if (does_not_exists != null) { + Assert.assertTrue("The document has been created and should not have been.", raised); + } + } + + @When("^I log in as \"([^\"]*)\":\"([^\"]*)\"$") + public void Login(String user, String password) { + JsonObject query = new JsonObject() + .put("username", user) + .put("password", password); + String jwt = k.login("local", query, 1000000); + Assert.assertNotNull("Jwt should not be null after a right login", jwt); + } + + @Then("^I check the JWT is( not)? null$") + public void CheckJwt(String not) { + if (not != null) { + Assert.assertNotNull(k.getJwt()); + } else { + Assert.assertNull(k.getJwt()); + } + } + + @When("^I update my credentials with username \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") + public void UpdateMyCredentials(String username, String key, String value) { + JsonObject credentials = new JsonObject() + .put("username", username) + .put(key, value); + try { + k.updateMyCredentials("local", credentials); + } catch(Exception e) {} + } + + @Then("^I check my new credentials are( not)? valid with username \"([^\"]*)\", password \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") + public void CheckMyCredentials(String not, String username, String password, String key, String value) { + JsonObject credentials = new JsonObject() + .put("username", username) + .put("password", password) + .put(key, value); + if (not == null) { + Assert.assertTrue(k.validateMyCredentials("local", credentials)); + } else { + try { + Assert.assertFalse(k.validateMyCredentials("local", credentials)); + } catch(UnauthorizedException e) {} + } + } + + @Given("^I logout$") + public void Logout() { + k.logout(); + } + */ +} diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature new file mode 100644 index 00000000..6975f0fc --- /dev/null +++ b/internal/wrappers/features/sdks.feature @@ -0,0 +1,20 @@ +Feature: SDK's integration tests + + Scenario: login user + Given I create a user "useradmin" with password "testpwd" with id "useradmin-id" + When I try to create a document with id "my-document" + Then I check if the document with id "my-document" does not exists + + When I log in as "useradmin":"testpwd" + Then I check the JWT is not null + + When I update my credentials with username "useradmin" and "foo" = "bar" + Then I check my new credentials are valid with username "useradmin", password "testpwd" and "foo" = "bar" + + When I try to create a document with id "my-document" + Then I check if the document with id "my-document" exists + + Given I logout + When I update my credentials with username "useradmin" and "foo" = "barz" + Then I check my new credentials are not valid with username "useradmin", password "testpwd" and "foo" = "barz" + Then I check the JWT is null \ No newline at end of file diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp index e6c7fd88..e9636f5f 100644 --- a/internal/wrappers/headers/document.hpp +++ b/internal/wrappers/headers/document.hpp @@ -30,7 +30,7 @@ namespace kuzzleio { virtual ~Document(); int count_(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; bool exists(const std::string& index, const std::string& collection, const std::string& id, query_options *options=NULL) Kuz_Throw_KuzzleException; - std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body="", query_options *options=NULL) Kuz_Throw_KuzzleException; std::string createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; std::string delete_(const std::string& index, const std::string& collection, const std::string& id, query_options *options=NULL) Kuz_Throw_KuzzleException; std::vector deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index ab7bd455..dd1e147e 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -118,7 +118,7 @@ typedef struct { char *scroll; } search_options; -typedef struct { +typedef struct auth { void *instance; kuzzle *kuzzle; } auth; diff --git a/kuzzle/query.go b/kuzzle/query.go index 40509a94..94a12dc4 100644 --- a/kuzzle/query.go +++ b/kuzzle/query.go @@ -40,7 +40,7 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r type body struct{} if query.Body == nil { - query.Body = make(map[string]interface{}) + query.Body = json.RawMessage("{}") } if options == nil { @@ -63,6 +63,7 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r } jsonRequest, _ := json.Marshal(query) + out := map[string]interface{}{} json.Unmarshal(jsonRequest, &out) @@ -89,6 +90,11 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r out["retryOnConflict"] = retryOnConflict } + jwt := k.Jwt() + if jwt != "" { + out["jwt"] = jwt + } + finalRequest, err := json.Marshal(out) if err != nil { diff --git a/kuzzle/query_test.go b/kuzzle/query_test.go index 136de6a8..ee4e4238 100644 --- a/kuzzle/query_test.go +++ b/kuzzle/query_test.go @@ -100,7 +100,6 @@ func TestQueryWithVolatile(t *testing.T) { request := types.KuzzleRequest{} json.Unmarshal(query, &request) - fmt.Printf("%s %s\n", request.Volatile, volatileData) assert.Equal(t, volatileData, request.Volatile) assert.NotNil(t, request.Volatile) diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index 9003dab0..c1b8cc63 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -70,7 +70,7 @@ type SubscribeQuery struct { Body interface{} `json:"body"` } -type VolatileData json.RawMessage +type VolatileData = json.RawMessage type UserData struct { ProfileIds []string `json:"profileIds"` From cef9679ca579d786483cb5cb209b6494ef479b8b Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 17 Apr 2018 09:22:20 +0200 Subject: [PATCH 089/363] removed last json-c dependencies --- .travis.yml | 8 ---- document/create.go | 4 -- internal/wrappers/README.md | 1 - internal/wrappers/cgo/kuzzle/destructors.go | 1 - .../wrappers/cgo/kuzzle/memory_storage.go | 42 +++++++++---------- internal/wrappers/cpp/document.cpp | 1 + .../test/java/gradle/cucumber/Logindefs.java | 8 +--- internal/wrappers/headers/core.hpp | 1 - internal/wrappers/headers/kuzzlesdk.h | 25 +++++++++++ internal/wrappers/headers/swig.h | 29 ------------- 10 files changed, 48 insertions(+), 72 deletions(-) delete mode 100644 internal/wrappers/headers/swig.h diff --git a/.travis.yml b/.travis.yml index 003c5575..4cb2bd7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,14 +3,6 @@ go: - 1.9 dist: trusty install: - - git clone https://github.com/json-c/json-c.git - - cd json-c - - sudo apt-get install build-essential swig oracle-java8-installer g++ - - sh autogen.sh - - ./configure - - make - - sudo make install - - cd - - go get -t -v ./... script: - bash ./test.sh diff --git a/document/create.go b/document/create.go index 13cfa78a..2a3017e8 100644 --- a/document/create.go +++ b/document/create.go @@ -37,10 +37,6 @@ func (d *Document) Create(index string, collection string, _id string, body stri return "", types.NewError("Document.Create: collection required", 400) } - if _id == "" { - return "", types.NewError("Document.Create: id required", 400) - } - if body == "" { return "", types.NewError("Document.Create: body required", 400) } diff --git a/internal/wrappers/README.md b/internal/wrappers/README.md index 132cbef8..54e61aae 100644 --- a/internal/wrappers/README.md +++ b/internal/wrappers/README.md @@ -7,7 +7,6 @@ This project contains a CGO wrapper to Kuzzle's [Go SDK](https://github.com/kuzz # Pre-requisites * [Go](https://golang.org/doc/install) -* [JSON-C library](https://github.com/json-c/json-c#install-using-apt-eg-ubuntu-16042-lts) # Contributing diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 848c927c..e215cfa2 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -16,7 +16,6 @@ package main /* #cgo CFLAGS: -std=c99 -I../../../headers - #cgo LDFLAGS: -ljson-c #include #include "kuzzlesdk.h" diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go index 5e786362..9275f96e 100644 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ b/internal/wrappers/cgo/kuzzle/memory_storage.go @@ -16,11 +16,9 @@ package main /* #cgo CFLAGS: -I../../headers - #cgo LDFLAGS: -ljson-c #include #include - #include #include "kuzzlesdk.h" #include "sdk_wrappers_internal.h" @@ -150,13 +148,13 @@ func kuzzle_ms_flushdb(k *C.kuzzle, options *C.query_options) *C.void_result { } //export kuzzle_ms_geoadd -func kuzzle_ms_geoadd(k *C.kuzzle, key *C.char, points **C.json_object, plen C.size_t, options *C.query_options) *C.int_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(points))[:plen:plen] +func kuzzle_ms_geoadd(k *C.kuzzle, key *C.char, points **C.point, plen C.size_t, options *C.query_options) *C.int_result { + wrapped := (*[1 << 20]*C.point)(unsafe.Pointer(points))[:plen:plen] gopoints := make([]*types.GeoPoint, int(plen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, gopoints[i]) } @@ -395,13 +393,13 @@ func kuzzle_ms_hmget(k *C.kuzzle, key *C.char, fields **C.char, flen C.size_t, o } //export kuzzle_ms_hmset -func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.json_object, elen C.size_t, options *C.query_options) *C.void_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(entries))[:elen:elen] +func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.ms_hash_field, elen C.size_t, options *C.query_options) *C.void_result { + wrapped := (*[1 << 20]*C.ms_hash_field)(unsafe.Pointer(entries))[:elen:elen] goentries := make([]*types.MsHashField, int(elen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, goentries[i]) } @@ -629,13 +627,13 @@ func kuzzle_ms_mget(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_ } //export kuzzle_ms_mset -func kuzzle_ms_mset(k *C.kuzzle, entries **C.json_object, elen C.size_t, options *C.query_options) *C.void_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(entries))[:elen:elen] +func kuzzle_ms_mset(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, options *C.query_options) *C.void_result { + wrapped := (*[1 << 20]*C.ms_key_value)(unsafe.Pointer(entries))[:elen:elen] goentries := make([]*types.MSKeyValue, int(elen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, goentries[i]) } @@ -647,13 +645,13 @@ func kuzzle_ms_mset(k *C.kuzzle, entries **C.json_object, elen C.size_t, options } //export kuzzle_ms_msetnx -func kuzzle_ms_msetnx(k *C.kuzzle, entries **C.json_object, elen C.size_t, options *C.query_options) *C.bool_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(entries))[:elen:elen] +func kuzzle_ms_msetnx(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, options *C.query_options) *C.bool_result { + wrapped := (*[1 << 20]*C.ms_key_value)(unsafe.Pointer(entries))[:elen:elen] goentries := make([]*types.MSKeyValue, int(elen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, goentries[i]) } @@ -1073,13 +1071,13 @@ func kuzzle_ms_type(k *C.kuzzle, key *C.char, options *C.query_options) *C.strin } //export kuzzle_ms_zadd -func kuzzle_ms_zadd(k *C.kuzzle, key *C.char, elements **C.json_object, elen C.size_t, options *C.query_options) *C.int_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(elements))[:elen:elen] +func kuzzle_ms_zadd(k *C.kuzzle, key *C.char, elements **C.ms_sorted_set, elen C.size_t, options *C.query_options) *C.int_result { + wrapped := (*[1 << 20]*C.ms_sorted_set)(unsafe.Pointer(elements))[:elen:elen] goelements := make([]*types.MSSortedSet, int(elen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, goelements[i]) } diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index 42982907..a632894d 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -52,6 +52,7 @@ namespace kuzzleio { std::string Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { string_result *r = kuzzle_document_create(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); + std::cout << r->error << std::endl; if (r->error != NULL) throwExceptionFromStatus(r); diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java index 223ea8b6..f30f6aa1 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -17,9 +17,7 @@ public void before() { try { k.getIndex().create("index"); k.getCollection().create("index", "collection"); - } catch(Exception e) { - e.printStackTrace(); - } + } catch(Exception e) {} } @After @@ -42,8 +40,6 @@ public void after() { @Given("^I create a user \"([^\"]*)\" with password \"([^\"]*)\" with id \"([^\"]*)\"$") public void CreateUser(String user, String password, String id) { - k = new Kuzzle("localhost", null); - String json = "{\n" + " \"content\": {\n" + " \"profileIds\": [\"default\"]" + @@ -67,7 +63,7 @@ public void CreateUser(String user, String password, String id) { @When("^I try to create a document with id \"([^\"]*)\"$") public void CreateDocument(String id) { - k.getDocument().create("index", "collection", "{\"foo\":\"bar\"}"); + k.getDocument().create("index", "collection", id, "{\"foo\":\"bar\"}"); } /* diff --git a/internal/wrappers/headers/core.hpp b/internal/wrappers/headers/core.hpp index 1bb53937..bd157fd9 100644 --- a/internal/wrappers/headers/core.hpp +++ b/internal/wrappers/headers/core.hpp @@ -21,7 +21,6 @@ extern "C" { #include "kuzzle.h" #include "kuzzlesdk.h" - #include "swig.h" } #endif \ No newline at end of file diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index dd1e147e..6b2d4d43 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -381,6 +381,31 @@ typedef struct geopos_result { char *stack; } geopos_result; +// ms.geopoint +typedef struct point { + float lat; + float lon; + char *name; +} point; + +// ms.msHashField +typedef struct ms_hash_field { + char *field; + char *value; +} ms_hash_field; + +// ms.keyValue +typedef struct ms_key_value { + char *key; + char *value; +} ms_key_value; + +// ms.sortedSet +typedef struct ms_sorted_set { + float score; + char *member; +} ms_sorted_set; + //check_token typedef struct token_validity { bool valid; diff --git a/internal/wrappers/headers/swig.h b/internal/wrappers/headers/swig.h deleted file mode 100644 index 156c5ef7..00000000 --- a/internal/wrappers/headers/swig.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SWIG_H_ -#define SWIG_H_ - -#define __swig_build - -//Json -extern void kuzzle_json_put(json_object*, char*, void*, int); -extern char* kuzzle_json_get_string(json_object*, char*); -extern int kuzzle_json_get_int(json_object*, char*); -extern double kuzzle_json_get_double(json_object*, char*); -extern json_bool kuzzle_json_get_bool(json_object*, char*); -extern json_object* kuzzle_json_get_json_object(json_object*, char*); -extern void kuzzle_json_new(json_object*); - -#endif \ No newline at end of file From f5fd8be5f78d2672e9971ddb55cd50233860ad52 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 17 Apr 2018 11:27:19 +0200 Subject: [PATCH 090/363] wrote e2e tests --- connection/websocket/web_socket.go | 4 ++ document/count.go | 4 +- document/count_test.go | 10 ++--- document/create.go | 4 +- document/createOrReplace.go | 4 +- document/createOrReplace_test.go | 12 +++--- document/create_test.go | 12 +++--- document/mCreate.go | 4 +- document/mCreateOrReplace.go | 4 +- document/mCreateOrReplace_test.go | 10 ++--- document/mCreate_test.go | 10 ++--- document/mReplace.go | 4 +- document/mReplace_test.go | 10 ++--- document/mUpdate.go | 4 +- document/mUpdate_test.go | 10 ++--- document/replace.go | 4 +- document/replace_test.go | 12 +++--- document/search.go | 4 +- document/search_test.go | 10 ++--- document/update.go | 4 +- document/update_test.go | 12 +++--- document/validate.go | 4 +- document/validate_test.go | 10 ++--- internal/wrappers/cgo/kuzzle/document.go | 23 ++++++----- internal/wrappers/cgo/kuzzle/errors.go | 1 - internal/wrappers/cgo/kuzzle/kuzzle.go | 5 +++ internal/wrappers/cpp/kuzzle.cpp | 4 ++ .../test/java/gradle/cucumber/Logindefs.java | 40 ++++++++----------- internal/wrappers/headers/kuzzle.hpp | 1 + internal/wrappers/kcore.i | 3 +- kuzzle/query.go | 1 + 31 files changed, 126 insertions(+), 118 deletions(-) diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 1c740ba9..7e70a289 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -354,6 +354,10 @@ func (ws *webSocket) listen() { c.(chan<- *types.KuzzleResponse) <- &message close(c.(chan<- *types.KuzzleResponse)) ws.channelsResult.Delete(message.RequestId) + } else if c, found := ws.channelsResult.Load(message.RoomId); found { + c.(chan<- *types.KuzzleResponse) <- &message + close(c.(chan<- *types.KuzzleResponse)) + ws.channelsResult.Delete(message.RequestId) } else { ws.EmitEvent(event.Discarded, &message) } diff --git a/document/count.go b/document/count.go index 652a3f17..9333595b 100644 --- a/document/count.go +++ b/document/count.go @@ -25,7 +25,7 @@ import ( // There is a small delay between documents creation and their existence in our advanced search layer, // usually a couple of seconds. // That means that a document that was just been created won’t be returned by this function -func (d *Document) Count(index string, collection string, body string, options types.QueryOptions) (int, error) { +func (d *Document) Count(index string, collection string, body json.RawMessage, options types.QueryOptions) (int, error) { if index == "" { return 0, types.NewError("Document.Count: index required", 400) } @@ -34,7 +34,7 @@ func (d *Document) Count(index string, collection string, body string, options t return 0, types.NewError("Document.Count: collection required", 400) } - if body == "" { + if body == nil { return 0, types.NewError("Document.Count: body required", 400) } diff --git a/document/count_test.go b/document/count_test.go index a4919c02..93fae122 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -28,21 +28,21 @@ import ( func TestCountIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("", "collection", "body", nil) + _, err := d.Count("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCountCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("index", "", "body", nil) + _, err := d.Count("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCountBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("index", "collection", "", nil) + _, err := d.Count("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -54,7 +54,7 @@ func TestCountDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Count("index", "collection", "body", nil) + _, err := d.Count("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -75,7 +75,7 @@ func TestCountDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - res, err := d.Count("index", "collection", "body", nil) + res, err := d.Count("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) assert.Equal(t, 1, res) } diff --git a/document/create.go b/document/create.go index 2a3017e8..4f52cc5f 100644 --- a/document/create.go +++ b/document/create.go @@ -28,7 +28,7 @@ import ( // If the same document already exists: // - resolves with an error if set to "error". // - replaces the existing document if set to "replace" -func (d *Document) Create(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { +func (d *Document) Create(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Create: index required", 400) } @@ -37,7 +37,7 @@ func (d *Document) Create(index string, collection string, _id string, body stri return "", types.NewError("Document.Create: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.Create: body required", 400) } diff --git a/document/createOrReplace.go b/document/createOrReplace.go index c0c1f7bf..07dcff6b 100644 --- a/document/createOrReplace.go +++ b/document/createOrReplace.go @@ -28,7 +28,7 @@ import ( // If the same document already exists: // - resolves with an error if set to "error". // - replaces the existing document if set to "replace" -func (d *Document) CreateOrReplace(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { +func (d *Document) CreateOrReplace(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.CreateOrReplace: index required", 400) } @@ -41,7 +41,7 @@ func (d *Document) CreateOrReplace(index string, collection string, _id string, return "", types.NewError("Document.CreateOrReplace: id required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.CreateOrReplace: body required", 400) } diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go index 1c39ad85..db7b1f2a 100644 --- a/document/createOrReplace_test.go +++ b/document/createOrReplace_test.go @@ -28,28 +28,28 @@ import ( func TestCreateOrReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("", "collection", "id1", "body", nil) + _, err := d.CreateOrReplace("", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateOrReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "", "id1", "body", nil) + _, err := d.CreateOrReplace("index", "", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateOrReplaceIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "collection", "", "body", nil) + _, err := d.CreateOrReplace("index", "collection", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateOrReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "collection", "id1", "", nil) + _, err := d.CreateOrReplace("index", "collection", "id1", nil, nil) assert.NotNil(t, err) } @@ -61,7 +61,7 @@ func TestCreateOrReplaceDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "collection", "id1", "body", nil) + _, err := d.CreateOrReplace("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -90,6 +90,6 @@ func TestCreateOrReplaceDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "collection", id, "body", nil) + _, err := d.CreateOrReplace("index", "collection", id, json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/create_test.go b/document/create_test.go index 98de94ac..662c06c2 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -28,28 +28,28 @@ import ( func TestCreateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Create("", "collection", "id1", "body", nil) + _, err := d.Create("", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Create("index", "", "id1", "body", nil) + _, err := d.Create("index", "", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Create("index", "collection", "", "body", nil) + _, err := d.Create("index", "collection", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Create("index", "collection", "id1", "", nil) + _, err := d.Create("index", "collection", "id1", nil, nil) assert.NotNil(t, err) } @@ -61,7 +61,7 @@ func TestCreateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Create("index", "collection", "id1", "body", nil) + _, err := d.Create("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -90,6 +90,6 @@ func TestCreateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Create("index", "collection", id, "body", nil) + _, err := d.Create("index", "collection", id, json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/mCreate.go b/document/mCreate.go index 763ebd48..0412c4c8 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -21,7 +21,7 @@ import ( ) // MCreate creates the provided documents. -func (d *Document) MCreate(index string, collection string, body string, options types.QueryOptions) (string, error) { +func (d *Document) MCreate(index string, collection string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MCreate: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) MCreate(index string, collection string, body string, options return "", types.NewError("Document.MCreate: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.MCreate: body required", 400) } diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index 8a1590b0..7a262054 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -21,7 +21,7 @@ import ( ) // MCreateOrReplace creates or replaces the provided documents. -func (d *Document) MCreateOrReplace(index string, collection string, body string, options types.QueryOptions) (string, error) { +func (d *Document) MCreateOrReplace(index string, collection string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MCreateOrReplace: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) MCreateOrReplace(index string, collection string, body string return "", types.NewError("Document.MCreateOrReplace: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.MCreateOrReplace: body required", 400) } diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index 5409be8d..9a6a3377 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -29,7 +29,7 @@ func TestMCreateOrReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("", "collection", "body", nil) + _, err := d.MCreateOrReplace("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMCreateOrReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "", "body", nil) + _, err := d.MCreateOrReplace("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestMCreateOrReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "collection", "", nil) + _, err := d.MCreateOrReplace("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMCreateOrReplaceDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "collection", "body", nil) + _, err := d.MCreateOrReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -110,6 +110,6 @@ func TestMCreateOrReplaceDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "collection", "body", nil) + _, err := d.MCreateOrReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/mCreate_test.go b/document/mCreate_test.go index 300e36c7..d2ca06d0 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -29,7 +29,7 @@ func TestMCreateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreate("", "collection", "body", nil) + _, err := d.MCreate("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMCreateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "", "body", nil) + _, err := d.MCreate("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestMCreateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "collection", "", nil) + _, err := d.MCreate("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMCreateDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "collection", "body", nil) + _, err := d.MCreate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -110,6 +110,6 @@ func TestMCreateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "collection", "body", nil) + _, err := d.MCreate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/mReplace.go b/document/mReplace.go index 690306c0..586b5bea 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -21,7 +21,7 @@ import ( ) // MReplace replaces multiple documents at once. -func (d *Document) MReplace(index string, collection string, body string, options types.QueryOptions) (string, error) { +func (d *Document) MReplace(index string, collection string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MReplace: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) MReplace(index string, collection string, body string, option return "", types.NewError("Document.MReplace: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.MReplace: body required", 400) } diff --git a/document/mReplace_test.go b/document/mReplace_test.go index 4af96989..8f322e2a 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -29,7 +29,7 @@ func TestMReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MReplace("", "collection", "body", nil) + _, err := d.MReplace("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "", "body", nil) + _, err := d.MReplace("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestMReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "collection", "", nil) + _, err := d.MReplace("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMReplaceDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "collection", "body", nil) + _, err := d.MReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -111,6 +111,6 @@ func TestMReplaceDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "collection", "body", nil) + _, err := d.MReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/mUpdate.go b/document/mUpdate.go index b27fcece..8ca4a26f 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -21,7 +21,7 @@ import ( ) // MUpdate updates multiple documents at once -func (d *Document) MUpdate(index string, collection string, body string, options types.QueryOptions) (string, error) { +func (d *Document) MUpdate(index string, collection string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MUpdate: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) MUpdate(index string, collection string, body string, options return "", types.NewError("Document.MUpdate: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.MUpdate: body required", 400) } diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index 4118d5fe..c8e2bb54 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -29,7 +29,7 @@ func TestMUpdateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MUpdate("", "collection", "body", nil) + _, err := d.MUpdate("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMUpdateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "", "body", nil) + _, err := d.MUpdate("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestMUpdateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "collection", "", nil) + _, err := d.MUpdate("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMUpdateDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "collection", "body", nil) + _, err := d.MUpdate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -111,6 +111,6 @@ func TestMUpdateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "collection", "body", nil) + _, err := d.MUpdate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/replace.go b/document/replace.go index b671bc2a..0cc297bb 100644 --- a/document/replace.go +++ b/document/replace.go @@ -21,7 +21,7 @@ import ( ) // Replace replaces a document in Kuzzle. -func (d *Document) Replace(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { +func (d *Document) Replace(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Replace: index required", 400) } @@ -34,7 +34,7 @@ func (d *Document) Replace(index string, collection string, _id string, body str return "", types.NewError("Document.Replace: id required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.Replace: body required", 400) } diff --git a/document/replace_test.go b/document/replace_test.go index f3b3678b..5a113a4f 100644 --- a/document/replace_test.go +++ b/document/replace_test.go @@ -29,7 +29,7 @@ func TestReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Replace("", "collection", "id1", "body", nil) + _, err := d.Replace("", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "", "id1", "body", nil) + _, err := d.Replace("index", "", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestReplaceIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "collection", "", "body", nil) + _, err := d.Replace("index", "collection", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -53,7 +53,7 @@ func TestReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "collection", "id1", "", nil) + _, err := d.Replace("index", "collection", "id1", nil, nil) assert.NotNil(t, err) } @@ -66,7 +66,7 @@ func TestReplaceDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "collection", "id1", "body", nil) + _, err := d.Replace("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -97,6 +97,6 @@ func TestReplaceDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "collection", id, "body", nil) + _, err := d.Replace("index", "collection", id, json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/search.go b/document/search.go index 9d06fbf9..8487ff37 100644 --- a/document/search.go +++ b/document/search.go @@ -21,7 +21,7 @@ import ( ) // Search documents in the given Collection, using provided filters and option. -func (d *Document) Search(index string, collection string, body string, options types.QueryOptions) (*types.SearchResult, error) { +func (d *Document) Search(index string, collection string, body json.RawMessage, options types.QueryOptions) (*types.SearchResult, error) { if index == "" { return nil, types.NewError("Document.Search: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) Search(index string, collection string, body string, options return nil, types.NewError("Document.Search: collection required", 400) } - if body == "" { + if body == nil { return nil, types.NewError("Document.Search: body required", 400) } diff --git a/document/search_test.go b/document/search_test.go index 47770d4d..eb6cc447 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -29,7 +29,7 @@ func TestSearchIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Search("", "collection", "body", nil) + _, err := d.Search("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestSearchCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Search("index", "", "body", nil) + _, err := d.Search("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestSearchBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Search("index", "collection", "", nil) + _, err := d.Search("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestSearchDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Search("index", "collection", "body", nil) + _, err := d.Search("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -85,6 +85,6 @@ func TestSearchDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Search("index", "collection", "body", nil) + _, err := d.Search("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/update.go b/document/update.go index cd295928..a819decc 100644 --- a/document/update.go +++ b/document/update.go @@ -21,7 +21,7 @@ import ( ) // Update updates a document in Kuzzle. -func (d *Document) Update(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { +func (d *Document) Update(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Update: index required", 400) } @@ -34,7 +34,7 @@ func (d *Document) Update(index string, collection string, _id string, body stri return "", types.NewError("Document.Update: id required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.Update: body required", 400) } diff --git a/document/update_test.go b/document/update_test.go index 4c6e0b4f..97148d54 100644 --- a/document/update_test.go +++ b/document/update_test.go @@ -29,7 +29,7 @@ func TestUpdateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Update("", "collection", "id1", "body", nil) + _, err := d.Update("", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestUpdateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Update("index", "", "id1", "body", nil) + _, err := d.Update("index", "", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestUpdateIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Update("index", "collection", "", "body", nil) + _, err := d.Update("index", "collection", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -53,7 +53,7 @@ func TestUpdateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Update("index", "collection", "id1", "", nil) + _, err := d.Update("index", "collection", "id1", nil, nil) assert.NotNil(t, err) } @@ -66,7 +66,7 @@ func TestUpdateDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Update("index", "collection", "id1", "body", nil) + _, err := d.Update("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -97,6 +97,6 @@ func TestUpdateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Update("index", "collection", id, "body", nil) + _, err := d.Update("index", "collection", id, json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/validate.go b/document/validate.go index 8d1f7557..662f5104 100644 --- a/document/validate.go +++ b/document/validate.go @@ -21,7 +21,7 @@ import ( ) // Validate validates data against existing validation rules. -func (d *Document) Validate(index string, collection string, body string, options types.QueryOptions) (bool, error) { +func (d *Document) Validate(index string, collection string, body json.RawMessage, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Document.Validate: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) Validate(index string, collection string, body string, option return false, types.NewError("Document.Validate: collection required", 400) } - if body == "" { + if body == nil { return false, types.NewError("Document.Validate: body required", 400) } diff --git a/document/validate_test.go b/document/validate_test.go index dcadf25f..1ca00457 100644 --- a/document/validate_test.go +++ b/document/validate_test.go @@ -28,21 +28,21 @@ import ( func TestValidateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("", "collection", "body", nil) + _, err := d.Validate("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestValidateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "", "body", nil) + _, err := d.Validate("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestValidateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "", nil) + _, err := d.Validate("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -54,7 +54,7 @@ func TestValidateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "body", nil) + _, err := d.Validate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -76,6 +76,6 @@ func TestValidateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "body", nil) + _, err := d.Validate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index 22d4a511..eecc890e 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -21,6 +21,7 @@ package main */ import "C" import ( + "encoding/json" "unsafe" "github.com/kuzzleio/sdk-go/document" @@ -57,7 +58,7 @@ func kuzzle_new_document(d *C.document, k *C.kuzzle) { //export kuzzle_document_count func kuzzle_document_count(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.int_result { - res, err := (*document.Document)(d.instance).Count(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Count(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCIntResult(res, err) } @@ -69,13 +70,13 @@ func kuzzle_document_exists(d *C.document, index *C.char, collection *C.char, id //export kuzzle_document_create func kuzzle_document_create(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Create(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Create(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_create_or_replace func kuzzle_document_create_or_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).CreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).CreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } @@ -99,37 +100,37 @@ func kuzzle_document_get(d *C.document, index *C.char, collection *C.char, id *C //export kuzzle_document_replace func kuzzle_document_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Replace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Replace(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_update func kuzzle_document_update(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Update(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Update(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_validate func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.bool_result { - res, err := (*document.Document)(d.instance).Validate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Validate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCBoolResult(res, err) } //export kuzzle_document_search func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.search_result { - res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCSearchResult(res, err) } //export kuzzle_document_mcreate func kuzzle_document_mcreate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MCreate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).MCreate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_mcreate_or_replace func kuzzle_document_mcreate_or_replace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MCreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).MCreateOrReplace(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } @@ -147,12 +148,12 @@ func kuzzle_document_mget(d *C.document, index *C.char, collection *C.char, ids //export kuzzle_document_mreplace func kuzzle_document_mreplace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MReplace(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).MReplace(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_mupdate func kuzzle_document_mupdate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MUpdate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).MUpdate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index a267cfcb..d9e60325 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -16,7 +16,6 @@ package main /* #cgo CFLAGS: -I../../../headers - #cgo LDFLAGS: -ljson-c #include "kuzzlesdk.h" */ diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 68090c5c..c73ae766 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -107,6 +107,11 @@ func kuzzle_get_index_controller(k *C.kuzzle) *C.kuzzle_index { return i } +//export kuzzle_get_jwt +func kuzzle_get_jwt(k *C.kuzzle) *C.char { + return C.CString((*kuzzle.Kuzzle)(k.instance).Jwt()) +} + //export kuzzle_get_server_controller func kuzzle_get_server_controller(k *C.kuzzle) *C.server { s := (*C.server)(C.calloc(1, C.sizeof_server)) diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index 2e3bd2db..bff55af9 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -111,6 +111,10 @@ namespace kuzzleio { return std::string(kuzzle_get_volatile(_kuzzle)); } + std::string Kuzzle::getJwt() { + return std::string(kuzzle_get_jwt(_kuzzle)); + } + void trigger_event_listener(int event, char* res, void* data) { ((Kuzzle*)data)->getListeners()[event]->trigger(res); } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java index f30f6aa1..de035ca9 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -3,8 +3,10 @@ import cucumber.api.java.Before; import cucumber.api.java.After; import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import io.kuzzle.sdk.*; +import org.junit.Assert; public class Logindefs { private Kuzzle k; @@ -63,17 +65,16 @@ public void CreateUser(String user, String password, String id) { @When("^I try to create a document with id \"([^\"]*)\"$") public void CreateDocument(String id) { - k.getDocument().create("index", "collection", id, "{\"foo\":\"bar\"}"); + try { + k.getDocument().create("index", "collection", id, "{\"foo\":\"bar\"}"); + } catch(Exception e) {} } - /* - @Then("^I check if the document with id \"([^\"]*)\"( does not)? exists$") public void GetDocument(String id, String does_not_exists) { boolean raised = false; - Collection c = new Collection(k, "collection", "index"); try { - c.fetchDocument(id); + k.getDocument().get("index", "collection", id); } catch (Exception e) { if (does_not_exists == null) { Assert.fail("Exception raised: " + e.toString()); @@ -88,50 +89,41 @@ public void GetDocument(String id, String does_not_exists) { @When("^I log in as \"([^\"]*)\":\"([^\"]*)\"$") public void Login(String user, String password) { - JsonObject query = new JsonObject() - .put("username", user) - .put("password", password); - String jwt = k.login("local", query, 1000000); + String jwt = k.getAuth().login("local", "{\"username\": \""+user+"\", \"password\":\""+password+"\" }"); Assert.assertNotNull("Jwt should not be null after a right login", jwt); } @Then("^I check the JWT is( not)? null$") public void CheckJwt(String not) { if (not != null) { - Assert.assertNotNull(k.getJwt()); + Assert.assertNotEquals("", k.getJwt()); } else { - Assert.assertNull(k.getJwt()); + Assert.assertEquals("", k.getJwt()); } } + @When("^I update my credentials with username \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") public void UpdateMyCredentials(String username, String key, String value) { - JsonObject credentials = new JsonObject() - .put("username", username) - .put(key, value); try { - k.updateMyCredentials("local", credentials); + k.getAuth().updateMyCredentials("local", "{\"username\": \""+username+"\", \""+key+"\":\""+value+"\"}"); } catch(Exception e) {} } @Then("^I check my new credentials are( not)? valid with username \"([^\"]*)\", password \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") public void CheckMyCredentials(String not, String username, String password, String key, String value) { - JsonObject credentials = new JsonObject() - .put("username", username) - .put("password", password) - .put(key, value); + String credentials = "{\"username\": \""+username+"\", \"password\":\""+password+"\", \""+key+"\":\""+value+"\"}"; if (not == null) { - Assert.assertTrue(k.validateMyCredentials("local", credentials)); + Assert.assertTrue(k.getAuth().validateMyCredentials("local", credentials)); } else { try { - Assert.assertFalse(k.validateMyCredentials("local", credentials)); - } catch(UnauthorizedException e) {} + Assert.assertFalse(k.getAuth().validateMyCredentials("local", credentials)); + } catch(Exception e) {} } } @Given("^I logout$") public void Logout() { - k.logout(); + k.getAuth().logout(); } - */ } diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 8e5a9d65..310c034f 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -52,6 +52,7 @@ namespace kuzzleio { bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string getJwt(); statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); kuzzle_response* query(kuzzle_request* query, query_options* options=NULL) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index e04dbe1e..3eded97a 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -11,8 +11,8 @@ #include "server.hpp" #include "document.hpp" #include "realtime.hpp" +#include "auth.hpp" #include -#include %} %define _Complex @@ -29,3 +29,4 @@ %include "server.hpp" %include "document.hpp" %include "realtime.hpp" +%include "auth.hpp" diff --git a/kuzzle/query.go b/kuzzle/query.go index 94a12dc4..c8e12a6d 100644 --- a/kuzzle/query.go +++ b/kuzzle/query.go @@ -105,6 +105,7 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r } err = k.socket.Send(finalRequest, options, responseChannel, requestId) + if err != nil { if responseChannel != nil { responseChannel <- &types.KuzzleResponse{Error: types.NewError(err.Error())} From eb39d520d752a447e8fc9936ee8d93cc564e9f4d Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 17 Apr 2018 11:53:42 +0200 Subject: [PATCH 091/363] do not throw error when creating a document without id --- document/create.go | 4 ++-- document/create_test.go | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/document/create.go b/document/create.go index 4f52cc5f..38674937 100644 --- a/document/create.go +++ b/document/create.go @@ -28,7 +28,7 @@ import ( // If the same document already exists: // - resolves with an error if set to "error". // - replaces the existing document if set to "replace" -func (d *Document) Create(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (string, error) { +func (d *Document) Create(index string, collection string, id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Create: index required", 400) } @@ -48,7 +48,7 @@ func (d *Document) Create(index string, collection string, _id string, body json Collection: collection, Controller: "document", Action: "create", - Id: _id, + Id: id, Body: body, } diff --git a/document/create_test.go b/document/create_test.go index 662c06c2..d4ec5f0d 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -39,13 +39,6 @@ func TestCreateCollectionNull(t *testing.T) { assert.NotNil(t, err) } -func TestCreateIdNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - d := document.NewDocument(k) - _, err := d.Create("index", "collection", "", json.RawMessage(`{"foo":"bar"}`), nil) - assert.NotNil(t, err) -} - func TestCreateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) From f9a36c43f29d193c124fab20122d5a0f7e651952 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 17 Apr 2018 11:58:42 +0200 Subject: [PATCH 092/363] install dependencies in travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4cb2bd7b..33a1c2d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ go: - 1.9 dist: trusty install: + - sudo apt-get install build-essential swig oracle-java8-installer g++ - go get -t -v ./... script: - bash ./test.sh From d772ee30ebd744b100e03f88d69b198e53cdfe9e Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 17 Apr 2018 17:28:56 +0200 Subject: [PATCH 093/363] added fixtures and scripts --- .../wrappers/features/fixtures/rights.json | 29 +++++++++++++++ internal/wrappers/features/fixtures/run.sh | 13 +++++++ internal/wrappers/features/run_java.sh | 6 +++ internal/wrappers/features/sdks.feature | 37 ++++++++++--------- 4 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 internal/wrappers/features/fixtures/rights.json create mode 100755 internal/wrappers/features/fixtures/run.sh create mode 100755 internal/wrappers/features/run_java.sh diff --git a/internal/wrappers/features/fixtures/rights.json b/internal/wrappers/features/fixtures/rights.json new file mode 100644 index 00000000..c9bac576 --- /dev/null +++ b/internal/wrappers/features/fixtures/rights.json @@ -0,0 +1,29 @@ +{ + "controllers": { + "auth": { + "actions": { + "*": true + } + }, + "security": { + "actions": { + "*": true + } + }, + "collection": { + "actions": { + "*": true + } + }, + "index": { + "actions": { + "*": true + } + }, + "document": { + "actions": { + "*": false + } + } + } +} \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/run.sh b/internal/wrappers/features/fixtures/run.sh new file mode 100755 index 00000000..c98bce06 --- /dev/null +++ b/internal/wrappers/features/fixtures/run.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +CONTENT_TYPE="Content-Type: application/json" +KUZZLE_HOST=http://localhost:7512 + +# update rights for anonymous user +curl -X PUT -H $CONTENT_TYPE -d "`cat rights.json`" $KUZZLE_HOST/roles/anonymous/_update + +# create index +curl -X POST -H $CONTENT_TYPE $KUZZLE_HOST/index/_create + +# create collection +curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/collection diff --git a/internal/wrappers/features/run_java.sh b/internal/wrappers/features/run_java.sh new file mode 100755 index 00000000..a710100a --- /dev/null +++ b/internal/wrappers/features/run_java.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd internal/wrappers/features/fixtures/ +./run.sh +cd ../java +gradle cucumber \ No newline at end of file diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature index 6975f0fc..4d47c586 100644 --- a/internal/wrappers/features/sdks.feature +++ b/internal/wrappers/features/sdks.feature @@ -1,20 +1,23 @@ Feature: SDK's integration tests - Scenario: login user - Given I create a user "useradmin" with password "testpwd" with id "useradmin-id" - When I try to create a document with id "my-document" - Then I check if the document with id "my-document" does not exists - - When I log in as "useradmin":"testpwd" - Then I check the JWT is not null - - When I update my credentials with username "useradmin" and "foo" = "bar" - Then I check my new credentials are valid with username "useradmin", password "testpwd" and "foo" = "bar" - - When I try to create a document with id "my-document" - Then I check if the document with id "my-document" exists + Scenario: Login user + Given I create a user "useradmin" with password "testpwd" with id "useradmin-id" + When I try to create a document with id "my-document" + Then I check if the document with id "my-document" does not exists + + When I log in as "useradmin":"testpwd" + Then I check the JWT is not null + + When I update my credentials with username "useradmin" and "foo" = "bar" + Then I check my new credentials are valid with username "useradmin", password "testpwd" and "foo" = "bar" + + When I try to create a document with id "my-document" + Then I check if the document with id "my-document" exists - Given I logout - When I update my credentials with username "useradmin" and "foo" = "barz" - Then I check my new credentials are not valid with username "useradmin", password "testpwd" and "foo" = "barz" - Then I check the JWT is null \ No newline at end of file + Given I logout + When I update my credentials with username "useradmin" and "foo" = "barz" + Then I check my new credentials are not valid with username "useradmin", password "testpwd" and "foo" = "barz" + Then I check the JWT is null + + Scenario: Subscribe to a collection and receive notifications + From 976b3e2615efe95830e774ce86b2e1a279f402a6 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 17 Apr 2018 17:30:07 +0200 Subject: [PATCH 094/363] added taskset to run gradle cucmber --- internal/wrappers/features/run_java.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/features/run_java.sh b/internal/wrappers/features/run_java.sh index a710100a..fc3dd52c 100755 --- a/internal/wrappers/features/run_java.sh +++ b/internal/wrappers/features/run_java.sh @@ -3,4 +3,4 @@ cd internal/wrappers/features/fixtures/ ./run.sh cd ../java -gradle cucumber \ No newline at end of file +taskset -c 1 gradle cucumber \ No newline at end of file From f59976660dee717d8fa0946273193b6b0dc25a39 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 17 Apr 2018 18:50:05 +0200 Subject: [PATCH 095/363] added genral script for e2e tests --- README.md | 8 ++++++++ internal/wrappers/features/e2e.sh | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 internal/wrappers/features/e2e.sh diff --git a/README.md b/README.md index 9c63d986..dceed973 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ func main() { ## Running Tests +### Unit tests + To run the tests you can simply execute the coverage.sh script ```sh ./coverage.sh @@ -58,6 +60,12 @@ You can also get html coverage by running ```sh ./coverage.sh --html ``` +### e2e tests + +To run e2e tests ensure you have a kuzzle running and then run +```sh +./internal/wrappers/features/e2e.sh +``` ## License diff --git a/internal/wrappers/features/e2e.sh b/internal/wrappers/features/e2e.sh new file mode 100644 index 00000000..d355d111 --- /dev/null +++ b/internal/wrappers/features/e2e.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +internal/wrappers/features/run_java.sh \ No newline at end of file From ffe2839b7067a3c1ac23b496e3c923c3fd5d954c Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 18 Apr 2018 08:31:05 +0200 Subject: [PATCH 096/363] update e2e tests scripts --- internal/wrappers/features/e2e.sh | 2 +- internal/wrappers/features/run_java.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/wrappers/features/e2e.sh b/internal/wrappers/features/e2e.sh index d355d111..1054e198 100644 --- a/internal/wrappers/features/e2e.sh +++ b/internal/wrappers/features/e2e.sh @@ -1,3 +1,3 @@ #!/bin/bash -internal/wrappers/features/run_java.sh \ No newline at end of file +internal/wrappers/features/run_$1.sh \ No newline at end of file diff --git a/internal/wrappers/features/run_java.sh b/internal/wrappers/features/run_java.sh index fc3dd52c..d42f9956 100755 --- a/internal/wrappers/features/run_java.sh +++ b/internal/wrappers/features/run_java.sh @@ -1,6 +1,4 @@ #!/bin/bash -cd internal/wrappers/features/fixtures/ -./run.sh -cd ../java +cd internal/wrappers/features/fixtures/java taskset -c 1 gradle cucumber \ No newline at end of file From 142c4e491ea909669242f92763bea2a6bcf8c6f6 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 18 Apr 2018 09:07:47 +0200 Subject: [PATCH 097/363] removed fixture --- .../wrappers/features/fixtures/rights.json | 29 ------------------- internal/wrappers/features/fixtures/run.sh | 13 --------- .../test/java/gradle/cucumber/Logindefs.java | 19 ------------ .../java/gradle/cucumber/Subscribedefs.java | 25 ++++++++++++++++ internal/wrappers/features/run_java.sh | 2 +- internal/wrappers/features/sdks.feature | 5 +++- 6 files changed, 30 insertions(+), 63 deletions(-) delete mode 100644 internal/wrappers/features/fixtures/rights.json delete mode 100755 internal/wrappers/features/fixtures/run.sh create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java diff --git a/internal/wrappers/features/fixtures/rights.json b/internal/wrappers/features/fixtures/rights.json deleted file mode 100644 index c9bac576..00000000 --- a/internal/wrappers/features/fixtures/rights.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "controllers": { - "auth": { - "actions": { - "*": true - } - }, - "security": { - "actions": { - "*": true - } - }, - "collection": { - "actions": { - "*": true - } - }, - "index": { - "actions": { - "*": true - } - }, - "document": { - "actions": { - "*": false - } - } - } -} \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/run.sh b/internal/wrappers/features/fixtures/run.sh deleted file mode 100755 index c98bce06..00000000 --- a/internal/wrappers/features/fixtures/run.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -CONTENT_TYPE="Content-Type: application/json" -KUZZLE_HOST=http://localhost:7512 - -# update rights for anonymous user -curl -X PUT -H $CONTENT_TYPE -d "`cat rights.json`" $KUZZLE_HOST/roles/anonymous/_update - -# create index -curl -X POST -H $CONTENT_TYPE $KUZZLE_HOST/index/_create - -# create collection -curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/collection diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java index de035ca9..95e7b8c4 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -14,29 +14,10 @@ public class Logindefs { @Before public void before() { k = new Kuzzle("localhost", null); - - // @todo do this with fixture - try { - k.getIndex().create("index"); - k.getCollection().create("index", "collection"); - } catch(Exception e) {} } @After public void after() { - //@todo do this with fixture - KuzzleRequest request = new KuzzleRequest(); - request.setController("collection"); - request.setAction("truncate"); - request.setIndex("index"); - request.setCollection("collection"); - k.query(request); - - request.setController("security"); - request.setAction("deleteUser"); - request.setId("useradmin-id"); - k.query(request); - k.disconnect(); } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java new file mode 100644 index 00000000..c38c3a35 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -0,0 +1,25 @@ +package gradle.cucumber; + +import cucumber.api.java.After; +import cucumber.api.java.Before; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.Kuzzle; +import io.kuzzle.sdk.KuzzleRequest; +import org.junit.Assert; + +public class Subscribedefs { + private Kuzzle k; + + @Before + public void before() { + k = new Kuzzle("localhost", null); + } + + @After + public void after() { + k.disconnect(); + } + +} diff --git a/internal/wrappers/features/run_java.sh b/internal/wrappers/features/run_java.sh index d42f9956..78c21113 100755 --- a/internal/wrappers/features/run_java.sh +++ b/internal/wrappers/features/run_java.sh @@ -1,4 +1,4 @@ #!/bin/bash -cd internal/wrappers/features/fixtures/java +cd internal/wrappers/features/java taskset -c 1 gradle cucumber \ No newline at end of file diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature index 4d47c586..4f3e9e93 100644 --- a/internal/wrappers/features/sdks.feature +++ b/internal/wrappers/features/sdks.feature @@ -19,5 +19,8 @@ Feature: SDK's integration tests Then I check my new credentials are not valid with username "useradmin", password "testpwd" and "foo" = "barz" Then I check the JWT is null + Scenario: Subscribe to a collection and receive notifications - + Given I subscribe to "collection" + When I create a document in "collection" + Then I receive a notification \ No newline at end of file From aad074d1879b569a75b2f9d812450c19e186810a Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 19 Apr 2018 10:15:45 +0200 Subject: [PATCH 098/363] wip --- connection/websocket/web_socket.go | 3 ++- document/create.go | 7 ++++-- internal/wrappers/cgo/kuzzle/realtime.go | 10 +++++--- internal/wrappers/cpp/realtime.cpp | 2 +- .../test/java/gradle/cucumber/Logindefs.java | 2 ++ .../java/gradle/cucumber/Subscribedefs.java | 25 +++++++++++++++++-- internal/wrappers/headers/realtime.hpp | 2 +- internal/wrappers/templates/java/core.i | 2 ++ realtime/realtime.go | 6 +++-- realtime/subscribe.go | 1 + 10 files changed, 48 insertions(+), 12 deletions(-) diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 7e70a289..2923be69 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -292,7 +292,6 @@ func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage if !found { subs = map[string]subscription{} - ws.subscriptions.Store(channel, subs) } subs.(map[string]subscription)[roomID] = subscription{ @@ -302,6 +301,8 @@ func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage onReconnectChannel: onReconnectChannel, filters: filters, } + + ws.subscriptions.Store(channel, subs) } func (ws *webSocket) UnregisterSub(roomID string) { diff --git a/document/create.go b/document/create.go index 38674937..292479ea 100644 --- a/document/create.go +++ b/document/create.go @@ -60,8 +60,11 @@ func (d *Document) Create(index string, collection string, id string, body json. return "", res.Error } - var created string + type response struct { + Created string `json:"_id"` + } + var created response json.Unmarshal(res.Result, &created) - return created, nil + return created.Created, nil } diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index d4ddb189..ed36a391 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -27,7 +27,7 @@ func registerRealtime(instance interface{}) { // unregister an instance from the instances map //export unregisterRealtime func unregisterRealtime(rt *C.realtime) { - delete(realtimeInstances, (*realtime.Realtime)(rt.instance)) + delete(realtimeInstances, rt) } // Allocates memory @@ -76,14 +76,18 @@ func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.string_result { c := make(chan types.KuzzleNotification) - roomId, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) + roomID, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) + + if err != nil { + goToCStringResult(&roomID, err) + } go func() { res := <-c C.kuzzle_notify(callback, goToCNotificationResult(&res), data) }() - return goToCStringResult(&roomId, err) + return goToCStringResult(&roomID, err) } //export kuzzle_realtime_join diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index 45fd41a9..0ec0eb72 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -59,7 +59,7 @@ namespace kuzzleio { } std::string Realtime::subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), call_subscribe_cb, this, options); + string_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), &call_subscribe_cb, this, options); if (r->error != NULL) throwExceptionFromStatus(r); std::string roomId = r->result; diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java index 95e7b8c4..658c95b3 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -23,6 +23,7 @@ public void after() { @Given("^I create a user \"([^\"]*)\" with password \"([^\"]*)\" with id \"([^\"]*)\"$") public void CreateUser(String user, String password, String id) { + /* String json = "{\n" + " \"content\": {\n" + " \"profileIds\": [\"default\"]" + @@ -42,6 +43,7 @@ public void CreateUser(String user, String password, String id) { request.setId(id); k.query(request); + */ } @When("^I try to create a document with id \"([^\"]*)\"$") diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index c38c3a35..87dd07c7 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -5,12 +5,12 @@ import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; -import io.kuzzle.sdk.Kuzzle; -import io.kuzzle.sdk.KuzzleRequest; +import io.kuzzle.sdk.*; import org.junit.Assert; public class Subscribedefs { private Kuzzle k; + private NotificationContent content = null; @Before public void before() { @@ -22,4 +22,25 @@ public void after() { k.disconnect(); } + @Given("^I subscribe to \"([^\"]*)\"$") + public void i_subscribe_to(String arg1) throws Exception { + k.getRealtime().subscribe("index", "collection", "{}", new NotificationListener() { + @Override + public void onMessage(NotificationResult res) { + content = res.getResult(); + } + }); + } + + @When("^I create a document in \"([^\"]*)\"$") + public void i_create_a_document_in(String arg1) throws Exception { + k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }"); + + k.getDocument().create("index", "collection", "", "{}"); + } + + @Then("^I receive a notification$") + public void i_receive_a_notification() throws Exception { + //Assert.assertEquals("foo", content.getContent()); + } } diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp index 9f17aefe..df8577e5 100644 --- a/internal/wrappers/headers/realtime.hpp +++ b/internal/wrappers/headers/realtime.hpp @@ -19,7 +19,7 @@ namespace kuzzleio { void join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, NotificationListener* cb) Kuz_Throw_KuzzleException; std::string list(const std::string& index, const std::string collection) Kuz_Throw_KuzzleException; void publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; - std::string subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options) Kuz_Throw_KuzzleException; + std::string subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options=NULL) Kuz_Throw_KuzzleException; void unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException; bool validate(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index bce1a4a3..91ab2877 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -22,6 +22,8 @@ %rename(RoomOptions) room_options; %rename(SearchFilters) search_filters; %rename(SearchResult) search_result; +%rename(NotificationResult) notification_result; +%rename(NotificationContent) notification_content; %ignore *::error; %ignore *::status; diff --git a/realtime/realtime.go b/realtime/realtime.go index 12d5b576..335efacd 100644 --- a/realtime/realtime.go +++ b/realtime/realtime.go @@ -22,6 +22,8 @@ type Realtime struct { } // NewRealtime instanciates a new realtime controller -func NewRealtime(k types.IKuzzle) *Realtime { - return &Realtime{k} +func NewRealtime(kuzzle types.IKuzzle) *Realtime { + return &Realtime{ + k: kuzzle, + } } diff --git a/realtime/subscribe.go b/realtime/subscribe.go index 03326341..0db0ce5c 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -50,6 +50,7 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, go r.k.Query(query, opts, result) res := <-result + if res.Error != nil { return "", res.Error } From 6ec235c6bf5d330ae6ec0de3425bbffbec06dacf Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 19 Apr 2018 10:53:41 +0200 Subject: [PATCH 099/363] added fixtures --- internal/wrappers/cpp/kuzzle.cpp | 7 ++--- .../wrappers/features/fixtures/rights.json | 29 +++++++++++++++++++ internal/wrappers/features/fixtures/run.sh | 13 +++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 internal/wrappers/features/fixtures/rights.json create mode 100755 internal/wrappers/features/fixtures/run.sh diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index bff55af9..bc2b83a7 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -37,13 +37,12 @@ namespace kuzzleio { this->_kuzzle = new kuzzle(); kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); - this->document = new Document(this, kuzzle_get_document_controller(this->_kuzzle)); + this->document = new Document(this, kuzzle_get_document_controller(_kuzzle)); this->auth = new Auth(this, kuzzle_get_auth_controller(_kuzzle)); this->index = new Index(this, kuzzle_get_index_controller(_kuzzle)); this->server = new Server(this, kuzzle_get_server_controller(_kuzzle)); - this->collection = new Collection(this, kuzzle_get_collection_controller(this->_kuzzle)); - - this->realtime = new Realtime(this, kuzzle_get_realtime_controller(this->_kuzzle)); + this->collection = new Collection(this, kuzzle_get_collection_controller(_kuzzle)); + this->realtime = new Realtime(this, kuzzle_get_realtime_controller(_kuzzle)); } Kuzzle::~Kuzzle() { diff --git a/internal/wrappers/features/fixtures/rights.json b/internal/wrappers/features/fixtures/rights.json new file mode 100644 index 00000000..c9bac576 --- /dev/null +++ b/internal/wrappers/features/fixtures/rights.json @@ -0,0 +1,29 @@ +{ + "controllers": { + "auth": { + "actions": { + "*": true + } + }, + "security": { + "actions": { + "*": true + } + }, + "collection": { + "actions": { + "*": true + } + }, + "index": { + "actions": { + "*": true + } + }, + "document": { + "actions": { + "*": false + } + } + } +} \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/run.sh b/internal/wrappers/features/fixtures/run.sh new file mode 100755 index 00000000..644f5110 --- /dev/null +++ b/internal/wrappers/features/fixtures/run.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +CONTENT_TYPE="Content-Type: application/json" +KUZZLE_HOST=http://localhost:7512 + +# update rights for anonymous user +curl -X PUT -H $CONTENT_TYPE -d "`cat rights.json`" $KUZZLE_HOST/roles/anonymous/_update + +# create index +curl -X POST -H $CONTENT_TYPE $KUZZLE_HOST/index/_create + +# create collection +curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/collection \ No newline at end of file From e1f862060d445d73862a4cf4121245e53b2dd68c Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 20 Apr 2018 09:46:47 +0200 Subject: [PATCH 100/363] subscribe test --- connection/connection.go | 2 +- connection/websocket/web_socket.go | 3 +- internal/wrappers/cgo/kuzzle/destructors.go | 8 ++++++ internal/wrappers/cgo/kuzzle/errors.go | 5 ++++ internal/wrappers/cgo/kuzzle/go_to_c.go | 14 ++++++++++ internal/wrappers/cgo/kuzzle/realtime.go | 9 +++--- internal/wrappers/cpp/auth.cpp | 2 +- internal/wrappers/cpp/realtime.cpp | 10 ++++--- .../test/java/gradle/cucumber/Logindefs.java | 13 +-------- .../java/gradle/cucumber/Subscribedefs.java | 28 ++++++++----------- internal/wrappers/features/sdks.feature | 1 - internal/wrappers/headers/kuzzlesdk.h | 8 ++++++ internal/wrappers/templates/java/core.i | 1 + kuzzle/kuzzle.go | 4 +-- realtime/join.go | 2 +- realtime/subscribe.go | 16 ++++------- types/ikuzzle.go | 2 +- types/kuzzle_response.go | 6 ++++ 18 files changed, 78 insertions(+), 56 deletions(-) diff --git a/connection/connection.go b/connection/connection.go index bbf1f6b5..08737b68 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -33,7 +33,7 @@ type Connection interface { Close() error State() int EmitEvent(int, interface{}) - RegisterSub(string, string, json.RawMessage, chan<- types.KuzzleNotification, chan<- interface{}) + RegisterSub(string, string, json.RawMessage, bool, chan<- types.KuzzleNotification, chan<- interface{}) UnregisterSub(string) CancelSubs() RequestHistory() map[string]time.Time diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 2923be69..cd2432fb 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -287,7 +287,7 @@ func (ws *webSocket) cleanQueue() { } } -func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { +func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage, subscribeToSelf bool, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { subs, found := ws.subscriptions.Load(channel) if !found { @@ -300,6 +300,7 @@ func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage notificationChannel: notifChan, onReconnectChannel: onReconnectChannel, filters: filters, + subscribeToSelf: subscribeToSelf, } ws.subscriptions.Store(channel, subs) diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index e215cfa2..1a5d116c 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -346,6 +346,14 @@ func _free_user_right(st *C.user_right) { } } +//export kuzzle_free_subscribe_result +func kuzzle_free_subscribe_result(st *C.subscribe_result) { + if st != nil { + C.free(unsafe.Pointer(st.room)) + C.free(unsafe.Pointer(st.channel)) + } +} + //export kuzzle_free_user_right func kuzzle_free_user_right(st *C.user_right) { _free_user_right(st) diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index d9e60325..fe26cd19 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -55,6 +55,11 @@ func Set_statistics_error(s *C.statistics_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } +// apply a types.KuzzleError on a statistics* C struct +func Set_subscribe_error(s *C.subscribe_result, err error) { + setErr(&s.status, &s.error, &s.stack, err) +} + // apply a types.KuzzleError on a string_array_result* C struct func Set_string_array_result_error(s *C.string_array_result, err error) { setErr(&s.status, &s.error, &s.stack, err) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 00faecaa..29e6af23 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -173,6 +173,20 @@ func goToCStringResult(goRes *string, err error) *C.string_result { return result } +func goToCSubscribeResult(goRes *types.SubscribeResult, err error) *C.subscribe_result { + result := (*C.subscribe_result)(C.calloc(1, C.sizeof_subscribe_result)) + + if err != nil { + Set_subscribe_error(result, err) + return result + } + + result.room = C.CString(goRes.Room) + result.channel = C.CString(goRes.Channel) + + return result +} + func goToCStringArrayResult(goRes []string, err error) *C.string_array_result { result := (*C.string_array_result)(C.calloc(1, C.sizeof_string_array_result)) diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index ed36a391..f265bd40 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -73,13 +73,12 @@ func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result } //export kuzzle_realtime_subscribe -func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.string_result { +func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.subscribe_result { c := make(chan types.KuzzleNotification) - - roomID, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) + subRes, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) if err != nil { - goToCStringResult(&roomID, err) + return goToCSubscribeResult(subRes, err) } go func() { @@ -87,7 +86,7 @@ func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, C.kuzzle_notify(callback, goToCNotificationResult(&res), data) }() - return goToCStringResult(&roomID, err) + return goToCSubscribeResult(subRes, err) } //export kuzzle_realtime_join diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 835017db..59cd7d7a 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -15,7 +15,7 @@ #include "auth.hpp" namespace kuzzleio { - Auth::Auth(Kuzzle* kuzzle) { + Auth::Auth(Kuzzle *kuzzle) { _auth = new auth(); kuzzle_new_auth(_auth, kuzzle->_kuzzle); } diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index 0ec0eb72..fde73344 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -59,13 +59,15 @@ namespace kuzzleio { } std::string Realtime::subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), &call_subscribe_cb, this, options); + subscribe_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), &call_subscribe_cb, this, options); if (r->error != NULL) throwExceptionFromStatus(r); - std::string roomId = r->result; + + std::string roomId = r->room; + std::string channel = r->channel; - _listener_instances[roomId] = cb; - kuzzle_free_string_result(r); + _listener_instances[channel] = cb; + kuzzle_free_subscribe_result(r); return roomId; } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java index 658c95b3..e5602ba2 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -9,17 +9,7 @@ import org.junit.Assert; public class Logindefs { - private Kuzzle k; - - @Before - public void before() { - k = new Kuzzle("localhost", null); - } - - @After - public void after() { - k.disconnect(); - } + private Kuzzle k = new Kuzzle("localhost"); @Given("^I create a user \"([^\"]*)\" with password \"([^\"]*)\" with id \"([^\"]*)\"$") public void CreateUser(String user, String password, String id) { @@ -85,7 +75,6 @@ public void CheckJwt(String not) { } } - @When("^I update my credentials with username \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") public void UpdateMyCredentials(String username, String key, String value) { try { diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index 87dd07c7..42c3f864 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -1,7 +1,5 @@ package gradle.cucumber; -import cucumber.api.java.After; -import cucumber.api.java.Before; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; @@ -9,38 +7,34 @@ import org.junit.Assert; public class Subscribedefs { - private Kuzzle k; + private Kuzzle k = new Kuzzle("localhost"); private NotificationContent content = null; - @Before - public void before() { - k = new Kuzzle("localhost", null); - } - - @After - public void after() { - k.disconnect(); - } - @Given("^I subscribe to \"([^\"]*)\"$") public void i_subscribe_to(String arg1) throws Exception { + k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }", 40000); + + RoomOptions opts = new RoomOptions(); + opts.setSubscribeToSelf(true); + k.getRealtime().subscribe("index", "collection", "{}", new NotificationListener() { @Override public void onMessage(NotificationResult res) { + System.out.println("++++++ "+res.toString()); content = res.getResult(); } - }); + }, opts); } @When("^I create a document in \"([^\"]*)\"$") public void i_create_a_document_in(String arg1) throws Exception { - k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }"); - k.getDocument().create("index", "collection", "", "{}"); + Thread.sleep(4000); } @Then("^I receive a notification$") public void i_receive_a_notification() throws Exception { - //Assert.assertEquals("foo", content.getContent()); + Assert.assertNotNull(content); + Assert.assertNotNull(content.getContent()); } } diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature index 4f3e9e93..8e975578 100644 --- a/internal/wrappers/features/sdks.feature +++ b/internal/wrappers/features/sdks.feature @@ -19,7 +19,6 @@ Feature: SDK's integration tests Then I check my new credentials are not valid with username "useradmin", password "testpwd" and "foo" = "barz" Then I check the JWT is null - Scenario: Subscribe to a collection and receive notifications Given I subscribe to "collection" When I create a document in "collection" diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 6b2d4d43..5972b4bd 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -133,6 +133,14 @@ typedef struct { kuzzle* kuzzle; } server; +typedef struct { + char *room; + char *channel; + int status; + char *error; + char *stack; +} subscribe_result; + //options passed to room constructor typedef struct { char *scope; diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 91ab2877..4fb4df92 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -24,6 +24,7 @@ %rename(SearchResult) search_result; %rename(NotificationResult) notification_result; %rename(NotificationContent) notification_content; +%rename(SubscribeToSelf) subscribe_to_self; %ignore *::error; %ignore *::status; diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index b47b588f..9df5acc6 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -148,8 +148,8 @@ func (k *Kuzzle) UnsetJwt() { k.socket.CancelSubs() } -func (k *Kuzzle) RegisterSub(channel, roomId string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { - k.socket.RegisterSub(channel, roomId, filters, notifChan, onReconnectChannel) +func (k *Kuzzle) RegisterSub(channel, roomId string, filters json.RawMessage, subscribeToSelf bool, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { + k.socket.RegisterSub(channel, roomId, filters, subscribeToSelf, notifChan, onReconnectChannel) } func (k *Kuzzle) UnregisterSub(roomId string) { diff --git a/realtime/join.go b/realtime/join.go index 0476d181..5af63de3 100644 --- a/realtime/join.go +++ b/realtime/join.go @@ -68,7 +68,7 @@ func (r *Realtime) Join(index, collection, roomID string, options types.RoomOpti onReconnect := make(chan interface{}) - r.k.RegisterSub(resSub.Channel, resSub.RoomID, nil, cb, onReconnect) + r.k.RegisterSub(resSub.Channel, resSub.RoomID, nil, options.SubscribeToSelf(), cb, onReconnect) go func() { <-onReconnect diff --git a/realtime/subscribe.go b/realtime/subscribe.go index 0db0ce5c..08d13f11 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -22,9 +22,9 @@ import ( ) // Subscribe permits to join a previously created subscription -func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, cb chan<- types.KuzzleNotification, options types.RoomOptions) (string, error) { +func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, cb chan<- types.KuzzleNotification, options types.RoomOptions) (*types.SubscribeResult, error) { if (index == "" || collection == "") || (filters == nil || cb == nil) { - return "", types.NewError("Realtime.Subscribe: index, collection, filters and notificationChannel required", 400) + return nil, types.NewError("Realtime.Subscribe: index, collection, filters and notificationChannel required", 400) } result := make(chan *types.KuzzleResponse) @@ -52,20 +52,16 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, res := <-result if res.Error != nil { - return "", res.Error + return nil, res.Error } - var resSub struct { - RequestID string `json:"requestId"` - RoomID string `json:"roomId"` - Channel string `json:"channel"` - } + var resSub types.SubscribeResult json.Unmarshal(res.Result, &resSub) onReconnect := make(chan interface{}) - r.k.RegisterSub(resSub.Channel, resSub.RoomID, filters, cb, onReconnect) + r.k.RegisterSub(resSub.Channel, resSub.Room, filters, options.SubscribeToSelf(), cb, onReconnect) go func() { <-onReconnect @@ -77,5 +73,5 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, r.k.AddListener(event.Reconnected, onReconnect) - return resSub.RoomID, nil + return &resSub, nil } diff --git a/types/ikuzzle.go b/types/ikuzzle.go index 4af9d962..b476584d 100644 --- a/types/ikuzzle.go +++ b/types/ikuzzle.go @@ -22,7 +22,7 @@ type IKuzzle interface { Query(query *KuzzleRequest, options QueryOptions, responseChannel chan<- *KuzzleResponse) EmitEvent(int, interface{}) SetJwt(string) - RegisterSub(string, string, json.RawMessage, chan<- KuzzleNotification, chan<- interface{}) + RegisterSub(string, string, json.RawMessage, bool, chan<- KuzzleNotification, chan<- interface{}) UnregisterSub(string) AddListener(event int, notifChan chan<- interface{}) AutoResubscribe() bool diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index 9f771908..b6b1cc6a 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -37,6 +37,11 @@ type ( DeletedAt int `json:"deletedAt"` } + SubscribeResult struct { + Room string `json:"roomId"` + Channel string `json:"channel"` + } + // NotificationResult contains NotificationResult struct { Id string `json:"_id"` @@ -60,6 +65,7 @@ type ( User string `json:"user"` Type string `json:"type"` RoomId string `json:"room"` + Channel string `json:"channel"` Timestamp int `json:"timestamp"` Status int `json:"status"` Error *KuzzleError `json:"error"` From 33215bacbdcf96ecf0e42e15a1ec06103a46833b Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 20 Apr 2018 10:11:35 +0200 Subject: [PATCH 101/363] change map for instances to sync.Map --- internal/mock_connection.go | 2 +- internal/wrappers/cgo/kuzzle/auth.go | 11 ++++------- internal/wrappers/cgo/kuzzle/collection.go | 13 +++++-------- internal/wrappers/cgo/kuzzle/document.go | 11 ++++------- internal/wrappers/cgo/kuzzle/index.go | 11 ++++------- internal/wrappers/cgo/kuzzle/kuzzle.go | 11 ++++------- internal/wrappers/cgo/kuzzle/realtime.go | 11 ++++------- internal/wrappers/cgo/kuzzle/server.go | 13 +++++-------- .../test/java/gradle/cucumber/Subscribedefs.java | 3 +-- realtime/join.go | 2 ++ realtime/subscribe.go | 2 ++ realtime/subscribe_test.go | 4 ++-- 12 files changed, 38 insertions(+), 56 deletions(-) diff --git a/internal/mock_connection.go b/internal/mock_connection.go index 2f713fd3..94953d4d 100644 --- a/internal/mock_connection.go +++ b/internal/mock_connection.go @@ -84,7 +84,7 @@ func (c *MockedConnection) EmitEvent(event int, arg interface{}) { } } -func (c *MockedConnection) RegisterSub(channel, roomID string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChan chan<- interface{}) { +func (c *MockedConnection) RegisterSub(channel, roomID string, filters json.RawMessage, subscribeToSelf bool, notifChan chan<- types.KuzzleNotification, onReconnectChan chan<- interface{}) { } func (c *MockedConnection) CancelSubs() {} diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 3989a5b8..8732ace5 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -25,6 +25,7 @@ package main import "C" import ( "encoding/json" + "sync" "unsafe" "github.com/kuzzleio/sdk-go/auth" @@ -32,17 +33,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var authInstances map[interface{}]bool +var authInstances sync.Map //register new instance of server func registerAuth(instance interface{}) { - authInstances[instance] = true + authInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterAuth func unregisterAuth(a *C.auth) { - delete(authInstances, (*auth.Auth)(a.instance)) + authInstances.Delete(a) } // Allocates memory @@ -51,10 +52,6 @@ func kuzzle_new_auth(a *C.auth, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) auth := auth.NewAuth(kuz) - if authInstances == nil { - authInstances = make(map[interface{}]bool) - } - a.instance = unsafe.Pointer(auth) a.kuzzle = k diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 905b6669..580d8084 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -22,6 +22,7 @@ package main import "C" import ( "encoding/json" + "sync" "unsafe" "github.com/kuzzleio/sdk-go/collection" @@ -29,17 +30,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var collectionInstances map[interface{}]bool +var collectionInstances sync.Map // register new instance to the instances map func registerCollection(instance interface{}) { - collectionInstances[instance] = true + collectionInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterCollection -func unregisterCollection(d *C.collection) { - delete(collectionInstances, (*collection.Collection)(d.instance)) +func unregisterCollection(c *C.collection) { + collectionInstances.Delete(c) } // Allocates memory @@ -48,10 +49,6 @@ func kuzzle_new_collection(c *C.collection, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) col := collection.NewCollection(kuz) - if collectionInstances == nil { - collectionInstances = make(map[interface{}]bool) - } - c.instance = unsafe.Pointer(col) c.kuzzle = k diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index eecc890e..0da39dae 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -22,6 +22,7 @@ package main import "C" import ( "encoding/json" + "sync" "unsafe" "github.com/kuzzleio/sdk-go/document" @@ -29,17 +30,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var documentInstances map[interface{}]bool +var documentInstances sync.Map // register new instance to the instances map func registerDocument(instance interface{}) { - documentInstances[instance] = true + documentInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterDocument func unregisterDocument(d *C.document) { - delete(documentInstances, (*document.Document)(d.instance)) + documentInstances.Delete(d) } //export kuzzle_new_document @@ -47,10 +48,6 @@ func kuzzle_new_document(d *C.document, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) doc := document.NewDocument(kuz) - if documentInstances == nil { - documentInstances = make(map[interface{}]bool) - } - d.instance = unsafe.Pointer(doc) d.kuzzle = k registerDocument(doc) diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index 49621a4a..65cea6f0 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -23,6 +23,7 @@ package main */ import "C" import ( + "sync" "unsafe" indexPkg "github.com/kuzzleio/sdk-go/index" @@ -30,17 +31,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var indexInstances map[interface{}]bool +var indexInstances sync.Map //register new instance of index func registerIndex(instance interface{}) { - indexInstances[instance] = true + indexInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterIndex func unregisterIndex(i *C.kuzzle_index) { - delete(indexInstances, (*indexPkg.Index)(i.instance)) + indexInstances.Delete(i) } // Allocates memory @@ -49,10 +50,6 @@ func kuzzle_new_index(i *C.kuzzle_index, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) index := indexPkg.NewIndex(kuz) - if indexInstances == nil { - indexInstances = make(map[interface{}]bool) - } - i.instance = unsafe.Pointer(index) i.kuzzle = k diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index c73ae766..a70c7ae2 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -24,6 +24,7 @@ package main import "C" import ( "encoding/json" + "sync" "time" "unsafe" @@ -34,30 +35,26 @@ import ( ) // map which stores instances to keep references in case the gc passes -var instances map[interface{}]bool +var instances sync.Map // map which stores channel and function's pointers adresses for listeners var listeners_list map[uintptr]chan<- interface{} // register new instance to the instances map func registerKuzzle(instance interface{}) { - instances[instance] = true + instances.Store(instance, true) } // unregister an instance from the instances map //export unregisterKuzzle func unregisterKuzzle(k *C.kuzzle) { - delete(instances, (*kuzzle.Kuzzle)(k.instance)) + instances.Delete(k) } //export kuzzle_new_kuzzle func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) { var c connection.Connection - if instances == nil { - instances = make(map[interface{}]bool) - } - if listeners_list == nil { listeners_list = make(map[uintptr]chan<- interface{}) } diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index f265bd40..9535fd51 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -9,6 +9,7 @@ import "C" import ( "encoding/json" + "sync" "unsafe" "github.com/kuzzleio/sdk-go/kuzzle" @@ -17,17 +18,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var realtimeInstances map[interface{}]bool +var realtimeInstances sync.Map // register new instance to the instances map func registerRealtime(instance interface{}) { - realtimeInstances[instance] = true + realtimeInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterRealtime func unregisterRealtime(rt *C.realtime) { - delete(realtimeInstances, rt) + realtimeInstances.Delete(rt) } // Allocates memory @@ -36,10 +37,6 @@ func kuzzle_new_realtime(rt *C.realtime, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) gort := realtime.NewRealtime(kuz) - if realtimeInstances == nil { - realtimeInstances = make(map[interface{}]bool) - } - rt.instance = unsafe.Pointer(gort) rt.kuzzle = k diff --git a/internal/wrappers/cgo/kuzzle/server.go b/internal/wrappers/cgo/kuzzle/server.go index 1a568b1b..030da65b 100644 --- a/internal/wrappers/cgo/kuzzle/server.go +++ b/internal/wrappers/cgo/kuzzle/server.go @@ -24,6 +24,7 @@ package main import "C" import ( "strconv" + "sync" "time" "unsafe" @@ -32,17 +33,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var serverInstances map[interface{}]bool +var serverInstances sync.Map //register new instance of server func registerServer(instance interface{}) { - serverInstances[instance] = true + serverInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterServer -func unregisterServer(d *C.server) { - delete(serverInstances, (*server.Server)(d.instance)) +func unregisterServer(s *C.server) { + serverInstances.Delete(s) } // Allocates memory @@ -51,10 +52,6 @@ func kuzzle_new_server(s *C.server, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) server := server.NewServer(kuz) - if serverInstances == nil { - serverInstances = make(map[interface{}]bool) - } - s.instance = unsafe.Pointer(server) s.kuzzle = k diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index 42c3f864..20020533 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -20,7 +20,6 @@ public void i_subscribe_to(String arg1) throws Exception { k.getRealtime().subscribe("index", "collection", "{}", new NotificationListener() { @Override public void onMessage(NotificationResult res) { - System.out.println("++++++ "+res.toString()); content = res.getResult(); } }, opts); @@ -29,7 +28,7 @@ public void onMessage(NotificationResult res) { @When("^I create a document in \"([^\"]*)\"$") public void i_create_a_document_in(String arg1) throws Exception { k.getDocument().create("index", "collection", "", "{}"); - Thread.sleep(4000); + Thread.sleep(1000); } @Then("^I receive a notification$") diff --git a/realtime/join.go b/realtime/join.go index 5af63de3..f1004902 100644 --- a/realtime/join.go +++ b/realtime/join.go @@ -49,6 +49,8 @@ func (r *Realtime) Join(index, collection, roomID string, options types.RoomOpti query.Scope = options.Scope() opts.SetVolatile(options.Volatile()) + } else { + options = types.NewRoomOptions() } go r.k.Query(query, opts, result) diff --git a/realtime/subscribe.go b/realtime/subscribe.go index 08d13f11..bb5d5159 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -45,6 +45,8 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, query.Scope = options.Scope() opts.SetVolatile(options.Volatile()) + } else { + options = types.NewRoomOptions() } go r.k.Query(query, opts, result) diff --git a/realtime/subscribe_test.go b/realtime/subscribe_test.go index 94a53a8e..85c69a16 100644 --- a/realtime/subscribe_test.go +++ b/realtime/subscribe_test.go @@ -105,7 +105,7 @@ func TestRenewWithSubscribeToSelf(t *testing.T) { res, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) assert.Nil(t, err) assert.NotNil(t, res) - assert.Equal(t, "42", res) + assert.Equal(t, "42", res.Room) } func TestRoomSubscribe(t *testing.T) { @@ -125,7 +125,7 @@ func TestRoomSubscribe(t *testing.T) { res, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) assert.Nil(t, err) assert.NotNil(t, res) - assert.Equal(t, "42", res) + assert.Equal(t, "42", res.Room) } From f6d0d5e3f91c2b6f7da02f491f9aeda68b612fc0 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 23 Apr 2018 11:55:13 +0200 Subject: [PATCH 102/363] subscribe geofence test --- connection/websocket/web_socket.go | 30 +++++---- document/update.go | 17 +++-- internal/wrappers/cgo/kuzzle/kuzzle.go | 14 ++-- internal/wrappers/cgo/kuzzle/realtime.go | 9 ++- internal/wrappers/cpp/document.cpp | 1 - internal/wrappers/features/e2e.sh | 0 .../wrappers/features/fixtures/mapping.json | 7 ++ internal/wrappers/features/fixtures/run.sh | 8 ++- .../java/gradle/cucumber/Geofencedefs.java | 66 +++++++++++++++++++ .../test/java/gradle/cucumber/Logindefs.java | 4 -- .../java/gradle/cucumber/Subscribedefs.java | 33 ++++++---- internal/wrappers/features/sdks.feature | 17 ++++- kuzzle/query.go | 9 ++- realtime/subscribe.go | 3 + realtime/unsubscribe.go | 9 +-- 15 files changed, 170 insertions(+), 57 deletions(-) mode change 100644 => 100755 internal/wrappers/features/e2e.sh create mode 100644 internal/wrappers/features/fixtures/mapping.json create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index cd2432fb..b4d7a570 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -185,16 +185,20 @@ func (ws *webSocket) Connect() (bool, error) { ws.EmitEvent(event.Connected, nil) } - resChan := make(chan []byte) + // resChan := make(chan []byte) + + ws.listenChan = make(chan []byte) + + go ws.listen() go func() { for { _, message, err := ws.ws.ReadMessage() - + ws.listenChan <- message // TODO: either send a Disconnected event on a proper disconnection, // or a NetworkError one if the socket has been unexpectedly closed if err != nil { - close(resChan) + close(ws.listenChan) ws.ws.Close() ws.state = state.Offline if ws.autoQueue { @@ -203,14 +207,9 @@ func (ws *webSocket) Connect() (bool, error) { ws.EmitEvent(event.Disconnected, nil) return } - go func() { - resChan <- message - }() } }() - ws.listenChan = resChan - go ws.listen() ws.ReplayQueue() return ws.wasConnected, err @@ -307,13 +306,16 @@ func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage } func (ws *webSocket) UnregisterSub(roomID string) { - s, ok := ws.subscriptions.Load(roomID) - if ok { - for _, sub := range s.(map[string]subscription) { - close(sub.onReconnectChannel) + ws.subscriptions.Range(func(k, v interface{}) bool { + for k, sub := range v.(map[string]subscription) { + if sub.roomID == roomID { + close(sub.onReconnectChannel) + close(sub.notificationChannel) + delete(v.(map[string]subscription), k) + } } - ws.subscriptions.Delete(roomID) - } + return true + }) } func (ws *webSocket) CancelSubs() { diff --git a/document/update.go b/document/update.go index a819decc..abf9bf82 100644 --- a/document/update.go +++ b/document/update.go @@ -21,7 +21,7 @@ import ( ) // Update updates a document in Kuzzle. -func (d *Document) Update(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (string, error) { +func (d *Document) Update(index string, collection string, id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Update: index required", 400) } @@ -30,10 +30,6 @@ func (d *Document) Update(index string, collection string, _id string, body json return "", types.NewError("Document.Update: collection required", 400) } - if _id == "" { - return "", types.NewError("Document.Update: id required", 400) - } - if body == nil { return "", types.NewError("Document.Update: body required", 400) } @@ -41,12 +37,12 @@ func (d *Document) Update(index string, collection string, _id string, body json ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ - Collection: collection, Index: index, + Collection: collection, Controller: "document", Action: "update", + Id: id, Body: body, - Id: _id, } go d.Kuzzle.Query(query, options, ch) @@ -57,8 +53,11 @@ func (d *Document) Update(index string, collection string, _id string, body json return "", res.Error } - var updated string + type response struct { + Updated string `json:"_id"` + } + var updated response json.Unmarshal(res.Result, &updated) - return updated, nil + return updated.Updated, nil } diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index a70c7ae2..ec6f9f01 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -222,11 +222,15 @@ func kuzzle_add_listener(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data listeners_list[uintptr(unsafe.Pointer(cb))] = c (*kuzzle.Kuzzle)(k.instance).AddListener(int(e), c) go func() { - res := <-c - - r, _ := json.Marshal(res) - - C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) + for { + res, ok := <-c + if ok == false { + break + } + r, _ := json.Marshal(res) + + C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) + } }() } diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index 9535fd51..ebc8d175 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -79,8 +79,13 @@ func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, } go func() { - res := <-c - C.kuzzle_notify(callback, goToCNotificationResult(&res), data) + for { + res, ok := <-c + if ok == false { + break + } + C.kuzzle_notify(callback, goToCNotificationResult(&res), data) + } }() return goToCSubscribeResult(subRes, err) diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index a632894d..42982907 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -52,7 +52,6 @@ namespace kuzzleio { std::string Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { string_result *r = kuzzle_document_create(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); - std::cout << r->error << std::endl; if (r->error != NULL) throwExceptionFromStatus(r); diff --git a/internal/wrappers/features/e2e.sh b/internal/wrappers/features/e2e.sh old mode 100644 new mode 100755 diff --git a/internal/wrappers/features/fixtures/mapping.json b/internal/wrappers/features/fixtures/mapping.json new file mode 100644 index 00000000..7ac15fa6 --- /dev/null +++ b/internal/wrappers/features/fixtures/mapping.json @@ -0,0 +1,7 @@ +{ + "properties": { + "position": { + "type": "geo_point" + } + } +} \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/run.sh b/internal/wrappers/features/fixtures/run.sh index 644f5110..5fb0f138 100755 --- a/internal/wrappers/features/fixtures/run.sh +++ b/internal/wrappers/features/fixtures/run.sh @@ -10,4 +10,10 @@ curl -X PUT -H $CONTENT_TYPE -d "`cat rights.json`" $KUZZLE_HOST/roles/anonymous curl -X POST -H $CONTENT_TYPE $KUZZLE_HOST/index/_create # create collection -curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/collection \ No newline at end of file +curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/collection + +# create geofence collection +curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/geofence + +#update mapping for geofence collection +curl -X PUT -H $CONTENT_TYPE -d "`cat mapping.json`" $KUZZLE_HOST/index/geofence/_mapping \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java new file mode 100644 index 00000000..b097592d --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java @@ -0,0 +1,66 @@ +package gradle.cucumber; + +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.*; +import org.junit.Assert; + +public class Geofencedefs { + private Kuzzle k = new Kuzzle("localhost"); + private NotificationResult content = null; + private String documentId; + + @Given("^I subscribe to \"([^\"]*)\" collection$") + public void i_subscribe_to_collection(String collection) throws Exception { + String filter = "{" + + "\"geoBoundingBox\": {" + + "\"position\": {" + + "\"topLeft\": {" + + "\"lat\": 10," + + "\"lon\": 1" + + "}," + + "\"bottomRight\": {" + + "\"lat\": 1," + + "\"lon\": 10" + + "}" + + "}" + + "}" + + "}"; + + RoomOptions opts = new RoomOptions(); + opts.setUser("all"); + opts.setState("all"); + opts.setScope("all"); + opts.setSubscribeToSelf(true); + + k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }", 40000); + + k.getRealtime().subscribe("index", collection, filter, new NotificationListener() { + @Override + public void onMessage(NotificationResult res) { + content = res; + } + }, opts); + } + + @When("^I create a document in \"([^\"]*)\" and inside my geofence$") + public void i_create_a_document_in_and_inside_my_geofence(String collection) throws Exception { + System.err.println("create document"); + documentId = k.getDocument().create("index", collection, "", "{\"position\":{\"lat\": 2, \"lon\": 2}}"); + Thread.sleep(1000); + } + + @Then("^I receive a \"([^\"]*)\" notification$") + public void i_receive_a_notification(String scope) throws Exception { + Assert.assertNotNull(content); + Assert.assertEquals(scope, content.getScope()); + } + + @When("^I update this document to be outside my geofence$") + public void i_update_this_document_to_be_outside_my_geofence() throws Exception { + content = null; + k.getDocument().update("index", "geofence", documentId, "{\"position\":{\"lat\": 30, \"lon\": 20}}"); + Thread.sleep(1000); + } +} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java index e5602ba2..7181c1a3 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -1,7 +1,5 @@ package gradle.cucumber; -import cucumber.api.java.Before; -import cucumber.api.java.After; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; @@ -13,7 +11,6 @@ public class Logindefs { @Given("^I create a user \"([^\"]*)\" with password \"([^\"]*)\" with id \"([^\"]*)\"$") public void CreateUser(String user, String password, String id) { - /* String json = "{\n" + " \"content\": {\n" + " \"profileIds\": [\"default\"]" + @@ -33,7 +30,6 @@ public void CreateUser(String user, String password, String id) { request.setId(id); k.query(request); - */ } @When("^I try to create a document with id \"([^\"]*)\"$") diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index 20020533..63271743 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -8,32 +8,41 @@ public class Subscribedefs { private Kuzzle k = new Kuzzle("localhost"); + private String roomId; private NotificationContent content = null; @Given("^I subscribe to \"([^\"]*)\"$") - public void i_subscribe_to(String arg1) throws Exception { + public void i_subscribe_to(String collection) throws Exception { k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }", 40000); - RoomOptions opts = new RoomOptions(); - opts.setSubscribeToSelf(true); - - k.getRealtime().subscribe("index", "collection", "{}", new NotificationListener() { + roomId = k.getRealtime().subscribe("index", collection, "{}", new NotificationListener() { @Override public void onMessage(NotificationResult res) { content = res.getResult(); } - }, opts); + }); } @When("^I create a document in \"([^\"]*)\"$") - public void i_create_a_document_in(String arg1) throws Exception { - k.getDocument().create("index", "collection", "", "{}"); + public void i_create_a_document_in(String collection) throws Exception { + k.getDocument().create("index", collection, "", "{}"); Thread.sleep(1000); } - @Then("^I receive a notification$") - public void i_receive_a_notification() throws Exception { - Assert.assertNotNull(content); - Assert.assertNotNull(content.getContent()); + @Then("^I( do not)? receive a notification$") + public void i_receive_a_notification(String dont) throws Exception { + if (dont == null) { + Assert.assertNotNull(content); + Assert.assertNotNull(content.getContent()); + content = null; + return; + } + Assert.assertNull(content); + } + + @Given("^I unsubscribe") + public void i_unsubscribe() throws Exception { + k.getRealtime().unsubscribe(roomId); } + } diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature index 8e975578..f457fdaa 100644 --- a/internal/wrappers/features/sdks.feature +++ b/internal/wrappers/features/sdks.feature @@ -22,4 +22,19 @@ Feature: SDK's integration tests Scenario: Subscribe to a collection and receive notifications Given I subscribe to "collection" When I create a document in "collection" - Then I receive a notification \ No newline at end of file + Then I receive a notification + + When I create a document in "collection" + Then I receive a notification + + Given I unsubscribe + When I create a document in "collection" + Then I do not receive a notification + + Scenario: Subscribe to a geofence filter + Given I subscribe to "geofence" collection + When I create a document in "geofence" and inside my geofence + Then I receive a "in" notification + + When I update this document to be outside my geofence + Then I receive a "out" notification \ No newline at end of file diff --git a/kuzzle/query.go b/kuzzle/query.go index c8e12a6d..ea460026 100644 --- a/kuzzle/query.go +++ b/kuzzle/query.go @@ -65,7 +65,14 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r jsonRequest, _ := json.Marshal(query) out := map[string]interface{}{} - json.Unmarshal(jsonRequest, &out) + err := json.Unmarshal(jsonRequest, &out) + + if err != nil { + if responseChannel != nil { + responseChannel <- &types.KuzzleResponse{Error: types.NewError(err.Error())} + } + return + } refresh := options.Refresh() if refresh != "" { diff --git a/realtime/subscribe.go b/realtime/subscribe.go index bb5d5159..c13c4f62 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -47,6 +47,9 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, opts.SetVolatile(options.Volatile()) } else { options = types.NewRoomOptions() + query.Users = options.Users() + query.State = options.State() + query.Scope = options.Scope() } go r.k.Query(query, opts, result) diff --git a/realtime/unsubscribe.go b/realtime/unsubscribe.go index 63544ba2..59ae22c4 100644 --- a/realtime/unsubscribe.go +++ b/realtime/unsubscribe.go @@ -15,8 +15,6 @@ package realtime import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" ) @@ -30,7 +28,7 @@ func (r *Realtime) Unsubscribe(roomID string) error { Controller: "realtime", Action: "unsubscribe", Body: struct { - RoomID string `json:"roomID"` + RoomID string `json:"roomId"` }{roomID}, } @@ -44,10 +42,7 @@ func (r *Realtime) Unsubscribe(roomID string) error { return res.Error } - var oldRoomID string - json.Unmarshal(res.Result, &oldRoomID) - - r.k.UnregisterSub(oldRoomID) + r.k.UnregisterSub(roomID) return nil } From c745a5fde50d9a79bbf22215828b4945c75652fc Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 23 Apr 2018 12:03:43 +0200 Subject: [PATCH 103/363] fix unit tests --- collection/update_mapping_test.go | 10 +++++----- collection/update_specifications_test.go | 10 +++++----- collection/validate_specifications_test.go | 6 +++--- document/update.go | 4 ++++ realtime/subscribe_test.go | 14 +++++++------- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index fa898e0d..3ab797af 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -31,14 +31,14 @@ import ( func TestUpdateMappingIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("", "collection", json.RawMessage("body"), nil) + err := nc.UpdateMapping("", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } func TestUpdateMappingCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "", json.RawMessage("body"), nil) + err := nc.UpdateMapping("index", "", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestUpdateMappingError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) + err := nc.UpdateMapping("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -71,7 +71,7 @@ func TestUpdateMapping(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) + err := nc.UpdateMapping("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.Nil(t, err) } @@ -80,7 +80,7 @@ func ExampleCollection_UpdateMapping() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) + err := nc.UpdateMapping("index", "collection", json.RawMessage(`{"body": "body"}`), nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go index 0c8dbb21..2743ec58 100644 --- a/collection/update_specifications_test.go +++ b/collection/update_specifications_test.go @@ -29,14 +29,14 @@ import ( func TestUpdateSpecificationsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("", "collection", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } func TestUpdateSpecificationsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("index", "", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -56,7 +56,7 @@ func TestUpdateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -69,7 +69,7 @@ func TestUpdateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.Nil(t, err) } @@ -78,7 +78,7 @@ func ExampleCollection_UpdateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index f5b63d31..22fe35b3 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -44,7 +44,7 @@ func TestValidateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) + _, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -62,7 +62,7 @@ func TestValidateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) + res, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) assert.Nil(t, err) assert.NotNil(t, res) assert.Equal(t, true, res) @@ -73,7 +73,7 @@ func ExampleCollection_ValidateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) + res, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) if err != nil { fmt.Println(err.Error()) diff --git a/document/update.go b/document/update.go index abf9bf82..1f8cb349 100644 --- a/document/update.go +++ b/document/update.go @@ -22,6 +22,10 @@ import ( // Update updates a document in Kuzzle. func (d *Document) Update(index string, collection string, id string, body json.RawMessage, options types.QueryOptions) (string, error) { + if id == "" { + return "", types.NewError("Document.update: id required", 400) + } + if index == "" { return "", types.NewError("Document.Update: index required", 400) } diff --git a/realtime/subscribe_test.go b/realtime/subscribe_test.go index 85c69a16..6bd682b2 100644 --- a/realtime/subscribe_test.go +++ b/realtime/subscribe_test.go @@ -31,7 +31,7 @@ func TestSubscribeIndexNull(t *testing.T) { nr := realtime.NewRealtime(k) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("", "collection", json.RawMessage("filters"), notifChan, nil) + _, err := nr.Subscribe("", "collection", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.NotNil(t, err) } @@ -41,7 +41,7 @@ func TestSubscribeCollectionNull(t *testing.T) { nr := realtime.NewRealtime(k) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("index", "", json.RawMessage("filters"), notifChan, nil) + _, err := nr.Subscribe("index", "", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.NotNil(t, err) } @@ -66,7 +66,7 @@ func TestSubscribeNotifChannelNull(t *testing.T) { }, nil) nr := realtime.NewRealtime(k) - _, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), nil, nil) + _, err := nr.Subscribe("index", "collection", json.RawMessage(`{"filter": "filter"}`), nil, nil) assert.NotNil(t, err) } @@ -84,7 +84,7 @@ func TestSubscribeQueryError(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) + _, err := nr.Subscribe("index", "collection", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.Equal(t, "ah!", err.Error()) } @@ -102,7 +102,7 @@ func TestRenewWithSubscribeToSelf(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - res, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) + res, err := nr.Subscribe("index", "collection", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.Nil(t, err) assert.NotNil(t, res) assert.Equal(t, "42", res.Room) @@ -122,7 +122,7 @@ func TestRoomSubscribe(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - res, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) + res, err := nr.Subscribe("index", "collection", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.Nil(t, err) assert.NotNil(t, res) assert.Equal(t, "42", res.Room) @@ -143,7 +143,7 @@ func TestRoomSubscribeNotConnected(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("collection", "index", json.RawMessage(""), notifChan, nil) + _, err := nr.Subscribe("collection", "index", json.RawMessage("{}"), notifChan, nil) assert.NotNil(t, err) assert.Equal(t, "Not Connected", err.Error()) } From 6c8cdc9713799b1e7a1af7a7205f64ae4973f9a1 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 23 Apr 2018 15:40:05 +0200 Subject: [PATCH 104/363] omit expiresIn if 0 --- types/kuzzle_request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index c1b8cc63..ba42c90d 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -29,7 +29,7 @@ type KuzzleRequest struct { Scroll string `json:"scroll,omitempty"` ScrollId string `json:"scrollId,omitempty"` Strategy string `json:"strategy,omitempty"` - ExpiresIn int `json:"expiresIn"` + ExpiresIn int `json:"expiresIn,omitempty"` Volatile VolatileData `json:"volatile"` Scope string `json:"scope"` State string `json:"state"` From d95d1fae9c36dc633ed395d0ef38e2740798e263 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 23 Apr 2018 16:08:22 +0200 Subject: [PATCH 105/363] use KUZZLE_HOST env if set --- .../java/src/test/java/gradle/cucumber/Geofencedefs.java | 2 +- .../features/java/src/test/java/gradle/cucumber/Logindefs.java | 2 +- .../java/src/test/java/gradle/cucumber/Subscribedefs.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java index b097592d..33fcc563 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java @@ -7,7 +7,7 @@ import org.junit.Assert; public class Geofencedefs { - private Kuzzle k = new Kuzzle("localhost"); + private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); private NotificationResult content = null; private String documentId; diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java index 7181c1a3..3165d9ae 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -7,7 +7,7 @@ import org.junit.Assert; public class Logindefs { - private Kuzzle k = new Kuzzle("localhost"); + private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); @Given("^I create a user \"([^\"]*)\" with password \"([^\"]*)\" with id \"([^\"]*)\"$") public void CreateUser(String user, String password, String id) { diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index 63271743..46a07157 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -7,7 +7,7 @@ import org.junit.Assert; public class Subscribedefs { - private Kuzzle k = new Kuzzle("localhost"); + private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); private String roomId; private NotificationContent content = null; From 642d3952e4b005380cb839181e5aff9ff39d14b1 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 24 Apr 2018 12:01:27 +0200 Subject: [PATCH 106/363] change path before generating .jar --- internal/wrappers/Makefile | 2 +- internal/wrappers/headers/document.hpp | 2 +- .../templates/java/javadoc/collection.i | 22 ------------------- .../templates/java/javadoc/document.i | 20 +++++++++++++++++ 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index dd4d17d6..882a5f04 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -71,7 +71,7 @@ java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - taskset -c 1 $(JAVA_HOME)/bin/jar cf $(OUTDIR)/kuzzlesdk.jar $(OUTDIR)/*.class + cd $(ROOTOUTDIR)/java && taskset -c 1 $(JAVA_HOME)/bin/jar cf $(OUTDIR)/kuzzlesdk.jar ./io/kuzzle/sdk/*.class #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp index e9636f5f..e6c7fd88 100644 --- a/internal/wrappers/headers/document.hpp +++ b/internal/wrappers/headers/document.hpp @@ -30,7 +30,7 @@ namespace kuzzleio { virtual ~Document(); int count_(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; bool exists(const std::string& index, const std::string& collection, const std::string& id, query_options *options=NULL) Kuz_Throw_KuzzleException; - std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body="", query_options *options=NULL) Kuz_Throw_KuzzleException; + std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; std::string createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; std::string delete_(const std::string& index, const std::string& collection, const std::string& id, query_options *options=NULL) Kuz_Throw_KuzzleException; std::vector deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options=NULL) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/templates/java/javadoc/collection.i b/internal/wrappers/templates/java/javadoc/collection.i index 1c1ffafc..274027d3 100644 --- a/internal/wrappers/templates/java/javadoc/collection.i +++ b/internal/wrappers/templates/java/javadoc/collection.i @@ -30,28 +30,6 @@ */ public"; -%javamethodmodifiers kuzzleio::Collection::createDocument(Document* document, const std::string& id, query_options* options) " - /** - * Create a new document in kuzzle - * - * @param document the document - * @param id the document id - * @param options Request options - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::createDocument(Document* document, const std::string& id) " - /** - * {@link #createDocument(Document document, String id, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::createDocument(Document* document) " - /** - * {@link #createDocument(Document document, String id, QueryOptions options)} - */ - public"; %javamethodmodifiers kuzzleio::Collection::deleteDocument(const std::string& id, query_options* options) " /** diff --git a/internal/wrappers/templates/java/javadoc/document.i b/internal/wrappers/templates/java/javadoc/document.i index 337dea10..b1340c97 100644 --- a/internal/wrappers/templates/java/javadoc/document.i +++ b/internal/wrappers/templates/java/javadoc/document.i @@ -31,6 +31,26 @@ */ public"; + +%javamethodmodifiers kuzzleio::Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body="", query_options *options) " + /** + * Create a new document in kuzzle + * + * @param index the index where to create the document + * @param collection the collection where to create the document + * @param id the document id + * @param body the content of the document + * @param options Request options + * @return document id + */ + public"; + +%javamethodmodifiers kuzzleio::Collection::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body="") " + /** + * {@link #create(String index, String collection, String id, String body, QueryOptions options)} + */ + public"; + %javamethodmodifiers kuzzleio::Document::delete_(query_options *) " /** * Delete this document from Kuzzle From 962601cca93b4b346989b3a56b64ef55a758b717 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 24 Apr 2018 13:59:38 +0200 Subject: [PATCH 107/363] wip --- internal/wrappers/features/java/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/wrappers/features/java/build.gradle b/internal/wrappers/features/java/build.gradle index 93dbb793..20bf2686 100644 --- a/internal/wrappers/features/java/build.gradle +++ b/internal/wrappers/features/java/build.gradle @@ -22,6 +22,10 @@ task cucumber() { } } +jar { + baseName = '' +} + dependencies { testCompile 'io.cucumber:cucumber-java:2.3.1' testCompile 'io.cucumber:cucumber-junit:2.3.1' From b7bb4ad3b9d3cf60003d794b2ef99db805947f6a Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 24 Apr 2018 15:18:57 +0200 Subject: [PATCH 108/363] update Makefile and .gitignore --- internal/wrappers/.gitignore | 3 ++- internal/wrappers/Makefile | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/wrappers/.gitignore b/internal/wrappers/.gitignore index dbaa76e7..65523116 100644 --- a/internal/wrappers/.gitignore +++ b/internal/wrappers/.gitignore @@ -5,4 +5,5 @@ kcore_wrap.c # build -build/ +build/c +build/java diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 882a5f04..22d7aba8 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -65,13 +65,13 @@ swig: makedir: mkdir -p $(OUTDIR) -java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk +java: OUTDIR = $(ROOTOUTDIR)/java/src/main/java/io/kuzzle/sdk java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - cd $(ROOTOUTDIR)/java && taskset -c 1 $(JAVA_HOME)/bin/jar cf $(OUTDIR)/kuzzlesdk.jar ./io/kuzzle/sdk/*.class + cd $(ROOTOUTDIR)/java && taskset-c 1 gradle jar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp @@ -99,7 +99,7 @@ cpp: makedir $(CPPSDK) g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build + rm -rf build/c build/java .PHONY: all java csharp python wrapper swig clean object core From 7cfd5df6e0bddfeb96ab93407846aed93593bda9 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 24 Apr 2018 15:19:48 +0200 Subject: [PATCH 109/363] update .gitignore --- internal/wrappers/.gitignore | 1 - internal/wrappers/build/java/build.gradle | 36 +++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 internal/wrappers/build/java/build.gradle diff --git a/internal/wrappers/.gitignore b/internal/wrappers/.gitignore index 65523116..10129859 100644 --- a/internal/wrappers/.gitignore +++ b/internal/wrappers/.gitignore @@ -6,4 +6,3 @@ kcore_wrap.c # build build/c -build/java diff --git a/internal/wrappers/build/java/build.gradle b/internal/wrappers/build/java/build.gradle new file mode 100644 index 00000000..aca5aa10 --- /dev/null +++ b/internal/wrappers/build/java/build.gradle @@ -0,0 +1,36 @@ +apply plugin: 'java' + +version = '1.0.0' + +configurations { + cucumberRuntime { + extendsFrom testRuntime + } +} + +compileTestJava { + classpath += files("../../build/java") +} + +task cucumber() { + dependsOn assemble, compileTestJava + doLast { + javaexec { + jvmArgs = ["-Djava.library.path=../../build/java/io/kuzzle/sdk"] + main = "cucumber.api.cli.Main" + classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output + files('../../build/java') + args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', '../'] + } + } +} + +dependencies { + testCompile 'io.cucumber:cucumber-java:2.3.1' + testCompile 'io.cucumber:cucumber-junit:2.3.1' + + testCompile 'junit:junit:4.12' +} + +repositories { + mavenCentral() +} \ No newline at end of file From 0099d7b6179aa6ac44bf812e610889c31f94bda2 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 24 Apr 2018 16:49:35 +0200 Subject: [PATCH 110/363] generate jar files --- internal/wrappers/.gitignore | 2 +- internal/wrappers/Makefile | 6 ++-- internal/wrappers/build.gradle | 32 ++++++++++++++++++++ internal/wrappers/build/java/build.gradle | 36 ----------------------- 4 files changed, 36 insertions(+), 40 deletions(-) create mode 100644 internal/wrappers/build.gradle delete mode 100644 internal/wrappers/build/java/build.gradle diff --git a/internal/wrappers/.gitignore b/internal/wrappers/.gitignore index 10129859..d253357d 100644 --- a/internal/wrappers/.gitignore +++ b/internal/wrappers/.gitignore @@ -5,4 +5,4 @@ kcore_wrap.c # build -build/c +build diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 22d7aba8..096eac8b 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -65,13 +65,13 @@ swig: makedir: mkdir -p $(OUTDIR) -java: OUTDIR = $(ROOTOUTDIR)/java/src/main/java/io/kuzzle/sdk +java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - cd $(ROOTOUTDIR)/java && taskset-c 1 gradle jar && cd - + taskset -c 1 gradle sourcesJar javadocJar moveJar #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp @@ -99,7 +99,7 @@ cpp: makedir $(CPPSDK) g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build/c build/java + rm -rf build/c build/java/ .PHONY: all java csharp python wrapper swig clean object core diff --git a/internal/wrappers/build.gradle b/internal/wrappers/build.gradle new file mode 100644 index 00000000..5b60d6c1 --- /dev/null +++ b/internal/wrappers/build.gradle @@ -0,0 +1,32 @@ +plugins { + id "java" + id "com.jfrog.bintray" version "1.7.3" +} + +version = '1.0.0' + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + baseName = 'kuzzlesdk' + from('build/java') +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + baseName = 'kuzzlesdk' + from('build/java') +} + +task moveJar(type: Copy) { + from(file('build/libs')) + into('./build/java/libs') + doLast { + delete('build/libs') + delete('build/tmp') + } +} + +artifacts { + archives sourcesJar + archives javadocJar +} \ No newline at end of file diff --git a/internal/wrappers/build/java/build.gradle b/internal/wrappers/build/java/build.gradle deleted file mode 100644 index aca5aa10..00000000 --- a/internal/wrappers/build/java/build.gradle +++ /dev/null @@ -1,36 +0,0 @@ -apply plugin: 'java' - -version = '1.0.0' - -configurations { - cucumberRuntime { - extendsFrom testRuntime - } -} - -compileTestJava { - classpath += files("../../build/java") -} - -task cucumber() { - dependsOn assemble, compileTestJava - doLast { - javaexec { - jvmArgs = ["-Djava.library.path=../../build/java/io/kuzzle/sdk"] - main = "cucumber.api.cli.Main" - classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output + files('../../build/java') - args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', '../'] - } - } -} - -dependencies { - testCompile 'io.cucumber:cucumber-java:2.3.1' - testCompile 'io.cucumber:cucumber-junit:2.3.1' - - testCompile 'junit:junit:4.12' -} - -repositories { - mavenCentral() -} \ No newline at end of file From 2e1bc4c53ec62fffcc6a83cbf9eaa96420d80403 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 24 Apr 2018 17:22:13 +0200 Subject: [PATCH 111/363] remove unused shared object before creating jar file --- internal/wrappers/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 096eac8b..919a88bc 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -70,6 +70,7 @@ java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask + rm -r $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so build/java/libs taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java taskset -c 1 gradle sourcesJar javadocJar moveJar #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class From 06a0af62f078beba857a1e6894a1cde987070711 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 24 Apr 2018 17:35:59 +0200 Subject: [PATCH 112/363] fix path of libs --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 919a88bc..fcfb9ae8 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -70,7 +70,7 @@ java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask - rm -r $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so build/java/libs + rm -r $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so $(ROOTOUTDIR)/java/libs taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java taskset -c 1 gradle sourcesJar javadocJar moveJar #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class From b1759aa73f62b9c27a8cd578efd505d2e6bba20c Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 24 Apr 2018 17:40:27 +0200 Subject: [PATCH 113/363] ignore rm error if no libs is present yet --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index fcfb9ae8..3b6a25a6 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -70,7 +70,7 @@ java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask - rm -r $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so $(ROOTOUTDIR)/java/libs + rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so $(ROOTOUTDIR)/java/libs taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java taskset -c 1 gradle sourcesJar javadocJar moveJar #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class From 5080609058710837f0c8f7e93648921e2b0518b0 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 25 Apr 2018 09:18:29 +0200 Subject: [PATCH 114/363] properly install gradle --- internal/wrappers/build.gradle | 6 +- .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54333 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + internal/wrappers/gradlew | 172 ++++++++++++++++++ internal/wrappers/gradlew.bat | 84 +++++++++ internal/wrappers/settings.gradle | 10 + 6 files changed, 273 insertions(+), 4 deletions(-) create mode 100644 internal/wrappers/gradle/wrapper/gradle-wrapper.jar create mode 100644 internal/wrappers/gradle/wrapper/gradle-wrapper.properties create mode 100755 internal/wrappers/gradlew create mode 100644 internal/wrappers/gradlew.bat create mode 100644 internal/wrappers/settings.gradle diff --git a/internal/wrappers/build.gradle b/internal/wrappers/build.gradle index 5b60d6c1..b9723ebd 100644 --- a/internal/wrappers/build.gradle +++ b/internal/wrappers/build.gradle @@ -7,13 +7,11 @@ version = '1.0.0' task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' - baseName = 'kuzzlesdk' from('build/java') } task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' - baseName = 'kuzzlesdk' from('build/java') } @@ -21,8 +19,8 @@ task moveJar(type: Copy) { from(file('build/libs')) into('./build/java/libs') doLast { - delete('build/libs') - delete('build/tmp') + delete('build/libs') + delete('build/tmp') } } diff --git a/internal/wrappers/gradle/wrapper/gradle-wrapper.jar b/internal/wrappers/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..c44b679acd3f794ddbb3aa5e919244914911014a GIT binary patch literal 54333 zcmagFV|ZrKvM!pAZQHhO+qP}9lTNfnHSl14(}!ze#uNJ zOwq~Ee}g>(n5P|-=+d-fQIs8&nEo1Q%{s|E!?|<4b^Z2lL;fA*|Ct;3-)|>ZtN&|S z|6d)r|I)E?H8Hoh_#ai#{#Dh>)x_D^!u9_$x%Smfzy3S)@4vr>;Xj**Iyt$!x&O6S zFtKq|b2o8yw{T@Nvo~>bi`CTeTF^xPLZ3(@6UVgr1|-kXM%ou=mdwiYxeB+94NgzDs+mE)Ga+Ly^k_UH5C z*$Tw4Ux`)JTW`clSj;wSpTkMxf3h5LYZ1X_d)yXW39j4pj@5OViiw2LqS+g3&3DWCnmgtrSQI?dL z?736Cw-uVf{12@tn8aO-Oj#09rPV4r!sQb^CA#PVOYHVQ3o4IRb=geYI24u(TkJ_i zeIuFQjqR?9MV`{2zUTgY&5dir>e+r^4-|bz zj74-^qyKBQV;#1R!8px8%^jiw!A6YsZkWLPO;$jv-(VxTfR1_~!I*Ys2nv?I7ysM0 z7K{`Zqkb@Z6lPyZmo{6M9sqY>f5*Kxy8XUbR9<~DHaC-1vv_JhtwqML&;rnKLSx&ip0h7nfzl)zBI70rUw7GZa>0*W8ARZjPnUuaPO!C08To znN$lYRGtyx)d$qTbYC^yIq&}hvN86-JEfSOr=Yk3K+pnGXWh^}0W_iMI@ z#=E=vL~t~qMd}^8FwgE_Mh}SWQp}xh?Ptbx$dzRPv77DIaRJ6o>qaYHSfE+_iS}ln z;@I!?iQl?8_2qITV{flaG_57C@=ALS|2|j7vjAC>jO<&MGec#;zQk%z4%%092eYXS z$fem@kSEJ6vQ-mH7!LNN>6H<_FOv{e5MDoMMwlg-afq#-w|Zp`$bZd80?qenAuQDk z@eKC-BaSg(#_Mhzv-DkTBi^iqwhm+jr8Jk2l~Ov2PKb&p^66tp9fM#(X?G$bNO0Qi#d^7jA2|Yb{Dty# z%ZrTuE9^^3|C$RP+WP{0rkD?)s2l$4{Trw&a`MBWP^5|ePiRe)eh1Krh{58%6G`pp zynITQL*j8WTo+N)p9HdEIrj0Sk^2vNlH_(&Cx0|VryTNz?8rT;(%{mcd2hFfqoh+7 z%)@$#TT?X0%)UQOD6wQ@!e3UK20`qWR$96Bs_lLEKCz0CM~I;EhNQ)YC8*fhAp;-y zG9ro^VEXfQj~>oiXu^b~#H=cDFq1m~pQM-f9r{}qrS#~je-yDxh1&sV2w@HhbD%rQ zvqF(aK|1^PfDY)2QmT*?RbqHsa?*q%=?fqC^^43G)W3!c>kxCx;=d>6@4rI!pHEJ4 zCoe~PClhmWmVca=0Wk`&1I)-_+twVqbe>EhaLa(aej;ZQMt%`{F?$#pnW~;_IHaAz zA#|5>{v!dxN&ouieHdb~fuGo>qW(ax^of8<3X{&(+Br@1bJ-0D6Chg$u$TReI=h+y zn=&-aBZ`g+mci#-+(2$LD5yFHMAVg8vNINQOHN6e4|jQhIb$~sO;+G?IYshZf)V{ZewQR z?(|^o>0Xre^gj!6e}> zTHb#iYu$Pe=|&3Y8bm`B=667b-*KMXwSbr9({a6%5J<}HiX`8&@sTKOHJuGG}oFsx9y^}APB2zP0xIzxS_Hyg5{(XFBs z^>x@qc<{m0R5JuE`~*Xx7j+Mlh8yU;#jl1$rp4`hqz$;RC(C47%q!OKCIUijULB^8 z@%X9OuE)qY7Y3_p2)FZG`{jy-MTvXFVG>m?arA&;;8L#XXv_zYE+xzlG3w?7{|{(+ z2PBOSHD7x?RN0^yTs(HvAFmAfOrff>@4q|H*h<19zai;uT@_RhlZef4L?;a`f&ps% z144>YiGZ|W%_IOSwunC&S$T1Z&LDI1EpAN4{D|F_9c^cK8`g zQ4t*yzU*=>_rK=h1_qv3NR56)5-ZsGV}C?MxA2mI>g$u>i9xQqxTY3CP6SFlmqT*kJm+Vp&6|Rd&HVjVV2iE;dO7g%DBvpKxz}%|=eqatxbO9J z26Tmn5nFnvGuWhCeQ?Xl{9b3Zn?76X;Ed_yB`4Tuh{@)~0u0g-+Z&_LbVuvfXZ0hi z<)Dcp(7mi{4J2=wr$jn!SYp3yKg*nj)GwiiYeB6=Jz5 ze_>nw@IjCW&>1ztev$h~1=OFs*n#QYa*6y3!u>`NWVdsD^W6FZ)$O=LbgMzY=6aNW zplFoLX0&iKqna6%IMp|Pv~7NW-SmpI>TkgLhX&(~iQtdJ4)~YUD3|+3J-`WfB|P2T zKia5&pE5L|hjvX`9gmw7v=bVal$_n*B&#A(4ZvvYVPfl@PI(5e!i4KS_sd`yS0R*R zt|Yp((|SofnsEsS8|&NyWo{U<<66>|)Ny{8(!hRcc&anv%ru(Oac)?%qn}g3etD=i zt6c#E^r&Ee#V}}Gw*0b1*n829iQ&QWLudUqSuO3_7xb~%Y!oRTVaOEei3o>?hmsf) z;_S_U>QXOG$fT6jv$dsI*kSvnPz=lrX#`RUNgb><2ex!06DPaN9^bVm^9pB1w&da} zI*&uh$!}B4)}{XY$ZZ6Nm0DP#+Y&@Ip9K%wCd;-QFPlDRJHLtFX~{V>`?TLxj8*x9 z*jS4bpX>d!Y&MZQ6EDrOY)o3BTi4E%6^Mp#l zq~RuQGD*{Kt9jrupV_gAjFggPSviGh)%1f35fvMk zrQGJZx2EnWQBy8XP+BjYan<&eGzs{tifUr7v1YdZH&>PQ$B7|UWPCr_Dp`oC%^0Rx zRsQMQ7@_=I8}s$7eOHa7i>cw?BIWKXa(W9-?dj+%`j)E%hfDjn$ywH=Zkko}o96NuqwWpty9I2QtUU6%Hh#}_->hVJ-f711&8$r7V~O^7sth1qdm+?fD?&gIjAc zyqFI*LNCe9r)#GW?r@x@=2cx756awNnnx7U6`y?7hMG~_*tSv_iX)jBjoam}%=SnL zQ>U^OCihLy24_3n!SV-gS zOc&9qhB7Ek%eZMq6j(?A@-DKtoAhCsG+Uuq3MlDQHgk4SY)xK$_R~$fy+|1^I3G2_ z%5Ss|QBcETpy^7Fak21m_;GRNFx4lC$y8Fsv?Ai^RuL6`{ZB<{Vh#&W=x%}TG%(@; zT)NU7Dy$MnbU{*R-74J&=92U75>jfM3qQ=|sBrk_gUpJ|3@m-(S} zqrmISaynDD_ioO6)*i^7o0;!bDMmWp0YMpaG8btAu^OJ)=_<07isXtT+3lF76nBJ{ z`;coD)dJ6*+R@2)aG#M$ba<~O=E&W~Ufgk7r@zL&qQ~h_DGzk<>-6*EUF#I+(fVvF zF0q3(GM8?WRWvoMY~XEg>9%PN1tw>wLt5DP-`2`e)KL%jgPt=`R_Tf+MJBwzz@6P` zYkcqgt{25RF6%_*@D6opLzleQ)7W@Gs4H3i#4LADwy$Js;!`pfiwBoJts0Aw#g{Mb zYooE6OW7NcUMd1}sH)Ri=3(K0WmBtvK!2KaY?U&Htr#Q|+gK<+)P!19dIyUlV-~ZD zWTnl`xcUr)m5@2S1Lk4U(6nbH$;vl%qb5Vh|G5KA{_*04p!LOkPsWhxMRz}sl&mDWMOvz5;Kq0`+&T6$VoLdpvEBn-UN`Yb8ZZ0wMcv3XC z&vdicA-t=}LW3(&B6Kj(>TT!YHdrG%6Mp}$B2)7 z+;)t8QsBkfxDOo?z_{=$3mKym5Go;g$Mk=-laVV$8~3tYKU*>B?!wZzsj%|0`(rDZ zQlak~9a?7KG<`P_r`)fK5tmRtfJx2_{|%4C{wGh4l@LS$tQ$Tbg&CH~tGKZcy%EgW z`Ej2=-Hlzs6Deb(!HzY)2>45_jU5(2ZZtAeg#)2VsD^#*$8x<;w5s&*^tt+nA0nto#6hJ&M?xQ5=lhI*Tap+o@#YI~Hi-l#@sdjZ4PCVcFr zrtJF2C$N~X&6L4W47_$Flt4D!po1W~)1L9HNr#|W_L09d`a-4_H0Mx`rv5icDMbTk zjgibis*{cth+j!U;jr1ejW?${hBE1{p6EKm8=(ABt9m z73d7-{oHvvZQ4|t%Yl|k2ISat%`52J25OJ=M|CD{m|Q`~Q%t0|TS>zV%Z(g_Tfm4* zrnW_nWqsh&V(Vg+lY`u)?gp>c{g&12){~5SxL)&$i>$($pDhnsXK=$u3m0Cx-kD$+ z5Sf?E*TYQ#^KvHWJU1%*={yG9NjM(7`Q)rS7&uMenLoOe2N*xk(vN5F{sf(%CH8#I;sdqf1dw%kBI&pS`K)){>EF18AT6CAYZz0_Bc|Ws1Nh3 z%twB`i+Lm2(%hoXJP|J5lGpD^-5BDO7S(}JJ>5B*GC`HoszjIH2&%(H9^gwUpLh!i z3Qy1nE2J}h@;Ak+bcPP0N_i9XP zGP%F-_xo6mx<}RTyu}Gtjo&rvdJ)cjDjdsF2#cIzUZPQ4jw3ooBicqI*=>s6PhTHP zUbqtt70zm3RGvU{bmEBy@7>pUvN*V&xd}e^Utpe0V;b_!mCArr(MJKQnMqizhhON$ z0PU2%@B_9xKJKKe6`VjcwmWC;Y0r{P@{$)pR~JK z7W*a7V+;ltQ(0F8#ai=9MTrhuKUuc?XHbAd#{@4h9w}rzVRuq6yXejFE!8sdL8=54 zlMy{taj5+w=D#noC@!#8;au}K+eZu|Qu0-kgkp6xNYzcURuN-6Kl%)%2VR8!wVGU1 zWZEqJTSbol6_)?Gn*57aSh-rbxyjqOxm!5?6VUdE?S~B!MwhszTd>6tpLmj(o$a(h zAs07xg*#7|8#vhWTd4=LC(iu_{`BjJsuC)6y+j zVt~bjACA>0y~vnuy8LtP`50?}Sv@t*JN-yL!!hVgrCPk1MZ}gKt0uixMw>b}LVSYT zO2tkmt!7v#jQQ>8j*U6`G)hEPOU>LGS_Bb0_fM;F-V(W)wq65Rk*aya3yO z_E*B&%-+Mz#?wO5#@<52%(}O6W4o%BNVbB8s4!4(PR*gSb z$j7Eencvf9?_))K7b19T597Ql)q~!PlMm$u$j3)NoBF(=YuwSFa=2J3EM=@!qJ=bK z2UY^`gcpl_0a{Nbh&mL-S}|dXDc@FYTzkR9u>DlO|r9zMbY9 zcvi~*Sn!-XdibS9>V|VmH54$J!N;-k>U|!e$!EePWpr0wZn4~|?w4vo%-Ffcx{+}N z74+Dx>^&$SsYtq~oLkztY&j;cG5S5NN)rYFS~F@`)MVA%911fMO^vLB+%;E2kGcx|C?bj%K*Y#Btv7K6inqIt~eN9{d@I&&(VF z1}bT14cQy!1jpa|7DiCJuBh_{+56)f_l3}qLWwox4&D>1NwX@~lG&(9Cp!ZS@vbCbV>$9jV0PWrUoc zGQm`Y5){E1K~q2RUK#=U*e^6&?8-y!fP9=6o+W+4nm+mSQeDNJD5!E8CaU;I#+HM)Gt`;3%$yq7H_kqm0#(U8c<8HUpZ5@8zRzEG5L^AX4{< zwDEN(lUW!^k%H!t&T_;T6To1i4r0S|tu+lWr|`3wjbo+~>MjOj62{&D3H$OiWs=Dw z`m6MW^8|~J3*ER5G^h~UbH*UPW$7ZHfg&@9%r2u(d@8YN94k?}pzw`3tuCNVl%MV&<#4ESfo@VX7dX=)C-e#!(E` z#+;b>rvW^#ug1(yr&cS%w96I($;2(O*FuVoTK-KiA2Qgwkhs0^Xt=eXkh&mx)iBSK z+r|&Xi($%(!3BO6G7f)2qliGTP)G50)i_iAAQYn_^v$7h=>j<98G2H|p1$BA(xe5i z0+-b-VX6A*!r*B>W<`WMPAsKiypzr_G25*NMBd*U0dSwuCz+0CPmX1%rGDw|L|sg- zFo|-kDGXpl#GVVhHIe#KRr^fX8dd>odTlP=D0<~ke(zU1xB8^1);p2#8t_>~o&?jKIG49W)EmhTo5fZ|aP=E2~}6=bv=O`0e4FpgaP@U~KHt>V*oR z{wKtxe`uCFdgYHlbLL2`H>|$?L@G&exvem8R^wQppk+Gu8BI;LR4v=pU`U4vlmwFw zxYbNZXbzdqO{7#b`Eo2>XlNcQEFC-Gk2v__^hqHG{bb%6gvMRe9ikQ>94zOK3o85` z)Ew{!is}|b0%g#qa2H+$A1i=5;*y)hv$5m)&;Z~CTv zpdZz#9k)yhrLH%G>|ly;%|Fe`K{}d{6vyNO^Gk$ZYOIL$3&5XuJTqse&XvY7TH(_z zb3L0aT`$6i&c(dBQVcLsV?yM^@BTj>C_2=Ih6Yxsk zP5r-Yg34bu;lJUUrT!1Gt>I?jD(&Q8A@Ag5=i&TcT(g><60QjPmt>;B(xYk(bt}+T z4_t3m_flhFXrd}o9hw+M$vh0Ej(*GdO21EJaL-eD*b$UHHZnUN|OJ z0Jp^;Ep{EvhbQw6K_&t~eB7m4_csSE=CWXyWY4sLL-`>gdwbXUqW8FqVwQ((K>Hes z6?QDu2SZjI&_Oqc`A&D$)~oa&r%dn2G?-*9nvEt&L!4PeU(lyXCgK1^guGj|F$M$j z(GuZXkiyMXV}lhNuz5oi;9>+0nCgNO|gp>9FS%CFa9W(t_WRn1h zi*Vk4IQG@3-{J`U=9`Ky!DmF2O%ld1w#`8Drc@C6KGz2^NhY^gQZo9SG}}BF9G0<> zUIO))F&%dt6uAb`cN%_jf&q5I)?_7J^9T09fb~#ll%%T{?}PznT^_22(*OROJ`X;tg`78+=eW z{nLQs1%;?R)4yhs=QXy;Ww3ta7dfE~<&UNFZ#6bKVY=m1@p+4G(=Yx{7vDsa`}d$v2%*jQt+wTN!@Q4~!T4`0#GI8YfG!RD zA-RJ))sAlYej5x5RQ-^2I`1%|`iFfD*JoRd`hJ1Hjq_1EjBZ7V)S;?@^TS;{^==d= z)f-C;4#XD*THtvXh>{A80hZC?O(tJ)M}tK1Z4n%Y}= z7G#ciWgC-qm?9fE0?893;j3|Em(+qaH${U|Z^A^QleR%Z7 z1tb3_8mwUDjv6g+M+PH*#OmXvrsOq;C|~Oa;`LR+=Ou;zBgy?^)d&PxR|BoHj6&sQLvauxiJO7V_3Dc#Yum zGB>eK>>aZ64e9dY{FHaG&8nfRUW*u+r;2EK&_#d;m#{&#@xVG;SRy=AUe9+PcYYs7 zj96WKYn5YVi{SKZ^0v}b<>~7D3U^W@eJTVKCDk#O!fc5%`1KJ%473-~Ep)z$w6SC^ zTLzy~^~c+8J4q^gv9G_h((u6+#9K|Hwyv?kkbEpaO6^U013F*&bbnuxwtH~v%F9#0 zmtLmWALa{|zD`KnzKOv=DK^Qdb+qyOnd??*IXEprOa{&tVKg3pExuAFe~YQ4t|)j) zij8hA%U)XCd1Xs~{O?y^$^Ay>@J#8GF%+8%LcH*p@gmDRZXB5qIXD z8>)QYQpTPLtK)oS#azTHeBGCqsnlj9NCIGNEpJb;iSSJPZ2?lGVE8nj#y*wRnoLNP zUDvlQvp`STbAjrwgsMtnowuaK;8{D_vB36%w zJv*S667QTThf?Cmh=Z!={xFo+ID2<-Vy`H~ArX{AKl+?KW=|8LZO0Np%7v|KE(}&? zkm-iqK;uMF5)cH3KYs+zl0BM%jvE+hMDx-L*xqRy;-OS_rAK2sX;%0n1!Ma{5Lmy9 z^imumWb?xIHBgd8Q<3ZITO&oZe53WDFt~k-gkZB#xr?4x**{ecHCK=){(+%{U)emp7C}WTX-ec@8h(}WY4jqVq71BVnXwP*x&;{_d zN*3_vi&qrs&)e8zxt-odRm_T)R;UhvD$t{UlTf!SlB8E1GF4cNqHtgHu}%8Q8%zI^ zpO2!5*(g*etB5GgYL`Ac=M!b)Xq2bNT3ITjN-o2|WjTohM*|Zlubs@v$LuHc` zZ9L$4X`?POL_=tgyId{qVRj|31h_W~uwSBS8Ah`MRZtYNw3)JW;zH~Pv)aMi=uCgq z#Os}gx^be(^r#pj-M0If8r_YMPZT)4&1&7mrz) zh!z$uE9c|~q;;`W8Ai3H!KF-#GtuGf98}gBI3*2zD4rHswCwmtL-<*{PH$;(Ich%i zT*e+^HTbEiukgv7AMqKZ_!%!^91tMZXJ&a+eBiBB>)uZd6=!3wJGNOlZBqfyTo_(Jq z52h7Y#wYwKScBP<{-&F}%`x@JiQDol9`9Y82JRmh8^6_R_^6I7I(oY45vsM)2Mg0! zNA^4MWmRnm?JM)uuzN;;ogInuA5}Qk;oaQ$cs9Ai)!zvU7TmWOs>`bxrdCQ#mnxk} z5Qpoyg#i0duj8%&Cc)XL_UW9Y?IgF{#`HuraxSoAO7mma*cOEu@T)wAF;<^bOp|dR zADP}}$WhfJnAd^kp5&R5b(nQw_sNEB!jZ-p!ty@M!(=`!YrVm5qzwmXy!+l^Qp||H zv)&M{iBPo$VxFKnW{T}^(SSQhrcO8bGeIkBJ=JR;#?sW8mMt~^yS(gY`@?F17Z%jH zb{eMek^AG53t{vvM+t+R{@qK?fCZn7^EkTA!lZMl?}J59=&K`ZSgNCVJpfBBkb%)0eYGJXVS%p1UU)y*F6#Od-P`RT#1*&Ua*G-rTNAwiZ_43phR z$Tt_#Lfj(r=Zu@nx5yBV zF=8b~y8XrjculznaTL$d_A?<3CJzV%`@=R?nu3qGhpnniU7b64jQx=U%#3e_@5n7P z9CZn~<+hnXIoahha&pWlKH!M&^LRKwKLg-_J)&7>fN$!Zhh*IevmsWNm%}J!& zx5esSGz=)HgFY>*tW#_Bh8hH?clu~3dMZr!u|cf<&P_Ks1R4orwjF4Qmy<{9I7j2^-P1Qe-E$ZHv^Y2|8)>4abo8@^ExNA7B+Oy;0NIqz z!#d;E2rU+kkB0P#KYyn7N;Nuo2k!qQugm($Hr+YiqO^0y2CRX2m^!SZq@xDICbo~5 z6K1##iSi zz-lajV(rBC^a}AEt3AqMcJSKZsorc=(iiiCwip4!9->vgGF5(@L;ix&mq$LxsQ;yn zCD@C_!;8(Kv^6$mb||Lfhhf5I6~WBlJ&cje30%f>NXFsAPq<6#QkQbOXF|Tn)4360 z9ZbI~k=SJ5#>G^Tk#7(x7#q*dL8Sx?4!s4*FGxDT3=jA- zd3uD7(hY0)XnNaS4GSis{9xF|$|=it<}R2GMf5Wql`jRfCIlWupKy@#xLkR# zzy28n_OG7iR%5>`{zXeUk^Xy69o^hb?Ct;Aua~R!?uV|06R7mWI$`-8S=U+5dQNhM z9s#aU873GO#z8Dy7*7=3%%h3V9+Hyn{DMBc>JiWew5`@Gwe3-l_Nq*xKzBH=U3-iE z^S$p)>!sqFt2ukqJ`MWF=P8G0+duu;f17Wc$LD>!z8BIM?+Xa8che3}l(H+vip?rN zmY_r$9RkS~39e{MO_?Yzg1K;KPT?$jv_RTuk&)P+*soxUT1qYm&lKDw?VqTQ%1uUT zmCPM}PwG>IM$|7Qv1``k--JdqO2vCC<1Y(PqH-1)%9q(|e$hwGPd83}5d~GExM|@R zBpbvU{*sds{b~YOaqyS#(!m;7!FP>%-U9*#Xa%fS%Lbx0X!c_gTQ_QIyy)Dc6#Hr4 z2h++MI(zSGDx;h_rrWJ%@OaAd34-iHC9B05u6e0yO^4aUl?u6zeTVJm*kFN~0_QlT zNv9T613ncxsZW(l%w`Lcf8uh@QgOnrm@^!>hcB=(a!3*OzFIV{R;wE73{p_aFYtg2 zzCY5;Ui~l_OVU;KGeSM9-wd66)uL6N3DqJHJ0L6rET&y2=f)>fP6;^5N)R`BXeL+& zo6QZ-BrVcmm1m{!!%^&u^*L!e>>{Tg?Du<%-A6<{O8xZCvmdNv?|;Xmm;55oj300) zByD!GlJZaPau!g@XX#!j!>VHPl5bWf^qk=Z+M%N_!myUu=dg$C;S{|)(pcrOI5b6g zcV*=qSI|KVEI(o_(QiDzss>!+>B>W5IhxlS^Eop*rIB0e3~F_Ry*d7(0zb2SYv%Kb z_K~7;{#bI4uy<>P8(6oG^->yVwA%#Ga{s{Xn{$C^=B;Y4GEp4m=&suBjN6XN-ws|h z6tG__V^Wl+rCfTPUf8trHW>GCue? z58?dkGg|8!;YQ(dl}+2_Im{K0{l$)Ec5rW*Y2Z!w?tGQ@ZkO%A?&@KMXBFF9EHi`i zOwT#+Fz~do?#nt1Hz3;_?3rEQU^K$J2BgxOX2AT>!bmMv8&0nQSVYKW83j(9ZEV#w zjN&G|L)`7uiV;>?**_x)mP$&Zg}sh;>8W-$u!qozJS8IH9zQ1|+90mWT-zni7m2b0$Anx2<6 zpgF=^bxuc|t#XClG*jIl^LA3hx?Z^%49PiWfiUKeVVv(xH_AIRe8-Pl=_1S?FaEF$ zZ!IPxsXgx_Sl%jaPlB<1tvQ^!2ii2R`W@xr@#^kRW!y^B-x4+3`V!9)HHE^F%>IqO zh;0Ul3|&UwF?&L-&5@Spcs2w(uSgY{aIB{MbAqjDb%)nrZUw`=7S+4d)K9AS5NS1B ztX^Dm+m$5hO#;9xtxqoNB6(|gHUyBn4`2C_<%a8abEB~01nwRf!?+T#Big__!bMbF zt|-LS;8LPy3a$3$gAD6^;xulrXsZXjKW-1pFu829!mWo?yqwx&THb1Th-c*q*u2^k zeefe7T+G~7CiS=Z5~B?}bW-J>-WuqL13Xx~@Q^)QhHxDgk+x*nyVFjnX8tR1^Sdl-R(PR#|j?hx!oryI`_wmmB4z4{7wrEBF>sclHoe z2JB6c#_$aL%lp4!UAb@_!sLIi3O&()fDr#T(f=PY@t^ItF#Z^atwL1KN7GYN4G^O3 zHDst`gr4lwxJkr~B*Z2x#CzmkNiiD~)46h}=bA*Cx|c;BZ5Un^r5fs}?6g3Svj=j;fV|OR^i@=cCh)VMW_5+L*;k;r!;9t>|w{@)`;;)E->kUinNJ?X8kN! z8`}GhsA>#DPeGkd8dg4r`L zyS19T8YH@ihS=4~WrkUhg$=sYId}&g^9vO>KCnTIzZ66a=?JDsc*B=vngxfB?;*qV zL|Xu(P(H={Trz4ndsE#KyKv}^sWN(EEpcsO6`4%x-hL6fp-yZ@=m!LME{*J|u;(PU zhn!*SVlA=jA^0#&C;}}4DRC|Tk)2eG1v`?uIH(hb7|mL7IBeI~W6fP_36}|0t9q!} z@!h`tf|zFCFY8G0K$!&iwF*jOb@C9E-u5s?^Rlaad%bCX{YDpPTBm z829R2aPrE$*^pP7-pjT|pATPS5NnI|WwT++-L34$e1-}4%*dsYYnu}Hm#92MgFE{o~NjJ{EMM1=Mai)NW%TmhhCo7lUYkk_3rXFLXs;*u? zgRA~x>&_K>WvT0`Pd9_t44Z?otM8lH}ukI$yM3RtOb}S@I`i-+*_MWx=B>k@KtGEN8>e7{~g_4w!LHb-T8%?i{F01C+zU_~n>ZWyA#$r92il-{03qE7w z=Cpz1(vmmZVhNpscjG0M0K4$Tenmdqi6Sa_1=KMJKbaxz-TB2#j| z6%G1&3`Cs*FXeBf5(kCLyAWQvCo0ZsL(P{pXxPqF2l6D7M->xL%)qCYEkc|mAi<}j zM!2f7X2*gpVHIkatPI>>9cVyXLNiS%vFL9?smnYBm z(8k{xAaDSFG3*O+n{p-<+h z7l32L?Kv`Udr$(2lSmFBW$yYNd>T2?L+3N;I5dSOJ3s}q5#UX0X^z@DgEB$HV&10A zh$rhWVb)Pj!doaXx0#;$Bcn=|-z~XKopH&SA^!)ZkvcurJVErdUW4&BwdCV8j+VY$ zciQn&1L7%B8%%^|UFw={uTc`symy1L3LMfFY3N*^yU?cSJQCgLc%}394vUB-)Itp( z))pWllOb*Nj8O0}RkoI!FBX!U4yC?kPD@vFu|>qeg`S&VXlPQMy2}GEa<|}5e#^L&lXX^D1U!rce9c0+G>TC7~L+bTW5AF8gv#eYG z_;WNQQpE>x&kqA*?^}TS2B(=Mr5>Ase_e4xngO--eRT4DtMq`h?QLjn;YW)HTixlc zpnP+~DkXWgh7H1Lu2wUeE>u&y<%4N*+>;F)+x=UWvKjon(XuB@r$%7Jb7cQh^@qdO zM9XJ}Xo(M1KWX8xU^Y0d(B!s?4bx`v-M6p0@$DZP?GrT3lb%%H>>?4TX%etz)cC`dOmZ__G2X+AGcJoGFy@wtQ zeakz$cBhhehjg_(SuL#qVk-xYE(aUTzIG8AK3XD0mZM0EJ13YVzUS$oZg^^hO{b+^ zWy#6}LqU}|3q#lZqO#g=>*2Az7iHbW68sdBHa@f4CwB*}eQsFu7Tt1TJhp;6vXBue z4Z&aWG#~BbN)h`=E<(Vw-4-1?9pAqoG$@yitG#M$ z{V)~zAZdJ9n{7$_oi$!R(XyIv*uawdn?iLi0_|*UpE{z}H(+r#IfP9?u^% z!kKxcc+??s1pNs5YaXS!5+zbthP-;O;!^z!rLXWNUgHa3&8% zFnn7A;Y{bf;(_n0W1vs@RX}8v>GhLDF1~V3{R_i?vJdlO68|#BgDk4eW|fA=Px|8~ zxE(@omgp2MOi2Be%RhF!?{Ga)FTRJW;ECWYF+u9F?c_jdOf1i1BmIzVaa^@Hjh%Dc z?F+^by1;e_#f|(klA^TO3A`*eE5&0ZPj%0yYALQ9XCW@RI&St+OHRvu1>@Onb5fQeP=E$YVLhC zMpkEIz*}74t>;PK?7p#~Z%%f?7~v`0DRg{|bgVzLd*4!|S_D~Bs^i}}-~bm7W%PuM#$_t2fExWw_|WAamWxY6S=i?9Vv z%r%BcXG@HRZ58<(=pqR3&TX^GGZa(U>rmsz|48$YB!5Mbd}P5~h{T9z78BD2Hc~3x zKc=D%SQ$%P6OieeGg?oR7gqz4+_JkSUx-yl&y1FKX^s)nU<6PVuXc@ z5Q^F76 z{SeBk&t7-TvH9etn33qag}(s;Y#{$}DuS}%Dsh-D+#S{21Xu}Sk&DG)xHL^Qw|H>V zxET9a!QifM%L2`JPex5!_AtdT_*%k`VeIDQ?HT<-M)oaKV}&lR%R{pCedOz43WD^xnWfcqCkBF@ z9VL7YK`@>c7LO}V=2TqML`PYb>%P~dvj3iOGBECvD{|;Qxf^$-ay$lo8O#nsR?je@BD*SU*98?E={03WiP!k{}RCQ9m z$}#Jzcn)I25#^-Qz>JN^??=RtAucr-Jg~DzhqOS$;j`Nvn04M4em6Ki1o7#9mexRO za1Xpdyz4D?3QY~9CFGp2%?f=2jo6e$v!*L(L}2VrIGXj$Qo`z2<~wn>{lP=(&WO_z z%zI*bMxNYxqS^^Q%LdYtVK#tB?aiXO4M+CB82bvCy5B5q+}+)^xE3hx?(XjHPO%Hc zp}4!dLve~*ad&rj`|j+_?#}#o_RA)akU$`p-?{HO?{gm6pZ01@yeN33rIEH6_h#S& zAtyDiJrVMTQI^fsYm9y9uY^o2bTA1eX3xK4_JcOpgRO?X!s>CM^h@c2{%VH*gzC+X zm|DU@rf9<$tml$Jms2>4!=KJ6d8-32{Whg&RZ)|_&kVZ0FTt!Gs9OJ(PnX+!>5)Qh zUlC8RiylPF@@L#Kl%)qKKc6ZzJ_2|rcY##{ID-2IQXd(&W*dO0U`Xf^_O3hzv+xkb zyWZ`jB(PC_st2sEDep$CoUQ^V_XIDXDA&I?s}bkBW^0jQ{7$(3#>|Pt&`$Eg+Gz5E z;1W~$+#bKU41|KrdzjU-}M$(v|Z_GtP$3uCNzu7r6tT zbL<-Yzs4_hl6Ar@TVoqX`_{xb0v&U6)YpWp#kj60veHC!+z-J61{@B5su999=xpMx-gS$e@eFvqMEK%gabP9K}#r0IvW%eC!?X4N_8L|4?qdX5#mx^1+!K`l5>-B!e?Zi&>J~yXe z^EiDXWNlAa=vKuV@D7qCAc#+)(rDN_h$lAQQr1NEM1~of6g0s&*Wa7$zfuqBC5F}q zIq_;)KITrRf4ja2p8@)7#`a)Uf-R*tDDuh~r5&3r|B*a)_||C;726hD33bKC@ZHC# z?zQfi_d71~w6Ulk;z5n@cnfKt56Ynic~^~u?4{Um-f)^FWFF-Hjo6)cC(RcWV-pld zUNDj_5A{hC~NfI(fVO2HkQ=y;Tzvm zhzHk*XBGZ<414*^20jeoP6fycxbX_4ZS-C0#Q+>;R*@QA_E_mUo$Lovdi=e6WBOgM zO$r}XbX2^Ad<4XtiE?#6K{o?sk1)A-V?YF^rd4z8@D$1MWZh^By(-wVH{ANZNZ60f z`VxgC22Jem%k!#k8&%#{WvT_rZ6&fo>ti-xff|7Cr6BIfkKPk5o&VJAoeS+3ZoU3Q zL%3tr>%#lX%>{;tPj-YL-?vb2jzl<>z-(*JU z#NgY(Xne)TUG*ZAJQ~DTMCGtEk1WReb_%|XglxGE-9F|)dF+enZ>5s#WpS}MuE!-@ ziZ2T!lpxm^3#caGuE!u+G$4Kc$I<|Ba8vj-l~>D5_%~He?)uB4i9Xj9SE#HO$E#r> z%SJ-{)O`xKRWCpsauH)Y634V#LG!Q&%L|cQ$cB+6KQfQH;8??vi0OE&;IYY{7e2}( zPBTv-c$2rgimyl;^vpeKO)1 zC>_sX@V&--z}6m#@s^0ExO@gZZ00=}D9*iM!~N(*W$uoP@(KSg!J}Dzov788kl!IyaRHISj`d0HO8AS*(KzxG4!kYWX6Be=3xjN< zV%-thv=OdVJ8<&z&!_kFH8GbI&!(@bU42xP_wdQ*z53EX9#7aJ7_5DVSbVFZ`SET9PA)Q2Zam@YoV458Nf#{uQ=< z*0n=~x)Z7MRDC<29^87p{+*hVetwUQGQXeloWGij(}&7UV7_rhwUrEpP-{6 z89MJ56vT+HDYZ9OyOa!|aM)$#DV}GS5vvZUGUy$*#TXqk#4F<6jEK&6BG4hJ=6u%z z2MikfzN)%;`||E559&09Mq+2T(8yCPP?-RXH3>x65|@udly}iJ+A$ zo8$4>0ZgZ|dGG{Se=jM2*dmF_;^7h$#|vu~>g%)#8*9+)-wK|3kY=^6^>_YV6f_jnm&w=h6F^A2G_%6x=JIK*F2`2&_J#h>IR zsS<`$vYK4_hShk9N*a}W>ZapIGBmH8qE*(CFsWe|LaNsDH?o}gH-M!dV2QOA0@iG% zhVgrYi(|5UGoK^sH_#_Fkjdw*MC6$6ly3Swx{xk;(pUJSHG-^uOzDe)F;MLSMw7eA z*P|%G6b}ncolp%}eR9e5;4%Ltf^6h1;nkuIvg~FF?Kv4whK`gOgc)m|&>0SzLfjdd zP#(f97vZEs-ga$#{7>Y&gOCy^=D&M}0 z_){+OQ@U62Do>z?SdEtrFjI=+yOieg%ILB*){Pwi(lJoMJ#JV9gRCHTH%>6+*Kwyr z^<>8}9IKkcym=InL#D3PQG@pEzgA8scXeaJQF?~LiI;Zqn~-7UM^u2-^rZ}80P6Gg zh9Qa1gsAnP7qM#jO>9W#$=$Wo^oZ?k+}1*UGX*`n>K6e-AGxw_SSYkU@ddPzyg#FR zyZJUzXjpbNlMhYSNG?f5AzLJJMb(r+MP8;Jzp|CxZVxUZc!zX2 zaH$O%^6W=WDKb%(Ia@)*cwtZs`FaSx4W#0%FewwWUN?eh7U1RiA_or`9lf z!_HZGo3ni_pdx6=>xh9TB3Nchzk=j|hWwm)c=nB;)t5;^hg|UvU;fTJMEK4e;xXzJ z35z}~O=*12Yz~>8ROkntnYjr))^l)lRI&+qfqf&9ky$0?t(@dyxFi>RNBlG<98cJwCS3?L< zwfHWqfkm?qag5EV9UT^5{7uwDCW-5Hnl5T;1NCb^OaVnl+xEt4Y-+iorirEqn`C-O z?S*;-pZwBqG21j;ZeISj&feB;Rz}wT_oKGoXIvRO>J!c&WIt^vhA^V*$@1CV&>h$a6Jih&0ef@ghZ?jshYO&hn z1PN!tTQ_tvx6rPH^z?%(8=h)`lT+qvbQ!~9EkW!-+Y?E6RXvZZQ(B-&^&d{IQF{V)}sp8;a@Ff3w$ zr)od6lhObk9u;uUy?E6KC}FN3jkMC=>rCc&gYjVJh0fAw#~tt-pg%y=>5mmVq<*5s z9kF~$s}#R>LF`63PH8RJdiz%6Sa(f_*}cFVthI5nwnzTOzhJxNDJx>r<_Y|xbX(!6 zA&3!qiE6@Za6)*&IXWo!C6Xp;rzXf!qW2mrP5sa8QdW&-b(_`MbAv~|D(wNf`iPuu zEi-ztT6HUIH@o=nhl;4wzRfESL=T`vOu4A9#+n=FS3yLMHItj*$-zhsBR2ezjOK^{ zOHVyC<_NuoY|{_pprRz^EYSh)jW6qDslRoUBy*w-%@^%)PCHPMyC=p*`bT;Xta&%) z<_A0RPNkbGPt5nZYZAzJMn~yz{B=BdXlRcW?X5^#gDo=f?BPYmKC+BrZ&;wfO6-vSrP6UXzH3F#y-XVoW@84{!B^gdOcUL3TqNoPPR;XJ`$F_QW8jxE4=puGt2L z=SPF&tssz>hvkS;)dIB^Sv#?Qan6Z8wvhzHyCD@bdJnSE76@`;)mW#cFHRPbdQbx!K`kJr}j1`2ZH@+vcv z;73k-7__tN5+9qW1K%&MPBgOo4ZIf~=yFd->Xyjg(r*ZC^Pd2VX9SgxYQME;Cjtp* zlMB;&pd^{z55DV>B`o$z6#6-B2&^u%s3V+`DLtO&1(n|CXmyVgIgVe(j<%)R z_01L&JobJ=h^zCb{bkk8I->rLKDz>|%4}mM`EEn@XGlQvMIJoyJ#XopX0KY!@bfXs zQ+*kOyZ7*rNE@kCZ%+|F55WrV2|S<1KtEzEH7+iWOsbP*RN>F1-Nub!X@zwgFOrrzV52|(o%AJ8e2`QP_S6)&Ke*bXQy20CrJTA8^>8rcJFI{(WoQ%6Nd4da7T zii?zBw3A&@r?4qRN0~{IvhfQB1tu6JOp*QxX(m+|z-4Dd3e@5LMcaVD;w0DsX_9Ml zE`@nG%I{I4Y*U_WZ(-E5{$a(&&*!|UyJ=DW4;g!#DNO_nb8 zx|clK;W^h(U7k$&SKgK#qzl}EpJiVmwh}j^WF5_b9I-0BlxHRCm}dzpoo3Qb^4eZ8 zwhjN<;4kG4>Va3Z7a{VCEfL7{Ah*EgC2dwKqhvyJ++l71mKYV8>;luinuhg-KsWE)oR|7{or&9mR%(J&>yyjbg7mJj1}~D zm19gUVwyr5%{*N4qA+N<*-Dc_;alzW(+Jq|!)?=6TSr1&v2J~fyb=OgDZOzTOT_h#9L9xJ?gm>~7dz%=_p8`qzqgwWIB3>(C z(PFj%jv%zP=M57VLvk17+TJZG+ztS;&p7`j7?M&n1sRH>?d&mX=vLo2PZhmDO;5*M;4-=0lOB>pJ$Gp7$b&~* zWsN1k<{yo7M^z~}bOV{1R~xSMhrXnGegm5qB!jXsRW#O;Us-5A%kcfUKl@0%7~W0U z@J!$9*EEl-k*hmijx@VU7|N|$`I1Y~B&)h<1k;j6JgOq#ZKnMN-9q5ntT}7Ee4FAK zFi)1!RH1NeE)1qQ3iHbIQ*R1m(F2N%L(7?R?+4>M@~cD|M^Y!0?xYQgW6|IZI^^$L zt|?;H?HyFe;0~D#OY&J z(xvYT&XC+{5t*wx@8|fM8vH8Z2_Pcw6A^iTBTeKGe-ICoaJJl9Y=L%LW5Dcw9U<~A z2vb}{nijn)Yd#>*#>wXhYmWD86u_O#+Xcx2n~n$1#PSR|Rc(hDT=(}tvRHZJb`|Km zn%-+8@E+vzM{dgb!@c*or)P1@*Tapi{`kR-Oe}@ zxRKu#4Rept=nlmrZAHWteObcWt|KDlij{WWF_=!`n6jxc#_4XyLbun3K9qRVWszBi zS&3f0*CT1A$rse1q{g^d9j%yVwGM4L5 z;vQtP%ub!$%GKXr*&5hxbKcK&Utg!D3_uR9Xu@PtM+`Y538D}#oCJm@c)vcjdG$;P z<3(EWn*MpP6Sz84|5~dTW>o8B>CcKd1Q%5`abJQEy73ZmtbHQ?Je{b>4Mh4ar4H)3aYnb{VV7&MMNw%0C~<#U*|vScop8mbF-HllyNf z$EXs^3rI{}@`)x{ww8vA%$|GuEWl@6`l~i=X?@@!Vj@iI8`v|}aGdX!4r
K7|BUm`^7>V&Zk%^_d-%A~k@lFe zJ29@)d6R=}098x)iL_mZLWI0K!FqBf3ZpOzvy+Jct8hK3BkXB|;{d;X&YC^=&6Ir$ z7dO(0F~nn3Gr|Rt;+c_XW1`>ZY0JmUlh|dGco5o?f9f0Y-h5b}XYwKP?NvN;_U?Fa}eW-)d@m zG(?{8rVK0|*ho7_Opp&!{iFuJUdcgq((l3@m?b)KL^()Va<63&5uKdl;a(6D;1J`U z;42^^7JCB#5|pAZ^5rG-lbPu`C$c)l**QEUMp7;DOxo5PJjDmn=^+bWzE_JJ6Cn$8 zu(?@2m4>yoN2Kw4Tlx-N@a-PQ`@>cYdaLXnZ};Y9Yl|Y6K*=+viVLwZ=+Q}QT4m_h z-|1S6u2bLQ(SKvVIDwGu(ezr)jS5pX;6-V$ z69nqiOAC@Y@k%a3swx&M%ck9gofsP2yXq=0h`^4o8Llly(mCHXN z_$=78d#||+)1kiO`H(mp6tWZ;8C)v zw57vIxFga4uE_TD%gVGst)f!7dE(gSY)5}W8SyFns3>ErCf;*(=u)gdI|nDFSIjM8 zAG5*H68om6K~IYM8gN5e2)jA*1HBHtB{`m0nJGn$@o?;v6(RCW1^)euPhonpc?3RO z=>f*`@?Jr3)E_%ZSUV488l!;_1?;w$b&LA6?1_X;PSw==cO zl}tiKT(g>~wqIhS)<3OjJsKp=f6*1P7?jqQWqnbSvM3`Mq<~OZjhjfE0$AOj4v>wg zWhTv%d7UTdD5=2c;2QM3eCo081+|D%{OgNFV~$963&5P8R6e#XN-r}+ly?+?+x`aE z6?s|Lcd4@4Hg=+Ph1a3pi`t>xt919pGj)P+AT@}1E3Ax=7B#21RIh@Ttd}ZN;V~JzPXAQu>+Kf+;v2mA zTLP{ezh6Sol3k*+7AlRs{4^Us3r93A>TDH3nE@@1g#pk>q`TJv^DRcB8=7)+##Zfh zysozdV|-_B!q>^W$ncNJ@dT;DstI3!;+4c3ZHNHf6FjvTmI>*bTJPr7Bg#kKR?bsO zhzPj2DuwS|l)an;@wEB*7!y`w6n~k`a%uLX+p&4NqJHHyUUK$?&WVzJLd&vVqLkmS4BiD*$uoMxW|#zjBghEf zY->VN$QZ=^kVjRrBuRBO*WSJ83fY8tAsg0l4|WlN_+nr@QSG@h*@8frYlEN-HPD1+ z`FI;aELzQa!+P+#7Fls+gknx*QCm{g5+etHEy7SQ-sm`bL zwSRn%Ds>`0Jvt3wc^|bBgeU3=7VV5E<*_Ayi3`&gb4>};7jbO~>k2#SC-UZ-<|FbZ zCtJ(4BHSioFh5ygXChtqJE9%|&2LvypvyG_ojC$K5#Nm$GlRfFAz&!ziu#lJ9lvlI zYb^vLI>Ha82K^5rjx#8+u;f+3wO2^a&)NI6*69k5C21dTc} z|1>T$_9>GhO>y;W_Sku|#_@vr4IPuqrXQV64;y?B8=V-bN4yKm8K>tHh{Cn&8>^O= zc4$5sO!;ntp4|fv{Jk3R{JpN$NHuA`e*io@_d4j68wf-i^V=#Q6X~%&DSu77!sv8bj+L-tmN`f&~!4M zn zNlj=wAdNpZP58T$EAVUF#aA@U+-K6A*kA3l#>ix~@x#qtw%wrIM9b=fF}v_f++UJ^ zjV|eBP`wwrg2)xtCs3Ud6k)2d24r)UXXm=u-mE~L;ZkZ`o+?lr)}?$r>V@$3xInMV z6Pme_r%TnQ`C7TpH!CB4@4=&Kk1nJVMzt+&i}p1_&+n^jvM;X2j4!U1ek?N%QnXJ` z$_wzG%1U1rV#6nHzO@Ljo8UWhVm{-d5$Z2=>6+yx-n(rIE8z_bzSyRf{l+p9KP}WX zURd?s^C2jaA6osgRg~^2AY3p+guC8LBb-c>||BvcYtTmjhlS=k&c39kJgP}vh<5m z#DK|O@2;kt))IjF$7dpS%y~7#-#%g(I(VYl$YQEOo^rz%D)BopnuLe$N>WIu>DPRy?#93>CyCkM<1{ADA#8~Vq92si`*Ew}%}xc={9A`JgX2x0h- zWDiH+{)f@=zkm!nn$am~IY!!MIVNe@5vh5($&tM;Unb~A#^stI|ALbMf9ro`ngEq{ z|B-3(_dmg8Vr%t30!ZS9?~-|e*A5lne)KP%ZGZc5A>+SAkC?cMIM~?%(G*!Ldo$qm z!ySmP{3ouGr1}qkdH6`W=5V{J%|FQd1+J_7X~L2))0V>Js58HZ%y1X&3{wz93Ih5z z^O@MEe-m%TvTkU_DJD1G869qL`&_oU9Bix$1O$9QIfj#i!=4>2aiH|ZfD%q6Jqmkq z6M7Ls5{dyl2kv#X%)$?DN)WWyFC78%fYa-rMl};+W7Zz9QeS;nPqMZ9)LvmrN2V^m z=gnP(n(*|UxVBk&=rt@5Ng6HJUp#szFDjY3ZGJlxc2+W9Y8}6C`pmgJq7qF~uh6CB zTqhz&7-}0#bF)v=8*>?N!N}JfV_W+5fZJlmO$?BXq$HTBZw?QtmYT6)oadt-j(%id z*$OhU(eD}W-GpYr=sZeH!mXqYJ>?E;rm-?**7vLPGHCDm`loKlvErB~n=&k@`pnRZ zGk+A?mH125Zf%4$PP?#dDUg3n442XEu14ITac^fZFV)v$2N-u-OcI5Cl}hE3+#y23 zjrf|10+{Qd0-RHdhK`Mk&WEs_IVs3z2qWg9zU}b{iMYEgPJMrwG435_?$G6GeD+Ep zXc>j8rl$#u90d8 zR8uVCY+Xh&oxWhQN+~=4Ra~9?*E4*4EOvM{hBUclsIpVY(gw`+ zsVdH){1;k>tc}{9UkVB#`6`~@!xAed<6*ftsSk061kwiuil3x!c z>V_?U-HUE}4Km9D5xzs9`OCNeS-JmNivNx8{qIFtrLLoa4+Q(GF{6_x!M7ahWFY`Eia6a#=vSjmD34{Uan&@^(KaL~Sjp7T}ZlmY8!PGYq_P z=a7Gka6k=*Pwy(7JtMU zTx*@E3Ye}euE4*y7UCeL359bC(kdubZN^mDb&aH5dQBg21p0~Xi!Q55V{#}}TK;hD zt(PmZbVw7IqqzuvIPLpJt3%GF@I&aE`}u z=0|I<1WxVh$pm{ca;v%}S3rkL> zo0ZEdY@*Z4w3Fd!m*_J1?Xp?djlPILD%l1@lXC{wd5i9f4Ux>Rs2yM*vbRUBV;`2f zJ9|}oL>6~216K(b4pmC388BkJ#U}@i_0>!EZULU>z7NNo-tx7NuTXo|_E<=B`B_ok zS_nm-C-wTBNj%v4Ux9o%d#rgMyc(s-Zh8H^X48%zQh>Tycc76iE^b3A>UDIKM?Cg* zRTMQzH1|j0_xy0Qfc%K1pGt#WFmi*S*%76~rNSvjx#Avg%~6+va&!pA(Y!b6)GJe_-2G1@o=K0G zrw~{iXTF6@{p5x794aZ~pXj0r0?dUkb?4JIKCLS`6mm%3cCEV!Hz-lA&7SHFo@3Fj zE;vw43#o-|3q^le_=EKsCsao_0V}oZk7pv@E+>rB@6|Rf?WI6`sjh7ZNrA?Mjm zxf}P|`jJ}>P|4FhXBr!pFmmU62q5cx>ZA7))CK!Q@AX`qeZf+KT`BvDs`&(Y#!cv( zn(x+Q24F_qXsHHa+=U~7@nvs)wYACF{Wj7O{G2?EC-rL8jR*gRv{@a{8z|61_lIha z0AgVm32I?iGy)0AL*E-wIM*%WyZr1WYu{cxd8(DR4Vj~Y(TfGeS7~$_;gu+4 zTXFbJ7#LE}PhlDoUZ*SZ(`kY3!JK&L?#LIoB8;2X1{bQFK@UN#{_06K!dJc<$F3CS!f+xY8?03k& z2DA*$?9oY4X9rW(58Fw@*FC|@a>4L@D`-|8yOqi4N}k8C|MfcB{jX5Q5jom;QTlDIRR~(-v%F1?P)AptH3e=Z|MM?&fAxLX&FMI8E9sTCx`UPqWVFC?qiPdOT zY+Wq4hx;(7gfHkNFF=8~49F(*ephuub&mx=gvxN6L#XAzyJrlL7el#XSQQLo7|IGxw|yk_`!be_nV0k;E*cX( zHiQaRi}fR1ug+iRlh+t+IkkN2jSfc84fT-YS^eW>5r{TUv+j%hf0?PMAtVuSfltK( z_*8&W%D)ah|MXP;GQC7A$;tE!qWH}&49?Y*Q%{kx!-?0((Ml>|fWg6Tv>dnFN`0+g zPyFCS{s0L`Y?aG{_$iE?oaNPU3CsdJd_2YP;hQ9MCCo(2q)>scM$FrUFR|@?OQhZI z#;IQB+82WLAyn`(2CIQX<%t~&3BXG$YYS!z!k5ZR9pRu}n}ffwk!co3d@%8&-F-S~Fzqd@`dZac6XMtZNmTjU zl=x5oUxj}v^(=KA4|HG`rb0|($6Z0QoOQ;AD}=S1(-zbgqG_>alC+@{3$bD?4xW`w zm2C}=csym=8u+?D0PP4{IjYT=<9lWCBrV8hH^$QsRs;yzID_qcp$&DBWvg zB{NpqD0N`(E~5NQqKPmb!Vr-{SPX5U1k@wwh>Hc;CflylCsVr0>#I1FE=N@1FKbN@ zCH>*Az>X-_t7C`tIrSJSR}o>rs&8m6!iFyxI?5|m&#TYJJa1d2uC zUL9Q&YQbBR4pVgmMakovWd~u;<#i z4VhX{@xQ|4f6j;)zNBb9YQ=|X3N=_Pgf!4{pu|mf4K`sJ?T%SLhg9Igl9zoqgj)ES zLJlfGTJF~NP_p1Adwso^^v&~A#lP2H>z6~PDS5JbHBN_?f#IX6*w>qMAYrIUbtdAO zwn|qWzEYcW{^rVx`kFHlRMHILO;H1*aaHdu(fdFp2-yHPlBrymL$NxJqDArL!Si^+H z)VFdA-FI|mK9~BQb>OEhDKzA3twArhZ!t+Q#!v6EhipA{M<@$Sf>Qgr4S9Rt7$-=B zEt&1tq@bGXXrP$!XnjgrmGC;P$VPk8{Wo*B`08@%S2uNDUXSZHt7Mv|YRT}E3;1E) z#iWf#R;r*1RW3Kas&(Tz$LZ%e5B;PB%W@vbxPo-*q6^ilN|YPJ*#pboi;UuJukPBfA zD2pP(`WqcN0jfbJ4Qp>yAvYcG?4PWY-q?#s#&Nf#ll~I;eQ#aK{$RB47*dh~cKE3+F-?Q%V{b>dz(36dJ*lD1p;Wv;FZ zqRF#EE-xXNE^RL&>`@Hr#eJ&`c6p%X(Y%|KGOsyBrop`i=D)#P8BwBT-+AhG@r_H1ajPoqlC0pc1&p%uBN0#b) z^pDjnws|zUV=#q+j1SXqB~k|sfkCH`4~NKU(6=^`(}1`>nK=ZYEpP+%2b$pJrIFF;P~hEhPn5D!-QzJ#Rd4{)Y8QP&0= z_BelO1Byn@ zKoi;jH1Y|J68c;4p4g{llQz8jetWo$$dn=mgjg^7Z}(CLD=?{hM@HW7VQ4D4?T-An z0>tJUr|+I%!zf`eBBCKjw)V|ic2%jh!*Z+AdKWem)K-M6ZseB2bWUl-`fsqV0V0!cR%56K-%{izCQQ zuqaDQxRtYutBRZP zKfe8U!sdYbsXV$8%Ex4LZ7qW$%9jmPx}yP4 zkWFxO#4kUtbAH6`h~ONaVbNo?hsHe}j%TKEZ>FVXrSSoAl6NSQKr`5?xD2ZwGM2&g z@wUTZMr-ISWIOzeQBo)@j5~qhu(15H(s5UkzfDkS0ph1k>TmWhu%EB@JQ` z>TSi$t~Y}*bY&GnSdqxQL;8WndSE*15m_pH z$9^fcKRcmL6nwP$B2c}}<6#?by?7rKsryCsqwLJ ze=T;$RN*6lBjB0F+8uT0C1Rq}BB<$lc;$=FJ<0JfQHm30EqA&sg-NSW3wP<|Gz8PM>Jxd$)RlO5u27E$yScHz zA14qe4&n4-=2eN?4bVb0dk>IJYYJ(yfHTGAdXGJ6XlT<&OAB1rI(lK-Wq0Z`UDrK% zxRz-dd&dhTCoo7t2^f!USjWVV`baIf=p2mm)aA`o{AVLh6;MW^z(^btE^`;7Z`PAy zC`}D`4J=Sjp+^{Ixk>uE>lAHLcgY&U#7Yq9N1|W_TMAVW35AcSelQ=BGKQmchJltV zbnkze^F3crR|@|&<3sk|?^scj8e`dkqOQ9k@aEW4^;R zmw>}epDDY5kCz8pc(ld;$YKU^?M+ zems4sBF0ReVAXfD6QHKYeWztCxn37~zG;S&6XlWfg^faE?MtuAOl`ByW^;#y?<(n- z;YgKZ$vB_RNgm7b3`OWN2194mWa#V|)BYzGfV1x%a0D;A8QPMy8 z=WFK!*GScUQSEHoKJ8Nj1~F}_pH$=yY7mmY&0`TW;Ykg+K`~bn?WXRI4CG=ac5**| zVT~fRfDLZGxbVh2&129pX`Qf8$4V1}(t2)>7h___ghz<1yFJm zb)t(DTQg7PRzhZ#%`tt&Jy6&nbPeA1NHWSl7yXr`K{^?`EmETYiHwMDHxMA#!oaw0 zs9(jubjzoIFj+mnPp&8)*p+HE{6L(@C#H;yv20;_On#1P1s9E*MJPBO%_MpDvphFv z<6ZL4=;4u3#-AlDXH$IpcJf#iK@utYfO#hk|{z)s`~j2Yqm|6XqY z(TRl3%pIJ8i6j5E71^nvYhd`>*E>2jSV|%$HCq-6kuZgTe34RwpKC$;VVB5RYWLMh zPUEMZMMD`dUO40f{@W~)_F(fS&n(kB@jGf(_Ah)9=0L<4ws&WPNxuv3DZhuchQ}IU zQ$iHP1Cok<&#+jtvi52243EUs(vwHZfa(rn#wh$Y4K-2g;ZGvn{W8=mNQ!h!c2Nw6-y=xAlkgMQp;n`IhsDNLrcjfqr526Ym5fA z9bsGTJkQE%(Y3+|J7Ygt0cyY4$Z|nj&W@cuh`}o%>cLf%8d3Ejm+$v6KYV|!6^7k> zJ-mYLIy+aFA&%3KJ-v40$l`+QNBm1?dU=^Rhgu`Udg(zs1KY;jFJE-%ZfmtrSG|v; z)ik7RQD^82Fgf_w;xd2m7Q$FpNj1v>F8T~z*_eW15WvtSMN)@WNtWv^Uk19IHv28Y zwEqLkuvmkY8jYMNQjEKidFUFPype1#&BkGCe;jW@l<}<|WX4m%E*&JLEsJOeg{mX+ zBQ9%p`~_Yt;%(V9Ij#a>W8oG(6-0#t&JHxRW?lJ2yZMqvj#}eFiNLBeu2qp(y?ASQ zhD&_e$lx5kh$E8#{JwJxU_^bmrcvvWSK&Q468nme&{NTi<9G!xi z%&NjsZs>D?fn&SI#<92MPAduEzAHkpJ4ITZ4zp@HoN;1$U;Aj6f2y@Ey;)yoT{$Ow zr)^3ww6c5|;gH9wJ?+NZp~NayNSrzKEUXs``WSbq8KI&yo3r#;!H`HZ7&nKn*4vju)9<*BOh7mmu#(tK#|C4A_ zN%tZ&`!69EfqQBC4|v}?Ph;qh9LtOTusI@Z8(UCtTU1bYBI0{-Qrl$C&boZzDVK5FX4ouZ+T!b>!Sso#I`O9deKCT+uHEPPCCB$vqh7b}m1?EaDwv?70Hw5fgiox3mc zO0iogzg@f#cUUq982UoXK6P)lLGKM@ZUX)lw(M?(E$0I^&IRCpMg0GAhKLxsm`T~Y znAy8nxdP*hRDjwudkf%H>u3bz9sXywbdk!c{j4Ag->L2zR2ZNUQBhS}I=4;ftDg{! z5`?I51O}*bd6z>%^zvvO-D=qr<_9TL2gVQR-)sRPt&=P2C~_o{G^3MePvdFayVoU` zmjWQAyENd00|@GK@qK)5Ym0R?eUyZlgldEw09O?rR!bHN>3wv7=_(-{psCvR_w7h4 zQ-{e$3vI$>JGgz0qe8h4fh<%_;Z*JHLDvyim!mK4u*)<&@3E$xhwmUCQ7cjKv=hO0 zlikH@5L&jo-V`fCEV7*ulC2e*`*>Df`AdRN*HwfJ4L-sPNrw{tYtaR*z+v$O;aF5$ z^s{7}2=|2+iC#(d-8iUuY^>z6VvIOKrOS_Zu}@Wmph4flwdw2cprrm~?cO4YIzE2G zif`EL{niTFNXS&u4z~)3a$r^&-GI5w#U-+G*{Li~@N3y}4b4(8$7%_VXn1pG)0mNSMNtbXqfydnD`XI+KT7laJ>1yP296NHJ{ zUs2h`d9xB?T6bxbd1c(w6S)~u$($f%qu(qYMyBJ6*s6lg*s2p8L_sP^k(=n)`?$PB zk0_RXo7@9MZC(+TS5@|@OW2A#glm~38)}AY9hjG5F1?!Ny-?wmIF8 zyuf~uejq&v`(Q8jWpm&;rIp)mV`=TF`~O7>=b+2oy$J;ZQi}?t`2SxDRK^~d?*8}5 z?(c0+#ns5w?C&$)y5{lUfXB~H&hrr09yA(F#i*GX&UN@87|`JpgIftcfdI>sMCs$C>8fy!80c8 zkg}s^mFea|M$8lU7iC9ZevP!JT;C~J{j`k@V8bdSohapsN{KV7;7`5WqFMt-o@TN& z>|6`Jc?ZA!m%0#bVmZtEDshF_{Gk;Nz4g-6Wb5SU6az}dBW;w{1G4;T1Sf2

Qox z0`xkkAPQweAlfOtBr;PCpCyY@I(B}_q2#9zd3W%J|3eWKpVLA(TO z5%Zf>!cM)^YQ?&n@bvEeMq7qf)_Rqe86vho+bO6^&4TNMJrCK9V`zKRuXfd8M5%~s`9IYm95q_DwQl# zw{#U3?nojDov=wtw2sQ^BnoussoxlxR&D21ZG+h=hHHPRxddwfoNLfm=2*#>S;;QV z!b3X2P@Y~tG@ zEsv?a$avqb z!A;+xKmVyOCP2?u_M?6ro!|6p3hE1XWYaW#CmFc3%s^$13Jd-mV|FHKD;5_gD8=oL zv9{Lt);bu_WV&2XT749?b+HvE@zDP45=p1BaTTD|Ujs_}Pptcu-!Z)p9f!fEsGcW0 zNI*A-;X6d73JsXdwnqOVLo}*B?BqJxV>?b(wQd&e?en)d{)G}U1e&OCD|aImZ`3H6ub*NDlQpCW z7Fvb22s61l4U30fGmyZE_9%KpbX?j2jtpKREvCcg;qd6)+bMk%rMajuBY7%4@T_MqDUPcc-On;3{h}TDaHHiD8llM)Y zenv30d7+wIdgsx!>bknt{ArjL-`i3>%>zm7b1aEWPdW0}Dn`+tNiz|#nDU#_Mw2GC zF??~VSmm`iB5JmNJnfW{;S|zFTxex&mW5Oa^r*W%uJM>*pmo=TO24r~ap-AG@Z^z& z@ag%!NpczPaLM}v-G7twO{k8Y@*^M&%;gdP$@biw`0`qQ$SNmi*8mkopTL?V(*&}c zBLjqsFZ6T@g5&L+aa)+Qr61|;9SRLU@j)Cb*v4VnqP&h-Cqz$)nB3x)s@C4u!g%pM zEyb*^R3|r3{4MKBUPH?(D8W81Y2Wi>?d83MZ{MQ=!DaVyWJQG-->ZYzQh6mm-2RAr zwJeG0GKJdfJyLuoeXc_f?Ancb`$9pUO=9Ebr%&VtFna#h@=(gm!2vLt`(x|`>{9<} z;LQAwbHwG{$}BQEX-KrBUk$h+Oe|hb=vXisNt!NgrwZ!qNZKii4fNz~AIrU&Cthe& z52`m1Pr}7=!w75=OcL=4TjSp2n8D(|{FJg?rBNVX+2cqF#nR*srLf3GN^A4tb~jU^ zw^00dk6n`pHdS@eyf=nvnjNK@PwmDHX|tg8hQda*<{Z&cN~6kAkK*PmYn!Yzdc&qo zZRN_;yI>xRqWF|ahf0Yk&#(p9mfqqvcEXjhG7XuCqJKPLZjihSvsrMYmv?GtZtpBC zygaAfZLcR?ncPb{QqRN2JsWmcosmDIY;l(-I{^F9WE4l-zK$g{sJwQ;rCrzj0d1cdA`jz{$1?pXrG=acA{?JbGvy(oh&ivO9cX;@g)xX}$b5Kq948PdDBiJbiYt zR0vER&T`jt{Dj;JtKbTgsy#L^0Zs{7FHT^NL1-580djJX)=Wk;e1aj-1UzILng@P` zgo%F__Zz9(sqT9~vJ}FxsRdQtC%d@`Y#?J>qrJisrL;3PxBXf$=g6%%F_Kn$wT!uy>CK@uaU z0F>zhy{(7o7W{}c*oBRdoE}3X9G68iyzT}{29wew58xymHl3&f zuKG?e$hb&uX*2Ki=|a54*X&bX`B`dyny*-oDJu~g-4!B*9?~JIa+lH+$w8>&CeB|M zHvac;C8+@GF9lftZ_OM3ZT2pD_C|l3H&!SuSWnBsak1EK_1KA#TB#1nPbCna#xZ|L zpr$O$`yj6vKXAO9!cL#;+Jqw2C99vUJ7z+5)ek$x)ON(BhmLXEvqt zE!l_#8jiyN2{>H4nZuoy$hkMW7~ZA(&|1LI{Yc%}K>^G0u+8Mhn>+&O@;9PmZ+CBO zd<`V`uQ_1;u#fK2XLP6rV;~bO>TAn7O zQMZ>EM(ELT)0mClcC7IkY##L4t!cV?uT^+Uv(ezz;AQS!p56^|2ln2^-NffhZ58{8k5t*V zK`^yH?32h(0seh<&w7XO%$Z1y)w53NfD`s^S{ugGPuHN8_N`V=MyaLW6}=7_9keUc zvywH`bHX{CBFadUFYkPsYx=p;Pq^#j9gMo|hCtf!oZMZ6X~|VEMT>W)6bPXLuT2Ap zJ%ZZk@$w9(`$o7^Iy-RnM@|Xu={|tY$Y&YlR*My=zA-==mW?tW$O31Vktg8KK&8c| zt&F3QqchlLNVw7JK-*T|@o?4G%0i>wMA$*6Ho#wB=#~XnqUXjFR}?T@Q0ZC4cK~uy zai|eukdf#KcZjRHEmS(8y5K?=Gy&|vDh_o+kTdxq`%T@zMMso0AuN*p|hGHue ztCRZL7%~=DgK+i8FgEJPi?!01K5?H;fX!C`Y@X$J)=Gca{L9sQqSC)S;ohgSlXA>x zl|!Cx$o0kf70i=VQyK_; z&K^)rtR@yP*;m_RzF|SzbaP7PBWHUc?&b|#+I6n2Hfgbm;0k9HKrS{`Z4Dakb4dY*Nn57C#) z=ECn}*Y1u~%pvL}>{5-!9ou<#23Q+=AWl%|Fh%D`@94AW$~9{*_^6gdOv_vO&i4#0 zi>d7wf0OY^@!GR6z5U_yf%%@H zb_*}SllSF=(a5w$dA9WgP&+VDPtU-lb%--Yg=2F}3b)WP0VEyFbgc;K0!u_p1{4rl zuT+SIC>2yD51g9c>`p3T&p2+oQL(5e|2W(B$-NV`5TnJLPXMj)X95zlFc(T zV;*6TyX^>C`K+kBi4bGJ>i#^BW(A^ z2R?pZE|5he!8_?UlcB|w%_0M@^j3}-P=KiErPlGVW3{%4&fPv#IAO4uW)`Fs%HdX0 z4uXay5=!}E#1_g(zlx6i4*S=UAd|qct{89ztmyBuO26J4`s1zm+aQoAuk}+_iK|wv z)>%rbE^X5#f=rmq8cBx`-;@{04=R@PmRT(5WWZS2n1skDm#0`Jkoy++K0nNb`4v30 znKSlSX6s(oFqg~Iu@@rhE)gMy+y%s!B#=XC5lrSbcUrKR$z_rHy{EXWQk4a zmmK_S-=qaodySWOuo0Yn0BnhzJa^IL{EV%fVr%SpfN3d4*xzu`(i-(9^dQMw_P_=J3AAf)c! zAse)jx9GXO<_2en3`Uh-2z8`DF&5mVd9kgOIN~Y#PHsnmFyg$b8z^Yy(D02 zoKEp6SSnKeg4dW0^j?V;Nn5Msgfom9_Ra|-8Eq(DM2}Po zznRFri~2Y@(7*&=g{uWLz>v=P+NbkQ%-4S*!O-i6?^~ojVUXKfh^9Jb%7Ug488T`; zw%)u^R7wXUN^k!Ch~9-yz2O91qMVV+)k#Se#gDM&Z-nT)& z`UYdx9f?)jAU1d0MkwkmwszZ9x^9G4YoBv2mCTx!u*`eK7){fT)5EE;*$DjXHpwDf z+B>rK9jC1zCQ1Bc10wytMU7r7OkgF~_?uGdw*u+T705iMs*&&Kw3bSnqm-`FrA}vr z!W%guPH=rNWM0$5a=0G^P$m1Q?MNLmXp%Z3rbRtARBplpqpfO+n%Hn7vqA5C%b-Qp z+eQD1+DQj-rcg*QeYitDz0(!Y!KC7r^cItL6*ZnfuNh6R}}T(~1u5O?VNB zazm$B2ZzJRrqkk@@!TD{k*wqsa-1eO`MW5waLvX58*vi*Apt}OUQ@w(Q1@!D(UW>e zcO0zH`fRacvP`=RNHEB@r>%OdxQEbG=|2&qN@3-lQ4o9cuW<6K2YgR3sl()d2)fvc z^ksPGL6UJVNL3_`?cQoV;vZTJcT;DI>_PSo?%u7+8!E%x9~O@p)qhSD8#35D$v7(K zI6H7FIw1XofP_Jo4t<=rHzC9K+?pUdAhr){`9xQE^SUL8+nAY5f+8iU;k}(35!A}5 zm!^M^MqQWaj~5xVnv+C0ya7h81TgadkGbxzefOD);{eG3q$gwNrNF|#Fj-_Od}ULz z8YDP=@sNU0v3OxgT0-}CLj^Eu&V#2(x0Rm<)4@G1UWXF*)%qk{j5g%S*Y$OeJ? zrF-59F#A3AL1aYzc$qfI_b6}LRCM2~8=I9THdQ0E{)ZU}7FdO>e;(H)(3iSoVHkG|S#aj2Tq z13192TLHUM^uIHq{rjM;u=Z28^GTWv3EBa)vBW`cSytEb%bhW8nkXY3-V(wH_O-Kb zkP}(sZUe(T&)sG?G50O_tqA(K)qYg?c>VH6H#`}x6q z^DW3M^$!}RaP~A_2mO^0sqR|=y3Sp>BC03%Qygt*H(XbIm%!HvtsA@`B>Z=aS*)YC zBhe6n2D$h$SNia^wYS>hGET4Ig|KlNT5>U(35bGx_ujl-I|9FIiUn z%A!qX4=Gi_*^Yx@ek2!es9RP$&WoWkyKoO_s3fM*-ZWPXC|6kr#%W@9iJ6;+K=B8_ zgLBgb&2+wc=YH{yfsSfL79Qm*NZAv+`Eg?!%5~Vh$RK}sRimWG^2(=ISXblie3Gsm zkK2$-;pwf)lq+C2v?v$rk~-@{_#m}iJ}PhSt9AF`&k?MvcWSmHaa$jN`&g7=<{wAR zNZ3fLv?YO6KfWer;3IoQUMtDBm|b|oLr4eVAU1OGL+}d=m5|f}Yjo!b6}I*bgVH1ubk21&MUkV)QN7<&uymkUFE>r< zRJC!XLc#MB*=_8uo-W;Fba(JOkRc)8K>If?}tg%gm)QkX(fIQa|paNyJ8fcJnWvT2Uz|@W^8=TE8K%hO4V={C$dIW zk<_T%6h2)427`Bs0W+9r@(4Pvw#;mAk!7(6hSdultQxeDKf*0j9hHq63p&l*E(FHq zl~K*c=h162i{3RX9UFFpLROYIRdmX|o1R3iy^YjVKc=N{?5{iTVIC(6EOWfq@NLSw zX(u)6dvXRcHYKWnVf9zj!?PJ-8WU%! zdEZM6*bp}($=xSOM%u!x2^BAKOZfSc!}MT;t8+GqQSzI5X>Z1-J85T-mVmxY<0e^& z7~XF%qlW1*u9!0frNO=uAfZ7yv-Y6Y*;5X@{vO#^|7xb1f=&>p>&?AtPz(}mu9AG+ zz|9w;ukfOIUX0b>>nJ9vB|CHsz+>vFxdQ5rvAY&;vA40ZJ@E0nI_}!cuNc>j zSfe|EQlVpN8lnf%3D(b?beq9Cc!v}_9kvVOKl6CnmZr&i#72Zag{PpMy*G}v??HyN zO8&AaWQrqa{}nGEUv*xlXQ8qs4naxzP?UxmT=QK4?m>78a}pL0&=Q;c3^)#t!f1&S za(5yxVC4v$X(0N*9uQ{#cWj(`#rCG-Fy;-80sV-kOj z2GWhcO2{(!nHJH6m|ycyyR3e(1*Lpu%Di-DmI<$Ds$;f-TjN3dA?wU(@|vonx3EIX zvO;F{Y?*^0Rg9YWI(pgRlx^)M)8_linWXm9eri4t%5Z%1yno}DEvqY6k$yKOSQ2ZhtlABUwteQ;g#Dy+(+fYbu;gkjV3cE;=xrY2}c4kOd}3t7r&sENjgXy znUD)|0haHPGcN6??4{G-@)Q3IDSjGyXcsp%y_+6S;$Vc0b1NIKkL6@vL;TH&G9EN7 z!BoD~ATT2@UmJydh+b;QsXQ08fM3Lau_Rtxs?@Q(n71U!?Nv#xN`dkTB@}L{v|2f~ zgd>}hv_frR+Ls-@{0!_EqclpDX?LgXu=nMP?v+pj=2soU@eGc2WSy|LF$`+MaHO@1 zhDpSL?PBePnGXhy870Ohpxc%^nZ#OSu?|iPxTCMka)~2?Ex#DWTfP}^Gp|*Or+N($ zQ6$-*5s=d@(4Fi4GY2wjvX^gYIPH`g;WZpM7$N}#q!p%7H-OJ%`!2m`J3J?&cy|* z5T_-Ly24xvz21zOCgLSfhT}vAfoj*h`pQiA69$4zq^jA&u)cD-qqJjDjvT#D=(ROt zD`W%1>hrz84DCcI9d^@6MUhmk8W?HsTx`teYYH#gQ21=SvA-eIHqgLB&GnUAAMu_5 zhMo$13J`_-s2Yn01^OamS(fznfc$a!R1(H;*&bty{za2&E=b0lC_ z%Vjwk`jnU}N?NVHPDWvp(0-JcnKYG6Qh#}3(WtM1l$&EKP}dD(!(@PWm8E$}?9QLS z`NQCgQ-+k0SGzeeYrAE?tH*G^c+~!3-FUc{y4k0MjiyZnpTtjL z381SjY6g#q`z-qOVTxHSg;*tz&@|R@ zbd<#4L`k4$XfR3evmym5l>K0ejVsGDFsJt0>nQEKmyeC%{8MAi_D_t0IFy7QY4g-n z*$FU?>hw$S?UfVN+v&=N-w2r(;tEv2<~B`zshv9{vDDNLdT{+P9!98t*glCKUPD*c zqphqt*%2Vls{*U$`>20h>&v0hlUialwQWKswd1Mh?w@ax?Z#WBTMn)@-DnuW*N>;M zVH~ss-kIoe(1U}Z!hM!y8iL+XL+S6M#faI!ejL(TSO=|o7xF|tkSf|x?e#X0bh(yg z>p(Vw%Re_n;~=SfZFO#@P@mpona|<`%Ski&e!|2jR0Q;6xol8{U8AU#^wb9#&B+7# zFQZX!D6nbNT1;be>MZr)NcW1__de&zjTwb~`!Z-7WkDm4pF{!gn`r3Jap-PQM>E@r zEtY#WVi#wgfC=2Vi2}^BNerB=P)oDU%s;gcZ<2n2jh#PeEkKPh&SCM{xw7IxXc4{r<4&%*uV_Gv8Q+3Qhh%eVQI1h(0MS(iKGBXp@ z6JVyswUL`@^?^OSq*zJitjTufqqxBRw!Q#$?Drtd7;gdU#Nm*4Mi!epVqr>5$U&Oa zDx`Tb==O!0LY8$mGYyNqdv?$sY1`^oAJd?WeZb5M-Rt{QDKQwf%?mHfFM8pjTuNKu z7o8$CEe4$I+wroMqnh}r8MYbh^YK^)m4ZA`8qw`*J*DF{V49W0-o5*5CuTLUw*!4# zr>QGXH0V%>g7BeW@*(i+snwxfE1t_hCK*TkJoJ(gf>UXGAraOGZ{L=Z)JR8}tY#%UPMNjFrCF~oCZ!m7FJr`mg`l^aM7h@ij z`rIV83S-NA9C9XNDn-Ar-F~HH!LY(76AzC39mvBsLOCR7 z)+%U0;re8Yg>L1nrq@oAMq3p_M-?*+HGLz+$oU%8<*UZKYIchR6de_7?}31DT)og`sIzEIud*k%-vx2vN1K0@Qi6W~ z;UFffX2pQKL3I%%fMh_*&1>f}4%qGC$Lhu6icketpd5QtG+F3A4P?SeuaZ7zx=X@~ zCKHk-Uuxd{n%SPr6hL+phIOEJb*hED6U0d^Gf{%Li{Nq2Kunl+&fV_G58vOaEOL3k50-xR_JxGz3#Y-H5vu<;srb1&&Y@gH4W^p5(6H zYqP+udfjjY@l`EIZ?#>cWi#mhN(45K5!Y}hT)iK^XQYGtXo??=q#HAZ5cqwZ{YJyvsQjT;hwxjKG~P+9F4rG?~i9wQJmdgjF*-( zOV#UgMn!x|viNZH7UgcRJ0boAhZ;p{Q=4=5sWK2hbM}=J-}O`hG4d9%%e3P=!DD-b zawq6f5-tv!JEhR=BN=H*?t z_If)wCJljVi(fKcWW$QUpZy|b)mI5IbrJgh@AU!gcp?`)tZ4}QT4zrM1D zE^&Zn$mLu4uCz*((eyPQogGX~UWdVBe7qZ@Ya`khCn;Roe~M+_OpWRE5g|4^@_m%R zoW@0zD(O|NN@dG1jl;ztVf*%)#nsa3AkK;U9}=gw4u*gIDpO$LEZ>?(An6fYs<8;*w~0zLKZkzj`%#s4Dw@oz-@WA&41ie9!O%NmtJ!8VqLle z{mt9ct`*G6U7`ovlEgM8Ob6CoWkqaX=8(?@W_;f1C6g$$(|F=gvb6$D!4Eo{%flDi zPZzsm`D9-lP)A4d(as?3mxOZ~l{f=4^tK^`bYb+wzd?LmA}=+BP|zR`miv6<$Fh&r z$Joi|CNv5Ky4HK?uH!Vp5`qrCGnrFaWeUgeHcuC%b`k05IO$b$@^B|#hAkXP4E;XA zMW{b($tup}Tm3hX)Fhpn={dyv6sk-iZcg68H6cj7Vam|vd>w8yHEuG*(`trkHVm1T z)9zkk@?o&|k7g}yGP<33NU<#eUxH&;{N#hS63$`*1+Tn~oF{l90@*HaB#DNzIVWe| z@JJ1PoU;_C5_5C9f*2zG&{m}nml)P$52s|#S;7qm1Cw`;3+3;d(5wi`QnHhVqN8Ok z_t9SMM2|9G$y31@dG2Td|EfTgi>jt*r$rN;^?Dg-Ru*+ok)@gE{Z#0sykHAfjSv+u z4pk|3&n9`I3^qr07B6ykI$e5T6;OrgXOs;8Z+FX3h)Y$ds5v-RO$bYBZ#Yt1I4*#k zH^?+YK6P6^qM>e}7I*@mxZ+^321%#BmN3qh*v-)hnXoyI&rBxJASagLZ9XcZpD)C$~!S=cnRMT(r0mO1)9 zVyyKv?tkl-542I>%2KL$v(MRi7k^m^OeN8rN3LCV&J8QmOA5E|e6hw)WIf7@NL3PG zJEIg3foR7ew7h}8Y0fD{vxMIxG0ODuM6ro3fM_(4YDVO!EsI?zwsOEDg-C5%L;kE% zd}g+U4Xw|NZQeOE`tHGfhBgUGy%dYKv;2@S=?hsv2}aKWaQ|vK+UVfjCG&nVkQaUO zZGDIVmO)i2-D+Qol?hB@2M2m(^9V2rIXi<}$n759e9{KQL0d|YeBT}|)v{!m9%pyG zQi?(Uh=GKt-kx;C{5-nuuFt#iDTWeJHVP3d67OK~CF~2!0?xdWM_Z8LMe^XPjB_;^ zRjo;3Bu%yeC8`-SPpm%k7JU$l{T7D9_L&Bj!%#gjpSC<>vEW-QI#}@$^|0#L801gX zM21{}j5Re(BI4GxEM!JyX+(JHD!B4T?Kt23U$I1>_oX5+zjw=D6548v=0bx(%5nlR z`G!Su*&opq)w)5Qx>|rd^P9p0B!#I!d)O0^bsXy4MT-h^B&an zT&hJ+4N@_Uy1qvoTuBrSrAubJG<|(Fy+hzB|R5B8)Q{XHddbNgL0yaQ%e3oTLY#+!pzjN}(n7xHrUFzGr0dTGZJVThU%RY3H|s z;hhqPbHCB*&=#2U@o0BexSg$qAXx9Tk^13HJ$?fgy+@(P_ZI17liCVmndH!8+I?#b zI}ST+ZGJd45Pn~gyai!7Rq=1umAa~vlei?>l~POc*dp`u_jn4f9!3009cE>kb_ZC~ zk}edI3O{;BN?r4O+7#uo9fMdz8#x(Wok^tW(s3ON3e!6tu#}Wdvy?paa(IK+80Nd$ zTp{jt>|By+a`m}-4s8Kiq_a>sk*XfzTrrbmcZ;d3XB+~Xhh*Z>kM|q<*!rF&RlR9X z<%wx|5wntIqjvYFi3Z#~v5CFnuR4R!9@h@{%ALLH;&((;6J&c%_>N%vOP4mbjyX>% zAPcXuHr`vl<;pMTR$tI`a;z^N)7Z{*Kzk?)Ym+$iVy?N5YZtWzX5GSkBD@^_m%|l?>l8;#$nbby= z70Hd{fj~Bjk>1*e^F+WldSI)>1)sXdZdfiyZ5CwPf~g;|lO4`59z(I+vlFjPW`F3Y za^V!@dV#rHn%>B*DlymX*?I@Uo?zeK$-i4{-_F$Et4|)a7Q2$+pK>@8`Y|q96rD>#oIDVK*+lpFDe%FLJ{&`C*WK`Dwpi&zd~f zGP*()xIf$tKFlt{L9>&tvpRZy`brL)(|KE&8Zr2QQR<3Rds1t;FT=Jy+!Z zGB)k4(aw6zN`miKm^@M~k+%feU-zDP{<>kR;cA_d0Pu_U13Wyx@b3J}!EX4cAm@MY zk*X~Cyi-Ab5?&gZ60BD0k6IyCnr2NhVhbXia4iYnB9_8jBC`{-Rfj^fz?X?JNthf6 z)ex7+od_%}1WilwVhHywV1y**Nn*LZ7<*^acCG@~!NGtbG228(1K2rbyW!aLG-;mV zd3xyQ0luYOmB~R2f?@E5i$K|yOR^*L{m@#~laJpmozuHgLR=j%ET-96NT@5rt#miKK(YEQbW#J;BlX9pFw&ERcRz=`p~tW>_eq1$YOWBx#9 zN%&zLyK4Q_)OwvdcI*Uw87l0|NAOjTLq}`!a$2-^3JBrAerFf{UA} zSV~|uhRq0VI^@^CF%hqX*l&N=z}y)Xc^G6JEw(>0OO{c^B*CRKC44_78X}njD&;zU zZd@9^$8-dFA;s@Ll%XPFq9}oCVN=_?lR+H7A1?)o=T#YS&3=Yy&|r3vF7JHn2%H$R zLcS8weK~f#;7TmYp-;1)2(&`%c{pSod3}u=MCiykRi*h+&W@GW=koM4v@Qa~$UwqG zsBg1DjpFv&Qb!gcK|%?jofFwrPy(IjACKcmuY3_>r1Amcw9L8LTw>px-L{}K87fV* zqFg2FKsiu-iY;~_=lnH=qvLRk?^6TiheUO*lL2On%gOXv(3!I4Y3t%xT%mg5aUdGdG4GpU1!wY>+`;RSnI86o zn&Uny$$U3ln5%0R16umR-^s_BpH#X?d|9iRFL8QZ zY!)PEdakEjt$w%OpvCk&ium?>ml|dx9vGao6TEN)&O9H zQ?(!L)@p|}xT>8Z=W^&O$Zh^EMxH92H|JiUJfGhZ8J_O4Ff=eJBRxX!BwZjf_XwXF zJt}sNpF2Q;x7)F19F%M`M54yF&bexYwu60E*rTb5K^|F8@I!v|QyC{#@OKg7&R7QGaU(D2C`GEb(UO4cZ*AXwIW7Z(dm!` z%bC5Z{ryOc26$!#7F~wW7OhJtp`c&p(Rfw^n84|Hgca;NSPNyMNY?2G+XnPDHnS%aNeG)n3MPjio~E`y@mAG3_QpCxUm0pk2@F4T>kS0 zkMNE=0&l4MJ>z>?!_&67R!}mRce%|P5No^v`U(2SVB1b~($#_bn_zL@Eo2EL_vWgk zx|A{sV&cwKEVG*c3U^oZZIq!^p zQa){S$s7xy>)Lxo>gmj|jrCZu##a*0GwMRW?Lim%KpU=ARsD`;)4MGIMw?hHpVKbm z)q?1TUIboH@npEjIo(r#3ehHO6r4@mEuw3JGj>;hW+fiqtEf%1bep)SZFsI}9v z0+~%Q@eEAQIDSt*?pOyI{Aydc2;H6`-Y9X!Xn%!D^ype2xdR~GH?f?)yNIn24Thn(7Y?{F`=H!D(JNs=g!Wd zR0k-q7s!&r9NtR(8?)@eY6k4KFjGS(z(eRR^M+y<&HGSnEngi>cwAW7eyN%=249!{ z2GT#zh{1d1`tI~{L!tcUz6F^h``YX~43W08_9Jp$Kwy-q0DCKo;GTN%H=ph?fLBxE zESz;_nFi__#r;Q|PUT`9qMol*kz5Ba2`VND1GR3Z05uO;L%C@?+|IX@n-mPk6yUr( zG3Exrl8;1r*g5Znd}ShqS4gq1YCb@~3C9{;X|Bb5rk8k-*Lsb-#s@0Y&qoWiBEZ-N za%#P9B%GkNnriCBNLO`gGX$wFnL%DW6_-tgf9vebF)eCe0NKBXq>d%tvk-n;Zt?&- zel6=`<$Qk?Ur~nBLSGf68L~ts*Qj|J+ynA`&wbyTj;kB*j&j8o>xPUVvlz-o~`P;bu$04{sM)ybs zjei{pX=tQ6!7tQA;v+@Pr5XxDZIdknp~ExlDFE}g5#Ue@vUEvbp@R2;8Yk|!%?TBc z5%jtSY@{Dk7b1yyre?A|WS)7hu`zu5;rZj0E<6R9p{%T&B%UAt+k4vVyq%!1bTP_; znD<$IRFuSa8s29gnkYWqY}XWQc7%aLA$W{f+Ntmr)eK*!tbPqBQ3*JrqS!Bi>ekmD z-heW0@lN)u9i$YfbdRcv*r6{Z6z@XNR^wyTnOB6 zXEL^?7a4Fsi*V!cOW3ApFxU_3J|v#AD4Nir@87vnYMsWKZ z*`{%!koSx#jm_z`mNbps*RD}&4{Sf^DF^r!$g#~`LE<{cK%z5dbX7Gz}Lkv#VyIC(58=rn|46|`NWI5CJqqK-HiEk8*PI{qzwF_3*TLEM{Bh?mN9h+_K{Bp;)37iNA|PO;G)#!-5QEhjvSUQ0#}s3`f@CaW>Zkz z=8*Zn545hcPzWM0uy>MFy}C6q^_-sL4+@AhuekawJaVnJzkpRCxSzT|7QIh2CwaR} zlz=!37KLyT6&Qs{9;_4kVW*wvYBq$O6hD~LcQHWUM|>vo8WI)jW5s-!<5%M&ZE}g5 zrWq`#wfZ7hRi)K)4CQvLi2P+UT5LL>0Snl!PMsyvPCfp;4AbSxnv@ihOcxQZV%&gWnR5;M3Gz8 z3PeJg682V6)pam0?CMj3u^^~o4v^660+Afd9@%~sB;T!9;#MC`y=yA^a2VP6PRv~^ z>L;sUE2bT~O|M5_O}?b&S;MhD_A`|%Y2{E0`yzdb`{Yms&UUpfH~czuEN`<0Bb6L6 z(cyuHH%rL`Qk;C(p!$swGKGWx5CvTa)C|Zep>0veW!-z`Pr0cyj#QwdlzAK_rhtE` z^VFeAxh;;>e}MdT5&HH=w+a&AQ6d1YpUIj3Erkv^vHQ<5=sPdP&mkZn0M+>b*Khi*7y%G;Dp?tN(SKG#@^&_oIn5MKQ#cVF@Gwb0rx*^{96+KpQwKJ z!E-qR-2SQJzvb%x#(d_ko_q#qSt)255SuNTm;X!fIC${Aj~hI1px{HmNt5Z|B<142{>fK?(i1SO}v2iGX4dS z6W|&7CqTf+;p)cc;Fjizl8S=p@r85bmb1fWPTo^e=bXa zm+2R+1xOoPIynI3L4?gLjra@<01Q%k)_VV!P5mVSNQwK3CZNOR03H5U;|K%1{=Xm) zvDX7+a8v?F35wcS8A;mMSUB1Kx@(Tg&Etyz!tsoNmXbd=9B@a6{}0grPCNC}_I{1K zcdY7A3P4!`TmYay6&%1X_(hY&{$q8&#>*^2yZr*_V`e~ZhQH!LQvVvy+QCuJ((=FA za3*v!FCpMfy#{k8dyTa*D02neux`1wJ8E{|4=U%3tyl@F&1eEBje~ z<|uhCwgA9Cy;MJAcV1S0nX%-#a`xXV|0ik0f1eG$gnyZZ;u)UY^lxqZ5B%?}BwiA| zRFZ!t8n^r#(VyD?Uv%YP!oQS6e}*@*{wMesljWDNFO|TbVS8=<3HHx^hL@NxWo4f+ zN1Xl%^N%Qi|Mq2kDd75y+T{EjsQ+Eg^=0#4ic&rkNxALt}nsf=eTz3|_l`Ul~R zmrO5Z37(mBqJD$v4|CxArAWa`s+ZB=&r}MrzfA@BzS#a*+3h9C%i!8)60?NgCi&xi z{gd3tOO}^WoX;%ANx#kV=a|ly1TQ1#o(UvU|33--SC74nX?mt21gzR#jB$VZy#M>7 z_CNdTWpK+gzDL$?;Qw=|%gcUy84K`C)(lvW{I4JL>q*wj9q4DwzPOF^WS)0PCNf(M*m|Nf9ZL7 zrors`zbV~+^TYh7&HwSb{Ml*p)9dnFtN>vD%?BeZ0SZ_L{S5e{2hstYLKp!2EfCQE E17(ftEC2ui literal 0 HcmV?d00001 diff --git a/internal/wrappers/gradle/wrapper/gradle-wrapper.properties b/internal/wrappers/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..568c50bf --- /dev/null +++ b/internal/wrappers/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip diff --git a/internal/wrappers/gradlew b/internal/wrappers/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/internal/wrappers/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/internal/wrappers/gradlew.bat b/internal/wrappers/gradlew.bat new file mode 100644 index 00000000..e95643d6 --- /dev/null +++ b/internal/wrappers/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/internal/wrappers/settings.gradle b/internal/wrappers/settings.gradle new file mode 100644 index 00000000..25da16a3 --- /dev/null +++ b/internal/wrappers/settings.gradle @@ -0,0 +1,10 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user guide at https://docs.gradle.org/4.5.1/userguide/multi_project_builds.html + */ + +rootProject.name = 'kuzzlesdk' From 6c34be0184f8c02f22a3a944b75e7f2c5d2ae471 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 25 Apr 2018 09:21:03 +0200 Subject: [PATCH 115/363] use gradlew to build jar files --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 3b6a25a6..e65e7693 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -72,7 +72,7 @@ java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so $(ROOTOUTDIR)/java/libs taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - taskset -c 1 gradle sourcesJar javadocJar moveJar + taskset -c 1 ./gradlew sourcesJar javadocJar moveJar #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp From 9d72984bd5b86f44ebfd23b5592ad438fd83f6f7 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 25 Apr 2018 12:16:18 +0200 Subject: [PATCH 116/363] wip --- internal/wrappers/Makefile | 2 +- internal/wrappers/build.gradle | 80 +++++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index e65e7693..b715d23e 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -100,7 +100,7 @@ cpp: makedir $(CPPSDK) g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build/c build/java/ + rm -rf build .PHONY: all java csharp python wrapper swig clean object core diff --git a/internal/wrappers/build.gradle b/internal/wrappers/build.gradle index b9723ebd..bd091e54 100644 --- a/internal/wrappers/build.gradle +++ b/internal/wrappers/build.gradle @@ -1,18 +1,34 @@ +buildscript { + repositories { + jcenter() + } +} + plugins { - id "java" id "com.jfrog.bintray" version "1.7.3" } +group = 'io.kuzzle' version = '1.0.0' +allprojects { + repositories { + jcenter() + } + apply plugin: 'maven-publish' + apply plugin: 'java' + apply plugin: 'java-library' +} + task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from('build/java') } +javadoc.failOnError = false task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' - from('build/java') + from('build/java') } task moveJar(type: Copy) { @@ -24,6 +40,66 @@ task moveJar(type: Copy) { } } +bintray { + user = 'kuzzle' + key = 'b4a4759238efa82a33b45bd9fbcf9c4cd42a2db9' + publications = ['MyPublication'] + + pkg { + repo = 'maven' + name = 'kuzzle-sdk' + userOrg = 'kuzzle' + licenses = ['Apache-2.0'] + desc = 'Kuzzle JAVA SDK' + vcsUrl = 'https://github.com/kuzzleio/sdk-go.git' + websiteUrl = 'https://kuzzle.io' + issueTrackerUrl = 'https://github.com/kuzzleio/sdk-go/issues' + publicDownloadNumbers = true + publish = true + } +} + +def pomConfig = { + licenses { + license { + name "The Apache Software License, Version 2.0" + url "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution "repo" + } + } + developers { + developer { + id "kuzzle" + name "kuzzle" + email "support@kuzzle.io" + } + } + + scm { + url "https://github.com/kuzzleio/sdk-go" + } +} + +publishing { + publications { + MyPublication(MavenPublication) { + from components.java + artifact sourcesJar + artifact javadocJar + groupId 'io.kuzzle' + artifactId 'kuzzle-sdk' + version version + pom.withXml { + def root = asNode() + root.appendNode('description', 'Kuzzle JAVA SDK') + root.appendNode('name', 'kuzzle-sdk') + root.appendNode('url', 'https://github.com/kuzzleio/sdk-go') + root.children().last() + pomConfig + } + } + } +} + artifacts { archives sourcesJar archives javadocJar From c1aede7a9e7153dca68953972dc0d7177214d598 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 25 Apr 2018 14:49:15 +0200 Subject: [PATCH 117/363] wip --- internal/wrappers/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/wrappers/build.gradle b/internal/wrappers/build.gradle index bd091e54..1e1c7efb 100644 --- a/internal/wrappers/build.gradle +++ b/internal/wrappers/build.gradle @@ -31,6 +31,10 @@ task javadocJar(type: Jar, dependsOn: javadoc) { from('build/java') } +jar { + from('build/java') +} + task moveJar(type: Copy) { from(file('build/libs')) into('./build/java/libs') From a3e77e41d55b53e704249741223036adb65779ca Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 25 Apr 2018 15:20:19 +0200 Subject: [PATCH 118/363] change generated java sources path --- internal/wrappers/.gitignore | 2 +- internal/wrappers/Makefile | 9 +++++---- internal/wrappers/{ => build/java}/build.gradle | 14 +++----------- .../java}/gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 internal/wrappers/{ => build/java}/gradlew | 0 internal/wrappers/{ => build/java}/gradlew.bat | 0 .../wrappers/{ => build/java}/settings.gradle | 0 8 files changed, 9 insertions(+), 16 deletions(-) rename internal/wrappers/{ => build/java}/build.gradle (59%) rename internal/wrappers/{ => build/java}/gradle/wrapper/gradle-wrapper.jar (100%) rename internal/wrappers/{ => build/java}/gradle/wrapper/gradle-wrapper.properties (100%) rename internal/wrappers/{ => build/java}/gradlew (100%) rename internal/wrappers/{ => build/java}/gradlew.bat (100%) rename internal/wrappers/{ => build/java}/settings.gradle (100%) diff --git a/internal/wrappers/.gitignore b/internal/wrappers/.gitignore index d253357d..b168d375 100644 --- a/internal/wrappers/.gitignore +++ b/internal/wrappers/.gitignore @@ -5,4 +5,4 @@ kcore_wrap.c # build -build +build/c build/java/build build/java/src diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index e65e7693..79ab71a5 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -65,14 +65,15 @@ swig: makedir: mkdir -p $(OUTDIR) -java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk +java: OUTDIR = $(ROOTOUTDIR)/java/src/main/java java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask - rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so $(ROOTOUTDIR)/java/libs + rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - taskset -c 1 ./gradlew sourcesJar javadocJar moveJar + cd build/java + cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp @@ -100,7 +101,7 @@ cpp: makedir $(CPPSDK) g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build/c build/java/ + rm -rf build/c build/java/src build/java/build .PHONY: all java csharp python wrapper swig clean object core diff --git a/internal/wrappers/build.gradle b/internal/wrappers/build/java/build.gradle similarity index 59% rename from internal/wrappers/build.gradle rename to internal/wrappers/build/java/build.gradle index b9723ebd..3da6d621 100644 --- a/internal/wrappers/build.gradle +++ b/internal/wrappers/build/java/build.gradle @@ -7,21 +7,13 @@ version = '1.0.0' task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' - from('build/java') + from sourceSets.main.allSource } +javadoc.failOnError = false task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' - from('build/java') -} - -task moveJar(type: Copy) { - from(file('build/libs')) - into('./build/java/libs') - doLast { - delete('build/libs') - delete('build/tmp') - } + from javadoc.destinationDir } artifacts { diff --git a/internal/wrappers/gradle/wrapper/gradle-wrapper.jar b/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from internal/wrappers/gradle/wrapper/gradle-wrapper.jar rename to internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.jar diff --git a/internal/wrappers/gradle/wrapper/gradle-wrapper.properties b/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from internal/wrappers/gradle/wrapper/gradle-wrapper.properties rename to internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties diff --git a/internal/wrappers/gradlew b/internal/wrappers/build/java/gradlew similarity index 100% rename from internal/wrappers/gradlew rename to internal/wrappers/build/java/gradlew diff --git a/internal/wrappers/gradlew.bat b/internal/wrappers/build/java/gradlew.bat similarity index 100% rename from internal/wrappers/gradlew.bat rename to internal/wrappers/build/java/gradlew.bat diff --git a/internal/wrappers/settings.gradle b/internal/wrappers/build/java/settings.gradle similarity index 100% rename from internal/wrappers/settings.gradle rename to internal/wrappers/build/java/settings.gradle From cffa4f6a0296e080b797d86899afdd4bdf41c1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Wed, 25 Apr 2018 15:24:35 +0200 Subject: [PATCH 119/363] Java e2e tests (#145) * remove dependency to any json object * remove wrapping of json_object in swig java template * removed last json-c dependencies * wrote e2e tests * do not throw error when creating a document without id * install dependencies in travis.yml * added fixtures and scripts * added taskset to run gradle cucmber * added genral script for e2e tests * update e2e tests scripts * removed fixture * added fixtures * subscribe test * change map for instances to sync.Map * subscribe geofence test * fix unit tests * omit expiresIn if 0 * use KUZZLE_HOST env if set * change path before generating .jar * go back to initial pwd after running java build --- .travis.yml | 7 - README.md | 8 + collection/create.go | 6 +- collection/update_mapping_test.go | 10 +- collection/update_specifications_test.go | 10 +- collection/validate_specifications_test.go | 6 +- connection/connection.go | 2 +- connection/websocket/web_socket.go | 40 +++-- document/count.go | 4 +- document/count_test.go | 10 +- document/create.go | 17 +- document/createOrReplace.go | 4 +- document/createOrReplace_test.go | 12 +- document/create_test.go | 17 +- document/mCreate.go | 4 +- document/mCreateOrReplace.go | 4 +- document/mCreateOrReplace_test.go | 10 +- document/mCreate_test.go | 10 +- document/mReplace.go | 4 +- document/mReplace_test.go | 10 +- document/mUpdate.go | 4 +- document/mUpdate_test.go | 10 +- document/replace.go | 4 +- document/replace_test.go | 12 +- document/search.go | 4 +- document/search_test.go | 10 +- document/update.go | 23 +-- document/update_test.go | 12 +- document/validate.go | 4 +- document/validate_test.go | 10 +- internal/mock_connection.go | 2 +- internal/wrappers/Makefile | 2 +- internal/wrappers/README.md | 1 - internal/wrappers/cgo/kuzzle/auth.go | 11 +- internal/wrappers/cgo/kuzzle/collection.go | 13 +- internal/wrappers/cgo/kuzzle/destructors.go | 9 +- internal/wrappers/cgo/kuzzle/document.go | 34 ++-- internal/wrappers/cgo/kuzzle/errors.go | 6 +- internal/wrappers/cgo/kuzzle/go_to_c.go | 14 ++ internal/wrappers/cgo/kuzzle/index.go | 11 +- internal/wrappers/cgo/kuzzle/jsonc_wrapper.go | 169 ------------------ internal/wrappers/cgo/kuzzle/kuzzle.go | 66 +++++-- .../wrappers/cgo/kuzzle/memory_storage.go | 42 +++-- internal/wrappers/cgo/kuzzle/query.go | 4 +- internal/wrappers/cgo/kuzzle/realtime.go | 29 +-- internal/wrappers/cgo/kuzzle/server.go | 13 +- internal/wrappers/cpp/auth.cpp | 4 +- internal/wrappers/cpp/collection.cpp | 8 +- internal/wrappers/cpp/index.cpp | 10 +- internal/wrappers/cpp/kuzzle.cpp | 16 +- internal/wrappers/cpp/realtime.cpp | 16 +- internal/wrappers/features/e2e.sh | 3 + .../wrappers/features/fixtures/mapping.json | 7 + .../wrappers/features/fixtures/rights.json | 29 +++ internal/wrappers/features/fixtures/run.sh | 19 ++ internal/wrappers/features/java/build.gradle | 34 ++++ .../java/gradle/cucumber/Geofencedefs.java | 66 +++++++ .../test/java/gradle/cucumber/Logindefs.java | 97 ++++++++++ .../java/gradle/cucumber/Subscribedefs.java | 48 +++++ internal/wrappers/features/run_java.sh | 4 + internal/wrappers/features/sdks.feature | 40 +++++ internal/wrappers/headers/core.hpp | 1 - internal/wrappers/headers/kuzzle.hpp | 1 + internal/wrappers/headers/kuzzlesdk.h | 35 +++- internal/wrappers/headers/realtime.hpp | 2 +- internal/wrappers/headers/swig.h | 29 --- internal/wrappers/kcore.i | 3 +- internal/wrappers/templates/java/core.i | 3 + .../templates/java/javadoc/collection.i | 22 --- .../templates/java/javadoc/document.i | 20 +++ kuzzle/kuzzle.go | 4 +- kuzzle/query.go | 18 +- realtime/join.go | 4 +- realtime/realtime.go | 6 +- realtime/subscribe.go | 22 +-- realtime/subscribe_test.go | 18 +- realtime/unsubscribe.go | 9 +- types/ikuzzle.go | 2 +- types/kuzzle_request.go | 4 +- types/kuzzle_response.go | 6 + 80 files changed, 793 insertions(+), 531 deletions(-) delete mode 100644 internal/wrappers/cgo/kuzzle/jsonc_wrapper.go create mode 100755 internal/wrappers/features/e2e.sh create mode 100644 internal/wrappers/features/fixtures/mapping.json create mode 100644 internal/wrappers/features/fixtures/rights.json create mode 100755 internal/wrappers/features/fixtures/run.sh create mode 100644 internal/wrappers/features/java/build.gradle create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java create mode 100755 internal/wrappers/features/run_java.sh create mode 100644 internal/wrappers/features/sdks.feature delete mode 100644 internal/wrappers/headers/swig.h diff --git a/.travis.yml b/.travis.yml index 003c5575..33a1c2d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,14 +3,7 @@ go: - 1.9 dist: trusty install: - - git clone https://github.com/json-c/json-c.git - - cd json-c - sudo apt-get install build-essential swig oracle-java8-installer g++ - - sh autogen.sh - - ./configure - - make - - sudo make install - - cd - - go get -t -v ./... script: - bash ./test.sh diff --git a/README.md b/README.md index 9c63d986..dceed973 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ func main() { ## Running Tests +### Unit tests + To run the tests you can simply execute the coverage.sh script ```sh ./coverage.sh @@ -58,6 +60,12 @@ You can also get html coverage by running ```sh ./coverage.sh --html ``` +### e2e tests + +To run e2e tests ensure you have a kuzzle running and then run +```sh +./internal/wrappers/features/e2e.sh +``` ## License diff --git a/collection/create.go b/collection/create.go index cccc8464..c2e8f607 100644 --- a/collection/create.go +++ b/collection/create.go @@ -40,5 +40,9 @@ func (dc *Collection) Create(index string, collection string, options types.Quer res := <-ch - return res.Error + if res.Error != nil { + return res.Error + } + + return nil } diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index fa898e0d..3ab797af 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -31,14 +31,14 @@ import ( func TestUpdateMappingIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("", "collection", json.RawMessage("body"), nil) + err := nc.UpdateMapping("", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } func TestUpdateMappingCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "", json.RawMessage("body"), nil) + err := nc.UpdateMapping("index", "", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestUpdateMappingError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) + err := nc.UpdateMapping("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -71,7 +71,7 @@ func TestUpdateMapping(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) + err := nc.UpdateMapping("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.Nil(t, err) } @@ -80,7 +80,7 @@ func ExampleCollection_UpdateMapping() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - err := nc.UpdateMapping("index", "collection", json.RawMessage("body"), nil) + err := nc.UpdateMapping("index", "collection", json.RawMessage(`{"body": "body"}`), nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go index 0c8dbb21..2743ec58 100644 --- a/collection/update_specifications_test.go +++ b/collection/update_specifications_test.go @@ -29,14 +29,14 @@ import ( func TestUpdateSpecificationsIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("", "collection", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } func TestUpdateSpecificationsCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("index", "", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -56,7 +56,7 @@ func TestUpdateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -69,7 +69,7 @@ func TestUpdateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.Nil(t, err) } @@ -78,7 +78,7 @@ func ExampleCollection_UpdateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage("body"), nil) + _, err := nc.UpdateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) if err != nil { fmt.Println(err.Error()) diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index f5b63d31..22fe35b3 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -44,7 +44,7 @@ func TestValidateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) + _, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -62,7 +62,7 @@ func TestValidateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) + res, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) assert.Nil(t, err) assert.NotNil(t, res) assert.Equal(t, true, res) @@ -73,7 +73,7 @@ func ExampleCollection_ValidateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.ValidateSpecifications(json.RawMessage("body"), nil) + res, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) if err != nil { fmt.Println(err.Error()) diff --git a/connection/connection.go b/connection/connection.go index bbf1f6b5..08737b68 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -33,7 +33,7 @@ type Connection interface { Close() error State() int EmitEvent(int, interface{}) - RegisterSub(string, string, json.RawMessage, chan<- types.KuzzleNotification, chan<- interface{}) + RegisterSub(string, string, json.RawMessage, bool, chan<- types.KuzzleNotification, chan<- interface{}) UnregisterSub(string) CancelSubs() RequestHistory() map[string]time.Time diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 1c740ba9..b4d7a570 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -185,16 +185,20 @@ func (ws *webSocket) Connect() (bool, error) { ws.EmitEvent(event.Connected, nil) } - resChan := make(chan []byte) + // resChan := make(chan []byte) + + ws.listenChan = make(chan []byte) + + go ws.listen() go func() { for { _, message, err := ws.ws.ReadMessage() - + ws.listenChan <- message // TODO: either send a Disconnected event on a proper disconnection, // or a NetworkError one if the socket has been unexpectedly closed if err != nil { - close(resChan) + close(ws.listenChan) ws.ws.Close() ws.state = state.Offline if ws.autoQueue { @@ -203,14 +207,9 @@ func (ws *webSocket) Connect() (bool, error) { ws.EmitEvent(event.Disconnected, nil) return } - go func() { - resChan <- message - }() } }() - ws.listenChan = resChan - go ws.listen() ws.ReplayQueue() return ws.wasConnected, err @@ -287,12 +286,11 @@ func (ws *webSocket) cleanQueue() { } } -func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { +func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage, subscribeToSelf bool, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { subs, found := ws.subscriptions.Load(channel) if !found { subs = map[string]subscription{} - ws.subscriptions.Store(channel, subs) } subs.(map[string]subscription)[roomID] = subscription{ @@ -301,17 +299,23 @@ func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage notificationChannel: notifChan, onReconnectChannel: onReconnectChannel, filters: filters, + subscribeToSelf: subscribeToSelf, } + + ws.subscriptions.Store(channel, subs) } func (ws *webSocket) UnregisterSub(roomID string) { - s, ok := ws.subscriptions.Load(roomID) - if ok { - for _, sub := range s.(map[string]subscription) { - close(sub.onReconnectChannel) + ws.subscriptions.Range(func(k, v interface{}) bool { + for k, sub := range v.(map[string]subscription) { + if sub.roomID == roomID { + close(sub.onReconnectChannel) + close(sub.notificationChannel) + delete(v.(map[string]subscription), k) + } } - ws.subscriptions.Delete(roomID) - } + return true + }) } func (ws *webSocket) CancelSubs() { @@ -354,6 +358,10 @@ func (ws *webSocket) listen() { c.(chan<- *types.KuzzleResponse) <- &message close(c.(chan<- *types.KuzzleResponse)) ws.channelsResult.Delete(message.RequestId) + } else if c, found := ws.channelsResult.Load(message.RoomId); found { + c.(chan<- *types.KuzzleResponse) <- &message + close(c.(chan<- *types.KuzzleResponse)) + ws.channelsResult.Delete(message.RequestId) } else { ws.EmitEvent(event.Discarded, &message) } diff --git a/document/count.go b/document/count.go index 652a3f17..9333595b 100644 --- a/document/count.go +++ b/document/count.go @@ -25,7 +25,7 @@ import ( // There is a small delay between documents creation and their existence in our advanced search layer, // usually a couple of seconds. // That means that a document that was just been created won’t be returned by this function -func (d *Document) Count(index string, collection string, body string, options types.QueryOptions) (int, error) { +func (d *Document) Count(index string, collection string, body json.RawMessage, options types.QueryOptions) (int, error) { if index == "" { return 0, types.NewError("Document.Count: index required", 400) } @@ -34,7 +34,7 @@ func (d *Document) Count(index string, collection string, body string, options t return 0, types.NewError("Document.Count: collection required", 400) } - if body == "" { + if body == nil { return 0, types.NewError("Document.Count: body required", 400) } diff --git a/document/count_test.go b/document/count_test.go index a4919c02..93fae122 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -28,21 +28,21 @@ import ( func TestCountIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("", "collection", "body", nil) + _, err := d.Count("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCountCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("index", "", "body", nil) + _, err := d.Count("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCountBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Count("index", "collection", "", nil) + _, err := d.Count("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -54,7 +54,7 @@ func TestCountDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Count("index", "collection", "body", nil) + _, err := d.Count("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -75,7 +75,7 @@ func TestCountDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - res, err := d.Count("index", "collection", "body", nil) + res, err := d.Count("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) assert.Equal(t, 1, res) } diff --git a/document/create.go b/document/create.go index 13cfa78a..292479ea 100644 --- a/document/create.go +++ b/document/create.go @@ -28,7 +28,7 @@ import ( // If the same document already exists: // - resolves with an error if set to "error". // - replaces the existing document if set to "replace" -func (d *Document) Create(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { +func (d *Document) Create(index string, collection string, id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Create: index required", 400) } @@ -37,11 +37,7 @@ func (d *Document) Create(index string, collection string, _id string, body stri return "", types.NewError("Document.Create: collection required", 400) } - if _id == "" { - return "", types.NewError("Document.Create: id required", 400) - } - - if body == "" { + if body == nil { return "", types.NewError("Document.Create: body required", 400) } @@ -52,7 +48,7 @@ func (d *Document) Create(index string, collection string, _id string, body stri Collection: collection, Controller: "document", Action: "create", - Id: _id, + Id: id, Body: body, } @@ -64,8 +60,11 @@ func (d *Document) Create(index string, collection string, _id string, body stri return "", res.Error } - var created string + type response struct { + Created string `json:"_id"` + } + var created response json.Unmarshal(res.Result, &created) - return created, nil + return created.Created, nil } diff --git a/document/createOrReplace.go b/document/createOrReplace.go index c0c1f7bf..07dcff6b 100644 --- a/document/createOrReplace.go +++ b/document/createOrReplace.go @@ -28,7 +28,7 @@ import ( // If the same document already exists: // - resolves with an error if set to "error". // - replaces the existing document if set to "replace" -func (d *Document) CreateOrReplace(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { +func (d *Document) CreateOrReplace(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.CreateOrReplace: index required", 400) } @@ -41,7 +41,7 @@ func (d *Document) CreateOrReplace(index string, collection string, _id string, return "", types.NewError("Document.CreateOrReplace: id required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.CreateOrReplace: body required", 400) } diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go index 1c39ad85..db7b1f2a 100644 --- a/document/createOrReplace_test.go +++ b/document/createOrReplace_test.go @@ -28,28 +28,28 @@ import ( func TestCreateOrReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("", "collection", "id1", "body", nil) + _, err := d.CreateOrReplace("", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateOrReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "", "id1", "body", nil) + _, err := d.CreateOrReplace("index", "", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateOrReplaceIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "collection", "", "body", nil) + _, err := d.CreateOrReplace("index", "collection", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateOrReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "collection", "id1", "", nil) + _, err := d.CreateOrReplace("index", "collection", "id1", nil, nil) assert.NotNil(t, err) } @@ -61,7 +61,7 @@ func TestCreateOrReplaceDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "collection", "id1", "body", nil) + _, err := d.CreateOrReplace("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -90,6 +90,6 @@ func TestCreateOrReplaceDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.CreateOrReplace("index", "collection", id, "body", nil) + _, err := d.CreateOrReplace("index", "collection", id, json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/create_test.go b/document/create_test.go index 98de94ac..d4ec5f0d 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -28,28 +28,21 @@ import ( func TestCreateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Create("", "collection", "id1", "body", nil) + _, err := d.Create("", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Create("index", "", "id1", "body", nil) - assert.NotNil(t, err) -} - -func TestCreateIdNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - d := document.NewDocument(k) - _, err := d.Create("index", "collection", "", "body", nil) + _, err := d.Create("index", "", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestCreateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Create("index", "collection", "id1", "", nil) + _, err := d.Create("index", "collection", "id1", nil, nil) assert.NotNil(t, err) } @@ -61,7 +54,7 @@ func TestCreateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Create("index", "collection", "id1", "body", nil) + _, err := d.Create("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -90,6 +83,6 @@ func TestCreateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Create("index", "collection", id, "body", nil) + _, err := d.Create("index", "collection", id, json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/mCreate.go b/document/mCreate.go index 763ebd48..0412c4c8 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -21,7 +21,7 @@ import ( ) // MCreate creates the provided documents. -func (d *Document) MCreate(index string, collection string, body string, options types.QueryOptions) (string, error) { +func (d *Document) MCreate(index string, collection string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MCreate: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) MCreate(index string, collection string, body string, options return "", types.NewError("Document.MCreate: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.MCreate: body required", 400) } diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index 8a1590b0..7a262054 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -21,7 +21,7 @@ import ( ) // MCreateOrReplace creates or replaces the provided documents. -func (d *Document) MCreateOrReplace(index string, collection string, body string, options types.QueryOptions) (string, error) { +func (d *Document) MCreateOrReplace(index string, collection string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MCreateOrReplace: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) MCreateOrReplace(index string, collection string, body string return "", types.NewError("Document.MCreateOrReplace: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.MCreateOrReplace: body required", 400) } diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index 5409be8d..9a6a3377 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -29,7 +29,7 @@ func TestMCreateOrReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("", "collection", "body", nil) + _, err := d.MCreateOrReplace("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMCreateOrReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "", "body", nil) + _, err := d.MCreateOrReplace("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestMCreateOrReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "collection", "", nil) + _, err := d.MCreateOrReplace("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMCreateOrReplaceDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "collection", "body", nil) + _, err := d.MCreateOrReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -110,6 +110,6 @@ func TestMCreateOrReplaceDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "collection", "body", nil) + _, err := d.MCreateOrReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/mCreate_test.go b/document/mCreate_test.go index 300e36c7..d2ca06d0 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -29,7 +29,7 @@ func TestMCreateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreate("", "collection", "body", nil) + _, err := d.MCreate("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMCreateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "", "body", nil) + _, err := d.MCreate("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestMCreateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "collection", "", nil) + _, err := d.MCreate("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMCreateDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "collection", "body", nil) + _, err := d.MCreate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -110,6 +110,6 @@ func TestMCreateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "collection", "body", nil) + _, err := d.MCreate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/mReplace.go b/document/mReplace.go index 690306c0..586b5bea 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -21,7 +21,7 @@ import ( ) // MReplace replaces multiple documents at once. -func (d *Document) MReplace(index string, collection string, body string, options types.QueryOptions) (string, error) { +func (d *Document) MReplace(index string, collection string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MReplace: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) MReplace(index string, collection string, body string, option return "", types.NewError("Document.MReplace: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.MReplace: body required", 400) } diff --git a/document/mReplace_test.go b/document/mReplace_test.go index 4af96989..8f322e2a 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -29,7 +29,7 @@ func TestMReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MReplace("", "collection", "body", nil) + _, err := d.MReplace("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "", "body", nil) + _, err := d.MReplace("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestMReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "collection", "", nil) + _, err := d.MReplace("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMReplaceDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "collection", "body", nil) + _, err := d.MReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -111,6 +111,6 @@ func TestMReplaceDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "collection", "body", nil) + _, err := d.MReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/mUpdate.go b/document/mUpdate.go index b27fcece..8ca4a26f 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -21,7 +21,7 @@ import ( ) // MUpdate updates multiple documents at once -func (d *Document) MUpdate(index string, collection string, body string, options types.QueryOptions) (string, error) { +func (d *Document) MUpdate(index string, collection string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.MUpdate: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) MUpdate(index string, collection string, body string, options return "", types.NewError("Document.MUpdate: collection required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.MUpdate: body required", 400) } diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index 4118d5fe..c8e2bb54 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -29,7 +29,7 @@ func TestMUpdateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MUpdate("", "collection", "body", nil) + _, err := d.MUpdate("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMUpdateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "", "body", nil) + _, err := d.MUpdate("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestMUpdateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "collection", "", nil) + _, err := d.MUpdate("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMUpdateDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "collection", "body", nil) + _, err := d.MUpdate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -111,6 +111,6 @@ func TestMUpdateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "collection", "body", nil) + _, err := d.MUpdate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/replace.go b/document/replace.go index b671bc2a..0cc297bb 100644 --- a/document/replace.go +++ b/document/replace.go @@ -21,7 +21,7 @@ import ( ) // Replace replaces a document in Kuzzle. -func (d *Document) Replace(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { +func (d *Document) Replace(index string, collection string, _id string, body json.RawMessage, options types.QueryOptions) (string, error) { if index == "" { return "", types.NewError("Document.Replace: index required", 400) } @@ -34,7 +34,7 @@ func (d *Document) Replace(index string, collection string, _id string, body str return "", types.NewError("Document.Replace: id required", 400) } - if body == "" { + if body == nil { return "", types.NewError("Document.Replace: body required", 400) } diff --git a/document/replace_test.go b/document/replace_test.go index f3b3678b..5a113a4f 100644 --- a/document/replace_test.go +++ b/document/replace_test.go @@ -29,7 +29,7 @@ func TestReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Replace("", "collection", "id1", "body", nil) + _, err := d.Replace("", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "", "id1", "body", nil) + _, err := d.Replace("index", "", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestReplaceIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "collection", "", "body", nil) + _, err := d.Replace("index", "collection", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -53,7 +53,7 @@ func TestReplaceBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "collection", "id1", "", nil) + _, err := d.Replace("index", "collection", "id1", nil, nil) assert.NotNil(t, err) } @@ -66,7 +66,7 @@ func TestReplaceDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "collection", "id1", "body", nil) + _, err := d.Replace("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -97,6 +97,6 @@ func TestReplaceDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Replace("index", "collection", id, "body", nil) + _, err := d.Replace("index", "collection", id, json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/search.go b/document/search.go index 9d06fbf9..8487ff37 100644 --- a/document/search.go +++ b/document/search.go @@ -21,7 +21,7 @@ import ( ) // Search documents in the given Collection, using provided filters and option. -func (d *Document) Search(index string, collection string, body string, options types.QueryOptions) (*types.SearchResult, error) { +func (d *Document) Search(index string, collection string, body json.RawMessage, options types.QueryOptions) (*types.SearchResult, error) { if index == "" { return nil, types.NewError("Document.Search: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) Search(index string, collection string, body string, options return nil, types.NewError("Document.Search: collection required", 400) } - if body == "" { + if body == nil { return nil, types.NewError("Document.Search: body required", 400) } diff --git a/document/search_test.go b/document/search_test.go index 47770d4d..eb6cc447 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -29,7 +29,7 @@ func TestSearchIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Search("", "collection", "body", nil) + _, err := d.Search("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestSearchCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Search("index", "", "body", nil) + _, err := d.Search("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestSearchBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Search("index", "collection", "", nil) + _, err := d.Search("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestSearchDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Search("index", "collection", "body", nil) + _, err := d.Search("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -85,6 +85,6 @@ func TestSearchDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Search("index", "collection", "body", nil) + _, err := d.Search("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/update.go b/document/update.go index cd295928..1f8cb349 100644 --- a/document/update.go +++ b/document/update.go @@ -21,7 +21,11 @@ import ( ) // Update updates a document in Kuzzle. -func (d *Document) Update(index string, collection string, _id string, body string, options types.QueryOptions) (string, error) { +func (d *Document) Update(index string, collection string, id string, body json.RawMessage, options types.QueryOptions) (string, error) { + if id == "" { + return "", types.NewError("Document.update: id required", 400) + } + if index == "" { return "", types.NewError("Document.Update: index required", 400) } @@ -30,23 +34,19 @@ func (d *Document) Update(index string, collection string, _id string, body stri return "", types.NewError("Document.Update: collection required", 400) } - if _id == "" { - return "", types.NewError("Document.Update: id required", 400) - } - - if body == "" { + if body == nil { return "", types.NewError("Document.Update: body required", 400) } ch := make(chan *types.KuzzleResponse) query := &types.KuzzleRequest{ - Collection: collection, Index: index, + Collection: collection, Controller: "document", Action: "update", + Id: id, Body: body, - Id: _id, } go d.Kuzzle.Query(query, options, ch) @@ -57,8 +57,11 @@ func (d *Document) Update(index string, collection string, _id string, body stri return "", res.Error } - var updated string + type response struct { + Updated string `json:"_id"` + } + var updated response json.Unmarshal(res.Result, &updated) - return updated, nil + return updated.Updated, nil } diff --git a/document/update_test.go b/document/update_test.go index 4c6e0b4f..97148d54 100644 --- a/document/update_test.go +++ b/document/update_test.go @@ -29,7 +29,7 @@ func TestUpdateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Update("", "collection", "id1", "body", nil) + _, err := d.Update("", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestUpdateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Update("index", "", "id1", "body", nil) + _, err := d.Update("index", "", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestUpdateIdNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Update("index", "collection", "", "body", nil) + _, err := d.Update("index", "collection", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } @@ -53,7 +53,7 @@ func TestUpdateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Update("index", "collection", "id1", "", nil) + _, err := d.Update("index", "collection", "id1", nil, nil) assert.NotNil(t, err) } @@ -66,7 +66,7 @@ func TestUpdateDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Update("index", "collection", "id1", "body", nil) + _, err := d.Update("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -97,6 +97,6 @@ func TestUpdateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Update("index", "collection", id, "body", nil) + _, err := d.Update("index", "collection", id, json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/document/validate.go b/document/validate.go index 8d1f7557..662f5104 100644 --- a/document/validate.go +++ b/document/validate.go @@ -21,7 +21,7 @@ import ( ) // Validate validates data against existing validation rules. -func (d *Document) Validate(index string, collection string, body string, options types.QueryOptions) (bool, error) { +func (d *Document) Validate(index string, collection string, body json.RawMessage, options types.QueryOptions) (bool, error) { if index == "" { return false, types.NewError("Document.Validate: index required", 400) } @@ -30,7 +30,7 @@ func (d *Document) Validate(index string, collection string, body string, option return false, types.NewError("Document.Validate: collection required", 400) } - if body == "" { + if body == nil { return false, types.NewError("Document.Validate: body required", 400) } diff --git a/document/validate_test.go b/document/validate_test.go index dcadf25f..1ca00457 100644 --- a/document/validate_test.go +++ b/document/validate_test.go @@ -28,21 +28,21 @@ import ( func TestValidateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("", "collection", "body", nil) + _, err := d.Validate("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestValidateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "", "body", nil) + _, err := d.Validate("index", "", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) } func TestValidateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "", nil) + _, err := d.Validate("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -54,7 +54,7 @@ func TestValidateDocumentError(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "body", nil) + _, err := d.Validate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) } @@ -76,6 +76,6 @@ func TestValidateDocument(t *testing.T) { } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Validate("index", "collection", "body", nil) + _, err := d.Validate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) } diff --git a/internal/mock_connection.go b/internal/mock_connection.go index 2f713fd3..94953d4d 100644 --- a/internal/mock_connection.go +++ b/internal/mock_connection.go @@ -84,7 +84,7 @@ func (c *MockedConnection) EmitEvent(event int, arg interface{}) { } } -func (c *MockedConnection) RegisterSub(channel, roomID string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChan chan<- interface{}) { +func (c *MockedConnection) RegisterSub(channel, roomID string, filters json.RawMessage, subscribeToSelf bool, notifChan chan<- types.KuzzleNotification, onReconnectChan chan<- interface{}) { } func (c *MockedConnection) CancelSubs() {} diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index dd4d17d6..7c04dbec 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -71,7 +71,7 @@ java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - taskset -c 1 $(JAVA_HOME)/bin/jar cf $(OUTDIR)/kuzzlesdk.jar $(OUTDIR)/*.class + cd $(ROOTOUTDIR)/java && taskset -c 1 $(JAVA_HOME)/bin/jar cf $(OUTDIR)/kuzzlesdk.jar ./io/kuzzle/sdk/*.class && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp diff --git a/internal/wrappers/README.md b/internal/wrappers/README.md index 132cbef8..54e61aae 100644 --- a/internal/wrappers/README.md +++ b/internal/wrappers/README.md @@ -7,7 +7,6 @@ This project contains a CGO wrapper to Kuzzle's [Go SDK](https://github.com/kuzz # Pre-requisites * [Go](https://golang.org/doc/install) -* [JSON-C library](https://github.com/json-c/json-c#install-using-apt-eg-ubuntu-16042-lts) # Contributing diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 3989a5b8..8732ace5 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -25,6 +25,7 @@ package main import "C" import ( "encoding/json" + "sync" "unsafe" "github.com/kuzzleio/sdk-go/auth" @@ -32,17 +33,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var authInstances map[interface{}]bool +var authInstances sync.Map //register new instance of server func registerAuth(instance interface{}) { - authInstances[instance] = true + authInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterAuth func unregisterAuth(a *C.auth) { - delete(authInstances, (*auth.Auth)(a.instance)) + authInstances.Delete(a) } // Allocates memory @@ -51,10 +52,6 @@ func kuzzle_new_auth(a *C.auth, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) auth := auth.NewAuth(kuz) - if authInstances == nil { - authInstances = make(map[interface{}]bool) - } - a.instance = unsafe.Pointer(auth) a.kuzzle = k diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 905b6669..580d8084 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -22,6 +22,7 @@ package main import "C" import ( "encoding/json" + "sync" "unsafe" "github.com/kuzzleio/sdk-go/collection" @@ -29,17 +30,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var collectionInstances map[interface{}]bool +var collectionInstances sync.Map // register new instance to the instances map func registerCollection(instance interface{}) { - collectionInstances[instance] = true + collectionInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterCollection -func unregisterCollection(d *C.collection) { - delete(collectionInstances, (*collection.Collection)(d.instance)) +func unregisterCollection(c *C.collection) { + collectionInstances.Delete(c) } // Allocates memory @@ -48,10 +49,6 @@ func kuzzle_new_collection(c *C.collection, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) col := collection.NewCollection(kuz) - if collectionInstances == nil { - collectionInstances = make(map[interface{}]bool) - } - c.instance = unsafe.Pointer(col) c.kuzzle = k diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 848c927c..1a5d116c 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -16,7 +16,6 @@ package main /* #cgo CFLAGS: -std=c99 -I../../../headers - #cgo LDFLAGS: -ljson-c #include #include "kuzzlesdk.h" @@ -347,6 +346,14 @@ func _free_user_right(st *C.user_right) { } } +//export kuzzle_free_subscribe_result +func kuzzle_free_subscribe_result(st *C.subscribe_result) { + if st != nil { + C.free(unsafe.Pointer(st.room)) + C.free(unsafe.Pointer(st.channel)) + } +} + //export kuzzle_free_user_right func kuzzle_free_user_right(st *C.user_right) { _free_user_right(st) diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index 22d4a511..0da39dae 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -21,6 +21,8 @@ package main */ import "C" import ( + "encoding/json" + "sync" "unsafe" "github.com/kuzzleio/sdk-go/document" @@ -28,17 +30,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var documentInstances map[interface{}]bool +var documentInstances sync.Map // register new instance to the instances map func registerDocument(instance interface{}) { - documentInstances[instance] = true + documentInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterDocument func unregisterDocument(d *C.document) { - delete(documentInstances, (*document.Document)(d.instance)) + documentInstances.Delete(d) } //export kuzzle_new_document @@ -46,10 +48,6 @@ func kuzzle_new_document(d *C.document, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) doc := document.NewDocument(kuz) - if documentInstances == nil { - documentInstances = make(map[interface{}]bool) - } - d.instance = unsafe.Pointer(doc) d.kuzzle = k registerDocument(doc) @@ -57,7 +55,7 @@ func kuzzle_new_document(d *C.document, k *C.kuzzle) { //export kuzzle_document_count func kuzzle_document_count(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.int_result { - res, err := (*document.Document)(d.instance).Count(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Count(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCIntResult(res, err) } @@ -69,13 +67,13 @@ func kuzzle_document_exists(d *C.document, index *C.char, collection *C.char, id //export kuzzle_document_create func kuzzle_document_create(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Create(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Create(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_create_or_replace func kuzzle_document_create_or_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).CreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).CreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } @@ -99,37 +97,37 @@ func kuzzle_document_get(d *C.document, index *C.char, collection *C.char, id *C //export kuzzle_document_replace func kuzzle_document_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Replace(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Replace(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_update func kuzzle_document_update(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Update(C.GoString(index), C.GoString(collection), C.GoString(id), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Update(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_validate func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.bool_result { - res, err := (*document.Document)(d.instance).Validate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Validate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCBoolResult(res, err) } //export kuzzle_document_search func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.search_result { - res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCSearchResult(res, err) } //export kuzzle_document_mcreate func kuzzle_document_mcreate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MCreate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).MCreate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_mcreate_or_replace func kuzzle_document_mcreate_or_replace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MCreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).MCreateOrReplace(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } @@ -147,12 +145,12 @@ func kuzzle_document_mget(d *C.document, index *C.char, collection *C.char, ids //export kuzzle_document_mreplace func kuzzle_document_mreplace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MReplace(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).MReplace(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } //export kuzzle_document_mupdate func kuzzle_document_mupdate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MUpdate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) + res, err := (*document.Document)(d.instance).MUpdate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCStringResult(&res, err) } diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index a267cfcb..fe26cd19 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -16,7 +16,6 @@ package main /* #cgo CFLAGS: -I../../../headers - #cgo LDFLAGS: -ljson-c #include "kuzzlesdk.h" */ @@ -56,6 +55,11 @@ func Set_statistics_error(s *C.statistics_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } +// apply a types.KuzzleError on a statistics* C struct +func Set_subscribe_error(s *C.subscribe_result, err error) { + setErr(&s.status, &s.error, &s.stack, err) +} + // apply a types.KuzzleError on a string_array_result* C struct func Set_string_array_result_error(s *C.string_array_result, err error) { setErr(&s.status, &s.error, &s.stack, err) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 00faecaa..29e6af23 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -173,6 +173,20 @@ func goToCStringResult(goRes *string, err error) *C.string_result { return result } +func goToCSubscribeResult(goRes *types.SubscribeResult, err error) *C.subscribe_result { + result := (*C.subscribe_result)(C.calloc(1, C.sizeof_subscribe_result)) + + if err != nil { + Set_subscribe_error(result, err) + return result + } + + result.room = C.CString(goRes.Room) + result.channel = C.CString(goRes.Channel) + + return result +} + func goToCStringArrayResult(goRes []string, err error) *C.string_array_result { result := (*C.string_array_result)(C.calloc(1, C.sizeof_string_array_result)) diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index 49621a4a..65cea6f0 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -23,6 +23,7 @@ package main */ import "C" import ( + "sync" "unsafe" indexPkg "github.com/kuzzleio/sdk-go/index" @@ -30,17 +31,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var indexInstances map[interface{}]bool +var indexInstances sync.Map //register new instance of index func registerIndex(instance interface{}) { - indexInstances[instance] = true + indexInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterIndex func unregisterIndex(i *C.kuzzle_index) { - delete(indexInstances, (*indexPkg.Index)(i.instance)) + indexInstances.Delete(i) } // Allocates memory @@ -49,10 +50,6 @@ func kuzzle_new_index(i *C.kuzzle_index, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) index := indexPkg.NewIndex(kuz) - if indexInstances == nil { - indexInstances = make(map[interface{}]bool) - } - i.instance = unsafe.Pointer(index) i.kuzzle = k diff --git a/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go b/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go deleted file mode 100644 index 8e788794..00000000 --- a/internal/wrappers/cgo/kuzzle/jsonc_wrapper.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2015-2017 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #cgo LDFLAGS: -ljson-c - - #include - #include "kuzzlesdk.h" -*/ -import "C" -import "unsafe" - -func JsonCType(jobj *C.json_object) C.json_type { - // Returning the value directly results in a type mismatch - switch C.json_object_get_type(jobj) { - case C.json_type_null: - return C.json_type_null - case C.json_type_boolean: - return C.json_type_boolean - case C.json_type_double: - return C.json_type_double - case C.json_type_int: - return C.json_type_int - case C.json_type_object: - return C.json_type_object - case C.json_type_array: - return C.json_type_array - default: - return C.json_type_null - } -} - -func JsonCConvert(jobj *C.json_object) interface{} { - if jobj == nil { - return nil - } - - jtype := C.json_object_get_type(jobj) - - switch jtype { - case C.json_type_null: - return nil - case C.json_type_boolean: - return int(C.json_object_get_boolean(jobj)) == 1 - case C.json_type_double: - return float64(C.json_object_get_double(jobj)) - case C.json_type_int: - return int(C.json_object_get_int(jobj)) - case C.json_type_string: - return C.GoString(C.json_object_get_string(jobj)) - case C.json_type_object: - table := C.json_object_get_object(jobj) - content := make(map[string]interface{}) - - if table == nil { - return content - } - - for field, nextField := table.head, table.head; field != nil; field = nextField { - nextField = field.next - - key := (*C.char)(field.k) - value := (*C.json_object)(field.v) - - content[C.GoString(key)] = JsonCConvert(value) - } - - return content - case C.json_type_array: - length := int(C.json_object_array_length(jobj)) - content := make([]interface{}, length) - - for i := 0; i < length; i++ { - content[i] = JsonCConvert(C.json_object_array_get_idx(jobj, C.size_t(i))) - } - - return content - } - - return nil -} - -//export kuzzle_json_new -func kuzzle_json_new(jobj *C.json_object) { - jobj = C.json_object_new_object() -} - -//export kuzzle_json_put -func kuzzle_json_put(jobj *C.json_object, key *C.char, content unsafe.Pointer, kind C.int) { - if kind == 0 { - //string - C.json_object_object_add(jobj, key, C.json_object_new_string((*C.char)(content))) - } else if kind == 1 { - //int - C.json_object_object_add(jobj, key, C.json_object_new_int64((C.int64_t)(*(*C.int)(content)))) - } else if kind == 2 { - //double - C.json_object_object_add(jobj, key, C.json_object_new_double(*(*C.double)(content))) - } else if kind == 3 { - //bool - C.json_object_object_add(jobj, key, C.json_object_new_boolean((C.json_bool)(*(*C.uchar)(content)))) - } else if kind == 4 { - //json_object - C.json_object_object_add(jobj, key, (*C.json_object)(content)) - } -} - -//export kuzzle_json_get_string -func kuzzle_json_get_string(jobj *C.json_object, key *C.char) *C.char { - var value *C.json_object - C.json_object_object_get_ex(jobj, key, &value) - - return C.json_object_get_string(value) -} - -//export kuzzle_json_get_int -func kuzzle_json_get_int(jobj *C.json_object, key *C.char) C.int { - var value *C.json_object - C.json_object_object_get_ex(jobj, key, &value) - - return C.int(C.json_object_get_int64(value)) -} - -//export kuzzle_json_get_double -func kuzzle_json_get_double(jobj *C.json_object, key *C.char) C.double { - var value *C.json_object - C.json_object_object_get_ex(jobj, key, &value) - - return C.json_object_get_double(value) -} - -//export kuzzle_json_get_bool -func kuzzle_json_get_bool(jobj *C.json_object, key *C.char) C.json_bool { - var value *C.json_object - C.json_object_object_get_ex(jobj, key, &value) - - return C.json_object_get_boolean(value) -} - -//export kuzzle_json_get_json_object -func kuzzle_json_get_json_object(jobj *C.json_object, key *C.char) *C.json_object { - var value *C.json_object - - C.json_object_object_get_ex(jobj, key, &value) - return value -} - -//export kuzzle_free_json_object -func kuzzle_free_json_object(jobj *C.json_object) { - if jobj != nil { - // json_object_put returns 1 when the json object is freed - for C.json_object_put(jobj) != 1 { - } - } -} diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index 006a9a28..ec6f9f01 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -24,6 +24,7 @@ package main import "C" import ( "encoding/json" + "sync" "time" "unsafe" @@ -34,30 +35,26 @@ import ( ) // map which stores instances to keep references in case the gc passes -var instances map[interface{}]bool +var instances sync.Map // map which stores channel and function's pointers adresses for listeners var listeners_list map[uintptr]chan<- interface{} // register new instance to the instances map func registerKuzzle(instance interface{}) { - instances[instance] = true + instances.Store(instance, true) } // unregister an instance from the instances map //export unregisterKuzzle func unregisterKuzzle(k *C.kuzzle) { - delete(instances, (*kuzzle.Kuzzle)(k.instance)) + instances.Delete(k) } //export kuzzle_new_kuzzle func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) { var c connection.Connection - if instances == nil { - instances = make(map[interface{}]bool) - } - if listeners_list == nil { listeners_list = make(map[uintptr]chan<- interface{}) } @@ -82,32 +79,61 @@ func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) //export kuzzle_get_document_controller func kuzzle_get_document_controller(k *C.kuzzle) *C.document { - return (*C.document)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Document)) + d := (*C.document)(C.calloc(1, C.sizeof_document)) + + d.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Document)) + d.kuzzle = k + return d } //export kuzzle_get_auth_controller func kuzzle_get_auth_controller(k *C.kuzzle) *C.auth { - return (*C.auth)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Auth)) + a := (*C.auth)(C.calloc(1, C.sizeof_auth)) + + a.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Auth)) + a.kuzzle = k + return a } //export kuzzle_get_index_controller func kuzzle_get_index_controller(k *C.kuzzle) *C.kuzzle_index { - return (*C.kuzzle_index)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Index)) + i := (*C.kuzzle_index)(C.calloc(1, C.sizeof_kuzzle_index)) + + i.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Index)) + i.kuzzle = k + return i +} + +//export kuzzle_get_jwt +func kuzzle_get_jwt(k *C.kuzzle) *C.char { + return C.CString((*kuzzle.Kuzzle)(k.instance).Jwt()) } //export kuzzle_get_server_controller func kuzzle_get_server_controller(k *C.kuzzle) *C.server { - return (*C.server)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Server)) + s := (*C.server)(C.calloc(1, C.sizeof_server)) + + s.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Server)) + s.kuzzle = k + return s } //export kuzzle_get_collection_controller func kuzzle_get_collection_controller(k *C.kuzzle) *C.collection { - return (*C.collection)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Collection)) + c := (*C.collection)(C.calloc(1, C.sizeof_collection)) + + c.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Collection)) + c.kuzzle = k + return c } //export kuzzle_get_realtime_controller func kuzzle_get_realtime_controller(k *C.kuzzle) *C.realtime { - return (*C.realtime)(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Realtime)) + rt := (*C.realtime)(C.calloc(1, C.sizeof_realtime)) + + rt.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Realtime)) + rt.kuzzle = k + return rt } // Allocates memory @@ -196,11 +222,15 @@ func kuzzle_add_listener(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data listeners_list[uintptr(unsafe.Pointer(cb))] = c (*kuzzle.Kuzzle)(k.instance).AddListener(int(e), c) go func() { - res := <-c - - r, _ := json.Marshal(res) - - C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) + for { + res, ok := <-c + if ok == false { + break + } + r, _ := json.Marshal(res) + + C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) + } }() } diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go index 5e786362..9275f96e 100644 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ b/internal/wrappers/cgo/kuzzle/memory_storage.go @@ -16,11 +16,9 @@ package main /* #cgo CFLAGS: -I../../headers - #cgo LDFLAGS: -ljson-c #include #include - #include #include "kuzzlesdk.h" #include "sdk_wrappers_internal.h" @@ -150,13 +148,13 @@ func kuzzle_ms_flushdb(k *C.kuzzle, options *C.query_options) *C.void_result { } //export kuzzle_ms_geoadd -func kuzzle_ms_geoadd(k *C.kuzzle, key *C.char, points **C.json_object, plen C.size_t, options *C.query_options) *C.int_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(points))[:plen:plen] +func kuzzle_ms_geoadd(k *C.kuzzle, key *C.char, points **C.point, plen C.size_t, options *C.query_options) *C.int_result { + wrapped := (*[1 << 20]*C.point)(unsafe.Pointer(points))[:plen:plen] gopoints := make([]*types.GeoPoint, int(plen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, gopoints[i]) } @@ -395,13 +393,13 @@ func kuzzle_ms_hmget(k *C.kuzzle, key *C.char, fields **C.char, flen C.size_t, o } //export kuzzle_ms_hmset -func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.json_object, elen C.size_t, options *C.query_options) *C.void_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(entries))[:elen:elen] +func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.ms_hash_field, elen C.size_t, options *C.query_options) *C.void_result { + wrapped := (*[1 << 20]*C.ms_hash_field)(unsafe.Pointer(entries))[:elen:elen] goentries := make([]*types.MsHashField, int(elen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, goentries[i]) } @@ -629,13 +627,13 @@ func kuzzle_ms_mget(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_ } //export kuzzle_ms_mset -func kuzzle_ms_mset(k *C.kuzzle, entries **C.json_object, elen C.size_t, options *C.query_options) *C.void_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(entries))[:elen:elen] +func kuzzle_ms_mset(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, options *C.query_options) *C.void_result { + wrapped := (*[1 << 20]*C.ms_key_value)(unsafe.Pointer(entries))[:elen:elen] goentries := make([]*types.MSKeyValue, int(elen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, goentries[i]) } @@ -647,13 +645,13 @@ func kuzzle_ms_mset(k *C.kuzzle, entries **C.json_object, elen C.size_t, options } //export kuzzle_ms_msetnx -func kuzzle_ms_msetnx(k *C.kuzzle, entries **C.json_object, elen C.size_t, options *C.query_options) *C.bool_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(entries))[:elen:elen] +func kuzzle_ms_msetnx(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, options *C.query_options) *C.bool_result { + wrapped := (*[1 << 20]*C.ms_key_value)(unsafe.Pointer(entries))[:elen:elen] goentries := make([]*types.MSKeyValue, int(elen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, goentries[i]) } @@ -1073,13 +1071,13 @@ func kuzzle_ms_type(k *C.kuzzle, key *C.char, options *C.query_options) *C.strin } //export kuzzle_ms_zadd -func kuzzle_ms_zadd(k *C.kuzzle, key *C.char, elements **C.json_object, elen C.size_t, options *C.query_options) *C.int_result { - wrapped := (*[1 << 20]*C.json_object)(unsafe.Pointer(elements))[:elen:elen] +func kuzzle_ms_zadd(k *C.kuzzle, key *C.char, elements **C.ms_sorted_set, elen C.size_t, options *C.query_options) *C.int_result { + wrapped := (*[1 << 20]*C.ms_sorted_set)(unsafe.Pointer(elements))[:elen:elen] goelements := make([]*types.MSSortedSet, int(elen)) for i, jobj := range wrapped { - stringified := C.json_object_to_json_string(jobj) - gobytes := C.GoBytes(unsafe.Pointer(stringified), C.int(C.strlen(stringified))) + stringified, _ := json.Marshal(jobj) + gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) json.Unmarshal(gobytes, goelements[i]) } diff --git a/internal/wrappers/cgo/kuzzle/query.go b/internal/wrappers/cgo/kuzzle/query.go index f7e12306..c3e31dcf 100644 --- a/internal/wrappers/cgo/kuzzle/query.go +++ b/internal/wrappers/cgo/kuzzle/query.go @@ -21,6 +21,8 @@ package main */ import "C" import ( + "encoding/json" + "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" ) @@ -70,7 +72,7 @@ func kuzzle_query(k *C.kuzzle, request *C.kuzzle_request, options *C.query_optio } if request.body != nil { - req.Body = request.body + req.Body = json.RawMessage(C.GoString(request.body)) } if request.volatiles != nil { diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index d4ddb189..ebc8d175 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -9,6 +9,7 @@ import "C" import ( "encoding/json" + "sync" "unsafe" "github.com/kuzzleio/sdk-go/kuzzle" @@ -17,17 +18,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var realtimeInstances map[interface{}]bool +var realtimeInstances sync.Map // register new instance to the instances map func registerRealtime(instance interface{}) { - realtimeInstances[instance] = true + realtimeInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterRealtime func unregisterRealtime(rt *C.realtime) { - delete(realtimeInstances, (*realtime.Realtime)(rt.instance)) + realtimeInstances.Delete(rt) } // Allocates memory @@ -36,10 +37,6 @@ func kuzzle_new_realtime(rt *C.realtime, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) gort := realtime.NewRealtime(kuz) - if realtimeInstances == nil { - realtimeInstances = make(map[interface{}]bool) - } - rt.instance = unsafe.Pointer(gort) rt.kuzzle = k @@ -73,17 +70,25 @@ func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result } //export kuzzle_realtime_subscribe -func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.string_result { +func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.subscribe_result { c := make(chan types.KuzzleNotification) + subRes, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) - roomId, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) + if err != nil { + return goToCSubscribeResult(subRes, err) + } go func() { - res := <-c - C.kuzzle_notify(callback, goToCNotificationResult(&res), data) + for { + res, ok := <-c + if ok == false { + break + } + C.kuzzle_notify(callback, goToCNotificationResult(&res), data) + } }() - return goToCStringResult(&roomId, err) + return goToCSubscribeResult(subRes, err) } //export kuzzle_realtime_join diff --git a/internal/wrappers/cgo/kuzzle/server.go b/internal/wrappers/cgo/kuzzle/server.go index 1a568b1b..030da65b 100644 --- a/internal/wrappers/cgo/kuzzle/server.go +++ b/internal/wrappers/cgo/kuzzle/server.go @@ -24,6 +24,7 @@ package main import "C" import ( "strconv" + "sync" "time" "unsafe" @@ -32,17 +33,17 @@ import ( ) // map which stores instances to keep references in case the gc passes -var serverInstances map[interface{}]bool +var serverInstances sync.Map //register new instance of server func registerServer(instance interface{}) { - serverInstances[instance] = true + serverInstances.Store(instance, true) } // unregister an instance from the instances map //export unregisterServer -func unregisterServer(d *C.server) { - delete(serverInstances, (*server.Server)(d.instance)) +func unregisterServer(s *C.server) { + serverInstances.Delete(s) } // Allocates memory @@ -51,10 +52,6 @@ func kuzzle_new_server(s *C.server, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) server := server.NewServer(kuz) - if serverInstances == nil { - serverInstances = make(map[interface{}]bool) - } - s.instance = unsafe.Pointer(server) s.kuzzle = k diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 836faa9e..59cd7d7a 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -15,7 +15,7 @@ #include "auth.hpp" namespace kuzzleio { - Auth::Auth(Kuzzle* kuzzle) { + Auth::Auth(Kuzzle *kuzzle) { _auth = new auth(); kuzzle_new_auth(_auth, kuzzle->_kuzzle); } @@ -54,7 +54,7 @@ namespace kuzzleio { void Auth::deleteMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_delete_my_credentials(_auth, const_cast(strategy.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); delete(r); } diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 30df65b5..1f8d8af2 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -33,7 +33,7 @@ namespace kuzzleio { void Collection::create(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_collection_create(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } @@ -60,7 +60,7 @@ namespace kuzzleio { void Collection::truncate(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); @@ -79,7 +79,7 @@ namespace kuzzleio { void Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); @@ -130,7 +130,7 @@ namespace kuzzleio { void Collection::deleteSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index 43be3c8d..a26f38f6 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -35,14 +35,14 @@ namespace kuzzleio { void Index::create(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_create(_index, const_cast(index.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } void Index::delete_(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_delete(_index, const_cast(index.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } @@ -79,21 +79,21 @@ namespace kuzzleio { void Index::refresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str()), options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } void Index::refreshInternal(query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_refresh_internal(_index, options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } void Index::setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options) Kuz_Throw_KuzzleException { void_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh, options); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp index b3f69c2f..bc2b83a7 100644 --- a/internal/wrappers/cpp/kuzzle.cpp +++ b/internal/wrappers/cpp/kuzzle.cpp @@ -20,9 +20,6 @@ #include "server.hpp" #include "collection.hpp" #include "document.hpp" -#include "auth.hpp" -#include "index.hpp" -#include "server.hpp" #include "realtime.hpp" #include #include @@ -38,13 +35,14 @@ namespace kuzzleio { Kuzzle::Kuzzle(const std::string& host, options *opts) { this->_kuzzle = new kuzzle(); - this->document = new Document(this, kuzzle_get_document_controller(this->_kuzzle)); + kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); + + this->document = new Document(this, kuzzle_get_document_controller(_kuzzle)); this->auth = new Auth(this, kuzzle_get_auth_controller(_kuzzle)); this->index = new Index(this, kuzzle_get_index_controller(_kuzzle)); this->server = new Server(this, kuzzle_get_server_controller(_kuzzle)); - this->collection = new Collection(this, kuzzle_get_collection_controller(this->_kuzzle)); - this->realtime = new Realtime(this, kuzzle_get_realtime_controller(this->_kuzzle)); - kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); + this->collection = new Collection(this, kuzzle_get_collection_controller(_kuzzle)); + this->realtime = new Realtime(this, kuzzle_get_realtime_controller(_kuzzle)); } Kuzzle::~Kuzzle() { @@ -112,6 +110,10 @@ namespace kuzzleio { return std::string(kuzzle_get_volatile(_kuzzle)); } + std::string Kuzzle::getJwt() { + return std::string(kuzzle_get_jwt(_kuzzle)); + } + void trigger_event_listener(int event, char* res, void* data) { ((Kuzzle*)data)->getListeners()[event]->trigger(res); } diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index 895e3115..fde73344 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -35,7 +35,7 @@ namespace kuzzleio { void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, NotificationListener* cb) Kuz_Throw_KuzzleException { void_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), options, call_subscribe_cb, this); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); _listener_instances[roomId] = cb; @@ -53,25 +53,27 @@ namespace kuzzleio { void Realtime::publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException { void_result *r = kuzzle_realtime_publish(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); kuzzle_free_void_result(r); } std::string Realtime::subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options) Kuz_Throw_KuzzleException { - string_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), call_subscribe_cb, this, options); + subscribe_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), &call_subscribe_cb, this, options); if (r->error != NULL) throwExceptionFromStatus(r); - std::string roomId = r->result; + + std::string roomId = r->room; + std::string channel = r->channel; - _listener_instances[roomId] = cb; - kuzzle_free_string_result(r); + _listener_instances[channel] = cb; + kuzzle_free_subscribe_result(r); return roomId; } void Realtime::unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException { void_result *r = kuzzle_realtime_unsubscribe(_realtime, const_cast(roomId.c_str())); - if (r->error != NULL) + if (r != NULL) throwExceptionFromStatus(r); _listener_instances[roomId] = NULL; diff --git a/internal/wrappers/features/e2e.sh b/internal/wrappers/features/e2e.sh new file mode 100755 index 00000000..1054e198 --- /dev/null +++ b/internal/wrappers/features/e2e.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +internal/wrappers/features/run_$1.sh \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/mapping.json b/internal/wrappers/features/fixtures/mapping.json new file mode 100644 index 00000000..7ac15fa6 --- /dev/null +++ b/internal/wrappers/features/fixtures/mapping.json @@ -0,0 +1,7 @@ +{ + "properties": { + "position": { + "type": "geo_point" + } + } +} \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/rights.json b/internal/wrappers/features/fixtures/rights.json new file mode 100644 index 00000000..c9bac576 --- /dev/null +++ b/internal/wrappers/features/fixtures/rights.json @@ -0,0 +1,29 @@ +{ + "controllers": { + "auth": { + "actions": { + "*": true + } + }, + "security": { + "actions": { + "*": true + } + }, + "collection": { + "actions": { + "*": true + } + }, + "index": { + "actions": { + "*": true + } + }, + "document": { + "actions": { + "*": false + } + } + } +} \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/run.sh b/internal/wrappers/features/fixtures/run.sh new file mode 100755 index 00000000..5fb0f138 --- /dev/null +++ b/internal/wrappers/features/fixtures/run.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +CONTENT_TYPE="Content-Type: application/json" +KUZZLE_HOST=http://localhost:7512 + +# update rights for anonymous user +curl -X PUT -H $CONTENT_TYPE -d "`cat rights.json`" $KUZZLE_HOST/roles/anonymous/_update + +# create index +curl -X POST -H $CONTENT_TYPE $KUZZLE_HOST/index/_create + +# create collection +curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/collection + +# create geofence collection +curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/geofence + +#update mapping for geofence collection +curl -X PUT -H $CONTENT_TYPE -d "`cat mapping.json`" $KUZZLE_HOST/index/geofence/_mapping \ No newline at end of file diff --git a/internal/wrappers/features/java/build.gradle b/internal/wrappers/features/java/build.gradle new file mode 100644 index 00000000..93dbb793 --- /dev/null +++ b/internal/wrappers/features/java/build.gradle @@ -0,0 +1,34 @@ +apply plugin: 'java' + +configurations { + cucumberRuntime { + extendsFrom testRuntime + } +} + +compileTestJava { + classpath += files("../../build/java") +} + +task cucumber() { + dependsOn assemble, compileTestJava + doLast { + javaexec { + jvmArgs = ["-Djava.library.path=../../build/java/io/kuzzle/sdk"] + main = "cucumber.api.cli.Main" + classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output + files('../../build/java') + args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', '../'] + } + } +} + +dependencies { + testCompile 'io.cucumber:cucumber-java:2.3.1' + testCompile 'io.cucumber:cucumber-junit:2.3.1' + + testCompile 'junit:junit:4.12' +} + +repositories { + mavenCentral() +} \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java new file mode 100644 index 00000000..33fcc563 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java @@ -0,0 +1,66 @@ +package gradle.cucumber; + +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.*; +import org.junit.Assert; + +public class Geofencedefs { + private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); + private NotificationResult content = null; + private String documentId; + + @Given("^I subscribe to \"([^\"]*)\" collection$") + public void i_subscribe_to_collection(String collection) throws Exception { + String filter = "{" + + "\"geoBoundingBox\": {" + + "\"position\": {" + + "\"topLeft\": {" + + "\"lat\": 10," + + "\"lon\": 1" + + "}," + + "\"bottomRight\": {" + + "\"lat\": 1," + + "\"lon\": 10" + + "}" + + "}" + + "}" + + "}"; + + RoomOptions opts = new RoomOptions(); + opts.setUser("all"); + opts.setState("all"); + opts.setScope("all"); + opts.setSubscribeToSelf(true); + + k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }", 40000); + + k.getRealtime().subscribe("index", collection, filter, new NotificationListener() { + @Override + public void onMessage(NotificationResult res) { + content = res; + } + }, opts); + } + + @When("^I create a document in \"([^\"]*)\" and inside my geofence$") + public void i_create_a_document_in_and_inside_my_geofence(String collection) throws Exception { + System.err.println("create document"); + documentId = k.getDocument().create("index", collection, "", "{\"position\":{\"lat\": 2, \"lon\": 2}}"); + Thread.sleep(1000); + } + + @Then("^I receive a \"([^\"]*)\" notification$") + public void i_receive_a_notification(String scope) throws Exception { + Assert.assertNotNull(content); + Assert.assertEquals(scope, content.getScope()); + } + + @When("^I update this document to be outside my geofence$") + public void i_update_this_document_to_be_outside_my_geofence() throws Exception { + content = null; + k.getDocument().update("index", "geofence", documentId, "{\"position\":{\"lat\": 30, \"lon\": 20}}"); + Thread.sleep(1000); + } +} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java new file mode 100644 index 00000000..3165d9ae --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java @@ -0,0 +1,97 @@ +package gradle.cucumber; + +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.*; +import org.junit.Assert; + +public class Logindefs { + private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); + + @Given("^I create a user \"([^\"]*)\" with password \"([^\"]*)\" with id \"([^\"]*)\"$") + public void CreateUser(String user, String password, String id) { + String json = "{\n" + + " \"content\": {\n" + + " \"profileIds\": [\"default\"]" + + " },\n" + + " \"credentials\": {\n" + + " \"local\": {\n" + + " \"username\": \""+user+"\"," + + " \"password\": \""+password+"\"" + + " }\n" + + " }\n" + + "}"; + + KuzzleRequest request = new KuzzleRequest(); + request.setController("security"); + request.setAction("createUser"); + request.setBody(json); + request.setId(id); + + k.query(request); + } + + @When("^I try to create a document with id \"([^\"]*)\"$") + public void CreateDocument(String id) { + try { + k.getDocument().create("index", "collection", id, "{\"foo\":\"bar\"}"); + } catch(Exception e) {} + } + + @Then("^I check if the document with id \"([^\"]*)\"( does not)? exists$") + public void GetDocument(String id, String does_not_exists) { + boolean raised = false; + try { + k.getDocument().get("index", "collection", id); + } catch (Exception e) { + if (does_not_exists == null) { + Assert.fail("Exception raised: " + e.toString()); + } else { + raised = true; + } + } + if (does_not_exists != null) { + Assert.assertTrue("The document has been created and should not have been.", raised); + } + } + + @When("^I log in as \"([^\"]*)\":\"([^\"]*)\"$") + public void Login(String user, String password) { + String jwt = k.getAuth().login("local", "{\"username\": \""+user+"\", \"password\":\""+password+"\" }"); + Assert.assertNotNull("Jwt should not be null after a right login", jwt); + } + + @Then("^I check the JWT is( not)? null$") + public void CheckJwt(String not) { + if (not != null) { + Assert.assertNotEquals("", k.getJwt()); + } else { + Assert.assertEquals("", k.getJwt()); + } + } + + @When("^I update my credentials with username \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") + public void UpdateMyCredentials(String username, String key, String value) { + try { + k.getAuth().updateMyCredentials("local", "{\"username\": \""+username+"\", \""+key+"\":\""+value+"\"}"); + } catch(Exception e) {} + } + + @Then("^I check my new credentials are( not)? valid with username \"([^\"]*)\", password \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") + public void CheckMyCredentials(String not, String username, String password, String key, String value) { + String credentials = "{\"username\": \""+username+"\", \"password\":\""+password+"\", \""+key+"\":\""+value+"\"}"; + if (not == null) { + Assert.assertTrue(k.getAuth().validateMyCredentials("local", credentials)); + } else { + try { + Assert.assertFalse(k.getAuth().validateMyCredentials("local", credentials)); + } catch(Exception e) {} + } + } + + @Given("^I logout$") + public void Logout() { + k.getAuth().logout(); + } +} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java new file mode 100644 index 00000000..46a07157 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -0,0 +1,48 @@ +package gradle.cucumber; + +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.*; +import org.junit.Assert; + +public class Subscribedefs { + private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); + private String roomId; + private NotificationContent content = null; + + @Given("^I subscribe to \"([^\"]*)\"$") + public void i_subscribe_to(String collection) throws Exception { + k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }", 40000); + + roomId = k.getRealtime().subscribe("index", collection, "{}", new NotificationListener() { + @Override + public void onMessage(NotificationResult res) { + content = res.getResult(); + } + }); + } + + @When("^I create a document in \"([^\"]*)\"$") + public void i_create_a_document_in(String collection) throws Exception { + k.getDocument().create("index", collection, "", "{}"); + Thread.sleep(1000); + } + + @Then("^I( do not)? receive a notification$") + public void i_receive_a_notification(String dont) throws Exception { + if (dont == null) { + Assert.assertNotNull(content); + Assert.assertNotNull(content.getContent()); + content = null; + return; + } + Assert.assertNull(content); + } + + @Given("^I unsubscribe") + public void i_unsubscribe() throws Exception { + k.getRealtime().unsubscribe(roomId); + } + +} diff --git a/internal/wrappers/features/run_java.sh b/internal/wrappers/features/run_java.sh new file mode 100755 index 00000000..78c21113 --- /dev/null +++ b/internal/wrappers/features/run_java.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd internal/wrappers/features/java +taskset -c 1 gradle cucumber \ No newline at end of file diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature new file mode 100644 index 00000000..f457fdaa --- /dev/null +++ b/internal/wrappers/features/sdks.feature @@ -0,0 +1,40 @@ +Feature: SDK's integration tests + + Scenario: Login user + Given I create a user "useradmin" with password "testpwd" with id "useradmin-id" + When I try to create a document with id "my-document" + Then I check if the document with id "my-document" does not exists + + When I log in as "useradmin":"testpwd" + Then I check the JWT is not null + + When I update my credentials with username "useradmin" and "foo" = "bar" + Then I check my new credentials are valid with username "useradmin", password "testpwd" and "foo" = "bar" + + When I try to create a document with id "my-document" + Then I check if the document with id "my-document" exists + + Given I logout + When I update my credentials with username "useradmin" and "foo" = "barz" + Then I check my new credentials are not valid with username "useradmin", password "testpwd" and "foo" = "barz" + Then I check the JWT is null + + Scenario: Subscribe to a collection and receive notifications + Given I subscribe to "collection" + When I create a document in "collection" + Then I receive a notification + + When I create a document in "collection" + Then I receive a notification + + Given I unsubscribe + When I create a document in "collection" + Then I do not receive a notification + + Scenario: Subscribe to a geofence filter + Given I subscribe to "geofence" collection + When I create a document in "geofence" and inside my geofence + Then I receive a "in" notification + + When I update this document to be outside my geofence + Then I receive a "out" notification \ No newline at end of file diff --git a/internal/wrappers/headers/core.hpp b/internal/wrappers/headers/core.hpp index 1bb53937..bd157fd9 100644 --- a/internal/wrappers/headers/core.hpp +++ b/internal/wrappers/headers/core.hpp @@ -21,7 +21,6 @@ extern "C" { #include "kuzzle.h" #include "kuzzlesdk.h" - #include "swig.h" } #endif \ No newline at end of file diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp index 8e5a9d65..310c034f 100644 --- a/internal/wrappers/headers/kuzzle.hpp +++ b/internal/wrappers/headers/kuzzle.hpp @@ -52,6 +52,7 @@ namespace kuzzleio { bool createIndex(const std::string& index, query_options* options=NULL) Kuz_Throw_KuzzleException; statistics* getAllStatistics(query_options* options=NULL) Kuz_Throw_KuzzleException; + std::string getJwt(); statistics* getStatistics(time_t start, time_t end, query_options* options=NULL) Kuz_Throw_KuzzleException; void disconnect(); kuzzle_response* query(kuzzle_request* query, query_options* options=NULL) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index ab7bd455..5972b4bd 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -118,7 +118,7 @@ typedef struct { char *scroll; } search_options; -typedef struct { +typedef struct auth { void *instance; kuzzle *kuzzle; } auth; @@ -133,6 +133,14 @@ typedef struct { kuzzle* kuzzle; } server; +typedef struct { + char *room; + char *channel; + int status; + char *error; + char *stack; +} subscribe_result; + //options passed to room constructor typedef struct { char *scope; @@ -381,6 +389,31 @@ typedef struct geopos_result { char *stack; } geopos_result; +// ms.geopoint +typedef struct point { + float lat; + float lon; + char *name; +} point; + +// ms.msHashField +typedef struct ms_hash_field { + char *field; + char *value; +} ms_hash_field; + +// ms.keyValue +typedef struct ms_key_value { + char *key; + char *value; +} ms_key_value; + +// ms.sortedSet +typedef struct ms_sorted_set { + float score; + char *member; +} ms_sorted_set; + //check_token typedef struct token_validity { bool valid; diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp index 9f17aefe..df8577e5 100644 --- a/internal/wrappers/headers/realtime.hpp +++ b/internal/wrappers/headers/realtime.hpp @@ -19,7 +19,7 @@ namespace kuzzleio { void join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, NotificationListener* cb) Kuz_Throw_KuzzleException; std::string list(const std::string& index, const std::string collection) Kuz_Throw_KuzzleException; void publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; - std::string subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options) Kuz_Throw_KuzzleException; + std::string subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options=NULL) Kuz_Throw_KuzzleException; void unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException; bool validate(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException; diff --git a/internal/wrappers/headers/swig.h b/internal/wrappers/headers/swig.h deleted file mode 100644 index 156c5ef7..00000000 --- a/internal/wrappers/headers/swig.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SWIG_H_ -#define SWIG_H_ - -#define __swig_build - -//Json -extern void kuzzle_json_put(json_object*, char*, void*, int); -extern char* kuzzle_json_get_string(json_object*, char*); -extern int kuzzle_json_get_int(json_object*, char*); -extern double kuzzle_json_get_double(json_object*, char*); -extern json_bool kuzzle_json_get_bool(json_object*, char*); -extern json_object* kuzzle_json_get_json_object(json_object*, char*); -extern void kuzzle_json_new(json_object*); - -#endif \ No newline at end of file diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index e04dbe1e..3eded97a 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -11,8 +11,8 @@ #include "server.hpp" #include "document.hpp" #include "realtime.hpp" +#include "auth.hpp" #include -#include %} %define _Complex @@ -29,3 +29,4 @@ %include "server.hpp" %include "document.hpp" %include "realtime.hpp" +%include "auth.hpp" diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index bce1a4a3..4fb4df92 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -22,6 +22,9 @@ %rename(RoomOptions) room_options; %rename(SearchFilters) search_filters; %rename(SearchResult) search_result; +%rename(NotificationResult) notification_result; +%rename(NotificationContent) notification_content; +%rename(SubscribeToSelf) subscribe_to_self; %ignore *::error; %ignore *::status; diff --git a/internal/wrappers/templates/java/javadoc/collection.i b/internal/wrappers/templates/java/javadoc/collection.i index 1c1ffafc..274027d3 100644 --- a/internal/wrappers/templates/java/javadoc/collection.i +++ b/internal/wrappers/templates/java/javadoc/collection.i @@ -30,28 +30,6 @@ */ public"; -%javamethodmodifiers kuzzleio::Collection::createDocument(Document* document, const std::string& id, query_options* options) " - /** - * Create a new document in kuzzle - * - * @param document the document - * @param id the document id - * @param options Request options - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::createDocument(Document* document, const std::string& id) " - /** - * {@link #createDocument(Document document, String id, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::createDocument(Document* document) " - /** - * {@link #createDocument(Document document, String id, QueryOptions options)} - */ - public"; %javamethodmodifiers kuzzleio::Collection::deleteDocument(const std::string& id, query_options* options) " /** diff --git a/internal/wrappers/templates/java/javadoc/document.i b/internal/wrappers/templates/java/javadoc/document.i index 337dea10..b1340c97 100644 --- a/internal/wrappers/templates/java/javadoc/document.i +++ b/internal/wrappers/templates/java/javadoc/document.i @@ -31,6 +31,26 @@ */ public"; + +%javamethodmodifiers kuzzleio::Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body="", query_options *options) " + /** + * Create a new document in kuzzle + * + * @param index the index where to create the document + * @param collection the collection where to create the document + * @param id the document id + * @param body the content of the document + * @param options Request options + * @return document id + */ + public"; + +%javamethodmodifiers kuzzleio::Collection::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body="") " + /** + * {@link #create(String index, String collection, String id, String body, QueryOptions options)} + */ + public"; + %javamethodmodifiers kuzzleio::Document::delete_(query_options *) " /** * Delete this document from Kuzzle diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index b47b588f..9df5acc6 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -148,8 +148,8 @@ func (k *Kuzzle) UnsetJwt() { k.socket.CancelSubs() } -func (k *Kuzzle) RegisterSub(channel, roomId string, filters json.RawMessage, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { - k.socket.RegisterSub(channel, roomId, filters, notifChan, onReconnectChannel) +func (k *Kuzzle) RegisterSub(channel, roomId string, filters json.RawMessage, subscribeToSelf bool, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { + k.socket.RegisterSub(channel, roomId, filters, subscribeToSelf, notifChan, onReconnectChannel) } func (k *Kuzzle) UnregisterSub(roomId string) { diff --git a/kuzzle/query.go b/kuzzle/query.go index 40509a94..ea460026 100644 --- a/kuzzle/query.go +++ b/kuzzle/query.go @@ -40,7 +40,7 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r type body struct{} if query.Body == nil { - query.Body = make(map[string]interface{}) + query.Body = json.RawMessage("{}") } if options == nil { @@ -63,8 +63,16 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r } jsonRequest, _ := json.Marshal(query) + out := map[string]interface{}{} - json.Unmarshal(jsonRequest, &out) + err := json.Unmarshal(jsonRequest, &out) + + if err != nil { + if responseChannel != nil { + responseChannel <- &types.KuzzleResponse{Error: types.NewError(err.Error())} + } + return + } refresh := options.Refresh() if refresh != "" { @@ -89,6 +97,11 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r out["retryOnConflict"] = retryOnConflict } + jwt := k.Jwt() + if jwt != "" { + out["jwt"] = jwt + } + finalRequest, err := json.Marshal(out) if err != nil { @@ -99,6 +112,7 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r } err = k.socket.Send(finalRequest, options, responseChannel, requestId) + if err != nil { if responseChannel != nil { responseChannel <- &types.KuzzleResponse{Error: types.NewError(err.Error())} diff --git a/realtime/join.go b/realtime/join.go index 0476d181..f1004902 100644 --- a/realtime/join.go +++ b/realtime/join.go @@ -49,6 +49,8 @@ func (r *Realtime) Join(index, collection, roomID string, options types.RoomOpti query.Scope = options.Scope() opts.SetVolatile(options.Volatile()) + } else { + options = types.NewRoomOptions() } go r.k.Query(query, opts, result) @@ -68,7 +70,7 @@ func (r *Realtime) Join(index, collection, roomID string, options types.RoomOpti onReconnect := make(chan interface{}) - r.k.RegisterSub(resSub.Channel, resSub.RoomID, nil, cb, onReconnect) + r.k.RegisterSub(resSub.Channel, resSub.RoomID, nil, options.SubscribeToSelf(), cb, onReconnect) go func() { <-onReconnect diff --git a/realtime/realtime.go b/realtime/realtime.go index 12d5b576..335efacd 100644 --- a/realtime/realtime.go +++ b/realtime/realtime.go @@ -22,6 +22,8 @@ type Realtime struct { } // NewRealtime instanciates a new realtime controller -func NewRealtime(k types.IKuzzle) *Realtime { - return &Realtime{k} +func NewRealtime(kuzzle types.IKuzzle) *Realtime { + return &Realtime{ + k: kuzzle, + } } diff --git a/realtime/subscribe.go b/realtime/subscribe.go index 03326341..c13c4f62 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -22,9 +22,9 @@ import ( ) // Subscribe permits to join a previously created subscription -func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, cb chan<- types.KuzzleNotification, options types.RoomOptions) (string, error) { +func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, cb chan<- types.KuzzleNotification, options types.RoomOptions) (*types.SubscribeResult, error) { if (index == "" || collection == "") || (filters == nil || cb == nil) { - return "", types.NewError("Realtime.Subscribe: index, collection, filters and notificationChannel required", 400) + return nil, types.NewError("Realtime.Subscribe: index, collection, filters and notificationChannel required", 400) } result := make(chan *types.KuzzleResponse) @@ -45,26 +45,28 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, query.Scope = options.Scope() opts.SetVolatile(options.Volatile()) + } else { + options = types.NewRoomOptions() + query.Users = options.Users() + query.State = options.State() + query.Scope = options.Scope() } go r.k.Query(query, opts, result) res := <-result + if res.Error != nil { - return "", res.Error + return nil, res.Error } - var resSub struct { - RequestID string `json:"requestId"` - RoomID string `json:"roomId"` - Channel string `json:"channel"` - } + var resSub types.SubscribeResult json.Unmarshal(res.Result, &resSub) onReconnect := make(chan interface{}) - r.k.RegisterSub(resSub.Channel, resSub.RoomID, filters, cb, onReconnect) + r.k.RegisterSub(resSub.Channel, resSub.Room, filters, options.SubscribeToSelf(), cb, onReconnect) go func() { <-onReconnect @@ -76,5 +78,5 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, r.k.AddListener(event.Reconnected, onReconnect) - return resSub.RoomID, nil + return &resSub, nil } diff --git a/realtime/subscribe_test.go b/realtime/subscribe_test.go index 94a53a8e..6bd682b2 100644 --- a/realtime/subscribe_test.go +++ b/realtime/subscribe_test.go @@ -31,7 +31,7 @@ func TestSubscribeIndexNull(t *testing.T) { nr := realtime.NewRealtime(k) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("", "collection", json.RawMessage("filters"), notifChan, nil) + _, err := nr.Subscribe("", "collection", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.NotNil(t, err) } @@ -41,7 +41,7 @@ func TestSubscribeCollectionNull(t *testing.T) { nr := realtime.NewRealtime(k) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("index", "", json.RawMessage("filters"), notifChan, nil) + _, err := nr.Subscribe("index", "", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.NotNil(t, err) } @@ -66,7 +66,7 @@ func TestSubscribeNotifChannelNull(t *testing.T) { }, nil) nr := realtime.NewRealtime(k) - _, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), nil, nil) + _, err := nr.Subscribe("index", "collection", json.RawMessage(`{"filter": "filter"}`), nil, nil) assert.NotNil(t, err) } @@ -84,7 +84,7 @@ func TestSubscribeQueryError(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) + _, err := nr.Subscribe("index", "collection", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.Equal(t, "ah!", err.Error()) } @@ -102,10 +102,10 @@ func TestRenewWithSubscribeToSelf(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - res, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) + res, err := nr.Subscribe("index", "collection", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.Nil(t, err) assert.NotNil(t, res) - assert.Equal(t, "42", res) + assert.Equal(t, "42", res.Room) } func TestRoomSubscribe(t *testing.T) { @@ -122,10 +122,10 @@ func TestRoomSubscribe(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - res, err := nr.Subscribe("index", "collection", json.RawMessage("filters"), notifChan, nil) + res, err := nr.Subscribe("index", "collection", json.RawMessage(`{"filter": "filter"}`), notifChan, nil) assert.Nil(t, err) assert.NotNil(t, res) - assert.Equal(t, "42", res) + assert.Equal(t, "42", res.Room) } @@ -143,7 +143,7 @@ func TestRoomSubscribeNotConnected(t *testing.T) { c.SetState(state.Connected) notifChan := make(chan<- types.KuzzleNotification) - _, err := nr.Subscribe("collection", "index", json.RawMessage(""), notifChan, nil) + _, err := nr.Subscribe("collection", "index", json.RawMessage("{}"), notifChan, nil) assert.NotNil(t, err) assert.Equal(t, "Not Connected", err.Error()) } diff --git a/realtime/unsubscribe.go b/realtime/unsubscribe.go index 63544ba2..59ae22c4 100644 --- a/realtime/unsubscribe.go +++ b/realtime/unsubscribe.go @@ -15,8 +15,6 @@ package realtime import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" ) @@ -30,7 +28,7 @@ func (r *Realtime) Unsubscribe(roomID string) error { Controller: "realtime", Action: "unsubscribe", Body: struct { - RoomID string `json:"roomID"` + RoomID string `json:"roomId"` }{roomID}, } @@ -44,10 +42,7 @@ func (r *Realtime) Unsubscribe(roomID string) error { return res.Error } - var oldRoomID string - json.Unmarshal(res.Result, &oldRoomID) - - r.k.UnregisterSub(oldRoomID) + r.k.UnregisterSub(roomID) return nil } diff --git a/types/ikuzzle.go b/types/ikuzzle.go index 4af9d962..b476584d 100644 --- a/types/ikuzzle.go +++ b/types/ikuzzle.go @@ -22,7 +22,7 @@ type IKuzzle interface { Query(query *KuzzleRequest, options QueryOptions, responseChannel chan<- *KuzzleResponse) EmitEvent(int, interface{}) SetJwt(string) - RegisterSub(string, string, json.RawMessage, chan<- KuzzleNotification, chan<- interface{}) + RegisterSub(string, string, json.RawMessage, bool, chan<- KuzzleNotification, chan<- interface{}) UnregisterSub(string) AddListener(event int, notifChan chan<- interface{}) AutoResubscribe() bool diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index 9003dab0..ba42c90d 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -29,7 +29,7 @@ type KuzzleRequest struct { Scroll string `json:"scroll,omitempty"` ScrollId string `json:"scrollId,omitempty"` Strategy string `json:"strategy,omitempty"` - ExpiresIn int `json:"expiresIn"` + ExpiresIn int `json:"expiresIn,omitempty"` Volatile VolatileData `json:"volatile"` Scope string `json:"scope"` State string `json:"state"` @@ -70,7 +70,7 @@ type SubscribeQuery struct { Body interface{} `json:"body"` } -type VolatileData json.RawMessage +type VolatileData = json.RawMessage type UserData struct { ProfileIds []string `json:"profileIds"` diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index 9f771908..b6b1cc6a 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -37,6 +37,11 @@ type ( DeletedAt int `json:"deletedAt"` } + SubscribeResult struct { + Room string `json:"roomId"` + Channel string `json:"channel"` + } + // NotificationResult contains NotificationResult struct { Id string `json:"_id"` @@ -60,6 +65,7 @@ type ( User string `json:"user"` Type string `json:"type"` RoomId string `json:"room"` + Channel string `json:"channel"` Timestamp int `json:"timestamp"` Status int `json:"status"` Error *KuzzleError `json:"error"` From c534f7a6e0baceaf0dce50fb1306841c08a8945d Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 25 Apr 2018 15:51:59 +0200 Subject: [PATCH 120/363] wip --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 79ab71a5..4b313af7 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -71,7 +71,7 @@ java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so - taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java + #taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java cd build/java cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class From 1ec2e2e0679c504a5690150e77428ddfa86a993c Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 25 Apr 2018 16:01:37 +0200 Subject: [PATCH 121/363] fix --- internal/wrappers/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index c7d3b9a9..79ab71a5 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -72,7 +72,8 @@ java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - cd $(ROOTOUTDIR)/java && taskset -c 1 $(JAVA_HOME)/bin/jar cf $(OUTDIR)/kuzzlesdk.jar ./io/kuzzle/sdk/*.class && cd - + cd build/java + cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp From a4b6a0d9e8d049970fdbb5bd8d1fe0edec708f90 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 25 Apr 2018 17:44:20 +0200 Subject: [PATCH 122/363] deploy on bintray --- collection/create.go | 6 +----- connection/websocket/web_socket.go | 2 -- internal/wrappers/Makefile | 8 +++++--- internal/wrappers/build/java/build.gradle | 4 ++++ internal/wrappers/cgo/kuzzle/destructors.go | 1 + 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/collection/create.go b/collection/create.go index c2e8f607..cccc8464 100644 --- a/collection/create.go +++ b/collection/create.go @@ -40,9 +40,5 @@ func (dc *Collection) Create(index string, collection string, options types.Quer res := <-ch - if res.Error != nil { - return res.Error - } - - return nil + return res.Error } diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index b4d7a570..35ab3f80 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -185,8 +185,6 @@ func (ws *webSocket) Connect() (bool, error) { ws.EmitEvent(event.Connected, nil) } - // resChan := make(chan []byte) - ws.listenChan = make(chan []byte) go ws.listen() diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 79ab71a5..9be8c480 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -33,7 +33,7 @@ SWIG = swig all: java kcore_wrap.o: kcore_wrap.cxx - $(CPP) -ggdb -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) + $(CPP) -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) %.o: cpp/%.cpp $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ -I./headers -I./build/c/ -L./build/c -lkuzzlesdk @@ -50,7 +50,8 @@ endif wrapper: $(OBJS) object: - $(CPP) -ggdb -shared $(OUTDIR)/kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-$(LANGUAGE).so $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) + $(CPP) -shared $(OUTDIR)/kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-$(LANGUAGE).so $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) + strip $(OUTDIR)/libkuzzle-wrapper-$(LANGUAGE).so posttask: cp -p $(GOTARGET) $(OUTDIR) @@ -72,7 +73,8 @@ java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - cd build/java + mkdir -p build/java/src/main/resources + mv build/java/src/main/java/libkuzzle-wrapper-java.so build/java/src/main/resources cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class diff --git a/internal/wrappers/build/java/build.gradle b/internal/wrappers/build/java/build.gradle index 7e328691..3bdb141b 100644 --- a/internal/wrappers/build/java/build.gradle +++ b/internal/wrappers/build/java/build.gradle @@ -91,6 +91,10 @@ publishing { } } +dependencies { + compile fileTree(dir: 'src/main/java', include: ['*.so']) +} + artifacts { archives sourcesJar archives javadocJar diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 1a5d116c..058f33b3 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -351,6 +351,7 @@ func kuzzle_free_subscribe_result(st *C.subscribe_result) { if st != nil { C.free(unsafe.Pointer(st.room)) C.free(unsafe.Pointer(st.channel)) + C.free(unsafe.Pointer(st)) } } From 0bdbd59a030d179229ea081f19135712c316310a Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 11:07:02 +0200 Subject: [PATCH 123/363] wip --- internal/wrappers/Makefile | 2 +- internal/wrappers/templates/java/core.i | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 9be8c480..b83ae25e 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -75,7 +75,7 @@ java: core swig wrapper object posttask taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java mkdir -p build/java/src/main/resources mv build/java/src/main/java/libkuzzle-wrapper-java.so build/java/src/main/resources - cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar && cd - + cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar jar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 4fb4df92..48271c88 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -64,7 +64,9 @@ %pragma(java) jniclasscode=%{ static { try { - System.loadLibrary("kuzzle-wrapper-java"); + java.nio.file.Path path = java.nio.file.FileSystems.getDefault().getPath("").toAbsolutePath(); + + System.load(path.toString() + "/libs/libkuzzle-wrapper-java.so"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load. \n" + e); System.exit(1); From 8e4a3f3f38364d17fac847db3740ec20b8d6af07 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 12:28:10 +0200 Subject: [PATCH 124/363] symbolic link of io/kuzzle/sdk to src/main/java --- internal/wrappers/Makefile | 6 ++++-- internal/wrappers/features/java/build.gradle | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 79ab71a5..9f2ec323 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -65,7 +65,7 @@ swig: makedir: mkdir -p $(OUTDIR) -java: OUTDIR = $(ROOTOUTDIR)/java/src/main/java +java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux java: LANGUAGE = java java: SWIGOPTS = -package io.kuzzle.sdk @@ -73,7 +73,9 @@ java: core swig wrapper object posttask rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java cd build/java - cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar && cd - + mkdir -p $(ROOTOUTDIR)/java/src/main/java + ln -s $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ + cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar jar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp diff --git a/internal/wrappers/features/java/build.gradle b/internal/wrappers/features/java/build.gradle index 93dbb793..d74ec04d 100644 --- a/internal/wrappers/features/java/build.gradle +++ b/internal/wrappers/features/java/build.gradle @@ -31,4 +31,4 @@ dependencies { repositories { mavenCentral() -} \ No newline at end of file +} From ac8adccefb49b7dc82e46a4bbf014312875008aa Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 12:30:28 +0200 Subject: [PATCH 125/363] clean io folder --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 9f2ec323..b0f595ff 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -103,7 +103,7 @@ cpp: makedir $(CPPSDK) g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build/c build/java/src build/java/build + rm -rf build/c build/java/src build/java/io build/java/build .PHONY: all java csharp python wrapper swig clean object core From 5ecb44d935510710ec5e72e4ac3aaa5d3c800012 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 12:32:06 +0200 Subject: [PATCH 126/363] force ln --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index b0f595ff..bce4026c 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -74,7 +74,7 @@ java: core swig wrapper object posttask taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java cd build/java mkdir -p $(ROOTOUTDIR)/java/src/main/java - ln -s $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ + ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar jar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class From 8a04a04acee85ef7f8778ab16fbd1c814fa6e808 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 16:11:04 +0200 Subject: [PATCH 127/363] dynamically load .so and publish on bintray according to the architecture --- internal/wrappers/.gitignore | 2 +- internal/wrappers/Makefile | 2 +- internal/wrappers/build/java/build.gradle | 8 +++--- internal/wrappers/templates/java/core.i | 31 +++++++++++++++++++---- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/internal/wrappers/.gitignore b/internal/wrappers/.gitignore index b168d375..126d7075 100644 --- a/internal/wrappers/.gitignore +++ b/internal/wrappers/.gitignore @@ -5,4 +5,4 @@ kcore_wrap.c # build -build/c build/java/build build/java/src +build/c build/java/build build/java/src build/java/io diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 81b89c64..28fba4a3 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -78,7 +78,7 @@ java: core swig wrapper object posttask cd build/java mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ - cd build/java && taskset -c 1 ./gradlew sourcesJar javadocJar jar && cd - + cd build/java && taskset -c 1 ./gradlew sourcesJar jar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp diff --git a/internal/wrappers/build/java/build.gradle b/internal/wrappers/build/java/build.gradle index 3bdb141b..6848fca3 100644 --- a/internal/wrappers/build/java/build.gradle +++ b/internal/wrappers/build/java/build.gradle @@ -32,13 +32,13 @@ task javadocJar(type: Jar, dependsOn: javadoc) { } bintray { - user = 'kuzzle' - key = 'b4a4759238efa82a33b45bd9fbcf9c4cd42a2db9' + user = System.getenv('BINTRAY_USER') + key = System.getenv('BINTRAY_KEY') publications = ['MyPublication'] pkg { repo = 'maven' - name = 'kuzzle-sdk' + name = 'kuzzle-sdk-' + System.getenv('ARCH') userOrg = 'kuzzle' licenses = ['Apache-2.0'] desc = 'Kuzzle JAVA SDK' @@ -78,7 +78,7 @@ publishing { artifact sourcesJar artifact javadocJar groupId 'io.kuzzle' - artifactId 'kuzzle-sdk' + artifactId 'kuzzle-sdk-' + System.getenv('ARCH') version version pom.withXml { def root = asNode() diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 48271c88..ad674c1c 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -64,12 +64,33 @@ %pragma(java) jniclasscode=%{ static { try { - java.nio.file.Path path = java.nio.file.FileSystems.getDefault().getPath("").toAbsolutePath(); - - System.load(path.toString() + "/libs/libkuzzle-wrapper-java.so"); + System.loadLibrary("kuzzle-wrapper-java"); } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. \n" + e); - System.exit(1); + try { + java.io.InputStream inputStream = kcoreJNI.class.getResourceAsStream("/libkuzzle-wrapper-java.so"); + java.nio.file.Path path = java.nio.file.FileSystems.getDefault().getPath("").toAbsolutePath(); + String sharedObject = path.toString() + "/libs/libkuzzle-wrapper-java.so"; + + try { + java.io.File folder = new java.io.File(path.toString() + "/libs/"); + folder.mkdir(); + } catch(Exception ee) {} + + java.io.OutputStream outputStream = new java.io.FileOutputStream(new java.io.File(sharedObject)); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + outputStream.write(bytes, 0, read); + } + + System.load(path.toString() + "/libs/libkuzzle-wrapper-java.so"); + } catch (Exception ex) { + System.err.println("Native code library failed to load. \n"); + ex.printStackTrace(); + System.exit(1); + } } } %} From 74cbb804fe882905a8d5d684fe8b2da600c89c3f Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 16:21:26 +0200 Subject: [PATCH 128/363] fix path in Makefile --- internal/wrappers/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 28fba4a3..4c0a669d 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -73,12 +73,11 @@ java: SWIGOPTS = -package io.kuzzle.sdk java: core swig wrapper object posttask rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - mkdir -p build/java/src/main/resources - mv build/java/src/main/java/libkuzzle-wrapper-java.so build/java/src/main/resources - cd build/java - mkdir -p $(ROOTOUTDIR)/java/src/main/java + mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources + mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources + mkdir -p $(ROOTOUTDIR)/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ - cd build/java && taskset -c 1 ./gradlew sourcesJar jar javadocJar && cd - + cd build/java && taskset -c 1 ./gradlew sourcesJar jarjavadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp From 7a16383b9fc2f82e247b514d89bf9bebd72a16ed Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 16:26:14 +0200 Subject: [PATCH 129/363] fix mkdir --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 4c0a669d..9879dede 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -75,7 +75,7 @@ java: core swig wrapper object posttask taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources - mkdir -p $(ROOTOUTDIR)/src/main/java + mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ cd build/java && taskset -c 1 ./gradlew sourcesJar jarjavadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class From 8b4df4ae5133e271b23c232ea91243b81f9d2746 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 16:27:53 +0200 Subject: [PATCH 130/363] execute gradlew with sh --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 9879dede..0fe5b1cb 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -77,7 +77,7 @@ java: core swig wrapper object posttask mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ - cd build/java && taskset -c 1 ./gradlew sourcesJar jarjavadocJar && cd - + cd build/java && taskset -c 1 sh gradlew sourcesJar jarjavadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp From 9cc94156d9c9bd83086f2d6e45efff46845e63a0 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 16:30:25 +0200 Subject: [PATCH 131/363] fix Makefile --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 0fe5b1cb..e5960530 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -77,7 +77,7 @@ java: core swig wrapper object posttask mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ - cd build/java && taskset -c 1 sh gradlew sourcesJar jarjavadocJar && cd - + cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class csharp: OUTDIR = $(ROOTOUTDIR)/csharp From 09084f4948b64d19958f58f6466fa720c575347d Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 16:38:39 +0200 Subject: [PATCH 132/363] update readme --- README.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dceed973..98614508 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build Status](https://travis-ci.org/kuzzleio/sdk-go.svg?branch=master)](https://travis-ci.org/kuzzleio/sdk-go) [![codecov.io](http://codecov.io/github/kuzzleio/sdk-php/coverage.svg?branch=master)](http://codecov.io/github/kuzzleio/sdk-go?branch=master) [![GoDoc](https://godoc.org/github.com/kuzzleio/sdk-go?status.svg)](https://godoc.org/github.com/kuzzleio/sdk-go) -Official Kuzzle GO SDK +Official Kuzzle GO SDK with wrappers for C++ and JAVA SDK ====== ## About Kuzzle @@ -67,6 +67,42 @@ To run e2e tests ensure you have a kuzzle running and then run ./internal/wrappers/features/e2e.sh ``` +## Wrappers + +### Dependencies + +Before generating the wrappers you will need to install: + +- [swig](www.swig.org) +- [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) (don't forget to set your JAVA_HOME environment variable) + +### Generate + +## JAVA + +```sh +make java +``` + +You will find the final jars files in `internal/wrappers/build/java/build/libs` + +## CP + +```sh +make cpp +``` +You will find the final .so file in `internal/wrappers/build/cpp` + +## All at once + +You can generate all sdk's at once by typing + +```sh +make all +``` + +You will be able to find the final + ## License [Apache 2](LICENSE.md) From 54443eff9e53d140df3fb0c99c8d27a23ab31c7a Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 16:39:49 +0200 Subject: [PATCH 133/363] fix readme --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 98614508..6a45897a 100644 --- a/README.md +++ b/README.md @@ -101,8 +101,6 @@ You can generate all sdk's at once by typing make all ``` -You will be able to find the final - ## License [Apache 2](LICENSE.md) From 5d2be2dde323e8fe18ac96379845bc5f2f633fca Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 26 Apr 2018 17:37:32 +0200 Subject: [PATCH 134/363] change java.library.path of cucumber --- internal/wrappers/features/java/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/features/java/build.gradle b/internal/wrappers/features/java/build.gradle index d74ec04d..4301227a 100644 --- a/internal/wrappers/features/java/build.gradle +++ b/internal/wrappers/features/java/build.gradle @@ -14,7 +14,7 @@ task cucumber() { dependsOn assemble, compileTestJava doLast { javaexec { - jvmArgs = ["-Djava.library.path=../../build/java/io/kuzzle/sdk"] + jvmArgs = ["-Djava.library.path=../../build/io/kuzzle/sdk/resources"] main = "cucumber.api.cli.Main" classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output + files('../../build/java') args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', '../'] From a34240501767c29e70e11f2cdab30787ee020059 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 27 Apr 2018 09:35:43 +0200 Subject: [PATCH 135/363] rename void_result to error_result --- internal/wrappers/cgo/kuzzle/auth.go | 4 +- internal/wrappers/cgo/kuzzle/collection.go | 16 ++++---- internal/wrappers/cgo/kuzzle/destructors.go | 4 +- internal/wrappers/cgo/kuzzle/errors.go | 2 +- internal/wrappers/cgo/kuzzle/go_to_c.go | 6 +-- internal/wrappers/cgo/kuzzle/index.go | 20 +++++----- .../wrappers/cgo/kuzzle/memory_storage.go | 40 +++++++++---------- internal/wrappers/cgo/kuzzle/realtime.go | 12 +++--- internal/wrappers/cgo/kuzzle/security.go | 20 +++++----- internal/wrappers/cpp/auth.cpp | 2 +- internal/wrappers/cpp/collection.cpp | 16 ++++---- internal/wrappers/cpp/index.cpp | 20 +++++----- internal/wrappers/cpp/realtime.cpp | 12 +++--- internal/wrappers/headers/kuzzlesdk.h | 4 +- 14 files changed, 89 insertions(+), 89 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 8732ace5..2a7a0cd7 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -96,12 +96,12 @@ func kuzzle_credentials_exist(a *C.auth, strategy *C.char, options *C.query_opti } //export kuzzle_delete_my_credentials -func kuzzle_delete_my_credentials(a *C.auth, strategy *C.char, options *C.query_options) *C.void_result { +func kuzzle_delete_my_credentials(a *C.auth, strategy *C.char, options *C.query_options) *C.error_result { err := (*auth.Auth)(a.instance).DeleteMyCredentials( C.GoString(strategy), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_get_current_user diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 580d8084..8d5aefba 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -56,15 +56,15 @@ func kuzzle_new_collection(c *C.collection, k *C.kuzzle) { } //export kuzzle_collection_create -func kuzzle_collection_create(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.void_result { +func kuzzle_collection_create(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.error_result { err := (*collection.Collection)(c.instance).Create(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_collection_truncate -func kuzzle_collection_truncate(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.void_result { +func kuzzle_collection_truncate(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.error_result { err := (*collection.Collection)(c.instance).Truncate(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_collection_exists @@ -92,18 +92,18 @@ func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char, } //export kuzzle_collection_update_mapping -func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.void_result { +func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.error_result { newBody, _ := json.Marshal(body) err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), newBody, SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } // Specifications //export kuzzle_collection_delete_specifications -func kuzzle_collection_delete_specifications(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.void_result { +func kuzzle_collection_delete_specifications(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.error_result { err := (*collection.Collection)(c.instance).DeleteSpecifications(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_collection_get_specifications diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 1a5d116c..9944468f 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -721,8 +721,8 @@ func kuzzle_free_mapping_result(st *C.mapping_result) { } } -//export kuzzle_free_void_result -func kuzzle_free_void_result(st *C.void_result) { +//export kuzzle_free_error_result +func kuzzle_free_error_result(st *C.error_result) { if st != nil { C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index fe26cd19..744564a8 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -165,7 +165,7 @@ func Set_collection_entry_error(s *C.collection_entry_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } -func Set_void_result_error(s *C.void_result, err error) { +func Set_error_result_error(s *C.error_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 29e6af23..bd27bb71 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -744,13 +744,13 @@ func fillStatistics(src *types.Statistics, dest *C.statistics) { } // Allocates memory -func goToCVoidResult(err error) *C.void_result { +func goToCErrorResult(err error) *C.error_result { if err == nil { return nil } - result := (*C.void_result)(C.calloc(1, C.sizeof_void_result)) - Set_void_result_error(result, err) + result := (*C.error_result)(C.calloc(1, C.sizeof_error_result)) + Set_error_result_error(result, err) return result } diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index 65cea6f0..b5e4737f 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -57,15 +57,15 @@ func kuzzle_new_index(i *C.kuzzle_index, k *C.kuzzle) { } //export kuzzle_index_create -func kuzzle_index_create(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.void_result { +func kuzzle_index_create(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.error_result { err := (*indexPkg.Index)(i.instance).Create(C.GoString(index), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_index_delete -func kuzzle_index_delete(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.void_result { +func kuzzle_index_delete(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.error_result { err := (*indexPkg.Index)(i.instance).Delete(C.GoString(index), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_index_mdelete @@ -81,21 +81,21 @@ func kuzzle_index_exists(i *C.kuzzle_index, index *C.char, options *C.query_opti } //export kuzzle_index_refresh -func kuzzle_index_refresh(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.void_result { +func kuzzle_index_refresh(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.error_result { err := (*indexPkg.Index)(i.instance).Refresh(C.GoString(index), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_index_refresh_internal -func kuzzle_index_refresh_internal(i *C.kuzzle_index, options *C.query_options) *C.void_result { +func kuzzle_index_refresh_internal(i *C.kuzzle_index, options *C.query_options) *C.error_result { err := (*indexPkg.Index)(i.instance).RefreshInternal(SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_index_set_auto_refresh -func kuzzle_index_set_auto_refresh(i *C.kuzzle_index, index *C.char, autoRefresh C.bool, options *C.query_options) *C.void_result { +func kuzzle_index_set_auto_refresh(i *C.kuzzle_index, index *C.char, autoRefresh C.bool, options *C.query_options) *C.error_result { err := (*indexPkg.Index)(i.instance).SetAutoRefresh(C.GoString(index), bool(autoRefresh), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_index_get_auto_refresh diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go index 9275f96e..a59a27d3 100644 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ b/internal/wrappers/cgo/kuzzle/memory_storage.go @@ -141,10 +141,10 @@ func kuzzle_ms_expireat(k *C.kuzzle, key *C.char, ts C.ulonglong, options *C.que } //export kuzzle_ms_flushdb -func kuzzle_ms_flushdb(k *C.kuzzle, options *C.query_options) *C.void_result { +func kuzzle_ms_flushdb(k *C.kuzzle, options *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Flushdb(SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_geoadd @@ -393,7 +393,7 @@ func kuzzle_ms_hmget(k *C.kuzzle, key *C.char, fields **C.char, flen C.size_t, o } //export kuzzle_ms_hmset -func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.ms_hash_field, elen C.size_t, options *C.query_options) *C.void_result { +func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.ms_hash_field, elen C.size_t, options *C.query_options) *C.error_result { wrapped := (*[1 << 20]*C.ms_hash_field)(unsafe.Pointer(entries))[:elen:elen] goentries := make([]*types.MsHashField, int(elen)) @@ -408,7 +408,7 @@ func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.ms_hash_field, elen C goentries, SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_hscan @@ -586,25 +586,25 @@ func kuzzle_ms_lrem(k *C.kuzzle, key *C.char, count C.long, value *C.char, optio } //export kuzzle_ms_lset -func kuzzle_ms_lset(k *C.kuzzle, key *C.char, index C.long, value *C.char, options *C.query_options) *C.void_result { +func kuzzle_ms_lset(k *C.kuzzle, key *C.char, index C.long, value *C.char, options *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Lset( C.GoString(key), int(index), C.GoString(value), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_ltrim -func kuzzle_ms_ltrim(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.void_result { +func kuzzle_ms_ltrim(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Ltrim( C.GoString(key), int(start), int(stop), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_mget @@ -627,7 +627,7 @@ func kuzzle_ms_mget(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_ } //export kuzzle_ms_mset -func kuzzle_ms_mset(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, options *C.query_options) *C.void_result { +func kuzzle_ms_mset(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, options *C.query_options) *C.error_result { wrapped := (*[1 << 20]*C.ms_key_value)(unsafe.Pointer(entries))[:elen:elen] goentries := make([]*types.MSKeyValue, int(elen)) @@ -641,7 +641,7 @@ func kuzzle_ms_mset(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, option goentries, SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_msetnx @@ -721,13 +721,13 @@ func kuzzle_ms_pfcount(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.que } //export kuzzle_ms_pfmerge -func kuzzle_ms_pfmerge(k *C.kuzzle, key *C.char, sources **C.char, slen C.size_t, options *C.query_options) *C.void_result { +func kuzzle_ms_pfmerge(k *C.kuzzle, key *C.char, sources **C.char, slen C.size_t, options *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Pfmerge( C.GoString(key), cToGoStrings(sources, slen), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_ping @@ -739,14 +739,14 @@ func kuzzle_ms_ping(k *C.kuzzle, options *C.query_options) *C.string_result { } //export kuzzle_ms_psetex -func kuzzle_ms_psetex(k *C.kuzzle, key *C.char, value *C.char, ttl C.ulong, options *C.query_options) *C.void_result { +func kuzzle_ms_psetex(k *C.kuzzle, key *C.char, value *C.char, ttl C.ulong, options *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Psetex( C.GoString(key), C.GoString(value), int(ttl), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_pttl @@ -767,13 +767,13 @@ func kuzzle_ms_randomkey(k *C.kuzzle, options *C.query_options) *C.string_result } //export kuzzle_ms_rename -func kuzzle_ms_rename(k *C.kuzzle, key *C.char, newkey *C.char, options *C.query_options) *C.void_result { +func kuzzle_ms_rename(k *C.kuzzle, key *C.char, newkey *C.char, options *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Rename( C.GoString(key), C.GoString(newkey), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_renamenx @@ -878,24 +878,24 @@ func kuzzle_ms_sdiffstore(k *C.kuzzle, key *C.char, keys **C.char, klen C.size_t } //export kuzzle_ms_set -func kuzzle_ms_set(k *C.kuzzle, key *C.char, value *C.char, options *C.query_options) *C.void_result { +func kuzzle_ms_set(k *C.kuzzle, key *C.char, value *C.char, options *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Set( C.GoString(key), C.GoString(value), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_setex -func kuzzle_ms_setex(k *C.kuzzle, key *C.char, value *C.char, ttl C.ulong, options *C.query_options) *C.void_result { +func kuzzle_ms_setex(k *C.kuzzle, key *C.char, value *C.char, ttl C.ulong, options *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Setex( C.GoString(key), C.GoString(value), int(ttl), SetQueryOptions(options)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_ms_setnx diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index ebc8d175..94ed6013 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -58,15 +58,15 @@ func kuzzle_realtime_list(rt *C.realtime, index, collection *C.char) *C.string_r } //export kuzzle_realtime_publish -func kuzzle_realtime_publish(rt *C.realtime, index, collection, body *C.char) *C.void_result { +func kuzzle_realtime_publish(rt *C.realtime, index, collection, body *C.char) *C.error_result { err := (*realtime.Realtime)(rt.instance).Publish(C.GoString(index), C.GoString(collection), C.GoString(body)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_realtime_unsubscribe -func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.void_result { +func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char) *C.error_result { err := (*realtime.Realtime)(rt.instance).Unsubscribe(C.GoString(roomId)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_realtime_subscribe @@ -92,7 +92,7 @@ func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, } //export kuzzle_realtime_join -func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, options *C.room_options, callback C.kuzzle_notification_listener, data unsafe.Pointer) *C.void_result { +func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, options *C.room_options, callback C.kuzzle_notification_listener, data unsafe.Pointer) *C.error_result { c := make(chan types.KuzzleNotification) err := (*realtime.Realtime)(rt.instance).Join(C.GoString(index), C.GoString(collection), C.GoString(roomId), SetRoomOptions(options), c) @@ -102,7 +102,7 @@ func kuzzle_realtime_join(rt *C.realtime, index, collection, roomId *C.char, opt C.kuzzle_notify(callback, goToCNotificationResult(&res), data) }() - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_realtime_validate diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go index 5d8ec229..f94b2006 100644 --- a/internal/wrappers/cgo/kuzzle/security.go +++ b/internal/wrappers/cgo/kuzzle/security.go @@ -293,9 +293,9 @@ func kuzzle_security_delete_user(k *C.kuzzle, id *C.char, o *C.query_options) *C } //export kuzzle_security_delete_credentials -func kuzzle_security_delete_credentials(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.void_result { +func kuzzle_security_delete_credentials(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteCredentials(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_security_create_profile @@ -387,9 +387,9 @@ func kuzzle_security_replace_user(k *C.kuzzle, id, content *C.char, o *C.query_o } //export kuzzle_security_update_credentials -func kuzzle_security_update_credentials(k *C.kuzzle, strategy *C.char, id *C.char, body *C.char, o *C.query_options) *C.void_result { +func kuzzle_security_update_credentials(k *C.kuzzle, strategy *C.char, id *C.char, body *C.char, o *C.query_options) *C.error_result { err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateCredentials(C.GoString(strategy), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_security_update_profile @@ -409,10 +409,10 @@ func kuzzle_security_update_profile(k *C.kuzzle, id *C.char, body *C.char, o *C. } //export kuzzle_security_update_profile_mapping -func kuzzle_security_update_profile_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { +func kuzzle_security_update_profile_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.error_result { options := SetQueryOptions(o) err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfileMapping(json.RawMessage(C.GoString(body)), options) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_security_update_role @@ -432,10 +432,10 @@ func kuzzle_security_update_role(k *C.kuzzle, id *C.char, body *C.char, o *C.que } //export kuzzle_security_update_role_mapping -func kuzzle_security_update_role_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { +func kuzzle_security_update_role_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.error_result { options := SetQueryOptions(o) err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRoleMapping(json.RawMessage(C.GoString(body)), options) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_security_update_user @@ -445,10 +445,10 @@ func kuzzle_security_update_user(k *C.kuzzle, id *C.char, body *C.char, o *C.que } //export kuzzle_security_update_user_mapping -func kuzzle_security_update_user_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.void_result { +func kuzzle_security_update_user_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.error_result { options := SetQueryOptions(o) err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUserMapping(json.RawMessage(C.GoString(body)), options) - return goToCVoidResult(err) + return goToCErrorResult(err) } //export kuzzle_security_is_action_allowed diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 59cd7d7a..e7ca859f 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -53,7 +53,7 @@ namespace kuzzleio { } void Auth::deleteMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_delete_my_credentials(_auth, const_cast(strategy.c_str()), options); + error_result *r = kuzzle_delete_my_credentials(_auth, const_cast(strategy.c_str()), options); if (r != NULL) throwExceptionFromStatus(r); delete(r); diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 1f8d8af2..68be2e6d 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -32,10 +32,10 @@ namespace kuzzleio { } void Collection::create(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_create(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); + error_result *r = kuzzle_collection_create(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } bool Collection::exists(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { @@ -59,11 +59,11 @@ namespace kuzzleio { } void Collection::truncate(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); + error_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } std::string Collection::getMapping(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { @@ -78,11 +78,11 @@ namespace kuzzleio { } void Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); + error_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } std::string Collection::getSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { @@ -129,10 +129,10 @@ namespace kuzzleio { } void Collection::deleteSpecifications(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); + error_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } } diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index a26f38f6..f79593fb 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -34,17 +34,17 @@ namespace kuzzleio { } void Index::create(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_create(_index, const_cast(index.c_str()), options); + error_result *r = kuzzle_index_create(_index, const_cast(index.c_str()), options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } void Index::delete_(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_delete(_index, const_cast(index.c_str()), options); + error_result *r = kuzzle_index_delete(_index, const_cast(index.c_str()), options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } std::vector Index::mDelete(const std::vector& indexes, query_options *options) Kuz_Throw_KuzzleException { @@ -78,24 +78,24 @@ namespace kuzzleio { } void Index::refresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str()), options); + error_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str()), options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } void Index::refreshInternal(query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_refresh_internal(_index, options); + error_result *r = kuzzle_index_refresh_internal(_index, options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } void Index::setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh, options); + error_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh, options); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } bool Index::getAutoRefresh(const std::string& index, query_options *options) Kuz_Throw_KuzzleException { diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index fde73344..28a3a6c2 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -34,12 +34,12 @@ namespace kuzzleio { } void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, NotificationListener* cb) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), options, call_subscribe_cb, this); + error_result *r = kuzzle_realtime_join(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), options, call_subscribe_cb, this); if (r != NULL) throwExceptionFromStatus(r); _listener_instances[roomId] = cb; - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } std::string Realtime::list(const std::string& index, const std::string collection) Kuz_Throw_KuzzleException { @@ -52,10 +52,10 @@ namespace kuzzleio { } void Realtime::publish(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_realtime_publish(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); + error_result *r = kuzzle_realtime_publish(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str())); if (r != NULL) throwExceptionFromStatus(r); - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } std::string Realtime::subscribe(const std::string& index, const std::string collection, const std::string body, NotificationListener* cb, room_options* options) Kuz_Throw_KuzzleException { @@ -72,12 +72,12 @@ namespace kuzzleio { } void Realtime::unsubscribe(const std::string& roomId) Kuz_Throw_KuzzleException { - void_result *r = kuzzle_realtime_unsubscribe(_realtime, const_cast(roomId.c_str())); + error_result *r = kuzzle_realtime_unsubscribe(_realtime, const_cast(roomId.c_str())); if (r != NULL) throwExceptionFromStatus(r); _listener_instances[roomId] = NULL; - kuzzle_free_void_result(r); + kuzzle_free_error_result(r); } bool Realtime::validate(const std::string& index, const std::string collection, const std::string body) Kuz_Throw_KuzzleException { diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 5972b4bd..c20bad07 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -443,11 +443,11 @@ typedef struct kuzzle_response { } kuzzle_response; //any void result -typedef struct void_result { +typedef struct error_result { int status; char *error; char *stack; -} void_result; +} error_result; //any json result typedef struct json_result { From 62aaa4488e89d67d7487ecf449bda09831ba7586 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 27 Apr 2018 09:57:55 +0200 Subject: [PATCH 136/363] remove io folder on clean --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index e5960530..357b31c2 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -105,7 +105,7 @@ cpp: makedir $(CPPSDK) g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build/c build/java/src build/java/io build/java/build + rm -rf build/c build/java/src build/java/io build/java/build build/io .PHONY: all java csharp python wrapper swig clean object core From c5653980d74fbc1130e59e7bf24ef728de8a59ff Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 27 Apr 2018 10:04:42 +0200 Subject: [PATCH 137/363] build cpp build --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index bce4026c..146f31fa 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -23,7 +23,6 @@ OBJS = $(SRCS:.cxx=.o) CPPSRCS = kuzzle.cpp \ document.cpp \ collection.cpp \ - room.cpp \ kcore_wrap.cxx CPPSDK = $(CPPSRCS:.cpp=.o) @@ -99,6 +98,7 @@ python: core swig wrapper makedir cpp: OUTDIR = $(ROOTOUTDIR)/cpp cpp: makedir $(CPPSDK) +cpp: core ar rvs $(OUTDIR)/libcpp.a $(OUTDIR)/*.o g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive From 3250cb525bf9e7e9b8f464e4c28572e7cc3903b0 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 27 Apr 2018 10:24:25 +0200 Subject: [PATCH 138/363] compile missing sources --- internal/wrappers/Makefile | 5 ++++- internal/wrappers/cpp/auth.cpp | 1 + internal/wrappers/cpp/server.cpp | 1 + internal/wrappers/headers/auth.hpp | 3 +++ internal/wrappers/headers/event_emitter.hpp | 4 +++- internal/wrappers/headers/realtime.hpp | 1 + 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 146f31fa..6a39f056 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -20,9 +20,12 @@ LIBS = -lkuzzlesdk SRCS = kcore_wrap.cxx OBJS = $(SRCS:.cxx=.o) -CPPSRCS = kuzzle.cpp \ +CPPSRCS = kuzzle.cpp \ document.cpp \ collection.cpp \ + realtime.cpp \ + auth.cpp \ + server.cpp \ kcore_wrap.cxx CPPSDK = $(CPPSRCS:.cpp=.o) diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index 59cd7d7a..a4260e79 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "kuzzle.hpp" #include "auth.hpp" namespace kuzzleio { diff --git a/internal/wrappers/cpp/server.cpp b/internal/wrappers/cpp/server.cpp index 8a62a056..a3d28488 100644 --- a/internal/wrappers/cpp/server.cpp +++ b/internal/wrappers/cpp/server.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "kuzzle.hpp" #include "server.hpp" namespace kuzzleio { diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp index f18bd651..f19a460c 100644 --- a/internal/wrappers/headers/auth.hpp +++ b/internal/wrappers/headers/auth.hpp @@ -19,6 +19,9 @@ #include "core.hpp" namespace kuzzleio { + + class Kuzzle; + class Auth { auth *_auth; Auth(); diff --git a/internal/wrappers/headers/event_emitter.hpp b/internal/wrappers/headers/event_emitter.hpp index 807c7293..9f56c9f0 100644 --- a/internal/wrappers/headers/event_emitter.hpp +++ b/internal/wrappers/headers/event_emitter.hpp @@ -16,9 +16,11 @@ #define _EVENT_EMITTER_HPP_ #include "kuzzle.hpp" -#include "listeners.hpp" namespace kuzzleio { + + class EventListener; + class KuzzleEventEmitter { public: virtual KuzzleEventEmitter* addListener(Event e, EventListener* listener) = 0; diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp index df8577e5..701f0266 100644 --- a/internal/wrappers/headers/realtime.hpp +++ b/internal/wrappers/headers/realtime.hpp @@ -3,6 +3,7 @@ #include "exceptions.hpp" #include "core.hpp" +#include "listeners.hpp" #include namespace kuzzleio { From 80d6f09e12507214256849227b1c7d2e0641fddb Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 27 Apr 2018 10:29:48 +0200 Subject: [PATCH 139/363] do a go get before making core --- internal/wrappers/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index bce4026c..2a619fc8 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -43,6 +43,7 @@ ifeq ($(wildcard $(GOCC)),) $(error "Unable to find go compiler") endif mkdir -p $(GOTARGETDIR) + cd ../../ && go get ./... ; cd - $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h From 8a90a399f08e1f424936eca8a9602bd7ee029750 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 27 Apr 2018 11:52:20 +0200 Subject: [PATCH 140/363] compile right sources for cpp --- internal/wrappers/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 6a39f056..f2669614 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -28,7 +28,14 @@ CPPSRCS = kuzzle.cpp \ server.cpp \ kcore_wrap.cxx -CPPSDK = $(CPPSRCS:.cpp=.o) +CPP_SDK_SRCS = kuzzle.cpp \ + document.cpp \ + collection.cpp \ + realtime.cpp \ + auth.cpp \ + server.cpp + +CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) SWIG = swig @@ -101,12 +108,13 @@ python: core swig wrapper makedir cpp: OUTDIR = $(ROOTOUTDIR)/cpp cpp: makedir $(CPPSDK) +cpp: LANGUAGE = c++ cpp: core ar rvs $(OUTDIR)/libcpp.a $(OUTDIR)/*.o g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build/c build/java/src build/java/io build/java/build + rm -rf build/c build/java/src build/java/io build/java/build kcore_wrap.cxx kcore_wrap.h .PHONY: all java csharp python wrapper swig clean object core From 2fe7103a73ee5d13055b9f45fe0facb26759d621 Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Tue, 15 May 2018 15:08:49 +0200 Subject: [PATCH 141/363] cpp sdk test: phase 0 --- auth/getCurrentUser.go | 3 + internal/wrappers/Makefile | 4 +- internal/wrappers/README.md | 1 + internal/wrappers/cpp/index.cpp | 2 +- internal/wrappers/features/fixtures/run.sh | 4 +- internal/wrappers/features/sdks2.feature | 98 +++ .../3rdparty/json_spirit/CMakeLists.txt | 26 + .../3rdparty/json_spirit/json_spirit.h | 18 + .../3rdparty/json_spirit/json_spirit.vcproj | 209 ++++++ .../json_spirit/json_spirit_error_position.h | 54 ++ .../json_spirit/json_spirit_reader.cpp | 137 ++++ .../3rdparty/json_spirit/json_spirit_reader.h | 62 ++ .../json_spirit/json_spirit_reader_template.h | 612 ++++++++++++++++++ .../json_spirit/json_spirit_stream_reader.h | 70 ++ .../3rdparty/json_spirit/json_spirit_utils.h | 61 ++ .../json_spirit/json_spirit_value.cpp | 8 + .../3rdparty/json_spirit/json_spirit_value.h | 532 +++++++++++++++ .../json_spirit/json_spirit_writer.cpp | 95 +++ .../3rdparty/json_spirit/json_spirit_writer.h | 50 ++ .../json_spirit/json_spirit_writer_template.h | 246 +++++++ .../features/step_defs_cpp/CMakeLists.txt | 47 ++ .../features/step_defs_cpp/cucumber.wire | 2 + .../step_defs_cpp/kuzzle-sdk-steps.cpp | 310 +++++++++ .../features/step_defs_cpp/kuzzle_utils.cpp | 204 ++++++ .../features/step_defs_cpp/kuzzle_utils.h | 47 ++ internal/wrappers/headers/collection.hpp | 3 +- internal/wrappers/headers/exceptions.hpp | 3 +- internal/wrappers/headers/index.hpp | 4 +- internal/wrappers/headers/kuzzlesdk.h | 75 ++- 29 files changed, 2950 insertions(+), 37 deletions(-) create mode 100644 internal/wrappers/features/sdks2.feature create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/CMakeLists.txt create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.h create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.vcproj create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_error_position.h create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.cpp create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.h create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader_template.h create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_stream_reader.h create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_utils.h create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.cpp create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.h create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.cpp create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.h create mode 100644 internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer_template.h create mode 100644 internal/wrappers/features/step_defs_cpp/CMakeLists.txt create mode 100644 internal/wrappers/features/step_defs_cpp/cucumber.wire create mode 100644 internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp create mode 100644 internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp create mode 100644 internal/wrappers/features/step_defs_cpp/kuzzle_utils.h diff --git a/auth/getCurrentUser.go b/auth/getCurrentUser.go index 51966638..ad0b6461 100644 --- a/auth/getCurrentUser.go +++ b/auth/getCurrentUser.go @@ -16,6 +16,7 @@ package auth import ( "encoding/json" + "fmt" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" @@ -34,6 +35,8 @@ func (a *Auth) GetCurrentUser() (*security.User, error) { res := <-result + fmt.Printf("GO: %s\n", res) + if res.Error != nil { return nil, res.Error } diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index f2669614..621b5c91 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -26,6 +26,7 @@ CPPSRCS = kuzzle.cpp \ realtime.cpp \ auth.cpp \ server.cpp \ + index.cpp \ kcore_wrap.cxx CPP_SDK_SRCS = kuzzle.cpp \ @@ -33,7 +34,8 @@ CPP_SDK_SRCS = kuzzle.cpp \ collection.cpp \ realtime.cpp \ auth.cpp \ - server.cpp + server.cpp \ + index.cpp CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) diff --git a/internal/wrappers/README.md b/internal/wrappers/README.md index 54e61aae..ff77ebc6 100644 --- a/internal/wrappers/README.md +++ b/internal/wrappers/README.md @@ -7,6 +7,7 @@ This project contains a CGO wrapper to Kuzzle's [Go SDK](https://github.com/kuzz # Pre-requisites * [Go](https://golang.org/doc/install) +* G++ 6.x # Contributing diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index a26f38f6..ac9fce1f 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "kuzzle.hpp" #include "index.hpp" #include -#include namespace kuzzleio { diff --git a/internal/wrappers/features/fixtures/run.sh b/internal/wrappers/features/fixtures/run.sh index 5fb0f138..79228753 100755 --- a/internal/wrappers/features/fixtures/run.sh +++ b/internal/wrappers/features/fixtures/run.sh @@ -4,7 +4,7 @@ CONTENT_TYPE="Content-Type: application/json" KUZZLE_HOST=http://localhost:7512 # update rights for anonymous user -curl -X PUT -H $CONTENT_TYPE -d "`cat rights.json`" $KUZZLE_HOST/roles/anonymous/_update +curl -X PUT -H $CONTENT_TYPE -d @rights.json $KUZZLE_HOST/roles/anonymous/_update # create index curl -X POST -H $CONTENT_TYPE $KUZZLE_HOST/index/_create @@ -16,4 +16,4 @@ curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/collection curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/geofence #update mapping for geofence collection -curl -X PUT -H $CONTENT_TYPE -d "`cat mapping.json`" $KUZZLE_HOST/index/geofence/_mapping \ No newline at end of file +curl -X PUT -H $CONTENT_TYPE -d @mapping.json $KUZZLE_HOST/index/geofence/_mapping \ No newline at end of file diff --git a/internal/wrappers/features/sdks2.feature b/internal/wrappers/features/sdks2.feature new file mode 100644 index 00000000..1e91ad11 --- /dev/null +++ b/internal/wrappers/features/sdks2.feature @@ -0,0 +1,98 @@ +# SDK's integration tests +#======================== + + +Feature: Create document with ids + + Scenario: Do not allow creating a document with an _id that already exist in the same collection + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + When I try to create a new document with id 'my-document-id' + Then I get an error with message 'document alread exists' + + Scenario: Allow creating a document with an _id when the _id isn't used yet + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection doesn't have a document with id 'my-document-id' + When I try to create a new document with id 'my-document-id' + Then the document is successfully created + + #Feature: User management + + Scenario Outline: Get a valid JWT when login + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + When I log in as : + Then the JWT is + Examples: + | user-name | user-pwd | jwt_validity | + | 'my-user-name' | 'my-user-pwd' | valid | + | 'my-user-name-w' | 'my-user-pwd' | invalid | + | 'my-user-name' | 'my-user-pwd-w' | invalid | + | 'my-user-name-w' | 'my-user-pwd-w' | invalid | + + Scenario Outline: Set user custom data (updateSelf) + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + And I log in as 'my-user-name':'my-user-pwd' + And I update my user custom data with the pair : + When I get my user info + Then the response '_source' field contains the pair : + And is a + Examples: + | fieldname | fieldvalue | type | + | my_data1 | "mystringvalue" | string | + | my_data2 | 1234 | number | + | my_data2 | -1234 | number | + | my_data2 | 1.234 | number | + | my_data2 | -1.234 | number | + | my_data1 | true | bool | + | my_data1 | false | bool | + + + Scenario: Login out shall revoke the JWT + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + And I login using 'local' authentication, with and password as credentials + And the retrieved JWT is valid + When I logout + Then the JWT is no more valid + + + +# Feature: Realtime subscribtion +# +# Scenario: Receive notifications when a document is created +# Given I subscribe to "collection" +# When I create a document in "collection" +# Then I receive a notification +# +# Scenario: Receive notifications when a document is deleted +# Scenario: Receive notifications when a document is updated +# Scenario: Receive notifications when a document is published +# When I create a document in "collection" +# Then I receive a notification + +# Scenario: Stop recieving notification when I unsubscribe +# Given I unsubscribe +# When I create a document in "collection" +# Then I do not receive a notification + +# Feature: Geofencing subscriptions + +# Scenario Outline: Subscribe to a geofence filter +# Given I subscribe to "geofence" collection +# When I create a document in "geofence" and inside my geofence +# Then I receive a "in" notification +# +# When I update this document to be outside my geofence +# Then I receive a "out" notification +# Examples: +# | lon | lat | in | +# | 43.6108 | 3.8767 | yes | \ No newline at end of file diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/CMakeLists.txt new file mode 100644 index 00000000..5c461d1f --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(Boost 1.34 REQUIRED) + +add_library(json_spirit.header INTERFACE) +target_sources(json_spirit.header INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit.h + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_error_position.h + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_reader_template.h + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_stream_reader.h + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_utils.h + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_value.h + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_writer_template.h +) +target_include_directories(json_spirit.header SYSTEM + INTERFACE + ${Boost_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. +) + +add_library(json_spirit STATIC EXCLUDE_FROM_ALL + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_reader.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_reader.h + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_value.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_writer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_writer.h +) +target_link_libraries(json_spirit PUBLIC json_spirit.header) diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.h new file mode 100644 index 00000000..7dac05c3 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.h @@ -0,0 +1,18 @@ +#ifndef JSON_SPIRIT +#define JSON_SPIRIT + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include "json_spirit_value.h" +#include "json_spirit_reader.h" +#include "json_spirit_writer.h" +#include "json_spirit_utils.h" + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.vcproj b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.vcproj new file mode 100644 index 00000000..ed0e5e0c --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.vcproj @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_error_position.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_error_position.h new file mode 100644 index 00000000..4a535ff5 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_error_position.h @@ -0,0 +1,54 @@ +#ifndef JSON_SPIRIT_ERROR_POSITION +#define JSON_SPIRIT_ERROR_POSITION + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +namespace json_spirit +{ + // An Error_position exception is thrown by the "read_or_throw" functions below on finding an error. + // Note the "read_or_throw" functions are around 3 times slower than the standard functions "read" + // functions that return a bool. + // + struct Error_position + { + Error_position(); + Error_position( unsigned int line, unsigned int column, const std::string& reason ); + bool operator==( const Error_position& lhs ) const; + unsigned int line_; + unsigned int column_; + std::string reason_; + }; + + inline Error_position::Error_position() + : line_( 0 ) + , column_( 0 ) + { + } + + inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason ) + : line_( line ) + , column_( column ) + , reason_( reason ) + { + } + + inline bool Error_position::operator==( const Error_position& lhs ) const + { + if( this == &lhs ) return true; + + return ( reason_ == lhs.reason_ ) && + ( line_ == lhs.line_ ) && + ( column_ == lhs.column_ ); +} +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.cpp b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.cpp new file mode 100644 index 00000000..8e2fb5e2 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.cpp @@ -0,0 +1,137 @@ +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#include "json_spirit_reader.h" +#include "json_spirit_reader_template.h" + +using namespace json_spirit; + +bool json_spirit::read( const std::string& s, Value& value ) +{ + return read_string( s, value ); +} + +void json_spirit::read_or_throw( const std::string& s, Value& value ) +{ + read_string_or_throw( s, value ); +} + +bool json_spirit::read( std::istream& is, Value& value ) +{ + return read_stream( is, value ); +} + +void json_spirit::read_or_throw( std::istream& is, Value& value ) +{ + read_stream_or_throw( is, value ); +} + +bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ) +{ + return read_range( begin, end, value ); +} + +void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ) +{ + begin = read_range_or_throw( begin, end, value ); +} + +#ifndef BOOST_NO_STD_WSTRING + +bool json_spirit::read( const std::wstring& s, wValue& value ) +{ + return read_string( s, value ); +} + +void json_spirit::read_or_throw( const std::wstring& s, wValue& value ) +{ + read_string_or_throw( s, value ); +} + +bool json_spirit::read( std::wistream& is, wValue& value ) +{ + return read_stream( is, value ); +} + +void json_spirit::read_or_throw( std::wistream& is, wValue& value ) +{ + read_stream_or_throw( is, value ); +} + +bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ) +{ + return read_range( begin, end, value ); +} + +void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ) +{ + begin = read_range_or_throw( begin, end, value ); +} + +#endif + +bool json_spirit::read( const std::string& s, mValue& value ) +{ + return read_string( s, value ); +} + +void json_spirit::read_or_throw( const std::string& s, mValue& value ) +{ + read_string_or_throw( s, value ); +} + +bool json_spirit::read( std::istream& is, mValue& value ) +{ + return read_stream( is, value ); +} + +void json_spirit::read_or_throw( std::istream& is, mValue& value ) +{ + read_stream_or_throw( is, value ); +} + +bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ) +{ + return read_range( begin, end, value ); +} + +void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ) +{ + begin = read_range_or_throw( begin, end, value ); +} + +#ifndef BOOST_NO_STD_WSTRING + +bool json_spirit::read( const std::wstring& s, wmValue& value ) +{ + return read_string( s, value ); +} + +void json_spirit::read_or_throw( const std::wstring& s, wmValue& value ) +{ + read_string_or_throw( s, value ); +} + +bool json_spirit::read( std::wistream& is, wmValue& value ) +{ + return read_stream( is, value ); +} + +void json_spirit::read_or_throw( std::wistream& is, wmValue& value ) +{ + read_stream_or_throw( is, value ); +} + +bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ) +{ + return read_range( begin, end, value ); +} + +void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ) +{ + begin = read_range_or_throw( begin, end, value ); +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.h new file mode 100644 index 00000000..a58bfc10 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.h @@ -0,0 +1,62 @@ +#ifndef JSON_SPIRIT_READER +#define JSON_SPIRIT_READER + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include "json_spirit_value.h" +#include "json_spirit_error_position.h" +#include + +namespace json_spirit +{ + // functions to reads a JSON values + + bool read( const std::string& s, Value& value ); + bool read( std::istream& is, Value& value ); + bool read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ); + + void read_or_throw( const std::string& s, Value& value ); + void read_or_throw( std::istream& is, Value& value ); + void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ); + +#ifndef BOOST_NO_STD_WSTRING + + bool read( const std::wstring& s, wValue& value ); + bool read( std::wistream& is, wValue& value ); + bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ); + + void read_or_throw( const std::wstring& s, wValue& value ); + void read_or_throw( std::wistream& is, wValue& value ); + void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ); + +#endif + + bool read( const std::string& s, mValue& value ); + bool read( std::istream& is, mValue& value ); + bool read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ); + + void read_or_throw( const std::string& s, mValue& value ); + void read_or_throw( std::istream& is, mValue& value ); + void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ); + +#ifndef BOOST_NO_STD_WSTRING + + bool read( const std::wstring& s, wmValue& value ); + bool read( std::wistream& is, wmValue& value ); + bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ); + + void read_or_throw( const std::wstring& s, wmValue& value ); + void read_or_throw( std::wistream& is, wmValue& value ); + void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ); + +#endif +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader_template.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader_template.h new file mode 100644 index 00000000..81cded43 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader_template.h @@ -0,0 +1,612 @@ +#ifndef JSON_SPIRIT_READER_TEMPLATE +#define JSON_SPIRIT_READER_TEMPLATE + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#include "json_spirit_value.h" +#include "json_spirit_error_position.h" + +//#define BOOST_SPIRIT_THREADSAFE // uncomment for multithreaded use, requires linking to boost.thread + +#include +#include +#include + +#if BOOST_VERSION >= 103800 + #include + #include + #include + #include + #include + #define spirit_namespace boost::spirit::classic +#else + #include + #include + #include + #include + #include + #define spirit_namespace boost::spirit +#endif + +namespace json_spirit +{ + const spirit_namespace::int_parser < boost::int64_t > int64_p = spirit_namespace::int_parser < boost::int64_t >(); + const spirit_namespace::uint_parser< boost::uint64_t > uint64_p = spirit_namespace::uint_parser< boost::uint64_t >(); + + template< class Iter_type > + bool is_eq( Iter_type first, Iter_type last, const char* c_str ) + { + for( Iter_type i = first; i != last; ++i, ++c_str ) + { + if( *c_str == 0 ) return false; + + if( *i != *c_str ) return false; + } + + return true; + } + + template< class Char_type > + Char_type hex_to_num( const Char_type c ) + { + if( ( c >= '0' ) && ( c <= '9' ) ) return c - '0'; + if( ( c >= 'a' ) && ( c <= 'f' ) ) return c - 'a' + 10; + if( ( c >= 'A' ) && ( c <= 'F' ) ) return c - 'A' + 10; + return 0; + } + + template< class Char_type, class Iter_type > + Char_type hex_str_to_char( Iter_type& begin ) + { + const Char_type c1( *( ++begin ) ); + const Char_type c2( *( ++begin ) ); + + return ( hex_to_num( c1 ) << 4 ) + hex_to_num( c2 ); + } + + template< class Char_type, class Iter_type > + Char_type unicode_str_to_char( Iter_type& begin ) + { + const Char_type c1( *( ++begin ) ); + const Char_type c2( *( ++begin ) ); + const Char_type c3( *( ++begin ) ); + const Char_type c4( *( ++begin ) ); + + return ( hex_to_num( c1 ) << 12 ) + + ( hex_to_num( c2 ) << 8 ) + + ( hex_to_num( c3 ) << 4 ) + + hex_to_num( c4 ); + } + + template< class String_type > + void append_esc_char_and_incr_iter( String_type& s, + typename String_type::const_iterator& begin, + typename String_type::const_iterator end ) + { + typedef typename String_type::value_type Char_type; + + const Char_type c2( *begin ); + + switch( c2 ) + { + case 't': s += '\t'; break; + case 'b': s += '\b'; break; + case 'f': s += '\f'; break; + case 'n': s += '\n'; break; + case 'r': s += '\r'; break; + case '\\': s += '\\'; break; + case '/': s += '/'; break; + case '"': s += '"'; break; + case 'x': + { + if( end - begin >= 3 ) // expecting "xHH..." + { + s += hex_str_to_char< Char_type >( begin ); + } + break; + } + case 'u': + { + if( end - begin >= 5 ) // expecting "uHHHH..." + { + s += unicode_str_to_char< Char_type >( begin ); + } + break; + } + } + } + + template< class String_type > + String_type substitute_esc_chars( typename String_type::const_iterator begin, + typename String_type::const_iterator end ) + { + typedef typename String_type::const_iterator Iter_type; + + if( end - begin < 2 ) return String_type( begin, end ); + + String_type result; + + result.reserve( end - begin ); + + const Iter_type end_minus_1( end - 1 ); + + Iter_type substr_start = begin; + Iter_type i = begin; + + for( ; i < end_minus_1; ++i ) + { + if( *i == '\\' ) + { + result.append( substr_start, i ); + + ++i; // skip the '\' + + append_esc_char_and_incr_iter( result, i, end ); + + substr_start = i + 1; + } + } + + result.append( substr_start, end ); + + return result; + } + + template< class String_type > + String_type get_str_( typename String_type::const_iterator begin, + typename String_type::const_iterator end ) + { + assert( end - begin >= 2 ); + + typedef typename String_type::const_iterator Iter_type; + + Iter_type str_without_quotes( ++begin ); + Iter_type end_without_quotes( --end ); + + return substitute_esc_chars< String_type >( str_without_quotes, end_without_quotes ); + } + + inline std::string get_str( std::string::const_iterator begin, std::string::const_iterator end ) + { + return get_str_< std::string >( begin, end ); + } + + inline std::wstring get_str( std::wstring::const_iterator begin, std::wstring::const_iterator end ) + { + return get_str_< std::wstring >( begin, end ); + } + + template< class String_type, class Iter_type > + String_type get_str( Iter_type begin, Iter_type end ) + { + const String_type tmp( begin, end ); // convert multipass iterators to string iterators + + return get_str( tmp.begin(), tmp.end() ); + } + + // this class's methods get called by the spirit parse resulting + // in the creation of a JSON object or array + // + // NB Iter_type could be a std::string iterator, wstring iterator, a position iterator or a multipass iterator + // + template< class Value_type, class Iter_type > + class Semantic_actions + { + public: + + typedef typename Value_type::Config_type Config_type; + typedef typename Config_type::String_type String_type; + typedef typename Config_type::Object_type Object_type; + typedef typename Config_type::Array_type Array_type; + typedef typename String_type::value_type Char_type; + + Semantic_actions( Value_type& value ) + : value_( value ) + , current_p_( 0 ) + { + } + + void begin_obj( Char_type c ) + { + assert( c == '{' ); + + begin_compound< Object_type >(); + } + + void end_obj( Char_type c ) + { + assert( c == '}' ); + + end_compound(); + } + + void begin_array( Char_type c ) + { + assert( c == '[' ); + + begin_compound< Array_type >(); + } + + void end_array( Char_type c ) + { + assert( c == ']' ); + + end_compound(); + } + + void new_name( Iter_type begin, Iter_type end ) + { + assert( current_p_->type() == obj_type ); + + name_ = get_str< String_type >( begin, end ); + } + + void new_str( Iter_type begin, Iter_type end ) + { + add_to_current( get_str< String_type >( begin, end ) ); + } + + void new_true( Iter_type begin, Iter_type end ) + { + assert( is_eq( begin, end, "true" ) ); + + add_to_current( true ); + } + + void new_false( Iter_type begin, Iter_type end ) + { + assert( is_eq( begin, end, "false" ) ); + + add_to_current( false ); + } + + void new_null( Iter_type begin, Iter_type end ) + { + assert( is_eq( begin, end, "null" ) ); + + add_to_current( Value_type() ); + } + + void new_int( boost::int64_t i ) + { + add_to_current( i ); + } + + void new_uint64( boost::uint64_t ui ) + { + add_to_current( ui ); + } + + void new_real( double d ) + { + add_to_current( d ); + } + + private: + + Semantic_actions& operator=( const Semantic_actions& ); + // to prevent "assignment operator could not be generated" warning + + Value_type* add_first( const Value_type& value ) + { + assert( current_p_ == 0 ); + + value_ = value; + current_p_ = &value_; + return current_p_; + } + + template< class Array_or_obj > + void begin_compound() + { + if( current_p_ == 0 ) + { + add_first( Array_or_obj() ); + } + else + { + stack_.push_back( current_p_ ); + + Array_or_obj new_array_or_obj; // avoid copy by building new array or object in place + + current_p_ = add_to_current( new_array_or_obj ); + } + } + + void end_compound() + { + if( current_p_ != &value_ ) + { + current_p_ = stack_.back(); + + stack_.pop_back(); + } + } + + Value_type* add_to_current( const Value_type& value ) + { + if( current_p_ == 0 ) + { + return add_first( value ); + } + else if( current_p_->type() == array_type ) + { + current_p_->get_array().push_back( value ); + + return ¤t_p_->get_array().back(); + } + + assert( current_p_->type() == obj_type ); + + return &Config_type::add( current_p_->get_obj(), name_, value ); + } + + Value_type& value_; // this is the object or array that is being created + Value_type* current_p_; // the child object or array that is currently being constructed + + std::vector< Value_type* > stack_; // previous child objects and arrays + + String_type name_; // of current name/value pair + }; + + template< typename Iter_type > + void throw_error( spirit_namespace::position_iterator< Iter_type > i, const std::string& reason ) + { + throw Error_position( i.get_position().line, i.get_position().column, reason ); + } + + template< typename Iter_type > + void throw_error( Iter_type i, const std::string& reason ) + { + throw reason; + } + + // the spirit grammer + // + template< class Value_type, class Iter_type > + class Json_grammer : public spirit_namespace::grammar< Json_grammer< Value_type, Iter_type > > + { + public: + + typedef Semantic_actions< Value_type, Iter_type > Semantic_actions_t; + + Json_grammer( Semantic_actions_t& semantic_actions ) + : actions_( semantic_actions ) + { + } + + static void throw_not_value( Iter_type begin, Iter_type end ) + { + throw_error( begin, "not a value" ); + } + + static void throw_not_array( Iter_type begin, Iter_type end ) + { + throw_error( begin, "not an array" ); + } + + static void throw_not_object( Iter_type begin, Iter_type end ) + { + throw_error( begin, "not an object" ); + } + + static void throw_not_pair( Iter_type begin, Iter_type end ) + { + throw_error( begin, "not a pair" ); + } + + static void throw_not_colon( Iter_type begin, Iter_type end ) + { + throw_error( begin, "no colon in pair" ); + } + + static void throw_not_string( Iter_type begin, Iter_type end ) + { + throw_error( begin, "not a string" ); + } + + template< typename ScannerT > + class definition + { + public: + + definition( const Json_grammer& self ) + { + using namespace spirit_namespace; + + typedef typename Value_type::String_type::value_type Char_type; + + // first we convert the semantic action class methods to functors with the + // parameter signature expected by spirit + + typedef boost::function< void( Char_type ) > Char_action; + typedef boost::function< void( Iter_type, Iter_type ) > Str_action; + typedef boost::function< void( double ) > Real_action; + typedef boost::function< void( boost::int64_t ) > Int_action; + typedef boost::function< void( boost::uint64_t ) > Uint64_action; + + Char_action begin_obj ( boost::bind( &Semantic_actions_t::begin_obj, &self.actions_, _1 ) ); + Char_action end_obj ( boost::bind( &Semantic_actions_t::end_obj, &self.actions_, _1 ) ); + Char_action begin_array( boost::bind( &Semantic_actions_t::begin_array, &self.actions_, _1 ) ); + Char_action end_array ( boost::bind( &Semantic_actions_t::end_array, &self.actions_, _1 ) ); + Str_action new_name ( boost::bind( &Semantic_actions_t::new_name, &self.actions_, _1, _2 ) ); + Str_action new_str ( boost::bind( &Semantic_actions_t::new_str, &self.actions_, _1, _2 ) ); + Str_action new_true ( boost::bind( &Semantic_actions_t::new_true, &self.actions_, _1, _2 ) ); + Str_action new_false ( boost::bind( &Semantic_actions_t::new_false, &self.actions_, _1, _2 ) ); + Str_action new_null ( boost::bind( &Semantic_actions_t::new_null, &self.actions_, _1, _2 ) ); + Real_action new_real ( boost::bind( &Semantic_actions_t::new_real, &self.actions_, _1 ) ); + Int_action new_int ( boost::bind( &Semantic_actions_t::new_int, &self.actions_, _1 ) ); + Uint64_action new_uint64 ( boost::bind( &Semantic_actions_t::new_uint64, &self.actions_, _1 ) ); + + // actual grammer + + json_ + = value_ | eps_p[ &throw_not_value ] + ; + + value_ + = string_[ new_str ] + | number_ + | object_ + | array_ + | str_p( "true" ) [ new_true ] + | str_p( "false" )[ new_false ] + | str_p( "null" ) [ new_null ] + ; + + object_ + = ch_p('{')[ begin_obj ] + >> !members_ + >> ( ch_p('}')[ end_obj ] | eps_p[ &throw_not_object ] ) + ; + + members_ + = pair_ >> *( ',' >> pair_ ) + ; + + pair_ + = string_[ new_name ] + >> ( ':' | eps_p[ &throw_not_colon ] ) + >> ( value_ | eps_p[ &throw_not_value ] ) + ; + + array_ + = ch_p('[')[ begin_array ] + >> !elements_ + >> ( ch_p(']')[ end_array ] | eps_p[ &throw_not_array ] ) + ; + + elements_ + = value_ >> *( ',' >> value_ ) + ; + + string_ + = lexeme_d // this causes white space inside a string to be retained + [ + confix_p + ( + '"', + *lex_escape_ch_p, + '"' + ) + ] + ; + + number_ + = strict_real_p[ new_real ] + | int64_p [ new_int ] + | uint64_p [ new_uint64 ] + ; + } + + spirit_namespace::rule< ScannerT > json_, object_, members_, pair_, array_, elements_, value_, string_, number_; + + const spirit_namespace::rule< ScannerT >& start() const { return json_; } + }; + + private: + + Json_grammer& operator=( const Json_grammer& ); // to prevent "assignment operator could not be generated" warning + + Semantic_actions_t& actions_; + }; + + template< class Iter_type, class Value_type > + Iter_type read_range_or_throw( Iter_type begin, Iter_type end, Value_type& value ) + { + Semantic_actions< Value_type, Iter_type > semantic_actions( value ); + + const spirit_namespace::parse_info< Iter_type > info = + spirit_namespace::parse( begin, end, + Json_grammer< Value_type, Iter_type >( semantic_actions ), + spirit_namespace::space_p ); + + if( !info.hit ) + { + assert( false ); // in theory exception should already have been thrown + throw_error( info.stop, "error" ); + } + + return info.stop; + } + + template< class Iter_type, class Value_type > + void add_posn_iter_and_read_range_or_throw( Iter_type begin, Iter_type end, Value_type& value ) + { + typedef spirit_namespace::position_iterator< Iter_type > Posn_iter_t; + + const Posn_iter_t posn_begin( begin, end ); + const Posn_iter_t posn_end( end, end ); + + read_range_or_throw( posn_begin, posn_end, value ); + } + + template< class Iter_type, class Value_type > + bool read_range( Iter_type& begin, Iter_type end, Value_type& value ) + { + try + { + begin = read_range_or_throw( begin, end, value ); + + return true; + } + catch( ... ) + { + return false; + } + } + + template< class String_type, class Value_type > + void read_string_or_throw( const String_type& s, Value_type& value ) + { + add_posn_iter_and_read_range_or_throw( s.begin(), s.end(), value ); + } + + template< class String_type, class Value_type > + bool read_string( const String_type& s, Value_type& value ) + { + typename String_type::const_iterator begin = s.begin(); + + return read_range( begin, s.end(), value ); + } + + template< class Istream_type > + struct Multi_pass_iters + { + typedef typename Istream_type::char_type Char_type; + typedef std::istream_iterator< Char_type, Char_type > istream_iter; + typedef spirit_namespace::multi_pass< istream_iter > Mp_iter; + + Multi_pass_iters( Istream_type& is ) + { + is.unsetf( std::ios::skipws ); + + begin_ = spirit_namespace::make_multi_pass( istream_iter( is ) ); + end_ = spirit_namespace::make_multi_pass( istream_iter() ); + } + + Mp_iter begin_; + Mp_iter end_; + }; + + template< class Istream_type, class Value_type > + bool read_stream( Istream_type& is, Value_type& value ) + { + Multi_pass_iters< Istream_type > mp_iters( is ); + + return read_range( mp_iters.begin_, mp_iters.end_, value ); + } + + template< class Istream_type, class Value_type > + void read_stream_or_throw( Istream_type& is, Value_type& value ) + { + const Multi_pass_iters< Istream_type > mp_iters( is ); + + add_posn_iter_and_read_range_or_throw( mp_iters.begin_, mp_iters.end_, value ); + } +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_stream_reader.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_stream_reader.h new file mode 100644 index 00000000..a9ceeacf --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_stream_reader.h @@ -0,0 +1,70 @@ +#ifndef JSON_SPIRIT_READ_STREAM +#define JSON_SPIRIT_READ_STREAM + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include "json_spirit_reader_template.h" + +namespace json_spirit +{ + // these classes allows you to read multiple top level contiguous values from a stream, + // the normal stream read functions have a bug that prevent multiple top level values + // from being read unless they are separated by spaces + + template< class Istream_type, class Value_type > + class Stream_reader + { + public: + + Stream_reader( Istream_type& is ) + : iters_( is ) + { + } + + bool read_next( Value_type& value ) + { + return read_range( iters_.begin_, iters_.end_, value ); + } + + private: + + typedef Multi_pass_iters< Istream_type > Mp_iters; + + Mp_iters iters_; + }; + + template< class Istream_type, class Value_type > + class Stream_reader_thrower + { + public: + + Stream_reader_thrower( Istream_type& is ) + : iters_( is ) + , posn_begin_( iters_.begin_, iters_.end_ ) + , posn_end_( iters_.end_, iters_.end_ ) + { + } + + void read_next( Value_type& value ) + { + posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value ); + } + + private: + + typedef Multi_pass_iters< Istream_type > Mp_iters; + typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t; + + Mp_iters iters_; + Posn_iter_t posn_begin_, posn_end_; + }; +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_utils.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_utils.h new file mode 100644 index 00000000..7eb338e7 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_utils.h @@ -0,0 +1,61 @@ +#ifndef JSON_SPIRIT_UTILS +#define JSON_SPIRIT_UTILS + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include "json_spirit_value.h" +#include + +namespace json_spirit +{ + template< class Obj_t, class Map_t > + void obj_to_map( const Obj_t& obj, Map_t& mp_obj ) + { + mp_obj.clear(); + + for( typename Obj_t::const_iterator i = obj.begin(); i != obj.end(); ++i ) + { + mp_obj[ i->name_ ] = i->value_; + } + } + + template< class Obj_t, class Map_t > + void map_to_obj( const Map_t& mp_obj, Obj_t& obj ) + { + obj.clear(); + + for( typename Map_t::const_iterator i = mp_obj.begin(); i != mp_obj.end(); ++i ) + { + obj.push_back( typename Obj_t::value_type( i->first, i->second ) ); + } + } + + typedef std::map< std::string, Value > Mapped_obj; + +#ifndef BOOST_NO_STD_WSTRING + typedef std::map< std::wstring, wValue > wMapped_obj; +#endif + + template< class Object_type, class String_type > + const typename Object_type::value_type::Value_type& find_value( const Object_type& obj, const String_type& name ) + { + for( typename Object_type::const_iterator i = obj.begin(); i != obj.end(); ++i ) + { + if( i->name_ == name ) + { + return i->value_; + } + } + + return Object_type::value_type::Value_type::null; + } +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.cpp b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.cpp new file mode 100644 index 00000000..dd5b50e5 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.cpp @@ -0,0 +1,8 @@ +/* Copyright (c) 2007 John W Wilkinson + + This source code can be used for any purpose as long as + this comment is retained. */ + +// json spirit version 2.00 + +#include "json_spirit_value.h" diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.h new file mode 100644 index 00000000..e8be3553 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.h @@ -0,0 +1,532 @@ +#ifndef JSON_SPIRIT_VALUE +#define JSON_SPIRIT_VALUE + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace json_spirit +{ + enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type }; + + template< class Config > // Config determines whether the value uses std::string or std::wstring and + // whether JSON Objects are represented as vectors or maps + class Value_impl + { + public: + + typedef Config Config_type; + typedef typename Config::String_type String_type; + typedef typename Config::Object_type Object; + typedef typename Config::Array_type Array; + typedef typename String_type::const_pointer Const_str_ptr; // eg const char* + + Value_impl(); // creates null value + Value_impl( Const_str_ptr value ); + Value_impl( const String_type& value ); + Value_impl( const Object& value ); + Value_impl( const Array& value ); + Value_impl( bool value ); + Value_impl( int value ); + Value_impl( boost::int64_t value ); + Value_impl( boost::uint64_t value ); + Value_impl( double value ); + + Value_impl( const Value_impl& other ); + + bool operator==( const Value_impl& lhs ) const; + + Value_impl& operator=( const Value_impl& lhs ); + + Value_type type() const; + + bool is_uint64() const; + bool is_null() const; + + const String_type& get_str() const; + const Object& get_obj() const; + const Array& get_array() const; + bool get_bool() const; + int get_int() const; + boost::int64_t get_int64() const; + boost::uint64_t get_uint64() const; + double get_real() const; + + Object& get_obj(); + Array& get_array(); + + template< typename T > T get_value() const; // example usage: int i = value.get_value< int >(); + // or double d = value.get_value< double >(); + + static const Value_impl null; + + private: + + void check_type( const Value_type vtype ) const; + + typedef boost::variant< String_type, + boost::recursive_wrapper< Object >, boost::recursive_wrapper< Array >, + bool, boost::int64_t, double > Variant; + + Value_type type_; + Variant v_; + bool is_uint64_; + }; + + // vector objects + + template< class Config > + struct Pair_impl + { + typedef typename Config::String_type String_type; + typedef typename Config::Value_type Value_type; + + Pair_impl( const String_type& name, const Value_type& value ); + + bool operator==( const Pair_impl& lhs ) const; + + String_type name_; + Value_type value_; + }; + + template< class String > + struct Config_vector + { + typedef String String_type; + typedef Value_impl< Config_vector > Value_type; + typedef Pair_impl < Config_vector > Pair_type; + typedef std::vector< Value_type > Array_type; + typedef std::vector< Pair_type > Object_type; + + static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value ) + { + obj.push_back( Pair_type( name , value ) ); + + return obj.back().value_; + } + + static String_type get_name( const Pair_type& pair ) + { + return pair.name_; + } + + static Value_type get_value( const Pair_type& pair ) + { + return pair.value_; + } + }; + + // typedefs for ASCII + + typedef Config_vector< std::string > Config; + + typedef Config::Value_type Value; + typedef Config::Pair_type Pair; + typedef Config::Object_type Object; + typedef Config::Array_type Array; + + // typedefs for Unicode + +#ifndef BOOST_NO_STD_WSTRING + + typedef Config_vector< std::wstring > wConfig; + + typedef wConfig::Value_type wValue; + typedef wConfig::Pair_type wPair; + typedef wConfig::Object_type wObject; + typedef wConfig::Array_type wArray; +#endif + + // map objects + + template< class String > + struct Config_map + { + typedef String String_type; + typedef Value_impl< Config_map > Value_type; + typedef std::vector< Value_type > Array_type; + typedef std::map< String_type, Value_type > Object_type; + typedef typename Object_type::value_type Pair_type; + + static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value ) + { + return obj[ name ] = value; + } + + static String_type get_name( const Pair_type& pair ) + { + return pair.first; + } + + static Value_type get_value( const Pair_type& pair ) + { + return pair.second; + } + }; + + // typedefs for ASCII + + typedef Config_map< std::string > mConfig; + + typedef mConfig::Value_type mValue; + typedef mConfig::Object_type mObject; + typedef mConfig::Array_type mArray; + + // typedefs for Unicode + +#ifndef BOOST_NO_STD_WSTRING + + typedef Config_map< std::wstring > wmConfig; + + typedef wmConfig::Value_type wmValue; + typedef wmConfig::Object_type wmObject; + typedef wmConfig::Array_type wmArray; + +#endif + + /////////////////////////////////////////////////////////////////////////////////////////////// + // + // implementation + + template< class Config > + const Value_impl< Config > Value_impl< Config >::null; + + template< class Config > + Value_impl< Config >::Value_impl() + : type_( null_type ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( const Const_str_ptr value ) + : type_( str_type ) + , v_( String_type( value ) ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( const String_type& value ) + : type_( str_type ) + , v_( value ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( const Object& value ) + : type_( obj_type ) + , v_( value ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( const Array& value ) + : type_( array_type ) + , v_( value ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( bool value ) + : type_( bool_type ) + , v_( value ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( int value ) + : type_( int_type ) + , v_( static_cast< boost::int64_t >( value ) ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( boost::int64_t value ) + : type_( int_type ) + , v_( value ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( boost::uint64_t value ) + : type_( int_type ) + , v_( static_cast< boost::int64_t >( value ) ) + , is_uint64_( true ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( double value ) + : type_( real_type ) + , v_( value ) + , is_uint64_( false ) + { + } + + template< class Config > + Value_impl< Config >::Value_impl( const Value_impl< Config >& other ) + : type_( other.type() ) + , v_( other.v_ ) + , is_uint64_( other.is_uint64_ ) + { + } + + template< class Config > + Value_impl< Config >& Value_impl< Config >::operator=( const Value_impl& lhs ) + { + Value_impl tmp( lhs ); + + std::swap( type_, tmp.type_ ); + std::swap( v_, tmp.v_ ); + std::swap( is_uint64_, tmp.is_uint64_ ); + + return *this; + } + + template< class Config > + bool Value_impl< Config >::operator==( const Value_impl& lhs ) const + { + if( this == &lhs ) return true; + + if( type() != lhs.type() ) return false; + + return v_ == lhs.v_; + } + + template< class Config > + Value_type Value_impl< Config >::type() const + { + return type_; + } + + template< class Config > + bool Value_impl< Config >::is_uint64() const + { + return is_uint64_; + } + + template< class Config > + bool Value_impl< Config >::is_null() const + { + return type() == null_type; + } + + template< class Config > + void Value_impl< Config >::check_type( const Value_type vtype ) const + { + if( type() != vtype ) + { + std::ostringstream os; + + os << "value type is " << type() << " not " << vtype; + + throw std::runtime_error( os.str() ); + } + } + + template< class Config > + const typename Config::String_type& Value_impl< Config >::get_str() const + { + check_type( str_type ); + + return *boost::get< String_type >( &v_ ); + } + + template< class Config > + const typename Value_impl< Config >::Object& Value_impl< Config >::get_obj() const + { + check_type( obj_type ); + + return *boost::get< Object >( &v_ ); + } + + template< class Config > + const typename Value_impl< Config >::Array& Value_impl< Config >::get_array() const + { + check_type( array_type ); + + return *boost::get< Array >( &v_ ); + } + + template< class Config > + bool Value_impl< Config >::get_bool() const + { + check_type( bool_type ); + + return boost::get< bool >( v_ ); + } + + template< class Config > + int Value_impl< Config >::get_int() const + { + check_type( int_type ); + + return static_cast< int >( get_int64() ); + } + + template< class Config > + boost::int64_t Value_impl< Config >::get_int64() const + { + check_type( int_type ); + + return boost::get< boost::int64_t >( v_ ); + } + + template< class Config > + boost::uint64_t Value_impl< Config >::get_uint64() const + { + check_type( int_type ); + + return static_cast< boost::uint64_t >( get_int64() ); + } + + template< class Config > + double Value_impl< Config >::get_real() const + { + if( type() == int_type ) + { + return is_uint64() ? static_cast< double >( get_uint64() ) + : static_cast< double >( get_int64() ); + } + + check_type( real_type ); + + return boost::get< double >( v_ ); + } + + template< class Config > + typename Value_impl< Config >::Object& Value_impl< Config >::get_obj() + { + check_type( obj_type ); + + return *boost::get< Object >( &v_ ); + } + + template< class Config > + typename Value_impl< Config >::Array& Value_impl< Config >::get_array() + { + check_type( array_type ); + + return *boost::get< Array >( &v_ ); + } + + template< class Config > + Pair_impl< Config >::Pair_impl( const String_type& name, const Value_type& value ) + : name_( name ) + , value_( value ) + { + } + + template< class Config > + bool Pair_impl< Config >::operator==( const Pair_impl< Config >& lhs ) const + { + if( this == &lhs ) return true; + + return ( name_ == lhs.name_ ) && ( value_ == lhs.value_ ); + } + + // converts a C string, ie. 8 bit char array, to a string object + // + template < class String_type > + String_type to_str( const char* c_str ) + { + String_type result; + + for( const char* p = c_str; *p != 0; ++p ) + { + result += *p; + } + + return result; + } + + // + + namespace internal_ + { + template< typename T > + struct Type_to_type + { + }; + + template< class Value > + int get_value( const Value& value, Type_to_type< int > ) + { + return value.get_int(); + } + + template< class Value > + boost::int64_t get_value( const Value& value, Type_to_type< boost::int64_t > ) + { + return value.get_int64(); + } + + template< class Value > + boost::uint64_t get_value( const Value& value, Type_to_type< boost::uint64_t > ) + { + return value.get_uint64(); + } + + template< class Value > + double get_value( const Value& value, Type_to_type< double > ) + { + return value.get_real(); + } + + template< class Value > + typename Value::String_type get_value( const Value& value, Type_to_type< typename Value::String_type > ) + { + return value.get_str(); + } + + template< class Value > + typename Value::Array get_value( const Value& value, Type_to_type< typename Value::Array > ) + { + return value.get_array(); + } + + template< class Value > + typename Value::Object get_value( const Value& value, Type_to_type< typename Value::Object > ) + { + return value.get_obj(); + } + + template< class Value > + bool get_value( const Value& value, Type_to_type< bool > ) + { + return value.get_bool(); + } + } + + template< class Config > + template< typename T > + T Value_impl< Config >::get_value() const + { + return internal_::get_value( *this, internal_::Type_to_type< T >() ); + } +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.cpp b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.cpp new file mode 100644 index 00000000..f3367b68 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.cpp @@ -0,0 +1,95 @@ +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#include "json_spirit_writer.h" +#include "json_spirit_writer_template.h" + +void json_spirit::write( const Value& value, std::ostream& os ) +{ + write_stream( value, os, false ); +} + +void json_spirit::write_formatted( const Value& value, std::ostream& os ) +{ + write_stream( value, os, true ); +} + +std::string json_spirit::write( const Value& value ) +{ + return write_string( value, false ); +} + +std::string json_spirit::write_formatted( const Value& value ) +{ + return write_string( value, true ); +} + +#ifndef BOOST_NO_STD_WSTRING + +void json_spirit::write( const wValue& value, std::wostream& os ) +{ + write_stream( value, os, false ); +} + +void json_spirit::write_formatted( const wValue& value, std::wostream& os ) +{ + write_stream( value, os, true ); +} + +std::wstring json_spirit::write( const wValue& value ) +{ + return write_string( value, false ); +} + +std::wstring json_spirit::write_formatted( const wValue& value ) +{ + return write_string( value, true ); +} + +#endif + +void json_spirit::write( const mValue& value, std::ostream& os ) +{ + write_stream( value, os, false ); +} + +void json_spirit::write_formatted( const mValue& value, std::ostream& os ) +{ + write_stream( value, os, true ); +} + +std::string json_spirit::write( const mValue& value ) +{ + return write_string( value, false ); +} + +std::string json_spirit::write_formatted( const mValue& value ) +{ + return write_string( value, true ); +} + +#ifndef BOOST_NO_STD_WSTRING + +void json_spirit::write( const wmValue& value, std::wostream& os ) +{ + write_stream( value, os, false ); +} + +void json_spirit::write_formatted( const wmValue& value, std::wostream& os ) +{ + write_stream( value, os, true ); +} + +std::wstring json_spirit::write( const wmValue& value ) +{ + return write_string( value, false ); +} + +std::wstring json_spirit::write_formatted( const wmValue& value ) +{ + return write_string( value, true ); +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.h new file mode 100644 index 00000000..1b67b512 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.h @@ -0,0 +1,50 @@ +#ifndef JSON_SPIRIT_WRITER +#define JSON_SPIRIT_WRITER + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include "json_spirit_value.h" +#include + +namespace json_spirit +{ + // functions to convert JSON Values to text, + // the "formatted" versions add whitespace to format the output nicely + + void write ( const Value& value, std::ostream& os ); + void write_formatted( const Value& value, std::ostream& os ); + std::string write ( const Value& value ); + std::string write_formatted( const Value& value ); + +#ifndef BOOST_NO_STD_WSTRING + + void write ( const wValue& value, std::wostream& os ); + void write_formatted( const wValue& value, std::wostream& os ); + std::wstring write ( const wValue& value ); + std::wstring write_formatted( const wValue& value ); + +#endif + + void write ( const mValue& value, std::ostream& os ); + void write_formatted( const mValue& value, std::ostream& os ); + std::string write ( const mValue& value ); + std::string write_formatted( const mValue& value ); + +#ifndef BOOST_NO_STD_WSTRING + + void write ( const wmValue& value, std::wostream& os ); + void write_formatted( const wmValue& value, std::wostream& os ); + std::wstring write ( const wmValue& value ); + std::wstring write_formatted( const wmValue& value ); + +#endif +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer_template.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer_template.h new file mode 100644 index 00000000..87b528b9 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer_template.h @@ -0,0 +1,246 @@ +#ifndef JSON_SPIRIT_WRITER_TEMPLATE +#define JSON_SPIRIT_WRITER_TEMPLATE + +// Copyright John W. Wilkinson 2007 - 2009. +// Distributed under the MIT License, see accompanying file LICENSE.txt + +// json spirit version 4.03 + +#include "json_spirit_value.h" + +#include +#include +#include +#include + +namespace json_spirit +{ + inline char to_hex_char( unsigned int c ) + { + assert( c <= 0xF ); + + const char ch = static_cast< char >( c ); + + if( ch < 10 ) return '0' + ch; + + return 'A' - 10 + ch; + } + + template< class String_type > + String_type non_printable_to_string( unsigned int c ) + { + typedef typename String_type::value_type Char_type; + + String_type result( 6, '\\' ); + + result[1] = 'u'; + + result[ 5 ] = to_hex_char( c & 0x000F ); c >>= 4; + result[ 4 ] = to_hex_char( c & 0x000F ); c >>= 4; + result[ 3 ] = to_hex_char( c & 0x000F ); c >>= 4; + result[ 2 ] = to_hex_char( c & 0x000F ); + + return result; + } + + template< typename Char_type, class String_type > + bool add_esc_char( Char_type c, String_type& s ) + { + switch( c ) + { + case '"': s += to_str< String_type >( "\\\"" ); return true; + case '\\': s += to_str< String_type >( "\\\\" ); return true; + case '\b': s += to_str< String_type >( "\\b" ); return true; + case '\f': s += to_str< String_type >( "\\f" ); return true; + case '\n': s += to_str< String_type >( "\\n" ); return true; + case '\r': s += to_str< String_type >( "\\r" ); return true; + case '\t': s += to_str< String_type >( "\\t" ); return true; + } + + return false; + } + + template< class String_type > + String_type add_esc_chars( const String_type& s ) + { + typedef typename String_type::const_iterator Iter_type; + typedef typename String_type::value_type Char_type; + + String_type result; + + const Iter_type end( s.end() ); + + for( Iter_type i = s.begin(); i != end; ++i ) + { + const Char_type c( *i ); + + if( add_esc_char( c, result ) ) continue; + + const wint_t unsigned_c( ( c >= 0 ) ? c : 256 + c ); + + if( std::iswprint( unsigned_c ) ) + { + result += c; + } + else + { + result += non_printable_to_string< String_type >( unsigned_c ); + } + } + + return result; + } + + // this class generates the JSON text, + // it keeps track of the indentation level etc. + // + template< class Value_type, class Ostream_type > + class Generator + { + typedef typename Value_type::Config_type Config_type; + typedef typename Config_type::String_type String_type; + typedef typename Config_type::Object_type Object_type; + typedef typename Config_type::Array_type Array_type; + typedef typename String_type::value_type Char_type; + typedef typename Object_type::value_type Obj_member_type; + + public: + + Generator( const Value_type& value, Ostream_type& os, bool pretty ) + : os_( os ) + , indentation_level_( 0 ) + , pretty_( pretty ) + { + output( value ); + } + + private: + + void output( const Value_type& value ) + { + switch( value.type() ) + { + case obj_type: output( value.get_obj() ); break; + case array_type: output( value.get_array() ); break; + case str_type: output( value.get_str() ); break; + case bool_type: output( value.get_bool() ); break; + case int_type: output_int( value ); break; + case real_type: os_ << std::showpoint << std::setprecision( 16 ) + << value.get_real(); break; + case null_type: os_ << "null"; break; + default: assert( false ); + } + } + + void output( const Object_type& obj ) + { + output_array_or_obj( obj, '{', '}' ); + } + + void output( const Array_type& arr ) + { + output_array_or_obj( arr, '[', ']' ); + } + + void output( const Obj_member_type& member ) + { + output( Config_type::get_name( member ) ); space(); + os_ << ':'; space(); + output( Config_type::get_value( member ) ); + } + + void output_int( const Value_type& value ) + { + if( value.is_uint64() ) + { + os_ << value.get_uint64(); + } + else + { + os_ << value.get_int64(); + } + } + + void output( const String_type& s ) + { + os_ << '"' << add_esc_chars( s ) << '"'; + } + + void output( bool b ) + { + os_ << to_str< String_type >( b ? "true" : "false" ); + } + + template< class T > + void output_array_or_obj( const T& t, Char_type start_char, Char_type end_char ) + { + os_ << start_char; new_line(); + + ++indentation_level_; + + for( typename T::const_iterator i = t.begin(); i != t.end(); ++i ) + { + indent(); output( *i ); + + typename T::const_iterator next = i; + + if( ++next != t.end()) + { + os_ << ','; + } + + new_line(); + } + + --indentation_level_; + + indent(); os_ << end_char; + } + + void indent() + { + if( !pretty_ ) return; + + for( int i = 0; i < indentation_level_; ++i ) + { + os_ << " "; + } + } + + void space() + { + if( pretty_ ) os_ << ' '; + } + + void new_line() + { + if( pretty_ ) os_ << '\n'; + } + + Generator& operator=( const Generator& ); // to prevent "assignment operator could not be generated" warning + + Ostream_type& os_; + int indentation_level_; + bool pretty_; + }; + + template< class Value_type, class Ostream_type > + void write_stream( const Value_type& value, Ostream_type& os, bool pretty ) + { + Generator< Value_type, Ostream_type >( value, os, pretty ); + } + + template< class Value_type > + typename Value_type::String_type write_string( const Value_type& value, bool pretty ) + { + typedef typename Value_type::String_type::value_type Char_type; + + std::basic_ostringstream< Char_type > os; + + write_stream( value, os, pretty ); + + return os.str(); + } +} + +#endif diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt new file mode 100644 index 00000000..7cd30d9b --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required(VERSION 3.0.0) +project(KuzzleSKDTests) + +add_subdirectory(3rdparty/json_spirit) + +# +# Boost +# +set(BOOST_MIN_VERSION "1.46") + +set(Boost_USE_STATIC_RUNTIME OFF) +set(CUKE_CORE_BOOST_LIBS thread system regex date_time program_options filesystem) +if(NOT CUKE_DISABLE_BOOST_TEST) + # "An external test runner utility is required to link with dynamic library" (Boost User's Guide) + set(Boost_USE_STATIC_LIBS OFF) + set(CMAKE_CXX_FLAGS "-DBOOST_TEST_DYN_LINK ${CMAKE_CXX_FLAGS}") + find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS unit_test_framework) +endif() + +if(CUKE_USE_STATIC_BOOST) + set(Boost_USE_STATIC_LIBS ON) + find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS ${CUKE_CORE_BOOST_LIBS} REQUIRED) + + if(NOT MSVC) + find_package(Threads) + set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + endif() +else() + set(CMAKE_CXX_FLAGS "-DBOOST_ALL_DYN_LINK ${CMAKE_CXX_FLAGS}") + set(Boost_USE_STATIC_LIBS OFF) + find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS ${CUKE_CORE_BOOST_LIBS} REQUIRED) +endif() + +include_directories(${Boost_INCLUDE_DIRS}) +set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) + + +if(Boost_UNIT_TEST_FRAMEWORK_FOUND) + link_directories("/home/etrousset/test/test_cucumber-cpp/cucumber-cpp/build/src") + link_directories("/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/build/cpp") + include_directories("/home/etrousset/test/test_cucumber-cpp/cucumber-cpp/include") + include_directories("/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/headers") + include_directories("/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/build/c") + add_executable(KuzzleSDKStepDefs kuzzle-sdk-steps kuzzle_utils) + target_link_libraries(KuzzleSDKStepDefs cpp cucumber-cpp json_spirit ${CUKE_EXTRA_LIBRARIES} ${CUKE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +endif() + diff --git a/internal/wrappers/features/step_defs_cpp/cucumber.wire b/internal/wrappers/features/step_defs_cpp/cucumber.wire new file mode 100644 index 00000000..da2da560 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/cucumber.wire @@ -0,0 +1,2 @@ +host: localhost +port: 3902 diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp new file mode 100644 index 00000000..d7ecd5e6 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -0,0 +1,310 @@ +#include +#define EXPECT_EQ BOOST_CHECK_EQUAL +#include +#include + +#include "auth.hpp" +#include "collection.hpp" +#include "document.hpp" +#include "index.hpp" +#include "kuzzle.hpp" + +#include "kuzzle_utils.h" + +using cucumber::ScenarioScope; + +using namespace kuzzleio; +using std::cout; +using std::endl; +using std::string; + +struct KuzzleCtx +{ + Kuzzle *kuzzle = NULL; + options kuzzle_options; + + string user_id; + string index; + string collection; + string jwt; + + user *currentUser = NULL; + + bool success; +}; + +BEFORE() { kuz_log_sep(); } + +GIVEN("^I create a user 'useradmin' with password 'testpwd' with id " + "'useradmin-id'$") +{ + pending(); +} + +WHEN("^I try to create a document with id '(my-document)'$") +{ + REGEX_PARAM(std::string, document_id); + + ScenarioScope ctx; + + try + { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, + "{\"a\":\"document\"}"); + } + catch (KuzzleException e) + { + BOOST_FAIL(e.getMessage()); + } +} + +GIVEN("^I update my user custom data with the pair ([\\w]+) : (.+)$") +{ + REGEX_PARAM(std::string, fieldname); + REGEX_PARAM(std::string, fieldvalue); + + ScenarioScope ctx; + + string data = "{\"" + fieldname + "\":" + fieldvalue + "}"; + + K_LOG_D("Updating user data with : %s", data.c_str()); + + try + { + K_LOG_D("a"); + ctx->kuzzle->auth->updateSelf(data); + K_LOG_D("b"); + } + catch (KuzzleException e) + { + K_LOG_E(e.getMessage().c_str()); + } + K_LOG_D("c"); +} + +GIVEN("^Kuzzle Server is running$") +{ + K_LOG_I("Connecting to Kuzzle on 'localhost:7512'"); + ScenarioScope ctx; + ctx->kuzzle_options = KUZZLE_OPTIONS_DEFAULT; + ctx->kuzzle_options.connect = MANUAL; + try + { + ctx->kuzzle = new Kuzzle("localhost", &ctx->kuzzle_options); + } + catch (KuzzleException e) + { + K_LOG_E(e.getMessage().c_str()); + } + char *error = ctx->kuzzle->connect(); + BOOST_CHECK(error == NULL); +} + +GIVEN("^there is an index '(test-index)'$") +{ + REGEX_PARAM(std::string, index_name); + ScenarioScope ctx; + ctx->index = index_name; + + if (!ctx->kuzzle->index->exists(index_name)) + { + K_LOG_D("Creating index: %s", index_name.c_str()); + try + { + ctx->kuzzle->index->create(index_name); + } + catch (KuzzleException e) + { + K_LOG_E(e.getMessage().c_str()); + BOOST_FAIL(e.getMessage()); + } + } + else + { + K_LOG_D("Using existing index: %s", index_name.c_str()); + } +} + +GIVEN("^it has a collection '(test-collection)'$") +{ + REGEX_PARAM(std::string, collection_name); + ScenarioScope ctx; + ctx->collection = collection_name; + + K_LOG_D("Creating collection: %s", collection_name.c_str()); + try + { + ctx->kuzzle->collection->create(ctx->index, ctx->collection); + } + catch (KuzzleException e) + { + K_LOG_E(e.getMessage().c_str()); + BOOST_FAIL(e.getMessage()); + } +} + +GIVEN("^the collection has a document with id '(my-document-id)'$") +{ + REGEX_PARAM(std::string, document_id); + + ScenarioScope ctx; + + try + { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, + "{\"a\":\"document\"}"); + } + catch (KuzzleException e) + { + e.getMessage(); + } +} + +GIVEN("^the collection doesn't have a document with id '(my-document-id)'$") +{ + REGEX_PARAM(std::string, document_id); + + ScenarioScope ctx; + + try + { + ctx->kuzzle->document->delete_(ctx->index, ctx->collection, document_id); + } + catch (KuzzleException e) + { + } +} + +WHEN("^I try to create a new document with id 'my-document-id'$") +{ + REGEX_PARAM(std::string, document_id); + + ScenarioScope ctx; + ctx->success = true; + try + { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, + "{\"a\":\"document\"}"); + } + catch (KuzzleException e) + { + ctx->success = true; + } +} + +THEN("^I get an error with message 'document alread exists'$") +{ + ScenarioScope ctx; + BOOST_CHECK(ctx->success == false); +} + +GIVEN("^'test-index'/'test-collection' does't have a document with id " + "'my-document-id'$") +{ + pending(); +} + +THEN("^the document is successfully created$") +{ + ScenarioScope ctx; + BOOST_CHECK(ctx->success == false); +} + +GIVEN("^there is an user with id '([\\w\\-]+)'$") +{ + REGEX_PARAM(std::string, user_id); + ScenarioScope ctx; + ctx->user_id = user_id; +} + +GIVEN("^the user has 'local' credentials with name '([\\w\\-]+)' and password " + "'([\\w\\-]+)'$") +{ + REGEX_PARAM(std::string, username); + REGEX_PARAM(std::string, password); + ScenarioScope ctx; + + kuzzle_user_create(ctx->kuzzle, ctx->user_id, username, password); +} + +WHEN("^I log in as '([\\w\\-]+)':'([\\w\\-]+)'$") +{ + REGEX_PARAM(std::string, username); + REGEX_PARAM(std::string, password); + ScenarioScope ctx; + + string jwt; + try + { + jwt = + ctx->kuzzle->auth->login("local", get_login_creds(username, password)); + K_LOG_D("Logged in as '%s'", username.c_str()); + K_LOG_D("JWT is: %s", jwt.c_str()); + } + catch (KuzzleException e) + { + K_LOG_W(e.getMessage().c_str()); + } + ctx->jwt = jwt; +} + +THEN("^the JWT is valid$") +{ + ScenarioScope ctx; + token_validity *v = ctx->kuzzle->auth->checkToken(ctx->jwt); + BOOST_CHECK(v->valid); +} + +THEN("^the JWT is invalid$") +{ + ScenarioScope ctx; + token_validity *v = ctx->kuzzle->auth->checkToken(ctx->jwt); + BOOST_CHECK(!v->valid); +} + +GIVEN("^I update my user custom data \\(updateSelf\\) with " + "'\\{\\\\\"foo\\\\\": \\\\\"bar\\\\\"\\}'$") +{ + pending(); +} + +WHEN("^I get my user info$") +{ + ScenarioScope ctx; + + sleep(5); + + try + { + ctx->currentUser = ctx->kuzzle->auth->getCurrentUser(); + } + catch (KuzzleException e) + { + K_LOG_E(e.getMessage().c_str()); + } + + try + { + K_LOG_D("========= getMyCredentials ============"); + K_LOG_D(ctx->kuzzle->auth->getMyCredentials("local").c_str()); + } + catch (KuzzleException e) + { + K_LOG_E(e.getMessage().c_str()); + } + + K_LOG_D("Current user content: %s", ctx->currentUser->content); + + BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, + "Failed to retrieve current user"); +} + +GIVEN("^I login using 'local' authentication, with and password " + " as credentials$") +{ + pending(); +} + +GIVEN("^the retrieved JWT is valid$") { pending(); } + +THEN("^The JWT is no more valid$") { pending(); } diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp new file mode 100644 index 00000000..488c7aa6 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp @@ -0,0 +1,204 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "kuzzle_utils.h" + +using boost::property_tree::ptree; +using boost::property_tree::read_json; +using boost::property_tree::write_json; + +using std::string; +using std::cout; +using std::endl; +using kuzzleio::Kuzzle; +using kuzzleio::KuzzleException; + +using json_spirit::Object; +using json_spirit::Pair; +using json_spirit::Value; +using json_spirit::Array; + +std::string get_login_creds(const std::string &username, + const std::string &password) { + // Write json. + ptree pt; + pt.put("username", username); + pt.put("password", password); + std::ostringstream buf; + write_json(buf, pt, false); + return buf.str(); +} + +string get_createUser_body(const std::string &username, + const std::string &password) { + // Write json. + + Object body; + Object content; + Object creds; + Object local; + + local.push_back(Pair("username", Value(username))); + local.push_back(Pair("password", Value(password))); + + creds.push_back(Pair("local", Value(local))); + + Array profileIds; + profileIds.push_back("default"); + + content.push_back(json_spirit::Pair("profileIds", Value(profileIds))); + content.push_back(json_spirit::Pair("name", Value(username))); + + body.push_back(Pair("content", Value(content))); + body.push_back(Pair("credentials", Value(creds))); + + std::ostringstream buf; + json_spirit::write_formatted(body, buf); + + return buf.str(); +} + +bool kuzzle_user_exists(Kuzzle *kuzzle, const string &user_id) { + bool user_exists = false; + try { + kuzzle_request req = {0}; + req.controller = "security"; + req.action = "getUser"; + req.id = user_id.c_str(); + kuzzle->query(&req); + user_exists = true; + } catch (KuzzleException e) { + K_LOG_W(e.getMessage().c_str()); + } + return user_exists; +} + +void kuzzle_user_delete(Kuzzle *kuzzle, const string &user_id) { + try { + kuzzle_request req = {0}; + req.controller = "security"; + req.action = "deleteUser"; + req.id = user_id.c_str(); + + query_options options = {0}; + options.refresh = (char *)"wait_for"; + kuzzle->query( + &req /*, &options*/); // TODO: test if we can delete with options + + K_LOG_D("Deleted user \"%s\"", user_id.c_str()); + } catch (KuzzleException e) { + K_LOG_E("Failed to delete user \"%s\"", user_id.c_str()); + } +} + +void kuzzle_credentials_delete(Kuzzle *kuzzle, const string &strategy, + const string &user_id) { + try { + kuzzle_request req = {0}; + req.controller = "security"; + req.action = "deleteCredentials"; + req.strategy = "local"; + req.id = user_id.c_str(); + + kuzzle->query(&req); + + K_LOG_D("Deleted '%s' credentials for userId '%s'", strategy.c_str(), + user_id.c_str()); + } catch (KuzzleException e) { + K_LOG_E("Failed to delete '%s' credentials for userId '%s'", + strategy.c_str(), user_id.c_str()); + K_LOG_E(e.getMessage().c_str()); + } +} + +void kuzzle_user_create(Kuzzle *kuzzle, const string &user_id, + const string &username, const string &password) { + + kuzzle_request req = {0}; + req.controller = "security"; + req.action = "createUser"; + req.strategy = "local"; + req.id = user_id.c_str(); + string body = get_createUser_body(username, password); + req.body = body.c_str(); + + if (kuzzle_user_exists(kuzzle, user_id.c_str())) { + K_LOG_W("An user with id: '%s' already exists, deleteting it...", + user_id.c_str()); + kuzzle_credentials_delete(kuzzle, "local", user_id); + kuzzle_user_delete(kuzzle, user_id); + } + + K_LOG_D("Creating user with id: '%s' and 'local' creds: %s:%s", + user_id.c_str(), username.c_str(), password.c_str()); + K_LOG_D("Req body: %s", req.body); + try { + kuzzle_response *resp = kuzzle->query(&req); + K_LOG_D("createUser ended with status: %d", resp->status); + } catch (KuzzleException e) { + K_LOG_E("Status (%d): %s", e.status, e.getMessage().c_str()); + } +} + +void kuz_log_sep() { + cout << "\x1b(0\x6c\x1b(B"; + for (int i = 0; i < 79; i++) { + cout << "\x1b(0\x71\x1b(B"; + } + cout << endl; +} + +void kuz_log_e(const char *filename, int linenumber, const char *fmt...) { + va_list args; + va_start(args, fmt); + + cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_RED << "E:"; + cout << basename(filename) << ":" << linenumber << ":"; + vprintf(fmt, args); + std::cout << TXT_COLOR_RESET << std::endl; + + va_end(args); +} + +void kuz_log_w(const char *filename, int linenumber, const char *fmt...) { + va_list args; + va_start(args, fmt); + cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_YELLOW << "W:"; + cout << basename(filename) << ":" << linenumber << ":"; + vprintf(fmt, args); + cout << TXT_COLOR_RESET << endl; + + va_end(args); +} + +void kuz_log_d(const char *filename, int linenumber, const char *fmt...) { + va_list args; + va_start(args, fmt); + + cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_DEFAULT << "D:"; + cout << basename(filename) << ":" << linenumber << ":"; + vprintf(fmt, args); + cout << TXT_COLOR_RESET << endl; + + va_end(args); +} + +void kuz_log_i(const char *filename, int linenumber, const char *fmt...) { + va_list args; + va_start(args, fmt); + + cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_BLUE << "I:"; + cout << basename(filename) << ":" << linenumber << ":"; + vprintf(fmt, args); + cout << TXT_COLOR_RESET << endl; + + va_end(args); +} \ No newline at end of file diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h new file mode 100644 index 00000000..8b6eb381 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h @@ -0,0 +1,47 @@ +#include +#include +#define TXT_COLOR_RESET "\e[0m" + +#define TXT_COLOR_DEFAULT "\e[39m" +#define TXT_COLOR_BLACK "\e[30m" +#define TXT_COLOR_RED "\e[31m" +#define TXT_COLOR_GREEN "\e[32m" +#define TXT_COLOR_YELLOW "\e[33m" +#define TXT_COLOR_BLUE "\e[34m" +#define TXT_COLOR_MAGENTA "\e[35m" +#define TXT_COLOR_CYAN "\e[36m" +#define TXT_COLOR_LIGHTGREY "\e[37m" +#define TXT_COLOR_DARKGREY "\e[90m" + +void kuz_log_sep(); + +void kuz_log_e(const char *filename, int linenumber, const char *fmt...); +void kuz_log_w(const char *filename, int linenumber, const char *fmt...); +void kuz_log_d(const char *filename, int linenumber, const char *fmt...); +void kuz_log_i(const char *filename, int linenumber, const char *fmt...); + +#define K_LOG_D(fmt, ...) \ + do { \ + kuz_log_d(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } while (0) + +#define K_LOG_W(fmt, ...) \ + do { \ + kuz_log_w(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } while (0) + +#define K_LOG_E(fmt, ...) \ + do { \ + kuz_log_e(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } while (0) + +#define K_LOG_I(fmt, ...) \ + do { \ + kuz_log_i(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \ + } while (0) + +std::string get_login_creds(const std::string &username, + const std::string &password); +void kuzzle_user_create(kuzzleio::Kuzzle *kuzzle, const std::string &user_id, + const std::string &username, + const std::string &password); diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp index a02b78f6..1a16cecb 100644 --- a/internal/wrappers/headers/collection.hpp +++ b/internal/wrappers/headers/collection.hpp @@ -18,9 +18,10 @@ #include #include #include "core.hpp" +#include "exceptions.hpp" namespace kuzzleio { - + class Kuzzle; class Collection { collection* _collection; Collection(); diff --git a/internal/wrappers/headers/exceptions.hpp b/internal/wrappers/headers/exceptions.hpp index 156bd037..fc6b81ab 100644 --- a/internal/wrappers/headers/exceptions.hpp +++ b/internal/wrappers/headers/exceptions.hpp @@ -17,6 +17,7 @@ #include #include +#include #define Kuz_Throw_KuzzleException throw(\ BadRequestException, \ @@ -161,4 +162,4 @@ namespace kuzzleio { } } -#endif \ No newline at end of file +#endif diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp index c05f7a44..9de53df2 100644 --- a/internal/wrappers/headers/index.hpp +++ b/internal/wrappers/headers/index.hpp @@ -14,11 +14,13 @@ #ifndef _KUZZLE_INDEX_HPP #define _KUZZLE_INDEX_HPP - +#include +#include #include "exceptions.hpp" #include "core.hpp" namespace kuzzleio { + class Kuzzle; class Index { kuzzle_index *_index; Index(); diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 5972b4bd..65b1bdc4 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -49,52 +49,52 @@ typedef void (*kuzzle_event_listener)(int, char*, void*); //define a request typedef struct { - char *request_id; - char *controller; - char *action; - char *index; - char *collection; - char *body; - char *id; + const char *request_id; + const char *controller; + const char *action; + const char *index; + const char *collection; + const char *body; + const char *id; long from; long size; - char *scroll; - char *scroll_id; - char *strategy; + const char *scroll; + const char *scroll_id; + const char *strategy; unsigned long long expires_in; - char *volatiles; - char *scope; - char *state; - char *user; - long start; + const char *volatiles; + const char *scope; + const char *state; + const char *user; + const long start; long stop; long end; unsigned char bit; - char *member; - char *member1; - char *member2; + const char *member; + const char *member1; + const char *member2; char **members; size_t members_length; double lon; double lat; double distance; - char *unit; - char *options; - char **keys; + const char *unit; + const char *options; + const char **keys; size_t keys_length; long cursor; long offset; - char *field; - char **fields; + const char *field; + const char **fields; size_t fields_length; - char *subcommand; - char *pattern; + const char *subcommand; + const char *pattern; long idx; - char *min; - char *max; - char *limit; + const char *min; + const char *max; + const char *limit; unsigned long count; - char *match; + const char *match; } kuzzle_request; typedef offline_queue* (*kuzzle_offline_queue_loader)(void); @@ -182,6 +182,21 @@ typedef struct { enum Mode {AUTO, MANUAL}; //options passed to the Kuzzle() fct + +#define KUZZLE_OPTIONS_DEFAULT { \ + .queue_ttl = 120000, \ + .queue_max_size = 500, \ + .offline_mode = 0, \ + .auto_queue = false, \ + .auto_reconnect = true, \ + .auto_replay = false, \ + .auto_resubscribe = true, \ + .reconnection_delay = 1000, \ + .replay_interval = 10, \ + .connect = AUTO, \ + .refresh = NULL, \ + .default_index = NULL \ +} typedef struct { unsigned queue_ttl; unsigned long queue_max_size; @@ -427,7 +442,7 @@ typedef struct token_validity { /* === Generic response structures === */ // raw Kuzzle response -typedef struct kuzzle_response { +typedef struct { char *request_id; char *result; char *volatiles; From be9885a4ab7070a4c225f5541e31859841b9fa8c Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Wed, 16 May 2018 18:06:06 +0200 Subject: [PATCH 142/363] build cucumber-cpp as cmake external project --- .../features/step_defs_cpp/CMakeLists.txt | 59 +++++++++++++++++-- .../features/step_defs_cpp/cucumber.wire | 4 +- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt index 7cd30d9b..c2427b56 100644 --- a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt +++ b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt @@ -1,6 +1,35 @@ cmake_minimum_required(VERSION 3.0.0) project(KuzzleSKDTests) + +include(ExternalProject) + +ExternalProject_Add( + ext_cucumber-cpp + PREFIX cucumber-cpp + GIT_REPOSITORY https://github.com/cucumber/cucumber-cpp + INSTALL_COMMAND "" + CMAKE_CACHE_ARGS + -DCUKE_DISABLE_QT:BOOL=ON + -DCUKE_ENABLE_EXAMPLES:BOOL=OFF + -DCUKE_DISABLE_GTEST:BOOL=ON + -DCUKE_DISABLE_UNIT_TESTS:BOOL=ON + -DCUKE_DISABLE_E2E_TESTS:BOOL=ON +) + +# Library +ExternalProject_Get_Property(ext_cucumber-cpp binary_dir) +set(CUCUMBER_CPP_LIBRARY_PATH ${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src/libcucumber-cpp.a) +set(CUCUMBER_CPP_LIBRARY cucumber-cpp) + + +ExternalProject_Get_property(ext_cucumber-cpp SOURCE_DIR) +set(CUCUMBER_CPP_INCLUDE_PATH "${SOURCE_DIR}/include") + +message("cucumber-cpp: include path = ${CUCUMBER_CPP_INCLUDE_PATH}") +message("cucumber-cpp: library parh = ${CUCUMBER_CPP_LIBRARY_PATH}") + + add_subdirectory(3rdparty/json_spirit) # @@ -36,12 +65,30 @@ set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost if(Boost_UNIT_TEST_FRAMEWORK_FOUND) - link_directories("/home/etrousset/test/test_cucumber-cpp/cucumber-cpp/build/src") - link_directories("/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/build/cpp") - include_directories("/home/etrousset/test/test_cucumber-cpp/cucumber-cpp/include") - include_directories("/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/headers") - include_directories("/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/build/c") add_executable(KuzzleSDKStepDefs kuzzle-sdk-steps kuzzle_utils) - target_link_libraries(KuzzleSDKStepDefs cpp cucumber-cpp json_spirit ${CUKE_EXTRA_LIBRARIES} ${CUKE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + + add_library(cucumber-cpp STATIC IMPORTED) # or STATIC instead of SHARED + set_target_properties(cucumber-cpp PROPERTIES + IMPORTED_LOCATION ${CUCUMBER_CPP_LIBRARY_PATH} + INTERFACE_INCLUDE_DIRECTORIES ${CUCUMBER_CPP_INCLUDE_PATH} + ) + + add_library(kuzzlesdk STATIC IMPORTED) # or STATIC instead of SHARED + set_target_properties(kuzzlesdk PROPERTIES + IMPORTED_LOCATION "/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/build/c/libkuzzlesdk.a" + INTERFACE_INCLUDE_DIRECTORIES + "/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/build/c" + ) + + add_library(cpp STATIC IMPORTED) # or STATIC instead of SHARED + set_target_properties(cpp PROPERTIES + IMPORTED_LOCATION "/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/build/cpp/libcpp.a" + INTERFACE_INCLUDE_DIRECTORIES + "/home/etrousset/go/src/github.com/kuzzleio/sdk-go/internal/wrappers/headers" + ) + + + + target_link_libraries(KuzzleSDKStepDefs cpp kuzzlesdk pthread cucumber-cpp json_spirit ${CUKE_EXTRA_LIBRARIES} ${CUKE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ) endif() diff --git a/internal/wrappers/features/step_defs_cpp/cucumber.wire b/internal/wrappers/features/step_defs_cpp/cucumber.wire index da2da560..631ff045 100644 --- a/internal/wrappers/features/step_defs_cpp/cucumber.wire +++ b/internal/wrappers/features/step_defs_cpp/cucumber.wire @@ -1,2 +1,4 @@ -host: localhost +host: local--host port: 3902 +timeout: + invoke: 4 \ No newline at end of file From e541c09e4ad45f817259f6c03ff36c1e9c9616af Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Thu, 17 May 2018 10:04:14 +0200 Subject: [PATCH 143/363] removed cucumber.wire file --- internal/wrappers/features/step_defs_cpp/cucumber.wire | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 internal/wrappers/features/step_defs_cpp/cucumber.wire diff --git a/internal/wrappers/features/step_defs_cpp/cucumber.wire b/internal/wrappers/features/step_defs_cpp/cucumber.wire deleted file mode 100644 index da2da560..00000000 --- a/internal/wrappers/features/step_defs_cpp/cucumber.wire +++ /dev/null @@ -1,2 +0,0 @@ -host: localhost -port: 3902 From aec6b23c5842839e1074b2e833f2f6021e07d661 Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Thu, 17 May 2018 11:37:54 +0200 Subject: [PATCH 144/363] added build script to build cpp e2e tests --- internal/wrappers/build_cpp_test.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 internal/wrappers/build_cpp_test.sh diff --git a/internal/wrappers/build_cpp_test.sh b/internal/wrappers/build_cpp_test.sh new file mode 100755 index 00000000..30bbe971 --- /dev/null +++ b/internal/wrappers/build_cpp_test.sh @@ -0,0 +1,5 @@ +#/bin/bash +cmake -E make_directory _build_cpp_tests +cmake -E chdir _build_cpp_tests cmake ../features/step_defs_cpp +cmake --build _build_cpp_tests -- -j + From 052e643cd3fe4c7c457f72e31da83f65a9a1267c Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Thu, 17 May 2018 14:56:53 +0200 Subject: [PATCH 145/363] small fixes...debuging --- internal/wrappers/features/sdks2.feature | 3 +- .../features/step_defs_cpp/CMakeLists.txt | 12 +-- .../features/step_defs_cpp/kuzzle_utils.cpp | 88 +++++++++++++------ 3 files changed, 69 insertions(+), 34 deletions(-) diff --git a/internal/wrappers/features/sdks2.feature b/internal/wrappers/features/sdks2.feature index 1e91ad11..b5d7d376 100644 --- a/internal/wrappers/features/sdks2.feature +++ b/internal/wrappers/features/sdks2.feature @@ -1,7 +1,6 @@ # SDK's integration tests #======================== - Feature: Create document with ids Scenario: Do not allow creating a document with an _id that already exist in the same collection @@ -95,4 +94,4 @@ Feature: Create document with ids # Then I receive a "out" notification # Examples: # | lon | lat | in | -# | 43.6108 | 3.8767 | yes | \ No newline at end of file +# | 43.6108 | 3.8767 | yes | diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt index c1027e3e..764bba79 100644 --- a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt +++ b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt @@ -5,8 +5,7 @@ project(KuzzleSKDTests) include(ExternalProject) ExternalProject_Add( - ext_cucumber_cpp - PREFIX cucumber-cpp + project_cucumber_cpp GIT_REPOSITORY https://github.com/cucumber/cucumber-cpp INSTALL_COMMAND "" CMAKE_CACHE_ARGS @@ -18,22 +17,23 @@ ExternalProject_Add( ) # Library -ExternalProject_Get_Property(ext_cucumber_cpp binary_dir) +ExternalProject_Get_Property(project_cucumber_cpp binary_dir) set(CUCUMBER_CPP_LIBRARY_PATH ${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src/libcucumber-cpp.a) set(CUCUMBER_CPP_LIBRARY cucumber-cpp) -ExternalProject_Get_property(ext_cucumber_cpp SOURCE_DIR) +ExternalProject_Get_property(project_cucumber_cpp SOURCE_DIR) set(CUCUMBER_CPP_INCLUDE_PATH "${SOURCE_DIR}/include") message("cucumber-cpp: include path = ${CUCUMBER_CPP_INCLUDE_PATH}") message("cucumber-cpp: library parh = ${CUCUMBER_CPP_LIBRARY_PATH}") add_library(cucumber-cpp STATIC IMPORTED) # or STATIC instead of SHARED -add_dependencies(cucumber-cpp ext_cucumber_cpp) +add_dependencies(cucumber-cpp project_cucumber_cpp) set_target_properties(cucumber-cpp PROPERTIES IMPORTED_LOCATION ${CUCUMBER_CPP_LIBRARY_PATH} INTERFACE_INCLUDE_DIRECTORIES ${CUCUMBER_CPP_INCLUDE_PATH} + DEPENDS project_cucumber_cpp ) # @@ -83,7 +83,7 @@ set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost if(Boost_UNIT_TEST_FRAMEWORK_FOUND) add_executable(KuzzleSDKStepDefs kuzzle-sdk-steps kuzzle_utils) - add_dependencies(KuzzleSDKStepDefs ext_cucumber_cpp) + add_dependencies(KuzzleSDKStepDefs project_cucumber_cpp) add_library(kuzzlesdk STATIC IMPORTED) # or STATIC instead of SHARED diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp index 488c7aa6..aa843c70 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp @@ -15,19 +15,20 @@ using boost::property_tree::ptree; using boost::property_tree::read_json; using boost::property_tree::write_json; -using std::string; -using std::cout; -using std::endl; using kuzzleio::Kuzzle; using kuzzleio::KuzzleException; +using std::cout; +using std::endl; +using std::string; +using json_spirit::Array; using json_spirit::Object; using json_spirit::Pair; using json_spirit::Value; -using json_spirit::Array; std::string get_login_creds(const std::string &username, - const std::string &password) { + const std::string &password) +{ // Write json. ptree pt; pt.put("username", username); @@ -38,7 +39,8 @@ std::string get_login_creds(const std::string &username, } string get_createUser_body(const std::string &username, - const std::string &password) { + const std::string &password) +{ // Write json. Object body; @@ -66,23 +68,34 @@ string get_createUser_body(const std::string &username, return buf.str(); } -bool kuzzle_user_exists(Kuzzle *kuzzle, const string &user_id) { +bool kuzzle_user_exists(Kuzzle *kuzzle, const string &user_id) +{ bool user_exists = false; - try { + try + { kuzzle_request req = {0}; req.controller = "security"; req.action = "getUser"; req.id = user_id.c_str(); kuzzle->query(&req); user_exists = true; - } catch (KuzzleException e) { + } + catch (kuzzleio::NotFoundException e) + { + user_exists = false; + } + catch (KuzzleException e) + { K_LOG_W(e.getMessage().c_str()); } return user_exists; } -void kuzzle_user_delete(Kuzzle *kuzzle, const string &user_id) { - try { +void kuzzle_user_delete(Kuzzle *kuzzle, const string &user_id) +{ + K_LOG_D("Deleting user with ID: '%s'", user_id.c_str()); + try + { kuzzle_request req = {0}; req.controller = "security"; req.action = "deleteUser"; @@ -90,18 +103,23 @@ void kuzzle_user_delete(Kuzzle *kuzzle, const string &user_id) { query_options options = {0}; options.refresh = (char *)"wait_for"; + options.volatiles = (char *)"{}"; kuzzle->query( - &req /*, &options*/); // TODO: test if we can delete with options + &req, &options); // TODO: test if we can delete with options K_LOG_D("Deleted user \"%s\"", user_id.c_str()); - } catch (KuzzleException e) { + } + catch (KuzzleException e) + { K_LOG_E("Failed to delete user \"%s\"", user_id.c_str()); } } void kuzzle_credentials_delete(Kuzzle *kuzzle, const string &strategy, - const string &user_id) { - try { + const string &user_id) +{ + try + { kuzzle_request req = {0}; req.controller = "security"; req.action = "deleteCredentials"; @@ -112,7 +130,9 @@ void kuzzle_credentials_delete(Kuzzle *kuzzle, const string &strategy, K_LOG_D("Deleted '%s' credentials for userId '%s'", strategy.c_str(), user_id.c_str()); - } catch (KuzzleException e) { + } + catch (KuzzleException e) + { K_LOG_E("Failed to delete '%s' credentials for userId '%s'", strategy.c_str(), user_id.c_str()); K_LOG_E(e.getMessage().c_str()); @@ -120,7 +140,8 @@ void kuzzle_credentials_delete(Kuzzle *kuzzle, const string &strategy, } void kuzzle_user_create(Kuzzle *kuzzle, const string &user_id, - const string &username, const string &password) { + const string &username, const string &password) +{ kuzzle_request req = {0}; req.controller = "security"; @@ -130,33 +151,45 @@ void kuzzle_user_create(Kuzzle *kuzzle, const string &user_id, string body = get_createUser_body(username, password); req.body = body.c_str(); - if (kuzzle_user_exists(kuzzle, user_id.c_str())) { + // if (kuzzle_user_exists(kuzzle, user_id.c_str())) + { K_LOG_W("An user with id: '%s' already exists, deleteting it...", user_id.c_str()); kuzzle_credentials_delete(kuzzle, "local", user_id); kuzzle_user_delete(kuzzle, user_id); } + // kuzzle_credentials_delete(kuzzle, "local", user_id); + K_LOG_D("Creating user with id: '%s' and 'local' creds: %s:%s", user_id.c_str(), username.c_str(), password.c_str()); K_LOG_D("Req body: %s", req.body); - try { + try + { kuzzle_response *resp = kuzzle->query(&req); K_LOG_D("createUser ended with status: %d", resp->status); - } catch (KuzzleException e) { + } + catch (KuzzleException e) + { K_LOG_E("Status (%d): %s", e.status, e.getMessage().c_str()); + if (kuzzle_user_exists(kuzzle, user_id.c_str())) { + K_LOG_W("But user seems to exist anyway?????"); + } } } -void kuz_log_sep() { +void kuz_log_sep() +{ cout << "\x1b(0\x6c\x1b(B"; - for (int i = 0; i < 79; i++) { + for (int i = 0; i < 79; i++) + { cout << "\x1b(0\x71\x1b(B"; } cout << endl; } -void kuz_log_e(const char *filename, int linenumber, const char *fmt...) { +void kuz_log_e(const char *filename, int linenumber, const char *fmt...) +{ va_list args; va_start(args, fmt); @@ -168,7 +201,8 @@ void kuz_log_e(const char *filename, int linenumber, const char *fmt...) { va_end(args); } -void kuz_log_w(const char *filename, int linenumber, const char *fmt...) { +void kuz_log_w(const char *filename, int linenumber, const char *fmt...) +{ va_list args; va_start(args, fmt); cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_YELLOW << "W:"; @@ -179,7 +213,8 @@ void kuz_log_w(const char *filename, int linenumber, const char *fmt...) { va_end(args); } -void kuz_log_d(const char *filename, int linenumber, const char *fmt...) { +void kuz_log_d(const char *filename, int linenumber, const char *fmt...) +{ va_list args; va_start(args, fmt); @@ -191,7 +226,8 @@ void kuz_log_d(const char *filename, int linenumber, const char *fmt...) { va_end(args); } -void kuz_log_i(const char *filename, int linenumber, const char *fmt...) { +void kuz_log_i(const char *filename, int linenumber, const char *fmt...) +{ va_list args; va_start(args, fmt); From 04c3c70d4b033b0aedf21f09ca5359a6d9f888bc Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Tue, 22 May 2018 10:48:52 +0200 Subject: [PATCH 146/363] added cucumber.wire config file --- internal/wrappers/features/step_definitions/cucumber.wire | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 internal/wrappers/features/step_definitions/cucumber.wire diff --git a/internal/wrappers/features/step_definitions/cucumber.wire b/internal/wrappers/features/step_definitions/cucumber.wire new file mode 100644 index 00000000..22e03d5c --- /dev/null +++ b/internal/wrappers/features/step_definitions/cucumber.wire @@ -0,0 +1,6 @@ +host: localhost +port: 3902 +timeout: + invoke: 4 + step_matches: 60 + From f2486d6b0e2133d0b357b3f214ac2c9217799720 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 22 May 2018 11:27:26 +0200 Subject: [PATCH 147/363] fix updateSelf --- internal/wrappers/cgo/kuzzle/auth.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 8732ace5..9f900b42 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -170,10 +170,8 @@ func kuzzle_update_my_credentials(a *C.auth, strategy *C.char, credentials *C.ch //export kuzzle_update_self func kuzzle_update_self(a *C.auth, data *C.char, options *C.query_options) *C.user_result { - marshed, _ := json.Marshal(C.GoString(data)) - res, err := (*auth.Auth)(a.instance).UpdateSelf( - marshed, + json.RawMessage(C.GoString(data)), SetQueryOptions(options)) return goToCUserResult(a.kuzzle, res, err) From 99c876a695d84bdea9c05dcc995d35c77d672082 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 22 May 2018 12:07:56 +0200 Subject: [PATCH 148/363] fix return in getCurrentUser cpp --- auth/getCurrentUser.go | 3 --- internal/wrappers/cpp/auth.cpp | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/auth/getCurrentUser.go b/auth/getCurrentUser.go index ad0b6461..51966638 100644 --- a/auth/getCurrentUser.go +++ b/auth/getCurrentUser.go @@ -16,7 +16,6 @@ package auth import ( "encoding/json" - "fmt" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" @@ -35,8 +34,6 @@ func (a *Auth) GetCurrentUser() (*security.User, error) { res := <-result - fmt.Printf("GO: %s\n", res) - if res.Error != nil { return nil, res.Error } diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index a4260e79..670ea0ae 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -64,7 +64,9 @@ namespace kuzzleio { user_result *r = kuzzle_get_current_user(_auth); if (r->error != NULL) throwExceptionFromStatus(r); + user *u = r->result; kuzzle_free_user_result(r); + return u; } std::string Auth::getMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { From 3dad3934ff3fcf5b628fb744f4fff2825669c164 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 22 May 2018 15:01:53 +0200 Subject: [PATCH 149/363] change cucumber timeout --- internal/wrappers/features/sdks2.feature | 2 +- internal/wrappers/features/step_definitions/cucumber.wire | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/features/sdks2.feature b/internal/wrappers/features/sdks2.feature index b5d7d376..ca99190a 100644 --- a/internal/wrappers/features/sdks2.feature +++ b/internal/wrappers/features/sdks2.feature @@ -41,7 +41,7 @@ Feature: Create document with ids And I log in as 'my-user-name':'my-user-pwd' And I update my user custom data with the pair : When I get my user info - Then the response '_source' field contains the pair : + Then the response '_source' field contains the pair : And is a Examples: | fieldname | fieldvalue | type | diff --git a/internal/wrappers/features/step_definitions/cucumber.wire b/internal/wrappers/features/step_definitions/cucumber.wire index 22e03d5c..e36943b8 100644 --- a/internal/wrappers/features/step_definitions/cucumber.wire +++ b/internal/wrappers/features/step_definitions/cucumber.wire @@ -1,6 +1,6 @@ host: localhost port: 3902 timeout: - invoke: 4 + invoke: 10 step_matches: 60 From 3e4ec8b453fc3bf6514e321e4d3226ee2d2e2ac4 Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Tue, 22 May 2018 15:16:18 +0200 Subject: [PATCH 150/363] raised cucumber 'invoke' timeout --- internal/wrappers/features/step_definitions/cucumber.wire | 2 +- internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/wrappers/features/step_definitions/cucumber.wire b/internal/wrappers/features/step_definitions/cucumber.wire index e36943b8..581267b9 100644 --- a/internal/wrappers/features/step_definitions/cucumber.wire +++ b/internal/wrappers/features/step_definitions/cucumber.wire @@ -1,6 +1,6 @@ host: localhost port: 3902 timeout: - invoke: 10 + invoke: 30 step_matches: 60 diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index d7ecd5e6..ba8a1f8c 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -293,6 +293,7 @@ WHEN("^I get my user info$") K_LOG_E(e.getMessage().c_str()); } + K_LOG_D("current user = 0x%p", ctx->currentUser); K_LOG_D("Current user content: %s", ctx->currentUser->content); BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, From 3f89f9bba76688618e08abcd98913fc45f3fcd27 Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Wed, 23 May 2018 15:11:38 +0200 Subject: [PATCH 151/363] fixed build: fixed tests weren't building anymore cucumber-cpp changed their build, introduicing the need for another include path to ensure we can find new generated header CukeExport.hpp --- .../wrappers/features/step_defs_cpp/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt index 764bba79..82ce0ebe 100644 --- a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt +++ b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt @@ -8,6 +8,7 @@ ExternalProject_Add( project_cucumber_cpp GIT_REPOSITORY https://github.com/cucumber/cucumber-cpp INSTALL_COMMAND "" + CMAKE_CACHE_ARGS -DCUKE_DISABLE_QT:BOOL=ON -DCUKE_ENABLE_EXAMPLES:BOOL=OFF @@ -19,20 +20,25 @@ ExternalProject_Add( # Library ExternalProject_Get_Property(project_cucumber_cpp binary_dir) set(CUCUMBER_CPP_LIBRARY_PATH ${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src/libcucumber-cpp.a) +list( APPEND CUCUMBER_CPP_INCLUDE_PATH "${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src") set(CUCUMBER_CPP_LIBRARY cucumber-cpp) ExternalProject_Get_property(project_cucumber_cpp SOURCE_DIR) -set(CUCUMBER_CPP_INCLUDE_PATH "${SOURCE_DIR}/include") +list(APPEND CUCUMBER_CPP_INCLUDE_PATH "${SOURCE_DIR}/include") message("cucumber-cpp: include path = ${CUCUMBER_CPP_INCLUDE_PATH}") message("cucumber-cpp: library parh = ${CUCUMBER_CPP_LIBRARY_PATH}") +list(APPEND LIB_INCLUDE_DIRS "dir1") +list(APPEND LIB_INCLUDE_DIRS "dir2") + add_library(cucumber-cpp STATIC IMPORTED) # or STATIC instead of SHARED add_dependencies(cucumber-cpp project_cucumber_cpp) set_target_properties(cucumber-cpp PROPERTIES IMPORTED_LOCATION ${CUCUMBER_CPP_LIBRARY_PATH} - INTERFACE_INCLUDE_DIRECTORIES ${CUCUMBER_CPP_INCLUDE_PATH} + INTERFACE_INCLUDE_DIRECTORIES + "${CUCUMBER_CPP_INCLUDE_PATH}" DEPENDS project_cucumber_cpp ) From 538f5e22f0b9e94ee0725162ca58ec29a2de71d2 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 23 May 2018 16:54:38 +0200 Subject: [PATCH 152/363] remove pointers type on KuzzleError --- auth/checkToken.go | 2 +- auth/createMyCredentials.go | 2 +- auth/credentialsExist.go | 2 +- auth/getCurrentUser.go | 2 +- auth/getMyCredentials.go | 2 +- auth/getMyRights.go | 2 +- auth/getStrategies.go | 2 +- auth/login.go | 2 +- auth/logout.go | 2 +- auth/update_my_credentials.go | 2 +- auth/update_self.go | 2 +- auth/validate_my_credentials.go | 2 +- collection/create.go | 4 ++++ collection/delete_specifications.go | 2 +- collection/exists.go | 2 +- collection/get_mapping.go | 2 +- collection/get_specifications.go | 2 +- collection/list.go | 2 +- collection/search_specifications.go | 2 +- collection/truncate.go | 2 +- collection/update_mapping.go | 2 +- collection/update_specifications.go | 2 +- collection/validate_specifications.go | 2 +- connection/websocket/web_socket.go | 2 +- document/count.go | 2 +- document/create.go | 2 +- document/createOrReplace.go | 2 +- document/delete.go | 2 +- document/deleteByQuery.go | 2 +- document/exists.go | 2 +- document/get.go | 2 +- document/mCreate.go | 2 +- document/mCreateOrReplace.go | 2 +- document/mDelete.go | 2 +- document/mGet.go | 2 +- document/mReplace.go | 2 +- document/mUpdate.go | 2 +- document/replace.go | 2 +- document/search.go | 2 +- document/update.go | 2 +- document/validate.go | 2 +- index/create.go | 2 +- index/delete.go | 2 +- index/exists.go | 2 +- index/getAutoRefresh.go | 2 +- index/list.go | 2 +- index/mDelete.go | 2 +- index/refreshInternal.go | 2 +- index/setAutoRefresh.go | 2 +- internal/wrappers/cgo/kuzzle/errors.go | 2 +- internal/wrappers/cgo/kuzzle/go_to_c.go | 4 ++-- ms/append.go | 2 +- ms/bitcount.go | 2 +- ms/bitop.go | 2 +- ms/bitpos.go | 2 +- ms/dbsize.go | 2 +- ms/decr.go | 2 +- ms/decrby.go | 2 +- ms/del.go | 2 +- ms/exists.go | 2 +- ms/expire.go | 2 +- ms/expireat.go | 2 +- ms/geoadd.go | 2 +- ms/geodist.go | 2 +- ms/geohash.go | 2 +- ms/geopos.go | 2 +- ms/georadius.go | 2 +- ms/georadiusbymember.go | 2 +- ms/get.go | 2 +- ms/getbit.go | 2 +- ms/getrange.go | 2 +- ms/getset.go | 2 +- ms/hdel.go | 2 +- ms/hexists.go | 2 +- ms/hget.go | 2 +- ms/hgetall.go | 2 +- ms/hincrby.go | 2 +- ms/hincrbyfloat.go | 2 +- ms/hkeys.go | 2 +- ms/hlen.go | 2 +- ms/hmget.go | 2 +- ms/hscan.go | 2 +- ms/hset.go | 2 +- ms/hsetnx.go | 2 +- ms/hstrlen.go | 2 +- ms/hvals.go | 2 +- ms/incr.go | 2 +- ms/incrby.go | 2 +- ms/incrbyfloat.go | 2 +- ms/keys.go | 2 +- ms/lindex.go | 2 +- ms/linsert.go | 2 +- ms/llen.go | 2 +- ms/lpop.go | 2 +- ms/lpush.go | 2 +- ms/lpushx.go | 2 +- ms/lrange.go | 2 +- ms/lrem.go | 2 +- ms/mget.go | 2 +- ms/msetnx.go | 2 +- ms/object.go | 2 +- ms/persist.go | 2 +- ms/pexpire.go | 2 +- ms/pexpireat.go | 2 +- ms/pfadd.go | 2 +- ms/pfcount.go | 2 +- ms/ping.go | 2 +- ms/pttl.go | 2 +- ms/randomkey.go | 2 +- ms/renamenx.go | 2 +- ms/rpop.go | 2 +- ms/rpoplpush.go | 2 +- ms/rpush.go | 2 +- ms/rpushx.go | 2 +- ms/sadd.go | 2 +- ms/scan.go | 2 +- ms/scard.go | 2 +- ms/sdiff.go | 2 +- ms/sdiffstore.go | 2 +- ms/setnx.go | 2 +- ms/sinter.go | 2 +- ms/sinterstore.go | 2 +- ms/sismember.go | 2 +- ms/smembers.go | 2 +- ms/smove.go | 2 +- ms/sort.go | 2 +- ms/spop.go | 2 +- ms/srandmember.go | 2 +- ms/srem.go | 2 +- ms/sscan.go | 2 +- ms/strlen.go | 2 +- ms/sunion.go | 2 +- ms/sunionstore.go | 2 +- ms/time.go | 2 +- ms/touch.go | 2 +- ms/ttl.go | 2 +- ms/type.go | 2 +- ms/zadd.go | 2 +- ms/zcard.go | 2 +- ms/zcount.go | 2 +- ms/zincrby.go | 2 +- ms/zinterstore.go | 2 +- ms/zlexcount.go | 2 +- ms/zrange.go | 2 +- ms/zrangebylex.go | 2 +- ms/zrangebyscore.go | 2 +- ms/zrank.go | 2 +- ms/zrem.go | 2 +- ms/zremrangebylex.go | 2 +- ms/zremrangebyrank.go | 2 +- ms/zremrangebyscore.go | 2 +- ms/zrevrange.go | 2 +- ms/zrevrangebylex.go | 2 +- ms/zrevrangebyscore.go | 2 +- ms/zrevrank.go | 2 +- ms/zscan.go | 2 +- ms/zscore.go | 2 +- ms/zunionstore.go | 2 +- realtime/count.go | 2 +- realtime/join.go | 2 +- realtime/list.go | 2 +- realtime/publish.go | 2 +- realtime/subscribe.go | 2 +- realtime/unsubscribe.go | 2 +- realtime/validate.go | 2 +- security/createCredentials.go | 2 +- security/createFirstAdmin.go | 2 +- security/createOrReplaceProfile.go | 2 +- security/createOrReplaceRole.go | 2 +- security/createProfile.go | 2 +- security/createRestrictedUser.go | 2 +- security/createRole.go | 2 +- security/createUser.go | 2 +- security/deleteCredentials.go | 2 +- security/deleteProfile.go | 2 +- security/deleteRole.go | 2 +- security/deleteUser.go | 2 +- security/getAllCredentialFields.go | 2 +- security/getCredentialFields.go | 2 +- security/getCredentials.go | 2 +- security/getCredentialsById.go | 2 +- security/getProfile.go | 2 +- security/getProfileMapping.go | 2 +- security/getProfileRights.go | 2 +- security/getRole.go | 2 +- security/getRoleMapping.go | 2 +- security/getUser.go | 2 +- security/getUserMapping.go | 2 +- security/getUserRights.go | 2 +- security/hasCredentials.go | 2 +- security/mDeleteCredentials.go | 2 +- security/mDeleteRoles.go | 2 +- security/mDeleteUsers.go | 2 +- security/mGetProfiles.go | 2 +- security/mGetRoles.go | 2 +- security/replaceUser.go | 2 +- security/searchProfiles.go | 2 +- security/searchRoles.go | 2 +- security/searchUsers.go | 2 +- security/updateCredentials.go | 2 +- security/updateProfile.go | 2 +- security/updateProfileMapping.go | 2 +- security/updateRole.go | 2 +- security/updateRoleMapping.go | 2 +- security/updateUser.go | 2 +- security/updateUserMapping.go | 2 +- security/validateCredentials.go | 2 +- server/adminExists.go | 2 +- server/getAllStats.go | 2 +- server/getConfig.go | 2 +- server/getLastStats.go | 2 +- server/getStats.go | 2 +- server/info.go | 2 +- server/now.go | 2 +- types/kuzzle_response.go | 10 +++++----- 215 files changed, 223 insertions(+), 219 deletions(-) diff --git a/auth/checkToken.go b/auth/checkToken.go index 8c7db868..eaadf565 100644 --- a/auth/checkToken.go +++ b/auth/checkToken.go @@ -48,7 +48,7 @@ func (a *Auth) CheckToken(token string) (*TokenValidity, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/createMyCredentials.go b/auth/createMyCredentials.go index cdb394f0..003ea06f 100644 --- a/auth/createMyCredentials.go +++ b/auth/createMyCredentials.go @@ -37,7 +37,7 @@ func (a *Auth) CreateMyCredentials(strategy string, credentials json.RawMessage, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/credentialsExist.go b/auth/credentialsExist.go index 57203459..c665ab52 100644 --- a/auth/credentialsExist.go +++ b/auth/credentialsExist.go @@ -36,7 +36,7 @@ func (a *Auth) CredentialsExist(strategy string, options types.QueryOptions) (bo res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/auth/getCurrentUser.go b/auth/getCurrentUser.go index 51966638..a0e9027e 100644 --- a/auth/getCurrentUser.go +++ b/auth/getCurrentUser.go @@ -34,7 +34,7 @@ func (a *Auth) GetCurrentUser() (*security.User, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/getMyCredentials.go b/auth/getMyCredentials.go index 0e66bc0a..5b612467 100644 --- a/auth/getMyCredentials.go +++ b/auth/getMyCredentials.go @@ -37,7 +37,7 @@ func (a *Auth) GetMyCredentials(strategy string, options types.QueryOptions) (js res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/getMyRights.go b/auth/getMyRights.go index e2847c30..59f3abb3 100644 --- a/auth/getMyRights.go +++ b/auth/getMyRights.go @@ -37,7 +37,7 @@ func (a *Auth) GetMyRights(options types.QueryOptions) ([]*types.UserRights, err res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/getStrategies.go b/auth/getStrategies.go index a58fee21..8cc24ef0 100644 --- a/auth/getStrategies.go +++ b/auth/getStrategies.go @@ -32,7 +32,7 @@ func (a *Auth) GetStrategies(options types.QueryOptions) ([]string, error) { res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/login.go b/auth/login.go index 49f1469f..9b907a32 100644 --- a/auth/login.go +++ b/auth/login.go @@ -58,7 +58,7 @@ func (a *Auth) Login(strategy string, credentials json.RawMessage, expiresIn *in json.Unmarshal(res.Result, &token) - if res.Error != nil { + if res.Error.Error() != "" { a.kuzzle.EmitEvent(event.LoginAttempt, &types.LoginAttempt{Success: false, Error: res.Error}) return "", res.Error } diff --git a/auth/logout.go b/auth/logout.go index 75bed61f..96e2f2a8 100644 --- a/auth/logout.go +++ b/auth/logout.go @@ -30,7 +30,7 @@ func (a *Auth) Logout() error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/auth/update_my_credentials.go b/auth/update_my_credentials.go index ac6d761e..3827b278 100644 --- a/auth/update_my_credentials.go +++ b/auth/update_my_credentials.go @@ -38,7 +38,7 @@ func (a *Auth) UpdateMyCredentials(strategy string, credentials json.RawMessage, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/update_self.go b/auth/update_self.go index 2c45d0f2..0fddbfdd 100644 --- a/auth/update_self.go +++ b/auth/update_self.go @@ -38,7 +38,7 @@ func (a *Auth) UpdateSelf(data json.RawMessage, options types.QueryOptions) (*se res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/validate_my_credentials.go b/auth/validate_my_credentials.go index 97774bb5..bc57ed67 100644 --- a/auth/validate_my_credentials.go +++ b/auth/validate_my_credentials.go @@ -35,7 +35,7 @@ func (a *Auth) ValidateMyCredentials(strategy string, credentials json.RawMessag res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/collection/create.go b/collection/create.go index cccc8464..ea633ae0 100644 --- a/collection/create.go +++ b/collection/create.go @@ -40,5 +40,9 @@ func (dc *Collection) Create(index string, collection string, options types.Quer res := <-ch + if res.Error.Error() == "" { + return nil + } + return res.Error } diff --git a/collection/delete_specifications.go b/collection/delete_specifications.go index 7ea8b01e..acc4e58f 100644 --- a/collection/delete_specifications.go +++ b/collection/delete_specifications.go @@ -38,7 +38,7 @@ func (dc *Collection) DeleteSpecifications(index string, collection string, opti res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/collection/exists.go b/collection/exists.go index 933eba45..d6f2c0c5 100644 --- a/collection/exists.go +++ b/collection/exists.go @@ -43,7 +43,7 @@ func (dc *Collection) Exists(index string, collection string, options types.Quer res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/collection/get_mapping.go b/collection/get_mapping.go index 5994ec53..a48ea342 100644 --- a/collection/get_mapping.go +++ b/collection/get_mapping.go @@ -42,7 +42,7 @@ func (dc *Collection) GetMapping(index string, collection string, options types. res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/get_specifications.go b/collection/get_specifications.go index 5cc54e6f..fa6511f5 100644 --- a/collection/get_specifications.go +++ b/collection/get_specifications.go @@ -42,7 +42,7 @@ func (dc *Collection) GetSpecifications(index string, collection string, options res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/list.go b/collection/list.go index 35307553..f06af938 100644 --- a/collection/list.go +++ b/collection/list.go @@ -38,7 +38,7 @@ func (dc *Collection) List(index string, options types.QueryOptions) (json.RawMe res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/search_specifications.go b/collection/search_specifications.go index 3a6a672c..3cae4a56 100644 --- a/collection/search_specifications.go +++ b/collection/search_specifications.go @@ -33,7 +33,7 @@ func (dc *Collection) SearchSpecifications(options types.QueryOptions) (*types.S res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/truncate.go b/collection/truncate.go index 4e7d075c..dc0d687b 100644 --- a/collection/truncate.go +++ b/collection/truncate.go @@ -40,7 +40,7 @@ func (dc *Collection) Truncate(index string, collection string, options types.Qu res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/collection/update_mapping.go b/collection/update_mapping.go index 7f24a5d3..ef3b4f36 100644 --- a/collection/update_mapping.go +++ b/collection/update_mapping.go @@ -47,7 +47,7 @@ func (dc *Collection) UpdateMapping(index string, collection string, body json.R res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/collection/update_specifications.go b/collection/update_specifications.go index 67b63f57..4164a560 100644 --- a/collection/update_specifications.go +++ b/collection/update_specifications.go @@ -47,7 +47,7 @@ func (dc *Collection) UpdateSpecifications(index string, collection string, body res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go index 7d6a87b1..b524d203 100644 --- a/collection/validate_specifications.go +++ b/collection/validate_specifications.go @@ -38,7 +38,7 @@ func (dc *Collection) ValidateSpecifications(body json.RawMessage, options types res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 35ab3f80..81a72ec6 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -348,7 +348,7 @@ func (ws *webSocket) listen() { } } else if c, found := ws.channelsResult.Load(message.RequestId); found { - if message.Error != nil && message.Error.Message == "Token expired" { + if message.Error.Error() != "" && message.Error.Message == "Token expired" { ws.EmitEvent(event.TokenExpired, nil) } diff --git a/document/count.go b/document/count.go index 9333595b..4f799a1c 100644 --- a/document/count.go +++ b/document/count.go @@ -51,7 +51,7 @@ func (d *Document) Count(index string, collection string, body json.RawMessage, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/document/create.go b/document/create.go index 292479ea..56d4497d 100644 --- a/document/create.go +++ b/document/create.go @@ -56,7 +56,7 @@ func (d *Document) Create(index string, collection string, id string, body json. res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/createOrReplace.go b/document/createOrReplace.go index 07dcff6b..68577d4b 100644 --- a/document/createOrReplace.go +++ b/document/createOrReplace.go @@ -60,7 +60,7 @@ func (d *Document) CreateOrReplace(index string, collection string, _id string, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/delete.go b/document/delete.go index ad5cf25a..3a96d483 100644 --- a/document/delete.go +++ b/document/delete.go @@ -48,7 +48,7 @@ func (d *Document) Delete(index string, collection string, _id string, options t res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go index f6c81973..536fba22 100644 --- a/document/deleteByQuery.go +++ b/document/deleteByQuery.go @@ -48,7 +48,7 @@ func (d *Document) DeleteByQuery(index string, collection string, body string, o res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/document/exists.go b/document/exists.go index d9a88ab4..0d63db82 100644 --- a/document/exists.go +++ b/document/exists.go @@ -48,7 +48,7 @@ func (d *Document) Exists(index string, collection string, _id string, options t res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/document/get.go b/document/get.go index 161e8552..1cd4fd90 100644 --- a/document/get.go +++ b/document/get.go @@ -48,7 +48,7 @@ func (d *Document) Get(index string, collection string, _id string, options type res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mCreate.go b/document/mCreate.go index 0412c4c8..03759d88 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -48,7 +48,7 @@ func (d *Document) MCreate(index string, collection string, body json.RawMessage res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index 7a262054..28a78c87 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -48,7 +48,7 @@ func (d *Document) MCreateOrReplace(index string, collection string, body json.R res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mDelete.go b/document/mDelete.go index 5ff59bf0..bc8fdeac 100644 --- a/document/mDelete.go +++ b/document/mDelete.go @@ -48,7 +48,7 @@ func (d *Document) MDelete(index string, collection string, ids []string, option res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/document/mGet.go b/document/mGet.go index ec4dcd67..b6619217 100644 --- a/document/mGet.go +++ b/document/mGet.go @@ -53,7 +53,7 @@ func (d *Document) MGet(index string, collection string, ids []string, includeTr res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mReplace.go b/document/mReplace.go index 586b5bea..d3718b64 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -48,7 +48,7 @@ func (d *Document) MReplace(index string, collection string, body json.RawMessag res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mUpdate.go b/document/mUpdate.go index 8ca4a26f..8a567bb5 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -48,7 +48,7 @@ func (d *Document) MUpdate(index string, collection string, body json.RawMessage res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/replace.go b/document/replace.go index 0cc297bb..6cbdddd9 100644 --- a/document/replace.go +++ b/document/replace.go @@ -53,7 +53,7 @@ func (d *Document) Replace(index string, collection string, _id string, body jso res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/search.go b/document/search.go index 8487ff37..827c60ac 100644 --- a/document/search.go +++ b/document/search.go @@ -48,7 +48,7 @@ func (d *Document) Search(index string, collection string, body json.RawMessage, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/document/update.go b/document/update.go index 1f8cb349..0d5cc1f1 100644 --- a/document/update.go +++ b/document/update.go @@ -53,7 +53,7 @@ func (d *Document) Update(index string, collection string, id string, body json. res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/validate.go b/document/validate.go index 662f5104..13c84019 100644 --- a/document/validate.go +++ b/document/validate.go @@ -48,7 +48,7 @@ func (d *Document) Validate(index string, collection string, body json.RawMessag res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/index/create.go b/index/create.go index c6114cda..cbd2245e 100644 --- a/index/create.go +++ b/index/create.go @@ -35,7 +35,7 @@ func (i *Index) Create(index string, options types.QueryOptions) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/index/delete.go b/index/delete.go index e06dc9dd..ef29ec08 100644 --- a/index/delete.go +++ b/index/delete.go @@ -33,7 +33,7 @@ func (i *Index) Delete(index string, options types.QueryOptions) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/index/exists.go b/index/exists.go index b61abead..16797714 100644 --- a/index/exists.go +++ b/index/exists.go @@ -39,7 +39,7 @@ func (i *Index) Exists(index string, options types.QueryOptions) (bool, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/index/getAutoRefresh.go b/index/getAutoRefresh.go index fee0ae9e..4afc079b 100644 --- a/index/getAutoRefresh.go +++ b/index/getAutoRefresh.go @@ -39,7 +39,7 @@ func (i *Index) GetAutoRefresh(index string, options types.QueryOptions) (bool, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/index/list.go b/index/list.go index f4516a76..b5469907 100644 --- a/index/list.go +++ b/index/list.go @@ -34,7 +34,7 @@ func (i *Index) List(options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/index/mDelete.go b/index/mDelete.go index 0edeab75..6a3d0b86 100644 --- a/index/mDelete.go +++ b/index/mDelete.go @@ -38,7 +38,7 @@ func (i *Index) MDelete(indexes []string, options types.QueryOptions) ([]string, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/index/refreshInternal.go b/index/refreshInternal.go index bd9df7a6..37541ce3 100644 --- a/index/refreshInternal.go +++ b/index/refreshInternal.go @@ -30,7 +30,7 @@ func (i *Index) RefreshInternal(options types.QueryOptions) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/index/setAutoRefresh.go b/index/setAutoRefresh.go index 9537a1bd..977af516 100644 --- a/index/setAutoRefresh.go +++ b/index/setAutoRefresh.go @@ -37,7 +37,7 @@ func (i *Index) SetAutoRefresh(index string, autoRefresh bool, options types.Que res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index 744564a8..880ee0d8 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -174,7 +174,7 @@ func Set_room_result_error(s *C.room_result, err error) { } func setErr(status *C.int, error **C.char, stack **C.char, err error) { - kuzzleError := err.(*types.KuzzleError) + kuzzleError := err.(types.KuzzleError) *status = C.int(kuzzleError.Status) *error = C.CString(kuzzleError.Message) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index bd27bb71..fe8413e4 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -85,7 +85,7 @@ func goToCNotificationContent(gNotifContent *types.NotificationResult) *C.notifi func goToCNotificationResult(gNotif *types.KuzzleNotification) *C.notification_result { result := (*C.notification_result)(C.calloc(1, C.sizeof_notification_result)) - if gNotif.Error != nil { + if gNotif.Error.Error() != "" { Set_notification_result_error(result, gNotif.Error) return result } @@ -127,7 +127,7 @@ func goToCKuzzleResponse(gRes *types.KuzzleResponse) *C.kuzzle_response { result.channel = C.CString(gRes.Channel) result.status = C.int(gRes.Status) - if gRes.Error != nil { + if gRes.Error.Error() != "" { // The error might be a partial error Set_kuzzle_response_error(result, gRes.Error) } diff --git a/ms/append.go b/ms/append.go index 06a9a6d1..8dc0b5cc 100755 --- a/ms/append.go +++ b/ms/append.go @@ -37,7 +37,7 @@ func (ms *Ms) Append(key string, value string, options types.QueryOptions) (int, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/bitcount.go b/ms/bitcount.go index 3ed0c776..a8d45764 100755 --- a/ms/bitcount.go +++ b/ms/bitcount.go @@ -43,7 +43,7 @@ func (ms *Ms) Bitcount(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/bitop.go b/ms/bitop.go index ed5b6a97..19c4899e 100755 --- a/ms/bitop.go +++ b/ms/bitop.go @@ -38,7 +38,7 @@ func (ms *Ms) Bitop(key string, operation string, keys []string, options types.Q res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/bitpos.go b/ms/bitpos.go index 758d44a1..a060440f 100755 --- a/ms/bitpos.go +++ b/ms/bitpos.go @@ -44,7 +44,7 @@ func (ms *Ms) Bitpos(key string, bit int, options types.QueryOptions) (int, erro res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/dbsize.go b/ms/dbsize.go index b101acc3..5bff76d9 100755 --- a/ms/dbsize.go +++ b/ms/dbsize.go @@ -31,7 +31,7 @@ func (ms *Ms) Dbsize(options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/decr.go b/ms/decr.go index 6edf534e..652202b3 100755 --- a/ms/decr.go +++ b/ms/decr.go @@ -33,7 +33,7 @@ func (ms *Ms) Decr(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/decrby.go b/ms/decrby.go index 3a88fb41..6c1d2fb1 100755 --- a/ms/decrby.go +++ b/ms/decrby.go @@ -38,7 +38,7 @@ func (ms *Ms) Decrby(key string, value int, options types.QueryOptions) (int, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/del.go b/ms/del.go index b3b3b808..6b325206 100755 --- a/ms/del.go +++ b/ms/del.go @@ -41,7 +41,7 @@ func (ms *Ms) Del(keys []string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/exists.go b/ms/exists.go index c082e54b..bf1b0aca 100755 --- a/ms/exists.go +++ b/ms/exists.go @@ -37,7 +37,7 @@ func (ms *Ms) Exists(keys []string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/expire.go b/ms/expire.go index 1696ea9e..c38fd1c9 100755 --- a/ms/expire.go +++ b/ms/expire.go @@ -38,7 +38,7 @@ func (ms *Ms) Expire(key string, seconds int, options types.QueryOptions) (bool, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/expireat.go b/ms/expireat.go index a2e9ab9e..29cb23d9 100755 --- a/ms/expireat.go +++ b/ms/expireat.go @@ -38,7 +38,7 @@ func (ms *Ms) Expireat(key string, timestamp int, options types.QueryOptions) (b res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/geoadd.go b/ms/geoadd.go index c41f33c5..030bca97 100755 --- a/ms/geoadd.go +++ b/ms/geoadd.go @@ -37,7 +37,7 @@ func (ms *Ms) Geoadd(key string, points []*types.GeoPoint, options types.QueryOp res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/geodist.go b/ms/geodist.go index 57dfbd91..413c11e1 100755 --- a/ms/geodist.go +++ b/ms/geodist.go @@ -39,7 +39,7 @@ func (ms *Ms) Geodist(key string, member1 string, member2 string, options types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult float64 diff --git a/ms/geohash.go b/ms/geohash.go index 3a4f9b5b..eeced2d1 100755 --- a/ms/geohash.go +++ b/ms/geohash.go @@ -33,7 +33,7 @@ func (ms *Ms) Geohash(key string, members []string, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/geopos.go b/ms/geopos.go index fefbec6d..c33d7c03 100755 --- a/ms/geopos.go +++ b/ms/geopos.go @@ -34,7 +34,7 @@ func (ms *Ms) Geopos(key string, members []string, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var stringResults [][]string diff --git a/ms/georadius.go b/ms/georadius.go index 6c2bbbd0..47f71a62 100755 --- a/ms/georadius.go +++ b/ms/georadius.go @@ -115,7 +115,7 @@ func (ms *Ms) Georadius(key string, lon float64, lat float64, distance float64, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/georadiusbymember.go b/ms/georadiusbymember.go index 3d7d5104..8dca0d8e 100755 --- a/ms/georadiusbymember.go +++ b/ms/georadiusbymember.go @@ -37,7 +37,7 @@ func (ms *Ms) Georadiusbymember(key string, member string, distance float64, uni res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/get.go b/ms/get.go index a8ed00f1..c89658bb 100755 --- a/ms/get.go +++ b/ms/get.go @@ -33,7 +33,7 @@ func (ms *Ms) Get(key string, options types.QueryOptions) (*string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/getbit.go b/ms/getbit.go index 4b865e36..0e8cc4d0 100755 --- a/ms/getbit.go +++ b/ms/getbit.go @@ -34,7 +34,7 @@ func (ms *Ms) Getbit(key string, offset int, options types.QueryOptions) (int, e res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/ms/getrange.go b/ms/getrange.go index 7bcfc1c2..39fb3c21 100755 --- a/ms/getrange.go +++ b/ms/getrange.go @@ -35,7 +35,7 @@ func (ms *Ms) Getrange(key string, start int, end int, options types.QueryOption res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } var returnedResult string diff --git a/ms/getset.go b/ms/getset.go index badc03f4..cef1751d 100755 --- a/ms/getset.go +++ b/ms/getset.go @@ -37,7 +37,7 @@ func (ms *Ms) Getset(key string, value string, options types.QueryOptions) (*str res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/hdel.go b/ms/hdel.go index 681c8659..8266f2cb 100755 --- a/ms/hdel.go +++ b/ms/hdel.go @@ -42,7 +42,7 @@ func (ms *Ms) Hdel(key string, fields []string, options types.QueryOptions) (int res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/ms/hexists.go b/ms/hexists.go index 50967349..1ef4d73c 100755 --- a/ms/hexists.go +++ b/ms/hexists.go @@ -34,7 +34,7 @@ func (ms *Ms) Hexists(key string, field string, options types.QueryOptions) (boo res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/hget.go b/ms/hget.go index f1492dd7..b0013d5e 100755 --- a/ms/hget.go +++ b/ms/hget.go @@ -34,7 +34,7 @@ func (ms *Ms) Hget(key string, field string, options types.QueryOptions) (*strin res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/hgetall.go b/ms/hgetall.go index 4dafc7af..fd547b40 100755 --- a/ms/hgetall.go +++ b/ms/hgetall.go @@ -33,7 +33,7 @@ func (ms *Ms) Hgetall(key string, options types.QueryOptions) (map[string]string res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } returnedResult := map[string]string{} diff --git a/ms/hincrby.go b/ms/hincrby.go index 3a591de2..40f3b8d8 100755 --- a/ms/hincrby.go +++ b/ms/hincrby.go @@ -39,7 +39,7 @@ func (ms *Ms) Hincrby(key string, field string, value int, options types.QueryOp res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/hincrbyfloat.go b/ms/hincrbyfloat.go index 9cf36de3..d585c4f7 100755 --- a/ms/hincrbyfloat.go +++ b/ms/hincrbyfloat.go @@ -40,7 +40,7 @@ func (ms *Ms) Hincrbyfloat(key string, field string, value float64, options type res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/hkeys.go b/ms/hkeys.go index 54f885b2..ce50e32a 100755 --- a/ms/hkeys.go +++ b/ms/hkeys.go @@ -33,7 +33,7 @@ func (ms *Ms) Hkeys(key string, options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/hlen.go b/ms/hlen.go index 0f8cbecf..7237aae1 100755 --- a/ms/hlen.go +++ b/ms/hlen.go @@ -33,7 +33,7 @@ func (ms *Ms) Hlen(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } var returnedResult int diff --git a/ms/hmget.go b/ms/hmget.go index 2dda4e11..5746b049 100755 --- a/ms/hmget.go +++ b/ms/hmget.go @@ -34,7 +34,7 @@ func (ms *Ms) Hmget(key string, fields []string, options types.QueryOptions) ([] res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/hscan.go b/ms/hscan.go index 2ac46da8..7bd9edaf 100755 --- a/ms/hscan.go +++ b/ms/hscan.go @@ -50,7 +50,7 @@ func (ms *Ms) Hscan(key string, cursor int, options types.QueryOptions) (*HscanR res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/hset.go b/ms/hset.go index fe0dfc9a..fa2a7c00 100755 --- a/ms/hset.go +++ b/ms/hset.go @@ -40,7 +40,7 @@ func (ms *Ms) Hset(key string, field string, value string, options types.QueryOp res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/hsetnx.go b/ms/hsetnx.go index aa4bb0a9..a72d1852 100755 --- a/ms/hsetnx.go +++ b/ms/hsetnx.go @@ -39,7 +39,7 @@ func (ms *Ms) Hsetnx(key string, field string, value string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/hstrlen.go b/ms/hstrlen.go index c80629a7..d6b25bc7 100755 --- a/ms/hstrlen.go +++ b/ms/hstrlen.go @@ -34,7 +34,7 @@ func (ms *Ms) Hstrlen(key string, field string, options types.QueryOptions) (int res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/ms/hvals.go b/ms/hvals.go index b5d88592..5be35b49 100755 --- a/ms/hvals.go +++ b/ms/hvals.go @@ -33,7 +33,7 @@ func (ms *Ms) Hvals(key string, options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/incr.go b/ms/incr.go index 67b78ecc..99073e1d 100755 --- a/ms/incr.go +++ b/ms/incr.go @@ -34,7 +34,7 @@ func (ms *Ms) Incr(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/incrby.go b/ms/incrby.go index 1b1900f1..eac9db96 100755 --- a/ms/incrby.go +++ b/ms/incrby.go @@ -39,7 +39,7 @@ func (ms *Ms) Incrby(key string, value int, options types.QueryOptions) (int, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/incrbyfloat.go b/ms/incrbyfloat.go index d12ce6e6..53ab1a00 100755 --- a/ms/incrbyfloat.go +++ b/ms/incrbyfloat.go @@ -40,7 +40,7 @@ func (ms *Ms) Incrbyfloat(key string, value float64, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/keys.go b/ms/keys.go index 19a302e1..128b1dd5 100755 --- a/ms/keys.go +++ b/ms/keys.go @@ -33,7 +33,7 @@ func (ms *Ms) Keys(pattern string, options types.QueryOptions) ([]string, error) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/lindex.go b/ms/lindex.go index 8d2acaaa..0be52022 100755 --- a/ms/lindex.go +++ b/ms/lindex.go @@ -34,7 +34,7 @@ func (ms *Ms) Lindex(key string, index int, options types.QueryOptions) (*string res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/linsert.go b/ms/linsert.go index bb172953..42583304 100755 --- a/ms/linsert.go +++ b/ms/linsert.go @@ -44,7 +44,7 @@ func (ms *Ms) Linsert(key string, position string, pivot string, value string, o res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } var returnedResult int diff --git a/ms/llen.go b/ms/llen.go index 74bdfb08..bdde6bd5 100755 --- a/ms/llen.go +++ b/ms/llen.go @@ -33,7 +33,7 @@ func (ms *Ms) Llen(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/lpop.go b/ms/lpop.go index 2065f3e8..bad1f3da 100755 --- a/ms/lpop.go +++ b/ms/lpop.go @@ -33,7 +33,7 @@ func (ms *Ms) Lpop(key string, options types.QueryOptions) (*string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/lpush.go b/ms/lpush.go index 294e3d98..4885f6f1 100755 --- a/ms/lpush.go +++ b/ms/lpush.go @@ -44,7 +44,7 @@ func (ms *Ms) Lpush(key string, values []string, options types.QueryOptions) (in res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/lpushx.go b/ms/lpushx.go index c41b9213..08022838 100755 --- a/ms/lpushx.go +++ b/ms/lpushx.go @@ -39,7 +39,7 @@ func (ms *Ms) Lpushx(key string, value string, options types.QueryOptions) (int, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/lrange.go b/ms/lrange.go index 46d325df..13c42713 100755 --- a/ms/lrange.go +++ b/ms/lrange.go @@ -35,7 +35,7 @@ func (ms *Ms) Lrange(key string, start int, stop int, options types.QueryOptions res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/lrem.go b/ms/lrem.go index 3e34778b..6f1d31b3 100755 --- a/ms/lrem.go +++ b/ms/lrem.go @@ -39,7 +39,7 @@ func (ms *Ms) Lrem(key string, count int, value string, options types.QueryOptio res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/mget.go b/ms/mget.go index 0a1c80a0..aa789487 100755 --- a/ms/mget.go +++ b/ms/mget.go @@ -36,7 +36,7 @@ func (ms *Ms) Mget(keys []string, options types.QueryOptions) ([]*string, error) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []*string diff --git a/ms/msetnx.go b/ms/msetnx.go index 7d9b43cb..202bb4de 100755 --- a/ms/msetnx.go +++ b/ms/msetnx.go @@ -41,7 +41,7 @@ func (ms *Ms) Msetnx(entries []*types.MSKeyValue, options types.QueryOptions) (b res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/object.go b/ms/object.go index 3bcf702b..3e62e576 100755 --- a/ms/object.go +++ b/ms/object.go @@ -37,7 +37,7 @@ func (ms *Ms) Object(key string, subcommand string, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/persist.go b/ms/persist.go index 31aa39be..e2daca1d 100755 --- a/ms/persist.go +++ b/ms/persist.go @@ -32,7 +32,7 @@ func (ms *Ms) Persist(key string, options types.QueryOptions) (bool, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/pexpire.go b/ms/pexpire.go index 604763b5..b27fd443 100755 --- a/ms/pexpire.go +++ b/ms/pexpire.go @@ -38,7 +38,7 @@ func (ms *Ms) Pexpire(key string, ttl int, options types.QueryOptions) (bool, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/pexpireat.go b/ms/pexpireat.go index 06b9ad2a..77d27a72 100755 --- a/ms/pexpireat.go +++ b/ms/pexpireat.go @@ -39,7 +39,7 @@ func (ms *Ms) Pexpireat(key string, timestamp int, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/pfadd.go b/ms/pfadd.go index c3db6e02..c4a66a82 100755 --- a/ms/pfadd.go +++ b/ms/pfadd.go @@ -41,7 +41,7 @@ func (ms *Ms) Pfadd(key string, elements []string, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/pfcount.go b/ms/pfcount.go index 1367de88..e5af6821 100755 --- a/ms/pfcount.go +++ b/ms/pfcount.go @@ -41,7 +41,7 @@ func (ms *Ms) Pfcount(keys []string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/ping.go b/ms/ping.go index 426f2635..6921e169 100755 --- a/ms/ping.go +++ b/ms/ping.go @@ -31,7 +31,7 @@ func (ms *Ms) Ping(options types.QueryOptions) (string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } var returnedResult string diff --git a/ms/pttl.go b/ms/pttl.go index a45f1703..60b11d28 100755 --- a/ms/pttl.go +++ b/ms/pttl.go @@ -32,7 +32,7 @@ func (ms *Ms) Pttl(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/randomkey.go b/ms/randomkey.go index 423892f7..4a42ad8f 100755 --- a/ms/randomkey.go +++ b/ms/randomkey.go @@ -31,7 +31,7 @@ func (ms *Ms) Randomkey(options types.QueryOptions) (*string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/renamenx.go b/ms/renamenx.go index 21d0f6a6..875a6a2d 100755 --- a/ms/renamenx.go +++ b/ms/renamenx.go @@ -37,7 +37,7 @@ func (ms *Ms) Renamenx(key string, newkey string, options types.QueryOptions) (b res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/rpop.go b/ms/rpop.go index dcfafd84..b14b5f92 100755 --- a/ms/rpop.go +++ b/ms/rpop.go @@ -36,7 +36,7 @@ func (ms *Ms) Rpop(key string, options types.QueryOptions) (*string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/rpoplpush.go b/ms/rpoplpush.go index b2be7190..a0f49d20 100755 --- a/ms/rpoplpush.go +++ b/ms/rpoplpush.go @@ -38,7 +38,7 @@ func (ms *Ms) Rpoplpush(source string, destination string, options types.QueryOp res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult string diff --git a/ms/rpush.go b/ms/rpush.go index 5715221f..79ff0ffd 100755 --- a/ms/rpush.go +++ b/ms/rpush.go @@ -42,7 +42,7 @@ func (ms *Ms) Rpush(source string, values []string, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/rpushx.go b/ms/rpushx.go index 79c0045f..a7c14149 100755 --- a/ms/rpushx.go +++ b/ms/rpushx.go @@ -38,7 +38,7 @@ func (ms *Ms) Rpushx(key string, value string, options types.QueryOptions) (int, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/sadd.go b/ms/sadd.go index 07164d84..c148c454 100755 --- a/ms/sadd.go +++ b/ms/sadd.go @@ -42,7 +42,7 @@ func (ms *Ms) Sadd(key string, values []string, options types.QueryOptions) (int res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/scan.go b/ms/scan.go index 81c416a2..237afb72 100755 --- a/ms/scan.go +++ b/ms/scan.go @@ -47,7 +47,7 @@ func (ms *Ms) Scan(cursor int, options types.QueryOptions) (*types.MSScanRespons res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/scard.go b/ms/scard.go index fdcc64f9..14da843c 100755 --- a/ms/scard.go +++ b/ms/scard.go @@ -33,7 +33,7 @@ func (ms *Ms) Scard(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/sdiff.go b/ms/sdiff.go index bcdae67b..fb0e19d2 100755 --- a/ms/sdiff.go +++ b/ms/sdiff.go @@ -38,7 +38,7 @@ func (ms *Ms) Sdiff(key string, sets []string, options types.QueryOptions) ([]st res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/sdiffstore.go b/ms/sdiffstore.go index bbab8922..6e79600c 100755 --- a/ms/sdiffstore.go +++ b/ms/sdiffstore.go @@ -45,7 +45,7 @@ func (ms *Ms) Sdiffstore(key string, sets []string, destination string, options res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/setnx.go b/ms/setnx.go index ab31a781..3b83f779 100755 --- a/ms/setnx.go +++ b/ms/setnx.go @@ -38,7 +38,7 @@ func (ms *Ms) Setnx(key string, value interface{}, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/sinter.go b/ms/sinter.go index 3faf5695..7bc536f0 100755 --- a/ms/sinter.go +++ b/ms/sinter.go @@ -37,7 +37,7 @@ func (ms *Ms) Sinter(keys []string, options types.QueryOptions) ([]string, error res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/sinterstore.go b/ms/sinterstore.go index 35fcea30..59e4f869 100755 --- a/ms/sinterstore.go +++ b/ms/sinterstore.go @@ -44,7 +44,7 @@ func (ms *Ms) Sinterstore(destination string, keys []string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/sismember.go b/ms/sismember.go index e41f506f..405ac988 100755 --- a/ms/sismember.go +++ b/ms/sismember.go @@ -34,7 +34,7 @@ func (ms *Ms) Sismember(key string, member string, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/smembers.go b/ms/smembers.go index 085b3b68..8d04c564 100755 --- a/ms/smembers.go +++ b/ms/smembers.go @@ -33,7 +33,7 @@ func (ms *Ms) Smembers(key string, options types.QueryOptions) ([]string, error) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/smove.go b/ms/smove.go index c7e09b38..1ca24ad2 100755 --- a/ms/smove.go +++ b/ms/smove.go @@ -39,7 +39,7 @@ func (ms *Ms) Smove(key string, destination string, member string, options types res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/sort.go b/ms/sort.go index 4193c495..95d82a33 100755 --- a/ms/sort.go +++ b/ms/sort.go @@ -67,7 +67,7 @@ func (ms *Ms) Sort(key string, options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/spop.go b/ms/spop.go index cd038d1a..c6ebdc71 100755 --- a/ms/spop.go +++ b/ms/spop.go @@ -39,7 +39,7 @@ func (ms *Ms) Spop(key string, options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/srandmember.go b/ms/srandmember.go index 44233fe3..4bde048c 100755 --- a/ms/srandmember.go +++ b/ms/srandmember.go @@ -46,7 +46,7 @@ func (ms *Ms) Srandmember(key string, options types.QueryOptions) ([]string, err res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/srem.go b/ms/srem.go index 7cfca649..1c99d9ea 100755 --- a/ms/srem.go +++ b/ms/srem.go @@ -42,7 +42,7 @@ func (ms *Ms) Srem(key string, valuesToRemove []string, options types.QueryOptio res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/sscan.go b/ms/sscan.go index 9ad371d6..9482816f 100755 --- a/ms/sscan.go +++ b/ms/sscan.go @@ -44,7 +44,7 @@ func (ms *Ms) Sscan(key string, cursor int, options types.QueryOptions) (*types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/strlen.go b/ms/strlen.go index 6be3d8ec..2c3e295f 100755 --- a/ms/strlen.go +++ b/ms/strlen.go @@ -33,7 +33,7 @@ func (ms *Ms) Strlen(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/sunion.go b/ms/sunion.go index b47507cd..79ec6fd3 100755 --- a/ms/sunion.go +++ b/ms/sunion.go @@ -37,7 +37,7 @@ func (ms *Ms) Sunion(sets []string, options types.QueryOptions) ([]string, error res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/sunionstore.go b/ms/sunionstore.go index 76c91fa9..c45284c1 100755 --- a/ms/sunionstore.go +++ b/ms/sunionstore.go @@ -43,7 +43,7 @@ func (ms *Ms) Sunionstore(destination string, sets []string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/time.go b/ms/time.go index a44cf04f..2ece24ba 100755 --- a/ms/time.go +++ b/ms/time.go @@ -31,7 +31,7 @@ func (ms *Ms) Time(options types.QueryOptions) ([]int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []int diff --git a/ms/touch.go b/ms/touch.go index 67e03f88..a999feae 100755 --- a/ms/touch.go +++ b/ms/touch.go @@ -40,7 +40,7 @@ func (ms *Ms) Touch(keys []string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/ttl.go b/ms/ttl.go index 77cfb54e..d21a8d13 100755 --- a/ms/ttl.go +++ b/ms/ttl.go @@ -37,7 +37,7 @@ func (ms *Ms) Ttl(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/type.go b/ms/type.go index 6cdc657c..f8b40063 100755 --- a/ms/type.go +++ b/ms/type.go @@ -33,7 +33,7 @@ func (ms *Ms) Type(key string, options types.QueryOptions) (string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } var returnedResult string diff --git a/ms/zadd.go b/ms/zadd.go index b9a19e54..6b3247cb 100755 --- a/ms/zadd.go +++ b/ms/zadd.go @@ -59,7 +59,7 @@ func (ms *Ms) Zadd(key string, elements []*types.MSSortedSet, options types.Quer res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zcard.go b/ms/zcard.go index 83030dbb..598e8d10 100755 --- a/ms/zcard.go +++ b/ms/zcard.go @@ -33,7 +33,7 @@ func (ms *Ms) Zcard(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zcount.go b/ms/zcount.go index 761bb620..28e70ddf 100755 --- a/ms/zcount.go +++ b/ms/zcount.go @@ -38,7 +38,7 @@ func (ms *Ms) Zcount(key string, min int, max int, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zincrby.go b/ms/zincrby.go index 54575d6c..2f2d58c5 100755 --- a/ms/zincrby.go +++ b/ms/zincrby.go @@ -40,7 +40,7 @@ func (ms *Ms) Zincrby(key string, member string, increment float64, options type res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zinterstore.go b/ms/zinterstore.go index 580c1877..61720c24 100755 --- a/ms/zinterstore.go +++ b/ms/zinterstore.go @@ -57,7 +57,7 @@ func (ms *Ms) Zinterstore(destination string, keys []string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zlexcount.go b/ms/zlexcount.go index e8a153e6..6500594d 100755 --- a/ms/zlexcount.go +++ b/ms/zlexcount.go @@ -39,7 +39,7 @@ func (ms *Ms) Zlexcount(key string, min string, max string, options types.QueryO res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zrange.go b/ms/zrange.go index 93157c10..b58cdb08 100755 --- a/ms/zrange.go +++ b/ms/zrange.go @@ -41,7 +41,7 @@ func (ms *Ms) Zrange(key string, start int, stop int, options types.QueryOptions res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrangebylex.go b/ms/zrangebylex.go index e0c2966d..c4d1a3aa 100755 --- a/ms/zrangebylex.go +++ b/ms/zrangebylex.go @@ -41,7 +41,7 @@ func (ms *Ms) Zrangebylex(key string, min string, max string, options types.Quer res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrangebyscore.go b/ms/zrangebyscore.go index 22b286fc..68379b81 100755 --- a/ms/zrangebyscore.go +++ b/ms/zrangebyscore.go @@ -38,7 +38,7 @@ func (ms *Ms) Zrangebyscore(key string, min float64, max float64, options types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrank.go b/ms/zrank.go index f7873882..d79c1c82 100755 --- a/ms/zrank.go +++ b/ms/zrank.go @@ -34,7 +34,7 @@ func (ms *Ms) Zrank(key string, member string, options types.QueryOptions) (int, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zrem.go b/ms/zrem.go index 38d26e1b..fa71f2c4 100755 --- a/ms/zrem.go +++ b/ms/zrem.go @@ -42,7 +42,7 @@ func (ms *Ms) Zrem(key string, members []string, options types.QueryOptions) (in res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zremrangebylex.go b/ms/zremrangebylex.go index 78fe1cca..7c9522d7 100755 --- a/ms/zremrangebylex.go +++ b/ms/zremrangebylex.go @@ -43,7 +43,7 @@ func (ms *Ms) Zremrangebylex(key string, min string, max string, options types.Q res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zremrangebyrank.go b/ms/zremrangebyrank.go index f0bf4556..417c47c0 100755 --- a/ms/zremrangebyrank.go +++ b/ms/zremrangebyrank.go @@ -42,7 +42,7 @@ func (ms *Ms) Zremrangebyrank(key string, min int, max int, options types.QueryO res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zremrangebyscore.go b/ms/zremrangebyscore.go index 4f79236b..98880da6 100755 --- a/ms/zremrangebyscore.go +++ b/ms/zremrangebyscore.go @@ -40,7 +40,7 @@ func (ms *Ms) Zremrangebyscore(key string, min float64, max float64, options typ res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zrevrange.go b/ms/zrevrange.go index c7354fd5..ff6e24a7 100755 --- a/ms/zrevrange.go +++ b/ms/zrevrange.go @@ -37,7 +37,7 @@ func (ms *Ms) Zrevrange(key string, start int, stop int, options types.QueryOpti res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrevrangebylex.go b/ms/zrevrangebylex.go index db9488d4..c571319c 100755 --- a/ms/zrevrangebylex.go +++ b/ms/zrevrangebylex.go @@ -41,7 +41,7 @@ func (ms *Ms) Zrevrangebylex(key string, min string, max string, options types.Q res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrevrangebyscore.go b/ms/zrevrangebyscore.go index 58aee6c6..f98b47f7 100755 --- a/ms/zrevrangebyscore.go +++ b/ms/zrevrangebyscore.go @@ -38,7 +38,7 @@ func (ms *Ms) Zrevrangebyscore(key string, min float64, max float64, options typ res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrevrank.go b/ms/zrevrank.go index 40549013..08dca5d5 100755 --- a/ms/zrevrank.go +++ b/ms/zrevrank.go @@ -34,7 +34,7 @@ func (ms *Ms) Zrevrank(key string, member string, options types.QueryOptions) (i res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zscan.go b/ms/zscan.go index 35050058..7ab5df31 100755 --- a/ms/zscan.go +++ b/ms/zscan.go @@ -50,7 +50,7 @@ func (ms *Ms) Zscan(key string, cursor int, options types.QueryOptions) (*types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zscore.go b/ms/zscore.go index bd37b568..5d0832f8 100755 --- a/ms/zscore.go +++ b/ms/zscore.go @@ -35,7 +35,7 @@ func (ms *Ms) Zscore(key string, member string, options types.QueryOptions) (flo res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zunionstore.go b/ms/zunionstore.go index 5b185514..3079bddb 100755 --- a/ms/zunionstore.go +++ b/ms/zunionstore.go @@ -57,7 +57,7 @@ func (ms *Ms) Zunionstore(destination string, keys []string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/realtime/count.go b/realtime/count.go index 4e68dd62..e7b70066 100644 --- a/realtime/count.go +++ b/realtime/count.go @@ -42,7 +42,7 @@ func (r *Realtime) Count(index, collection, roomID string) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/realtime/join.go b/realtime/join.go index f1004902..8011c7ad 100644 --- a/realtime/join.go +++ b/realtime/join.go @@ -56,7 +56,7 @@ func (r *Realtime) Join(index, collection, roomID string, options types.RoomOpti go r.k.Query(query, opts, result) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/realtime/list.go b/realtime/list.go index a3449fd6..1f31c087 100644 --- a/realtime/list.go +++ b/realtime/list.go @@ -39,7 +39,7 @@ func (r *Realtime) List(index string, collection string) (json.RawMessage, error res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/realtime/publish.go b/realtime/publish.go index 4eb539a8..4b7d5748 100644 --- a/realtime/publish.go +++ b/realtime/publish.go @@ -36,7 +36,7 @@ func (r *Realtime) Publish(index string, collection string, body string) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/realtime/subscribe.go b/realtime/subscribe.go index c13c4f62..13d0f186 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -56,7 +56,7 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/realtime/unsubscribe.go b/realtime/unsubscribe.go index 59ae22c4..13c2a77d 100644 --- a/realtime/unsubscribe.go +++ b/realtime/unsubscribe.go @@ -38,7 +38,7 @@ func (r *Realtime) Unsubscribe(roomID string) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/realtime/validate.go b/realtime/validate.go index f761e401..d99ccdfa 100644 --- a/realtime/validate.go +++ b/realtime/validate.go @@ -40,7 +40,7 @@ func (r *Realtime) Validate(index string, collection string, body string) (bool, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/security/createCredentials.go b/security/createCredentials.go index 09da3952..e8535108 100644 --- a/security/createCredentials.go +++ b/security/createCredentials.go @@ -39,7 +39,7 @@ func (s *Security) CreateCredentials(strategy, id string, body json.RawMessage, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createFirstAdmin.go b/security/createFirstAdmin.go index 9e3bdd26..d2666f2e 100644 --- a/security/createFirstAdmin.go +++ b/security/createFirstAdmin.go @@ -42,7 +42,7 @@ func (s *Security) CreateFirstAdmin(body json.RawMessage, options types.QueryOpt res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createOrReplaceProfile.go b/security/createOrReplaceProfile.go index aa6f5363..c4433786 100644 --- a/security/createOrReplaceProfile.go +++ b/security/createOrReplaceProfile.go @@ -38,7 +38,7 @@ func (s *Security) CreateOrReplaceProfile(id string, body json.RawMessage, optio res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createOrReplaceRole.go b/security/createOrReplaceRole.go index e345a161..232ff2fa 100644 --- a/security/createOrReplaceRole.go +++ b/security/createOrReplaceRole.go @@ -38,7 +38,7 @@ func (s *Security) CreateOrReplaceRole(id string, body json.RawMessage, options res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createProfile.go b/security/createProfile.go index d9f613b1..b9ebdb39 100644 --- a/security/createProfile.go +++ b/security/createProfile.go @@ -38,7 +38,7 @@ func (s *Security) CreateProfile(id string, body json.RawMessage, options types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createRestrictedUser.go b/security/createRestrictedUser.go index b44493e4..e8f38728 100644 --- a/security/createRestrictedUser.go +++ b/security/createRestrictedUser.go @@ -41,7 +41,7 @@ func (s *Security) CreateRestrictedUser(body json.RawMessage, options types.Quer res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createRole.go b/security/createRole.go index 78dde2bf..7da27a64 100644 --- a/security/createRole.go +++ b/security/createRole.go @@ -38,7 +38,7 @@ func (s *Security) CreateRole(id string, body json.RawMessage, options types.Que res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createUser.go b/security/createUser.go index a1780fad..4adf657f 100644 --- a/security/createUser.go +++ b/security/createUser.go @@ -37,7 +37,7 @@ func (s *Security) CreateUser(body json.RawMessage, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/deleteCredentials.go b/security/deleteCredentials.go index a3ba5fae..a1760c55 100644 --- a/security/deleteCredentials.go +++ b/security/deleteCredentials.go @@ -36,7 +36,7 @@ func (s *Security) DeleteCredentials(strategy, id string, options types.QueryOpt res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/deleteProfile.go b/security/deleteProfile.go index 6aaa901c..2862e316 100644 --- a/security/deleteProfile.go +++ b/security/deleteProfile.go @@ -37,7 +37,7 @@ func (s *Security) DeleteProfile(id string, options types.QueryOptions) (string, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/security/deleteRole.go b/security/deleteRole.go index 35be04f2..8c522f3b 100644 --- a/security/deleteRole.go +++ b/security/deleteRole.go @@ -37,7 +37,7 @@ func (s *Security) DeleteRole(id string, options types.QueryOptions) (string, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/security/deleteUser.go b/security/deleteUser.go index bd3a516f..c1329a76 100644 --- a/security/deleteUser.go +++ b/security/deleteUser.go @@ -37,7 +37,7 @@ func (s *Security) DeleteUser(id string, options types.QueryOptions) (string, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/security/getAllCredentialFields.go b/security/getAllCredentialFields.go index 74cdd609..f7c632f3 100644 --- a/security/getAllCredentialFields.go +++ b/security/getAllCredentialFields.go @@ -32,7 +32,7 @@ func (s *Security) GetAllCredentialFields(options types.QueryOptions) (json.RawM res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getCredentialFields.go b/security/getCredentialFields.go index 36b327e6..16d5b81b 100644 --- a/security/getCredentialFields.go +++ b/security/getCredentialFields.go @@ -37,7 +37,7 @@ func (s *Security) GetCredentialFields(strategy string, options types.QueryOptio res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getCredentials.go b/security/getCredentials.go index 2c782de4..8377be10 100644 --- a/security/getCredentials.go +++ b/security/getCredentials.go @@ -37,7 +37,7 @@ func (s *Security) GetCredentials(strategy, id string, options types.QueryOption res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getCredentialsById.go b/security/getCredentialsById.go index 5f983e20..e4991721 100644 --- a/security/getCredentialsById.go +++ b/security/getCredentialsById.go @@ -38,7 +38,7 @@ func (s *Security) GetCredentialsByID(strategy, id string, options types.QueryOp res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getProfile.go b/security/getProfile.go index e5955b83..9620759b 100644 --- a/security/getProfile.go +++ b/security/getProfile.go @@ -37,7 +37,7 @@ func (s *Security) GetProfile(id string, options types.QueryOptions) (*Profile, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getProfileMapping.go b/security/getProfileMapping.go index 304977c5..d76deeaf 100644 --- a/security/getProfileMapping.go +++ b/security/getProfileMapping.go @@ -32,7 +32,7 @@ func (s *Security) GetProfileMapping(options types.QueryOptions) (json.RawMessag res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getProfileRights.go b/security/getProfileRights.go index b313762d..dbd85ead 100644 --- a/security/getProfileRights.go +++ b/security/getProfileRights.go @@ -37,7 +37,7 @@ func (s *Security) GetProfileRights(id string, options types.QueryOptions) (json res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getRole.go b/security/getRole.go index 2ac7c9c0..d7f80fb0 100644 --- a/security/getRole.go +++ b/security/getRole.go @@ -36,7 +36,7 @@ func (s *Security) GetRole(id string, options types.QueryOptions) (*Role, error) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getRoleMapping.go b/security/getRoleMapping.go index f043cb4f..d9d34982 100644 --- a/security/getRoleMapping.go +++ b/security/getRoleMapping.go @@ -32,7 +32,7 @@ func (s *Security) GetRoleMapping(options types.QueryOptions) (json.RawMessage, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getUser.go b/security/getUser.go index d59aeed8..9fcef592 100644 --- a/security/getUser.go +++ b/security/getUser.go @@ -36,7 +36,7 @@ func (s *Security) GetUser(id string, options types.QueryOptions) (*User, error) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getUserMapping.go b/security/getUserMapping.go index bd905c21..9e4c01fd 100644 --- a/security/getUserMapping.go +++ b/security/getUserMapping.go @@ -32,7 +32,7 @@ func (s *Security) GetUserMapping(options types.QueryOptions) (json.RawMessage, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getUserRights.go b/security/getUserRights.go index d982bd15..bcf50992 100644 --- a/security/getUserRights.go +++ b/security/getUserRights.go @@ -37,7 +37,7 @@ func (s *Security) GetUserRights(id string, options types.QueryOptions) (json.Ra res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/hasCredentials.go b/security/hasCredentials.go index 83a12ee9..fff05732 100644 --- a/security/hasCredentials.go +++ b/security/hasCredentials.go @@ -38,7 +38,7 @@ func (s *Security) HasCredentials(strategy, id string, options types.QueryOption res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/security/mDeleteCredentials.go b/security/mDeleteCredentials.go index 3e86795b..a5b8166f 100644 --- a/security/mDeleteCredentials.go +++ b/security/mDeleteCredentials.go @@ -39,7 +39,7 @@ func (s *Security) MDeleteCredentials(ids []string, options types.QueryOptions) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/mDeleteRoles.go b/security/mDeleteRoles.go index e1b9fae2..12c32f56 100644 --- a/security/mDeleteRoles.go +++ b/security/mDeleteRoles.go @@ -39,7 +39,7 @@ func (s *Security) MDeleteRoles(ids []string, options types.QueryOptions) ([]str res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/mDeleteUsers.go b/security/mDeleteUsers.go index 04c59299..68112bf6 100644 --- a/security/mDeleteUsers.go +++ b/security/mDeleteUsers.go @@ -39,7 +39,7 @@ func (s *Security) MDeleteUsers(ids []string, options types.QueryOptions) ([]str res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/mGetProfiles.go b/security/mGetProfiles.go index 692758cc..d9436ded 100644 --- a/security/mGetProfiles.go +++ b/security/mGetProfiles.go @@ -39,7 +39,7 @@ func (s *Security) MGetProfiles(ids []string, options types.QueryOptions) ([]*Pr res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/mGetRoles.go b/security/mGetRoles.go index ec3b4bc0..38905c5f 100644 --- a/security/mGetRoles.go +++ b/security/mGetRoles.go @@ -39,7 +39,7 @@ func (s *Security) MGetRoles(ids []string, options types.QueryOptions) ([]*Role, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/replaceUser.go b/security/replaceUser.go index bb15e783..64286398 100644 --- a/security/replaceUser.go +++ b/security/replaceUser.go @@ -38,7 +38,7 @@ func (s *Security) ReplaceUser(id string, content json.RawMessage, options types res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/searchProfiles.go b/security/searchProfiles.go index e703726a..31629c74 100644 --- a/security/searchProfiles.go +++ b/security/searchProfiles.go @@ -43,7 +43,7 @@ func (s *Security) SearchProfiles(body json.RawMessage, options types.QueryOptio res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/searchRoles.go b/security/searchRoles.go index 5ec694c9..eba93fea 100644 --- a/security/searchRoles.go +++ b/security/searchRoles.go @@ -43,7 +43,7 @@ func (s *Security) SearchRoles(body json.RawMessage, options types.QueryOptions) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } jsonSearchResult := &jsonRoleSearchResult{} diff --git a/security/searchUsers.go b/security/searchUsers.go index 6f3c6534..f6fbdef8 100644 --- a/security/searchUsers.go +++ b/security/searchUsers.go @@ -43,7 +43,7 @@ func (s *Security) SearchUsers(body json.RawMessage, options types.QueryOptions) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/updateCredentials.go b/security/updateCredentials.go index 70cf528f..bfd64863 100644 --- a/security/updateCredentials.go +++ b/security/updateCredentials.go @@ -39,7 +39,7 @@ func (s *Security) UpdateCredentials(strategy string, kuid string, body json.Raw res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/updateProfile.go b/security/updateProfile.go index d1930a86..665654df 100644 --- a/security/updateProfile.go +++ b/security/updateProfile.go @@ -37,7 +37,7 @@ func (s *Security) UpdateProfile(id string, body json.RawMessage, options types. res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/updateProfileMapping.go b/security/updateProfileMapping.go index bcd09103..897fe411 100644 --- a/security/updateProfileMapping.go +++ b/security/updateProfileMapping.go @@ -36,7 +36,7 @@ func (s *Security) UpdateProfileMapping(body json.RawMessage, options types.Quer res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/updateRole.go b/security/updateRole.go index 94274d58..e3216479 100644 --- a/security/updateRole.go +++ b/security/updateRole.go @@ -37,7 +37,7 @@ func (s *Security) UpdateRole(id string, body json.RawMessage, options types.Que res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/updateRoleMapping.go b/security/updateRoleMapping.go index dc3dfbe5..16bbfcab 100644 --- a/security/updateRoleMapping.go +++ b/security/updateRoleMapping.go @@ -36,7 +36,7 @@ func (s *Security) UpdateRoleMapping(body json.RawMessage, options types.QueryOp res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/updateUser.go b/security/updateUser.go index 3bcc0f69..043ff4d7 100644 --- a/security/updateUser.go +++ b/security/updateUser.go @@ -37,7 +37,7 @@ func (s *Security) UpdateUser(id string, body json.RawMessage, options types.Que res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/updateUserMapping.go b/security/updateUserMapping.go index 86c37acc..f5a7f534 100644 --- a/security/updateUserMapping.go +++ b/security/updateUserMapping.go @@ -36,7 +36,7 @@ func (s *Security) UpdateUserMapping(body json.RawMessage, options types.QueryOp res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/validateCredentials.go b/security/validateCredentials.go index ae5dc95e..43e34b38 100644 --- a/security/validateCredentials.go +++ b/security/validateCredentials.go @@ -39,7 +39,7 @@ func (s *Security) ValidateCredentials(strategy string, kuid string, body json.R res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/server/adminExists.go b/server/adminExists.go index 975c9545..6e27455a 100644 --- a/server/adminExists.go +++ b/server/adminExists.go @@ -33,7 +33,7 @@ func (s *Server) AdminExists(options types.QueryOptions) (bool, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/server/getAllStats.go b/server/getAllStats.go index 551378eb..fd846a7a 100644 --- a/server/getAllStats.go +++ b/server/getAllStats.go @@ -33,7 +33,7 @@ func (s *Server) GetAllStats(options types.QueryOptions) (json.RawMessage, error res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } return res.Result, nil diff --git a/server/getConfig.go b/server/getConfig.go index 52e7a8a9..8859c0e4 100644 --- a/server/getConfig.go +++ b/server/getConfig.go @@ -32,7 +32,7 @@ func (s *Server) GetConfig(options types.QueryOptions) (json.RawMessage, error) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/server/getLastStats.go b/server/getLastStats.go index 3ed13540..c9a534af 100644 --- a/server/getLastStats.go +++ b/server/getLastStats.go @@ -33,7 +33,7 @@ func (s *Server) GetLastStats(options types.QueryOptions) (json.RawMessage, erro res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/server/getStats.go b/server/getStats.go index 8267621e..666effba 100644 --- a/server/getStats.go +++ b/server/getStats.go @@ -48,7 +48,7 @@ func (s *Server) GetStats(startTime *time.Time, stopTime *time.Time, options typ res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/server/info.go b/server/info.go index 03717897..e60b935d 100644 --- a/server/info.go +++ b/server/info.go @@ -32,7 +32,7 @@ func (s *Server) Info(options types.QueryOptions) (json.RawMessage, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/server/now.go b/server/now.go index 0b5bcca2..881a76d5 100644 --- a/server/now.go +++ b/server/now.go @@ -32,7 +32,7 @@ func (s *Server) Now(options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index b6b1cc6a..22ffb077 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -68,7 +68,7 @@ type ( Channel string `json:"channel"` Timestamp int `json:"timestamp"` Status int `json:"status"` - Error *KuzzleError `json:"error"` + Error KuzzleError `json:"error"` } // KuzzleResponse is a response to a KuzzleRequest @@ -83,7 +83,7 @@ type ( RoomId string `json:"room"` Channel string `json:"channel"` Status int `json:"status"` - Error *KuzzleError `json:"error"` + Error KuzzleError `json:"error"` } SpecificationField struct { @@ -263,7 +263,7 @@ type ( } ) -func (e *KuzzleError) Error() string { +func (e KuzzleError) Error() string { msg := e.Message if len(e.Stack) > 0 { @@ -278,8 +278,8 @@ func (e *KuzzleError) Error() string { } // NewError instanciates a new KuzzleError -func NewError(msg string, status ...int) *KuzzleError { - err := &KuzzleError{Message: msg} +func NewError(msg string, status ...int) KuzzleError { + err := KuzzleError{Message: msg} if len(status) == 1 { err.Status = status[0] From 50357810fbde4011f5cdcf7e07f5e0eb58a26a42 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 24 May 2018 10:43:03 +0200 Subject: [PATCH 153/363] fix tests --- auth/checkToken_test.go | 3 +-- auth/createMyCredentials_test.go | 4 ++-- auth/credentialsExist_test.go | 2 +- auth/deleteMyCredentials.go | 6 +++++- auth/deleteMyCredentials_test.go | 4 ++-- auth/getCurrentUser_test.go | 2 +- auth/getMyCredentials.go | 1 - auth/getMyCredentials_test.go | 2 +- auth/getMyRights_test.go | 2 +- auth/getStrategies_test.go | 2 +- auth/login_test.go | 2 +- auth/logout_test.go | 2 +- auth/update_my_credentials_test.go | 4 ++-- auth/update_self_test.go | 2 +- auth/validate_my_credentials_test.go | 2 +- collection/create_test.go | 2 +- collection/delete_specifications_test.go | 2 +- collection/exists_test.go | 2 +- collection/get_mapping_test.go | 2 +- collection/get_specifications_test.go | 2 +- collection/list_test.go | 2 +- collection/search_specifications_test.go | 2 +- collection/truncate_test.go | 2 +- collection/update_mapping_test.go | 2 +- collection/update_specifications_test.go | 2 +- collection/validate_specifications_test.go | 2 +- document/count_test.go | 2 +- document/createOrReplace_test.go | 2 +- document/create_test.go | 2 +- document/deleteByQuery_test.go | 2 +- document/delete_test.go | 2 +- document/exists_test.go | 2 +- document/get_test.go | 2 +- document/mCreateOrReplace_test.go | 2 +- document/mCreate_test.go | 2 +- document/mDelete_test.go | 2 +- document/mGet_test.go | 2 +- document/mReplace_test.go | 2 +- document/mUpdate_test.go | 2 +- document/replace_test.go | 2 +- document/search_test.go | 2 +- document/update_test.go | 2 +- document/validate_test.go | 2 +- index/create_test.go | 2 +- index/delete_test.go | 2 +- index/exists_test.go | 2 +- index/getAutoRefresh_test.go | 2 +- index/list_test.go | 2 +- index/mDelete_test.go | 2 +- index/refresh.go | 5 ++++- index/refreshInternal.go | 1 - index/refreshInternal_test.go | 4 ++-- index/refresh_test.go | 4 ++-- index/setAutoRefresh_test.go | 2 +- internal/wrappers/cgo/kuzzle/memory_storage.go | 2 +- kuzzle/kuzzle_test.go | 2 +- ms/append_test.go | 2 +- ms/bitcount_test.go | 2 +- ms/bitop_test.go | 2 +- ms/bitpos_test.go | 2 +- ms/dbsize_test.go | 2 +- ms/decr_test.go | 2 +- ms/decrby_test.go | 2 +- ms/del_test.go | 2 +- ms/exists_test.go | 2 +- ms/expire_test.go | 2 +- ms/expireat_test.go | 2 +- ms/flushdb.go | 6 +++++- ms/flushdb_test.go | 5 +++-- ms/geoadd_test.go | 2 +- ms/geodist_test.go | 2 +- ms/geohash_test.go | 2 +- ms/geopos_test.go | 2 +- ms/georadius_test.go | 2 +- ms/georadiusbymember_test.go | 2 +- ms/get_test.go | 2 +- ms/getbit_test.go | 2 +- ms/getrange_test.go | 2 +- ms/getset_test.go | 2 +- ms/hdel_test.go | 2 +- ms/hexists_test.go | 2 +- ms/hget_test.go | 2 +- ms/hgetall_test.go | 2 +- ms/hincrby_test.go | 2 +- ms/hincrbyfloat_test.go | 2 +- ms/hkeys_test.go | 2 +- ms/hlen_test.go | 2 +- ms/hmget_test.go | 2 +- ms/hmset.go | 5 ++++- ms/hmset_test.go | 5 +++-- ms/hscan_test.go | 2 +- ms/hset_test.go | 2 +- ms/hsetnx_test.go | 2 +- ms/hstrlen_test.go | 2 +- ms/hvals_test.go | 2 +- ms/incr_test.go | 2 +- ms/incrby_test.go | 2 +- ms/incrbyfloat_test.go | 2 +- ms/keys_test.go | 2 +- ms/lindex_test.go | 2 +- ms/linsert_test.go | 2 +- ms/llen_test.go | 2 +- ms/lpop_test.go | 2 +- ms/lpush_test.go | 2 +- ms/lpushx_test.go | 2 +- ms/lrange_test.go | 2 +- ms/lrem_test.go | 2 +- ms/lset.go | 5 ++++- ms/lset_test.go | 5 +++-- ms/ltrim.go | 6 +++++- ms/ltrim_test.go | 5 +++-- ms/mget_test.go | 2 +- ms/mset.go | 5 ++++- ms/mset_test.go | 5 +++-- ms/msetnx_test.go | 2 +- ms/object_test.go | 2 +- ms/persist_test.go | 2 +- ms/pexpire_test.go | 2 +- ms/pexpireat_test.go | 2 +- ms/pfadd_test.go | 2 +- ms/pfcount_test.go | 2 +- ms/pfmerge.go | 5 ++++- ms/pfmerge_test.go | 5 +++-- ms/ping_test.go | 2 +- ms/psetex.go | 5 ++++- ms/psetex_test.go | 5 +++-- ms/pttl_test.go | 2 +- ms/randomkey_test.go | 2 +- ms/rename.go | 5 ++++- ms/rename_test.go | 5 +++-- ms/renamenx_test.go | 2 +- ms/rpop_test.go | 2 +- ms/rpoplpush_test.go | 2 +- ms/rpush_test.go | 2 +- ms/rpushx_test.go | 2 +- ms/sadd_test.go | 2 +- ms/scan_test.go | 2 +- ms/scard_test.go | 2 +- ms/sdiff_test.go | 2 +- ms/sdiffstore_test.go | 2 +- ms/set.go | 5 ++++- ms/set_test.go | 5 +++-- ms/setex.go | 5 ++++- ms/setex_test.go | 5 +++-- ms/setnx_test.go | 2 +- ms/sinter_test.go | 2 +- ms/sinterstore_test.go | 2 +- ms/sismember_test.go | 2 +- ms/smembers_test.go | 2 +- ms/smove_test.go | 2 +- ms/sort_test.go | 2 +- ms/spop_test.go | 2 +- ms/srandmember_test.go | 2 +- ms/srem_test.go | 2 +- ms/sscan_test.go | 2 +- ms/strlen_test.go | 2 +- ms/sunion_test.go | 2 +- ms/sunionstore_test.go | 2 +- ms/time_test.go | 2 +- ms/touch_test.go | 2 +- ms/ttl_test.go | 2 +- ms/type_test.go | 2 +- ms/zadd_test.go | 2 +- ms/zcard_test.go | 2 +- ms/zcount_test.go | 2 +- ms/zincrby_test.go | 2 +- ms/zinterstore_test.go | 2 +- ms/zlexcount_test.go | 2 +- ms/zrange_test.go | 2 +- ms/zrangebylex_test.go | 2 +- ms/zrangebyscore_test.go | 2 +- ms/zrank_test.go | 2 +- ms/zrem_test.go | 2 +- ms/zremrangebylex_test.go | 2 +- ms/zremrangebyrank_test.go | 2 +- ms/zremrangebyscore_test.go | 2 +- ms/zrevrange_test.go | 2 +- ms/zrevrangebylex_test.go | 2 +- ms/zrevrangebyscore_test.go | 2 +- ms/zrevrank_test.go | 2 +- ms/zscan_test.go | 2 +- ms/zscore_test.go | 2 +- ms/zunionstore_test.go | 2 +- realtime/count_test.go | 2 +- realtime/list_test.go | 2 +- realtime/subscribe_test.go | 4 ++-- security/createCredentials_test.go | 2 +- security/createFirstAdmin_test.go | 2 +- security/createOrReplaceProfile_test.go | 2 +- security/createOrReplaceRole_test.go | 2 +- security/createProfile_test.go | 2 +- security/createRestrictedUser_test.go | 2 +- security/createRole_test.go | 2 +- security/createUser_test.go | 2 +- security/deleteCredentials_test.go | 2 +- security/deleteProfile_test.go | 2 +- security/deleteRole_test.go | 2 +- security/deleteUser_test.go | 2 +- security/getAllCredentialFields_test.go | 2 +- security/getCredentialFields_test.go | 4 ++-- security/getCredentialsById_test.go | 2 +- security/getCredentials_test.go | 2 +- security/getProfileMapping_test.go | 2 +- security/getProfileRights_test.go | 2 +- security/getRoleMapping_test.go | 2 +- security/getRole_test.go | 2 +- security/getUserMapping_test.go | 2 +- security/getUserRights_test.go | 2 +- security/hasCredentials_test.go | 2 +- security/mDeleteCredentials_test.go | 2 +- security/mDeleteRoles_test.go | 2 +- security/mDeleteUsers_test.go | 2 +- security/replaceUser_test.go | 2 +- security/searchRoles_test.go | 2 +- security/updateCredentials_test.go | 6 +++--- security/validateCredentials_test.go | 6 +++--- server/adminExists_test.go | 2 +- server/getAllStats_test.go | 2 +- server/getConfig_test.go | 2 +- server/getLastStats_test.go | 2 +- server/getStats_test.go | 2 +- server/info_test.go | 2 +- server/now_test.go | 2 +- 223 files changed, 291 insertions(+), 245 deletions(-) diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go index 1f465760..037f00f2 100644 --- a/auth/checkToken_test.go +++ b/auth/checkToken_test.go @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - package auth_test import ( @@ -42,7 +41,7 @@ func TestCheckTokenQueryError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) _, err := k.Auth.CheckToken("token") assert.NotNil(t, err) - assert.Equal(t, 123, err.(*types.KuzzleError).Status) + assert.Equal(t, 123, err.(types.KuzzleError).Status) } func TestCheckToken(t *testing.T) { diff --git a/auth/createMyCredentials_test.go b/auth/createMyCredentials_test.go index 8285ac4e..272219fd 100644 --- a/auth/createMyCredentials_test.go +++ b/auth/createMyCredentials_test.go @@ -33,7 +33,7 @@ func TestCreateMyCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "createMyCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestCreateMyCredentialsQueryError(t *testing.T) { func TestCreateMyCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/credentialsExist_test.go b/auth/credentialsExist_test.go index 8bdbf354..3aef1184 100644 --- a/auth/credentialsExist_test.go +++ b/auth/credentialsExist_test.go @@ -41,7 +41,7 @@ func TestCredentialsExistQueryError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "credentialsExist", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/deleteMyCredentials.go b/auth/deleteMyCredentials.go index 2697d8cc..8136b55d 100644 --- a/auth/deleteMyCredentials.go +++ b/auth/deleteMyCredentials.go @@ -39,5 +39,9 @@ func (a *Auth) DeleteMyCredentials(strategy string, options types.QueryOptions) res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + + return nil } diff --git a/auth/deleteMyCredentials_test.go b/auth/deleteMyCredentials_test.go index d4b8d5d3..7315cbac 100644 --- a/auth/deleteMyCredentials_test.go +++ b/auth/deleteMyCredentials_test.go @@ -33,7 +33,7 @@ func TestDeleteMyCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "deleteMyCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestDeleteMyCredentialsQueryError(t *testing.T) { func TestDeleteMyCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/getCurrentUser_test.go b/auth/getCurrentUser_test.go index e97ac068..4c079682 100644 --- a/auth/getCurrentUser_test.go +++ b/auth/getCurrentUser_test.go @@ -34,7 +34,7 @@ func TestGetCurrentUserQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "getCurrentUser", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/getMyCredentials.go b/auth/getMyCredentials.go index 5b612467..955300ab 100644 --- a/auth/getMyCredentials.go +++ b/auth/getMyCredentials.go @@ -40,6 +40,5 @@ func (a *Auth) GetMyCredentials(strategy string, options types.QueryOptions) (js if res.Error.Error() != "" { return nil, res.Error } - return res.Result, nil } diff --git a/auth/getMyCredentials_test.go b/auth/getMyCredentials_test.go index ecf33ddb..2d65f283 100644 --- a/auth/getMyCredentials_test.go +++ b/auth/getMyCredentials_test.go @@ -34,7 +34,7 @@ func TestGetMyCredentialsQueryError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "getMyCredentials", request.Action) assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/getMyRights_test.go b/auth/getMyRights_test.go index 97cedff7..54ae9a64 100644 --- a/auth/getMyRights_test.go +++ b/auth/getMyRights_test.go @@ -34,7 +34,7 @@ func TestGetMyRightsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "getMyRights", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/getStrategies_test.go b/auth/getStrategies_test.go index d7d56453..2f2b815f 100644 --- a/auth/getStrategies_test.go +++ b/auth/getStrategies_test.go @@ -33,7 +33,7 @@ func TestGetStrategiesError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "getStrategies", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/login_test.go b/auth/login_test.go index a906367a..06484eff 100644 --- a/auth/login_test.go +++ b/auth/login_test.go @@ -41,7 +41,7 @@ func TestLoginError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "login", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, MockEmitEvent: func(e int, arg interface{}) { assert.Equal(t, event.LoginAttempt, e) diff --git a/auth/logout_test.go b/auth/logout_test.go index 743c1b29..ce11ffe5 100644 --- a/auth/logout_test.go +++ b/auth/logout_test.go @@ -34,7 +34,7 @@ func TestLogoutError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "logout", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } diff --git a/auth/update_my_credentials_test.go b/auth/update_my_credentials_test.go index 3488238f..91671a7f 100644 --- a/auth/update_my_credentials_test.go +++ b/auth/update_my_credentials_test.go @@ -33,7 +33,7 @@ func TestUpdateMyCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "updateMyCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestUpdateMyCredentialsQueryError(t *testing.T) { func TestUpdateMyCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/update_self_test.go b/auth/update_self_test.go index ee9c918e..71891fc8 100644 --- a/auth/update_self_test.go +++ b/auth/update_self_test.go @@ -29,7 +29,7 @@ import ( func TestUpdateSelfQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/validate_my_credentials_test.go b/auth/validate_my_credentials_test.go index 4c0a4cbb..7c6b5930 100644 --- a/auth/validate_my_credentials_test.go +++ b/auth/validate_my_credentials_test.go @@ -34,7 +34,7 @@ func TestValidateMyCredentialsQueryError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "validateMyCredentials", request.Action) assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/create_test.go b/collection/create_test.go index b1e21012..b57f31be 100644 --- a/collection/create_test.go +++ b/collection/create_test.go @@ -50,7 +50,7 @@ func TestCreateError(t *testing.T) { nc := collection.NewCollection(k) err := nc.Create("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestCreate(t *testing.T) { diff --git a/collection/delete_specifications_test.go b/collection/delete_specifications_test.go index 16aa09e1..2cade018 100644 --- a/collection/delete_specifications_test.go +++ b/collection/delete_specifications_test.go @@ -50,7 +50,7 @@ func TestDeleteSpecificationsError(t *testing.T) { nc := collection.NewCollection(k) err := nc.DeleteSpecifications("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestDeleteSpecifications(t *testing.T) { diff --git a/collection/exists_test.go b/collection/exists_test.go index cbd7bd5a..0fbc1ac8 100644 --- a/collection/exists_test.go +++ b/collection/exists_test.go @@ -50,7 +50,7 @@ func TestExistsError(t *testing.T) { nc := collection.NewCollection(k) _, err := nc.Exists("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestExists(t *testing.T) { diff --git a/collection/get_mapping_test.go b/collection/get_mapping_test.go index 46f2e0ef..be0b0e85 100644 --- a/collection/get_mapping_test.go +++ b/collection/get_mapping_test.go @@ -51,7 +51,7 @@ func TestGetMappingError(t *testing.T) { nc := collection.NewCollection(k) _, err := nc.GetMapping("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestGetMapping(t *testing.T) { diff --git a/collection/get_specifications_test.go b/collection/get_specifications_test.go index 863cbafa..d4e825e6 100644 --- a/collection/get_specifications_test.go +++ b/collection/get_specifications_test.go @@ -51,7 +51,7 @@ func TestGetSpecificationsError(t *testing.T) { nc := collection.NewCollection(k) _, err := nc.GetSpecifications("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestGetSpecifications(t *testing.T) { diff --git a/collection/list_test.go b/collection/list_test.go index fda61153..c6257647 100644 --- a/collection/list_test.go +++ b/collection/list_test.go @@ -46,7 +46,7 @@ func TestListError(t *testing.T) { _, err := nc.List("index", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestList(t *testing.T) { diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go index b7cd70aa..f7bbced2 100644 --- a/collection/search_specifications_test.go +++ b/collection/search_specifications_test.go @@ -29,7 +29,7 @@ import ( func TestSearchSpecificationsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/truncate_test.go b/collection/truncate_test.go index 394e0855..31c86f7c 100644 --- a/collection/truncate_test.go +++ b/collection/truncate_test.go @@ -44,7 +44,7 @@ func TestTruncateCollectionNull(t *testing.T) { func TestTruncateError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index 3ab797af..9d3134f2 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -52,7 +52,7 @@ func TestUpdateMappingBodyNull(t *testing.T) { func TestUpdateMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go index 2743ec58..3145f111 100644 --- a/collection/update_specifications_test.go +++ b/collection/update_specifications_test.go @@ -50,7 +50,7 @@ func TestUpdateSpecificationsBodyNull(t *testing.T) { func TestUpdateSpecificationsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index 22fe35b3..f299613f 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -38,7 +38,7 @@ func TestValidateSpecificationsBodyNull(t *testing.T) { func TestValidateSpecificationsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/document/count_test.go b/document/count_test.go index 93fae122..e84a21e2 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -56,7 +56,7 @@ func TestCountDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Count("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestCountDocument(t *testing.T) { diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go index db7b1f2a..9032180c 100644 --- a/document/createOrReplace_test.go +++ b/document/createOrReplace_test.go @@ -63,7 +63,7 @@ func TestCreateOrReplaceDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.CreateOrReplace("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestCreateOrReplaceDocument(t *testing.T) { diff --git a/document/create_test.go b/document/create_test.go index d4ec5f0d..c62b887e 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -56,7 +56,7 @@ func TestCreateDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Create("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestCreateDocument(t *testing.T) { diff --git a/document/deleteByQuery_test.go b/document/deleteByQuery_test.go index 66341bcb..8779e673 100644 --- a/document/deleteByQuery_test.go +++ b/document/deleteByQuery_test.go @@ -60,7 +60,7 @@ func TestDeleteByQueryDocumentError(t *testing.T) { _, err := d.DeleteByQuery("index", "collection", "body", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestDeleteByQueryDocument(t *testing.T) { diff --git a/document/delete_test.go b/document/delete_test.go index 85c6b48c..7657933d 100644 --- a/document/delete_test.go +++ b/document/delete_test.go @@ -56,7 +56,7 @@ func TestDeleteDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Delete("index", "collection", "id1", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestDeleteDocument(t *testing.T) { diff --git a/document/exists_test.go b/document/exists_test.go index b90bed5e..5ac25827 100644 --- a/document/exists_test.go +++ b/document/exists_test.go @@ -56,7 +56,7 @@ func TestExistsDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Exists("index", "collection", "id1", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestExistsDocument(t *testing.T) { diff --git a/document/get_test.go b/document/get_test.go index 4e6a03d4..c70a0771 100644 --- a/document/get_test.go +++ b/document/get_test.go @@ -56,7 +56,7 @@ func TestGetDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Get("index", "collection", "id1", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestGetDocument(t *testing.T) { diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index 9a6a3377..61aa8fe8 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -60,7 +60,7 @@ func TestMCreateOrReplaceDocumentError(t *testing.T) { _, err := d.MCreateOrReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMCreateOrReplaceDocument(t *testing.T) { diff --git a/document/mCreate_test.go b/document/mCreate_test.go index d2ca06d0..7357dc2c 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -60,7 +60,7 @@ func TestMCreateDocumentError(t *testing.T) { _, err := d.MCreate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMCreateDocument(t *testing.T) { diff --git a/document/mDelete_test.go b/document/mDelete_test.go index b4399c17..5f7f4a37 100644 --- a/document/mDelete_test.go +++ b/document/mDelete_test.go @@ -67,7 +67,7 @@ func TestMDeleteDocumentError(t *testing.T) { ids = append(ids, "id1") _, err := d.MDelete("index", "collection", ids, nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMDeleteDocument(t *testing.T) { diff --git a/document/mGet_test.go b/document/mGet_test.go index 254e98d6..2ea63f34 100644 --- a/document/mGet_test.go +++ b/document/mGet_test.go @@ -63,7 +63,7 @@ func TestMGetDocumentError(t *testing.T) { ids = append(ids, "id1") _, err := d.MGet("index", "collection", ids, true, nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMGetDocument(t *testing.T) { diff --git a/document/mReplace_test.go b/document/mReplace_test.go index 8f322e2a..d5fc2bae 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -60,7 +60,7 @@ func TestMReplaceDocumentError(t *testing.T) { _, err := d.MReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMReplaceDocument(t *testing.T) { diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index c8e2bb54..944fd826 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -60,7 +60,7 @@ func TestMUpdateDocumentError(t *testing.T) { _, err := d.MUpdate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMUpdateDocument(t *testing.T) { diff --git a/document/replace_test.go b/document/replace_test.go index 5a113a4f..a0986802 100644 --- a/document/replace_test.go +++ b/document/replace_test.go @@ -68,7 +68,7 @@ func TestReplaceDocumentError(t *testing.T) { _, err := d.Replace("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestReplaceDocument(t *testing.T) { diff --git a/document/search_test.go b/document/search_test.go index eb6cc447..dc2c3cfe 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -60,7 +60,7 @@ func TestSearchDocumentError(t *testing.T) { _, err := d.Search("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestSearchDocument(t *testing.T) { diff --git a/document/update_test.go b/document/update_test.go index 97148d54..3e66559b 100644 --- a/document/update_test.go +++ b/document/update_test.go @@ -68,7 +68,7 @@ func TestUpdateDocumentError(t *testing.T) { _, err := d.Update("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestUpdateDocument(t *testing.T) { diff --git a/document/validate_test.go b/document/validate_test.go index 1ca00457..ddaface1 100644 --- a/document/validate_test.go +++ b/document/validate_test.go @@ -56,7 +56,7 @@ func TestValidateDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Validate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestValidateDocument(t *testing.T) { diff --git a/index/create_test.go b/index/create_test.go index dd881b97..6501c4e8 100644 --- a/index/create_test.go +++ b/index/create_test.go @@ -37,7 +37,7 @@ func TestCreateNull(t *testing.T) { func TestCreateQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/delete_test.go b/index/delete_test.go index d36ee38e..54c8079e 100644 --- a/index/delete_test.go +++ b/index/delete_test.go @@ -37,7 +37,7 @@ func TestDeleteNull(t *testing.T) { func TestDeleteQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/exists_test.go b/index/exists_test.go index edca4a25..87f96636 100644 --- a/index/exists_test.go +++ b/index/exists_test.go @@ -37,7 +37,7 @@ func TestExistsNull(t *testing.T) { func TestExistsQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/getAutoRefresh_test.go b/index/getAutoRefresh_test.go index 793ec953..b99f2121 100644 --- a/index/getAutoRefresh_test.go +++ b/index/getAutoRefresh_test.go @@ -37,7 +37,7 @@ func TestGetAutoRefreshNull(t *testing.T) { func TestGetAutoRefreshQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/list_test.go b/index/list_test.go index 16b115ed..da6bce85 100644 --- a/index/list_test.go +++ b/index/list_test.go @@ -37,7 +37,7 @@ func TestListError(t *testing.T) { i := index.NewIndex(k) _, err := i.List(nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestList(t *testing.T) { diff --git a/index/mDelete_test.go b/index/mDelete_test.go index fa69a345..d8fe7695 100644 --- a/index/mDelete_test.go +++ b/index/mDelete_test.go @@ -38,7 +38,7 @@ func TestMDeleteNull(t *testing.T) { func TestMDeleteQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/refresh.go b/index/refresh.go index 6bce1ba5..10b27071 100644 --- a/index/refresh.go +++ b/index/refresh.go @@ -35,5 +35,8 @@ func (i *Index) Refresh(index string, options types.QueryOptions) error { res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/index/refreshInternal.go b/index/refreshInternal.go index 37541ce3..7f2089d6 100644 --- a/index/refreshInternal.go +++ b/index/refreshInternal.go @@ -33,6 +33,5 @@ func (i *Index) RefreshInternal(options types.QueryOptions) error { if res.Error.Error() != "" { return res.Error } - return nil } diff --git a/index/refreshInternal_test.go b/index/refreshInternal_test.go index 34916d0b..82e1d98b 100644 --- a/index/refreshInternal_test.go +++ b/index/refreshInternal_test.go @@ -30,7 +30,7 @@ import ( func TestRefreshInternalQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -68,7 +68,7 @@ func ExampleIndex_RefreshInternal() { k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) err := i.RefreshInternal(nil) - if err != nil { + if err.Error() != "" { fmt.Println(err.Error()) return } diff --git a/index/refresh_test.go b/index/refresh_test.go index b48fc5d3..419bc82b 100644 --- a/index/refresh_test.go +++ b/index/refresh_test.go @@ -37,7 +37,7 @@ func TestRefreshNull(t *testing.T) { func TestRefreshQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -77,7 +77,7 @@ func ExampleIndex_Refresh() { i := index.NewIndex(k) i.Create("index", nil) err := i.Refresh("index", nil) - if err != nil { + if err.Error() != "" { fmt.Println(err.Error()) return } diff --git a/index/setAutoRefresh_test.go b/index/setAutoRefresh_test.go index 4b09edbc..7731dc4a 100644 --- a/index/setAutoRefresh_test.go +++ b/index/setAutoRefresh_test.go @@ -37,7 +37,7 @@ func TestSetAutoRefreshNull(t *testing.T) { func TestSetAutoRefreshQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go index a59a27d3..d2c51d11 100644 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ b/internal/wrappers/cgo/kuzzle/memory_storage.go @@ -197,7 +197,7 @@ func kuzzle_ms_geopos(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, SetQueryOptions(options)) if err != nil { - kuzzleError := err.(*types.KuzzleError) + kuzzleError := err.(types.KuzzleError) result.status = C.int(kuzzleError.Status) result.error = C.CString(kuzzleError.Message) diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index 8585c86b..1a4bf791 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -119,7 +119,7 @@ func TestSetDefaultIndex(t *testing.T) { request := types.KuzzleRequest{} json.Unmarshal(query, &request) assert.Equal(t, "myindex", request.Index) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/append_test.go b/ms/append_test.go index 505f7f5e..9ca7bc7b 100755 --- a/ms/append_test.go +++ b/ms/append_test.go @@ -28,7 +28,7 @@ import ( func TestAppendError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/bitcount_test.go b/ms/bitcount_test.go index 40ad0e21..a3d33247 100755 --- a/ms/bitcount_test.go +++ b/ms/bitcount_test.go @@ -28,7 +28,7 @@ import ( func TestBitcountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/bitop_test.go b/ms/bitop_test.go index 72220a2b..dbd544d8 100755 --- a/ms/bitop_test.go +++ b/ms/bitop_test.go @@ -28,7 +28,7 @@ import ( func TestBitopError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/bitpos_test.go b/ms/bitpos_test.go index 925c244b..b420dc5e 100755 --- a/ms/bitpos_test.go +++ b/ms/bitpos_test.go @@ -28,7 +28,7 @@ import ( func TestBitposError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/dbsize_test.go b/ms/dbsize_test.go index ce38f98a..fd0e26e5 100755 --- a/ms/dbsize_test.go +++ b/ms/dbsize_test.go @@ -28,7 +28,7 @@ import ( func TestDbsizeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/decr_test.go b/ms/decr_test.go index fe2bc794..355ebf0a 100755 --- a/ms/decr_test.go +++ b/ms/decr_test.go @@ -28,7 +28,7 @@ import ( func TestDecrError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/decrby_test.go b/ms/decrby_test.go index 88603fe8..263d21ab 100755 --- a/ms/decrby_test.go +++ b/ms/decrby_test.go @@ -28,7 +28,7 @@ import ( func TestDecrbyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/del_test.go b/ms/del_test.go index fd2bd8f0..41a1e219 100755 --- a/ms/del_test.go +++ b/ms/del_test.go @@ -36,7 +36,7 @@ func TestDelEmptyList(t *testing.T) { func TestDelError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/exists_test.go b/ms/exists_test.go index d3f6150c..c56be0ba 100755 --- a/ms/exists_test.go +++ b/ms/exists_test.go @@ -28,7 +28,7 @@ import ( func TestExistsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/expire_test.go b/ms/expire_test.go index 1cfff4cc..cf3b2bf8 100755 --- a/ms/expire_test.go +++ b/ms/expire_test.go @@ -28,7 +28,7 @@ import ( func TestExpireError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/expireat_test.go b/ms/expireat_test.go index 5b7c52cf..4741dc36 100755 --- a/ms/expireat_test.go +++ b/ms/expireat_test.go @@ -28,7 +28,7 @@ import ( func TestExpireatError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/flushdb.go b/ms/flushdb.go index 1f24f15d..d49ecb63 100755 --- a/ms/flushdb.go +++ b/ms/flushdb.go @@ -30,5 +30,9 @@ func (ms *Ms) Flushdb(options types.QueryOptions) error { res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + + return nil } diff --git a/ms/flushdb_test.go b/ms/flushdb_test.go index 8754ab9c..87c1d1eb 100755 --- a/ms/flushdb_test.go +++ b/ms/flushdb_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestFlushdbError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/geoadd_test.go b/ms/geoadd_test.go index 897231a6..a829bc10 100755 --- a/ms/geoadd_test.go +++ b/ms/geoadd_test.go @@ -28,7 +28,7 @@ import ( func TestGeoaddError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/geodist_test.go b/ms/geodist_test.go index ee0ec04c..a41db166 100755 --- a/ms/geodist_test.go +++ b/ms/geodist_test.go @@ -28,7 +28,7 @@ import ( func TestGeodistError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/geohash_test.go b/ms/geohash_test.go index 7a68c24e..a7b64193 100755 --- a/ms/geohash_test.go +++ b/ms/geohash_test.go @@ -28,7 +28,7 @@ import ( func TestGeohashError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/geopos_test.go b/ms/geopos_test.go index 1841b4b7..9713db74 100755 --- a/ms/geopos_test.go +++ b/ms/geopos_test.go @@ -28,7 +28,7 @@ import ( func TestGeoposError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/georadius_test.go b/ms/georadius_test.go index 5a135256..a81911b7 100755 --- a/ms/georadius_test.go +++ b/ms/georadius_test.go @@ -28,7 +28,7 @@ import ( func TestGeoradiusError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/georadiusbymember_test.go b/ms/georadiusbymember_test.go index 413dd46b..11b1652b 100755 --- a/ms/georadiusbymember_test.go +++ b/ms/georadiusbymember_test.go @@ -28,7 +28,7 @@ import ( func TestGeoradiusbymemberError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/get_test.go b/ms/get_test.go index 2ec3a2d6..7972cc34 100755 --- a/ms/get_test.go +++ b/ms/get_test.go @@ -28,7 +28,7 @@ import ( func TestGetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/getbit_test.go b/ms/getbit_test.go index 8ceb14d0..91523e3c 100755 --- a/ms/getbit_test.go +++ b/ms/getbit_test.go @@ -28,7 +28,7 @@ import ( func TestGetbitError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/getrange_test.go b/ms/getrange_test.go index e7668bd9..6385a97d 100755 --- a/ms/getrange_test.go +++ b/ms/getrange_test.go @@ -28,7 +28,7 @@ import ( func TestGetrangeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/getset_test.go b/ms/getset_test.go index def70498..0004df14 100755 --- a/ms/getset_test.go +++ b/ms/getset_test.go @@ -28,7 +28,7 @@ import ( func TestGetsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hdel_test.go b/ms/hdel_test.go index 88db905a..eb2c9471 100755 --- a/ms/hdel_test.go +++ b/ms/hdel_test.go @@ -36,7 +36,7 @@ func TestHdelEmptyFields(t *testing.T) { func TestHdelError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hexists_test.go b/ms/hexists_test.go index 0e5da70c..02b17f1a 100755 --- a/ms/hexists_test.go +++ b/ms/hexists_test.go @@ -28,7 +28,7 @@ import ( func TestHexistsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hget_test.go b/ms/hget_test.go index 179e0b14..52e4c93d 100755 --- a/ms/hget_test.go +++ b/ms/hget_test.go @@ -28,7 +28,7 @@ import ( func TestHgetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hgetall_test.go b/ms/hgetall_test.go index 7d55014c..8577dda8 100755 --- a/ms/hgetall_test.go +++ b/ms/hgetall_test.go @@ -28,7 +28,7 @@ import ( func TestHgetallError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hincrby_test.go b/ms/hincrby_test.go index 7b8837bb..3039cea9 100755 --- a/ms/hincrby_test.go +++ b/ms/hincrby_test.go @@ -28,7 +28,7 @@ import ( func TestHincrbyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hincrbyfloat_test.go b/ms/hincrbyfloat_test.go index 69aaba56..7602bb1e 100755 --- a/ms/hincrbyfloat_test.go +++ b/ms/hincrbyfloat_test.go @@ -28,7 +28,7 @@ import ( func TestHincrbyfloatError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hkeys_test.go b/ms/hkeys_test.go index 40654c7a..fc25d413 100755 --- a/ms/hkeys_test.go +++ b/ms/hkeys_test.go @@ -28,7 +28,7 @@ import ( func TestHkeysError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hlen_test.go b/ms/hlen_test.go index 373e7006..83e40b3d 100755 --- a/ms/hlen_test.go +++ b/ms/hlen_test.go @@ -28,7 +28,7 @@ import ( func TestHlenError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hmget_test.go b/ms/hmget_test.go index 0cd04c65..a1a4c594 100755 --- a/ms/hmget_test.go +++ b/ms/hmget_test.go @@ -28,7 +28,7 @@ import ( func TestHmgetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hmset.go b/ms/hmset.go index 651e150b..40bbd091 100755 --- a/ms/hmset.go +++ b/ms/hmset.go @@ -41,5 +41,8 @@ func (ms *Ms) Hmset(key string, entries []*types.MsHashField, options types.Quer res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/hmset_test.go b/ms/hmset_test.go index 444f8d50..b8567f7e 100755 --- a/ms/hmset_test.go +++ b/ms/hmset_test.go @@ -17,12 +17,13 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestHmsetEmptyEntries(t *testing.T) { @@ -37,7 +38,7 @@ func TestHmsetEmptyEntries(t *testing.T) { func TestHmsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hscan_test.go b/ms/hscan_test.go index be3203f7..3b7b2014 100755 --- a/ms/hscan_test.go +++ b/ms/hscan_test.go @@ -29,7 +29,7 @@ import ( func TestHscanError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hset_test.go b/ms/hset_test.go index 9487e77a..7ff73874 100755 --- a/ms/hset_test.go +++ b/ms/hset_test.go @@ -28,7 +28,7 @@ import ( func TestHsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hsetnx_test.go b/ms/hsetnx_test.go index 1e9ac11e..731d5e80 100755 --- a/ms/hsetnx_test.go +++ b/ms/hsetnx_test.go @@ -28,7 +28,7 @@ import ( func TestHsetnxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hstrlen_test.go b/ms/hstrlen_test.go index 5d2ca689..0025315d 100755 --- a/ms/hstrlen_test.go +++ b/ms/hstrlen_test.go @@ -28,7 +28,7 @@ import ( func TestHstrlenError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hvals_test.go b/ms/hvals_test.go index c9a116f0..0540e15f 100755 --- a/ms/hvals_test.go +++ b/ms/hvals_test.go @@ -28,7 +28,7 @@ import ( func TestHvalsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/incr_test.go b/ms/incr_test.go index 2de475ab..536f7295 100755 --- a/ms/incr_test.go +++ b/ms/incr_test.go @@ -28,7 +28,7 @@ import ( func TestIncrError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/incrby_test.go b/ms/incrby_test.go index c44ca049..d3f39f8b 100755 --- a/ms/incrby_test.go +++ b/ms/incrby_test.go @@ -28,7 +28,7 @@ import ( func TestIncrbyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/incrbyfloat_test.go b/ms/incrbyfloat_test.go index f534469d..59a2c2f2 100755 --- a/ms/incrbyfloat_test.go +++ b/ms/incrbyfloat_test.go @@ -28,7 +28,7 @@ import ( func TestIncrbyfloatError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/keys_test.go b/ms/keys_test.go index b58dc57e..56e2e0ce 100755 --- a/ms/keys_test.go +++ b/ms/keys_test.go @@ -28,7 +28,7 @@ import ( func TestKeysError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lindex_test.go b/ms/lindex_test.go index f1184808..284b2f53 100755 --- a/ms/lindex_test.go +++ b/ms/lindex_test.go @@ -28,7 +28,7 @@ import ( func TestLindexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/linsert_test.go b/ms/linsert_test.go index 7cda3468..074c2daf 100755 --- a/ms/linsert_test.go +++ b/ms/linsert_test.go @@ -36,7 +36,7 @@ func TestLinsertInvalidPivot(t *testing.T) { func TestLinsertError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/llen_test.go b/ms/llen_test.go index 1be8bcf7..8d1c1553 100755 --- a/ms/llen_test.go +++ b/ms/llen_test.go @@ -28,7 +28,7 @@ import ( func TestLlenError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lpop_test.go b/ms/lpop_test.go index aabd06b0..90f825f0 100755 --- a/ms/lpop_test.go +++ b/ms/lpop_test.go @@ -28,7 +28,7 @@ import ( func TestLpopError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lpush_test.go b/ms/lpush_test.go index b0790234..251a681c 100755 --- a/ms/lpush_test.go +++ b/ms/lpush_test.go @@ -37,7 +37,7 @@ func TestLpushEmptyValues(t *testing.T) { func TestLpushError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lpushx_test.go b/ms/lpushx_test.go index d956f1a2..b2870245 100755 --- a/ms/lpushx_test.go +++ b/ms/lpushx_test.go @@ -28,7 +28,7 @@ import ( func TestLpushxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lrange_test.go b/ms/lrange_test.go index 3cf74514..628ea131 100755 --- a/ms/lrange_test.go +++ b/ms/lrange_test.go @@ -28,7 +28,7 @@ import ( func TestLrangeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lrem_test.go b/ms/lrem_test.go index 96d86414..2db0ace7 100755 --- a/ms/lrem_test.go +++ b/ms/lrem_test.go @@ -28,7 +28,7 @@ import ( func TestLremError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lset.go b/ms/lset.go index 1b3df115..e635ceea 100755 --- a/ms/lset.go +++ b/ms/lset.go @@ -38,5 +38,8 @@ func (ms *Ms) Lset(key string, index int, value string, options types.QueryOptio res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/lset_test.go b/ms/lset_test.go index 8c90088f..cfbd8b2a 100755 --- a/ms/lset_test.go +++ b/ms/lset_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestLsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/ltrim.go b/ms/ltrim.go index 7ad496cc..ffc0aeab 100755 --- a/ms/ltrim.go +++ b/ms/ltrim.go @@ -39,5 +39,9 @@ func (ms *Ms) Ltrim(key string, start int, stop int, options types.QueryOptions) res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + + return nil } diff --git a/ms/ltrim_test.go b/ms/ltrim_test.go index 3e7a3eb4..38fa93db 100755 --- a/ms/ltrim_test.go +++ b/ms/ltrim_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestLtrimError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/mget_test.go b/ms/mget_test.go index b982ea5e..c6618c3f 100755 --- a/ms/mget_test.go +++ b/ms/mget_test.go @@ -37,7 +37,7 @@ func TestMgetEmptyKeys(t *testing.T) { func TestMgetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/mset.go b/ms/mset.go index 04f4ec2d..50674719 100755 --- a/ms/mset.go +++ b/ms/mset.go @@ -40,5 +40,8 @@ func (ms *Ms) Mset(entries []*types.MSKeyValue, options types.QueryOptions) erro res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/mset_test.go b/ms/mset_test.go index 07cbf491..5cb26e18 100755 --- a/ms/mset_test.go +++ b/ms/mset_test.go @@ -17,12 +17,13 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestMsetEmptyEntries(t *testing.T) { @@ -36,7 +37,7 @@ func TestMsetEmptyEntries(t *testing.T) { func TestMsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/msetnx_test.go b/ms/msetnx_test.go index 498d0a6b..92a3e9cb 100755 --- a/ms/msetnx_test.go +++ b/ms/msetnx_test.go @@ -37,7 +37,7 @@ func TestMsetnxEmptyEntries(t *testing.T) { func TestMsetnxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/object_test.go b/ms/object_test.go index ddc30ec6..8bd3df0a 100755 --- a/ms/object_test.go +++ b/ms/object_test.go @@ -37,7 +37,7 @@ func TestObjectInvalidSubcommand(t *testing.T) { func TestObjectError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/persist_test.go b/ms/persist_test.go index 58135e59..3c254861 100755 --- a/ms/persist_test.go +++ b/ms/persist_test.go @@ -28,7 +28,7 @@ import ( func TestPersistError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pexpire_test.go b/ms/pexpire_test.go index 2e6701a3..69dbf1a1 100755 --- a/ms/pexpire_test.go +++ b/ms/pexpire_test.go @@ -28,7 +28,7 @@ import ( func TestPexpireError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pexpireat_test.go b/ms/pexpireat_test.go index 80dcc547..4a90240e 100755 --- a/ms/pexpireat_test.go +++ b/ms/pexpireat_test.go @@ -28,7 +28,7 @@ import ( func TestPexpireatError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pfadd_test.go b/ms/pfadd_test.go index 1aaa429b..bd7b25d0 100755 --- a/ms/pfadd_test.go +++ b/ms/pfadd_test.go @@ -37,7 +37,7 @@ func TestPfaddEmptyElements(t *testing.T) { func TestPfaddError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pfcount_test.go b/ms/pfcount_test.go index 424a4198..9cd2902b 100755 --- a/ms/pfcount_test.go +++ b/ms/pfcount_test.go @@ -37,7 +37,7 @@ func TestPfcountEmptyKeys(t *testing.T) { func TestPfcountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pfmerge.go b/ms/pfmerge.go index afbe7428..97f96ac1 100755 --- a/ms/pfmerge.go +++ b/ms/pfmerge.go @@ -41,5 +41,8 @@ func (ms *Ms) Pfmerge(key string, sources []string, options types.QueryOptions) res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/pfmerge_test.go b/ms/pfmerge_test.go index 4eb8041f..5ae450dc 100755 --- a/ms/pfmerge_test.go +++ b/ms/pfmerge_test.go @@ -17,12 +17,13 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestPfmergeEmptySources(t *testing.T) { @@ -37,7 +38,7 @@ func TestPfmergeEmptySources(t *testing.T) { func TestPfmergeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/ping_test.go b/ms/ping_test.go index bf3951b7..2de17788 100755 --- a/ms/ping_test.go +++ b/ms/ping_test.go @@ -28,7 +28,7 @@ import ( func TestPingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/psetex.go b/ms/psetex.go index 053bcc09..303c943f 100755 --- a/ms/psetex.go +++ b/ms/psetex.go @@ -38,5 +38,8 @@ func (ms *Ms) Psetex(key string, value string, ttl int, options types.QueryOptio res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/psetex_test.go b/ms/psetex_test.go index 0cff49c5..065342c2 100755 --- a/ms/psetex_test.go +++ b/ms/psetex_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestPsetexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pttl_test.go b/ms/pttl_test.go index 09c426df..c2493a2f 100755 --- a/ms/pttl_test.go +++ b/ms/pttl_test.go @@ -28,7 +28,7 @@ import ( func TestPttlError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/randomkey_test.go b/ms/randomkey_test.go index ac67f2ab..027c51a3 100755 --- a/ms/randomkey_test.go +++ b/ms/randomkey_test.go @@ -28,7 +28,7 @@ import ( func TestRandomkeyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rename.go b/ms/rename.go index c7b07ae2..27fe6702 100755 --- a/ms/rename.go +++ b/ms/rename.go @@ -36,5 +36,8 @@ func (ms *Ms) Rename(key string, newkey string, options types.QueryOptions) erro res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/rename_test.go b/ms/rename_test.go index 211fc996..f436c1d2 100755 --- a/ms/rename_test.go +++ b/ms/rename_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestRenameError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/renamenx_test.go b/ms/renamenx_test.go index ab355f5e..6ea434bd 100755 --- a/ms/renamenx_test.go +++ b/ms/renamenx_test.go @@ -28,7 +28,7 @@ import ( func TestRenamenxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rpop_test.go b/ms/rpop_test.go index 998c1770..6dc757e7 100755 --- a/ms/rpop_test.go +++ b/ms/rpop_test.go @@ -28,7 +28,7 @@ import ( func TestRpopError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rpoplpush_test.go b/ms/rpoplpush_test.go index 389e7cb0..001fe987 100755 --- a/ms/rpoplpush_test.go +++ b/ms/rpoplpush_test.go @@ -28,7 +28,7 @@ import ( func TestRpoplpushError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rpush_test.go b/ms/rpush_test.go index eddff84d..85bcd123 100755 --- a/ms/rpush_test.go +++ b/ms/rpush_test.go @@ -37,7 +37,7 @@ func TestRpushEmptyValues(t *testing.T) { func TestRpushError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rpushx_test.go b/ms/rpushx_test.go index ea320706..2bbcf780 100755 --- a/ms/rpushx_test.go +++ b/ms/rpushx_test.go @@ -28,7 +28,7 @@ import ( func TestRpushxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sadd_test.go b/ms/sadd_test.go index be9d4a55..af5e620c 100755 --- a/ms/sadd_test.go +++ b/ms/sadd_test.go @@ -37,7 +37,7 @@ func TestSaddEmptyValues(t *testing.T) { func TestSaddError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/scan_test.go b/ms/scan_test.go index 883f1377..996a787e 100755 --- a/ms/scan_test.go +++ b/ms/scan_test.go @@ -28,7 +28,7 @@ import ( func TestScanError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/scard_test.go b/ms/scard_test.go index a76afdbf..d2bd58a3 100755 --- a/ms/scard_test.go +++ b/ms/scard_test.go @@ -28,7 +28,7 @@ import ( func TestScardError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sdiff_test.go b/ms/sdiff_test.go index 28693fe0..358cd6ad 100755 --- a/ms/sdiff_test.go +++ b/ms/sdiff_test.go @@ -37,7 +37,7 @@ func TestSdiffEmptySets(t *testing.T) { func TestSdiffError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sdiffstore_test.go b/ms/sdiffstore_test.go index c614c228..5bc5f900 100755 --- a/ms/sdiffstore_test.go +++ b/ms/sdiffstore_test.go @@ -37,7 +37,7 @@ func TestSdiffstoreEmptySets(t *testing.T) { func TestSdiffstoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/set.go b/ms/set.go index 41ce01ca..6819471b 100755 --- a/ms/set.go +++ b/ms/set.go @@ -56,5 +56,8 @@ func (ms *Ms) Set(key string, value interface{}, options types.QueryOptions) err res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/set_test.go b/ms/set_test.go index 8a925eb2..651e0cef 100755 --- a/ms/set_test.go +++ b/ms/set_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestSetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/setex.go b/ms/setex.go index 02dc7717..bdd424f0 100755 --- a/ms/setex.go +++ b/ms/setex.go @@ -39,5 +39,8 @@ func (ms *Ms) Setex(key string, value interface{}, ttl int, options types.QueryO res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/setex_test.go b/ms/setex_test.go index 6c564455..d6b72c2c 100755 --- a/ms/setex_test.go +++ b/ms/setex_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestSetexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/setnx_test.go b/ms/setnx_test.go index 9d5a99e3..c60de735 100755 --- a/ms/setnx_test.go +++ b/ms/setnx_test.go @@ -28,7 +28,7 @@ import ( func TestSetnxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sinter_test.go b/ms/sinter_test.go index 8a3e17a2..d5431c7b 100755 --- a/ms/sinter_test.go +++ b/ms/sinter_test.go @@ -37,7 +37,7 @@ func TestSinterEmptyKeys(t *testing.T) { func TestSinterError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sinterstore_test.go b/ms/sinterstore_test.go index 4bad90aa..4b449555 100755 --- a/ms/sinterstore_test.go +++ b/ms/sinterstore_test.go @@ -37,7 +37,7 @@ func TestSinterstoreEmptyKeys(t *testing.T) { func TestSinterstoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sismember_test.go b/ms/sismember_test.go index 8c435701..9b65ad2f 100755 --- a/ms/sismember_test.go +++ b/ms/sismember_test.go @@ -28,7 +28,7 @@ import ( func TestSismemberError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/smembers_test.go b/ms/smembers_test.go index 6c808230..c0929f1d 100755 --- a/ms/smembers_test.go +++ b/ms/smembers_test.go @@ -28,7 +28,7 @@ import ( func TestSmembersError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/smove_test.go b/ms/smove_test.go index edd29299..df4ed525 100755 --- a/ms/smove_test.go +++ b/ms/smove_test.go @@ -28,7 +28,7 @@ import ( func TestSmoveError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sort_test.go b/ms/sort_test.go index b211b371..3f648f08 100755 --- a/ms/sort_test.go +++ b/ms/sort_test.go @@ -28,7 +28,7 @@ import ( func TestSortError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/spop_test.go b/ms/spop_test.go index 5db40f1c..af5b3874 100755 --- a/ms/spop_test.go +++ b/ms/spop_test.go @@ -28,7 +28,7 @@ import ( func TestSpopError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/srandmember_test.go b/ms/srandmember_test.go index 2519a42b..5152c067 100755 --- a/ms/srandmember_test.go +++ b/ms/srandmember_test.go @@ -28,7 +28,7 @@ import ( func TestSrandmemberError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/srem_test.go b/ms/srem_test.go index 7cd5d62c..87802082 100755 --- a/ms/srem_test.go +++ b/ms/srem_test.go @@ -37,7 +37,7 @@ func TestSremEmptyValues(t *testing.T) { func TestSremError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sscan_test.go b/ms/sscan_test.go index 42174fb5..00e2c5b3 100755 --- a/ms/sscan_test.go +++ b/ms/sscan_test.go @@ -28,7 +28,7 @@ import ( func TestSscanError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/strlen_test.go b/ms/strlen_test.go index 3f219c0a..30ff1e7b 100755 --- a/ms/strlen_test.go +++ b/ms/strlen_test.go @@ -28,7 +28,7 @@ import ( func TestStrlenError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sunion_test.go b/ms/sunion_test.go index a88610ac..6b987006 100755 --- a/ms/sunion_test.go +++ b/ms/sunion_test.go @@ -37,7 +37,7 @@ func TestSunionEmptySet(t *testing.T) { func TestSunionError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sunionstore_test.go b/ms/sunionstore_test.go index a7420101..02aa73df 100755 --- a/ms/sunionstore_test.go +++ b/ms/sunionstore_test.go @@ -37,7 +37,7 @@ func TestSunionstoreEmptySet(t *testing.T) { func TestSunionStoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/time_test.go b/ms/time_test.go index 7bc3d3b3..e30316f6 100755 --- a/ms/time_test.go +++ b/ms/time_test.go @@ -28,7 +28,7 @@ import ( func TestTimeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/touch_test.go b/ms/touch_test.go index c9230dcc..7734b04f 100755 --- a/ms/touch_test.go +++ b/ms/touch_test.go @@ -37,7 +37,7 @@ func TestTouchEmptyKeys(t *testing.T) { func TestTouchError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/ttl_test.go b/ms/ttl_test.go index fc7c281e..f10c18fe 100755 --- a/ms/ttl_test.go +++ b/ms/ttl_test.go @@ -28,7 +28,7 @@ import ( func TestTtlError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/type_test.go b/ms/type_test.go index 1c3d3cc7..a35b58c9 100755 --- a/ms/type_test.go +++ b/ms/type_test.go @@ -28,7 +28,7 @@ import ( func TestTypeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zadd_test.go b/ms/zadd_test.go index b4d9fbb4..6092db7f 100755 --- a/ms/zadd_test.go +++ b/ms/zadd_test.go @@ -37,7 +37,7 @@ func TestZaddEmptyElements(t *testing.T) { func TestZaddError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zcard_test.go b/ms/zcard_test.go index edb53b25..4723610b 100755 --- a/ms/zcard_test.go +++ b/ms/zcard_test.go @@ -28,7 +28,7 @@ import ( func TestZcardError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zcount_test.go b/ms/zcount_test.go index dbb99bda..bf0c11ea 100755 --- a/ms/zcount_test.go +++ b/ms/zcount_test.go @@ -28,7 +28,7 @@ import ( func TestZcountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zincrby_test.go b/ms/zincrby_test.go index 688135d2..e3e9f189 100755 --- a/ms/zincrby_test.go +++ b/ms/zincrby_test.go @@ -28,7 +28,7 @@ import ( func TestZincrbyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zinterstore_test.go b/ms/zinterstore_test.go index 05b11aa5..b62a362e 100755 --- a/ms/zinterstore_test.go +++ b/ms/zinterstore_test.go @@ -37,7 +37,7 @@ func TestZinterstoreEmptyKeys(t *testing.T) { func TestZinterstoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zlexcount_test.go b/ms/zlexcount_test.go index db0234fa..27e37642 100755 --- a/ms/zlexcount_test.go +++ b/ms/zlexcount_test.go @@ -46,7 +46,7 @@ func TestZlexcountEmptyMax(t *testing.T) { func TestZlexcountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrange_test.go b/ms/zrange_test.go index 3d4adece..6a4411cc 100755 --- a/ms/zrange_test.go +++ b/ms/zrange_test.go @@ -28,7 +28,7 @@ import ( func TestZrangeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrangebylex_test.go b/ms/zrangebylex_test.go index eeeca540..c2b840df 100755 --- a/ms/zrangebylex_test.go +++ b/ms/zrangebylex_test.go @@ -46,7 +46,7 @@ func TestZrangebylexEmptyMax(t *testing.T) { func TestZrangebylexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrangebyscore_test.go b/ms/zrangebyscore_test.go index a3edd5fe..e6b8c7e7 100755 --- a/ms/zrangebyscore_test.go +++ b/ms/zrangebyscore_test.go @@ -28,7 +28,7 @@ import ( func TestZrangebyscoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrank_test.go b/ms/zrank_test.go index 954663e9..066cabeb 100755 --- a/ms/zrank_test.go +++ b/ms/zrank_test.go @@ -28,7 +28,7 @@ import ( func TestZrankError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrem_test.go b/ms/zrem_test.go index 0f842cf3..430890de 100755 --- a/ms/zrem_test.go +++ b/ms/zrem_test.go @@ -37,7 +37,7 @@ func TestZremEmptyMembers(t *testing.T) { func TestZremError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zremrangebylex_test.go b/ms/zremrangebylex_test.go index 12cf70de..5c76f64a 100755 --- a/ms/zremrangebylex_test.go +++ b/ms/zremrangebylex_test.go @@ -46,7 +46,7 @@ func TestZremrangebylexEmptyMax(t *testing.T) { func TestZremrangebylexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zremrangebyrank_test.go b/ms/zremrangebyrank_test.go index d8e10bb2..eced5369 100755 --- a/ms/zremrangebyrank_test.go +++ b/ms/zremrangebyrank_test.go @@ -28,7 +28,7 @@ import ( func TestZremrangebyrankError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zremrangebyscore_test.go b/ms/zremrangebyscore_test.go index 21d194a1..904388fa 100755 --- a/ms/zremrangebyscore_test.go +++ b/ms/zremrangebyscore_test.go @@ -28,7 +28,7 @@ import ( func TestZremrangebyscoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrevrange_test.go b/ms/zrevrange_test.go index 82b42f44..d714baf0 100755 --- a/ms/zrevrange_test.go +++ b/ms/zrevrange_test.go @@ -28,7 +28,7 @@ import ( func TestZrevrangeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrevrangebylex_test.go b/ms/zrevrangebylex_test.go index 400e7a9b..1debf93d 100755 --- a/ms/zrevrangebylex_test.go +++ b/ms/zrevrangebylex_test.go @@ -46,7 +46,7 @@ func TestZrevrangebylexEmptyMax(t *testing.T) { func TestZrevrangebylexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrevrangebyscore_test.go b/ms/zrevrangebyscore_test.go index 408423d5..2dfaf470 100755 --- a/ms/zrevrangebyscore_test.go +++ b/ms/zrevrangebyscore_test.go @@ -28,7 +28,7 @@ import ( func TestZrevrangebyscoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrevrank_test.go b/ms/zrevrank_test.go index e4305121..241b0d35 100755 --- a/ms/zrevrank_test.go +++ b/ms/zrevrank_test.go @@ -28,7 +28,7 @@ import ( func TestZrevrankError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zscan_test.go b/ms/zscan_test.go index 4c973b12..70549123 100755 --- a/ms/zscan_test.go +++ b/ms/zscan_test.go @@ -28,7 +28,7 @@ import ( func TestZscanError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zscore_test.go b/ms/zscore_test.go index 6f367801..b16b7f45 100755 --- a/ms/zscore_test.go +++ b/ms/zscore_test.go @@ -28,7 +28,7 @@ import ( func TestZscoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zunionstore_test.go b/ms/zunionstore_test.go index 26b66941..9cbe0637 100755 --- a/ms/zunionstore_test.go +++ b/ms/zunionstore_test.go @@ -37,7 +37,7 @@ func TestZunionstoreEmptyKeys(t *testing.T) { func TestZunionstoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/realtime/count_test.go b/realtime/count_test.go index 933db29a..9215f84a 100644 --- a/realtime/count_test.go +++ b/realtime/count_test.go @@ -56,7 +56,7 @@ func TestCountRoomIDNull(t *testing.T) { func TestCountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/realtime/list_test.go b/realtime/list_test.go index 4726a35d..52740281 100644 --- a/realtime/list_test.go +++ b/realtime/list_test.go @@ -54,7 +54,7 @@ func TestListError(t *testing.T) { _, err := nr.List("index", "collection") assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestList(t *testing.T) { diff --git a/realtime/subscribe_test.go b/realtime/subscribe_test.go index 6bd682b2..fd5eb9bc 100644 --- a/realtime/subscribe_test.go +++ b/realtime/subscribe_test.go @@ -76,7 +76,7 @@ func TestSubscribeQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "ah!"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "ah!"}} }, } k, _ = kuzzle.NewKuzzle(c, nil) @@ -134,7 +134,7 @@ func TestRoomSubscribeNotConnected(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Not Connected"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Not Connected"}} }, } diff --git a/security/createCredentials_test.go b/security/createCredentials_test.go index fa39bc9d..6454ca1b 100644 --- a/security/createCredentials_test.go +++ b/security/createCredentials_test.go @@ -45,7 +45,7 @@ func TestCreateCredentialsBodyNull(t *testing.T) { func TestCreateCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createFirstAdmin_test.go b/security/createFirstAdmin_test.go index 8a48c48f..32f0dcf9 100644 --- a/security/createFirstAdmin_test.go +++ b/security/createFirstAdmin_test.go @@ -33,7 +33,7 @@ func TestCreateFirstAdminBodyNull(t *testing.T) { func TestCreateFirstAdminError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createOrReplaceProfile_test.go b/security/createOrReplaceProfile_test.go index 86897eb8..f518f7b1 100644 --- a/security/createOrReplaceProfile_test.go +++ b/security/createOrReplaceProfile_test.go @@ -33,7 +33,7 @@ func TestCreateOrReplaceProfileBodyNull(t *testing.T) { func TestCreateOrReplaceProfileError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createOrReplaceRole_test.go b/security/createOrReplaceRole_test.go index a0fa73e2..7503da0a 100644 --- a/security/createOrReplaceRole_test.go +++ b/security/createOrReplaceRole_test.go @@ -33,7 +33,7 @@ func TestCreateOrReplaceRoleBodyNull(t *testing.T) { func TestCreateOrReplaceRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createProfile_test.go b/security/createProfile_test.go index 149759bb..1b859535 100644 --- a/security/createProfile_test.go +++ b/security/createProfile_test.go @@ -39,7 +39,7 @@ func TestCreateProfileBodyNull(t *testing.T) { func TestCreateProfileError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createRestrictedUser_test.go b/security/createRestrictedUser_test.go index 71f5cadd..87c5caf9 100644 --- a/security/createRestrictedUser_test.go +++ b/security/createRestrictedUser_test.go @@ -33,7 +33,7 @@ func TestCreateRestrictedUserBodyNull(t *testing.T) { func TestCreateRestrictedUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createRole_test.go b/security/createRole_test.go index 2f193918..b2709d4d 100644 --- a/security/createRole_test.go +++ b/security/createRole_test.go @@ -39,7 +39,7 @@ func TestCreateRoleBodyNull(t *testing.T) { func TestCreateRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createUser_test.go b/security/createUser_test.go index 7045d893..fc4a7f25 100644 --- a/security/createUser_test.go +++ b/security/createUser_test.go @@ -33,7 +33,7 @@ func TestCreateUserBodyNull(t *testing.T) { func TestCreateUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/deleteCredentials_test.go b/security/deleteCredentials_test.go index d190bb22..8c84e941 100644 --- a/security/deleteCredentials_test.go +++ b/security/deleteCredentials_test.go @@ -39,7 +39,7 @@ func TestDeleteCredentialsIDNull(t *testing.T) { func TestDeleteCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/deleteProfile_test.go b/security/deleteProfile_test.go index c384896b..663abfbd 100644 --- a/security/deleteProfile_test.go +++ b/security/deleteProfile_test.go @@ -33,7 +33,7 @@ func TestDeleteProfileIDNull(t *testing.T) { func TestDeleteProfileError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/deleteRole_test.go b/security/deleteRole_test.go index ca69b472..248332e1 100644 --- a/security/deleteRole_test.go +++ b/security/deleteRole_test.go @@ -33,7 +33,7 @@ func TestDeleteRoleIDNull(t *testing.T) { func TestDeleteRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/deleteUser_test.go b/security/deleteUser_test.go index 1f170c6f..0b56e980 100644 --- a/security/deleteUser_test.go +++ b/security/deleteUser_test.go @@ -33,7 +33,7 @@ func TestDeleteUserIDNull(t *testing.T) { func TestDeleteUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getAllCredentialFields_test.go b/security/getAllCredentialFields_test.go index 77a61fbd..c8ec1c09 100644 --- a/security/getAllCredentialFields_test.go +++ b/security/getAllCredentialFields_test.go @@ -33,7 +33,7 @@ func TestGetAllCredentialFieldsError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "security", request.Controller) assert.Equal(t, "getAllCredentialFields", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getCredentialFields_test.go b/security/getCredentialFields_test.go index 1c9a8a90..3d57e2c5 100644 --- a/security/getCredentialFields_test.go +++ b/security/getCredentialFields_test.go @@ -29,7 +29,7 @@ import ( func TestGetCredentialFieldsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -45,7 +45,7 @@ func TestGetCredentialFieldsError(t *testing.T) { assert.Equal(t, "security", request.Controller) assert.Equal(t, "getCredentialFields", request.Action) assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getCredentialsById_test.go b/security/getCredentialsById_test.go index 9dee3d19..ed626294 100644 --- a/security/getCredentialsById_test.go +++ b/security/getCredentialsById_test.go @@ -39,7 +39,7 @@ func TestGetCredentialsByIDIDNull(t *testing.T) { func TestGetCredentialsByIDError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getCredentials_test.go b/security/getCredentials_test.go index 35327c86..00fede1c 100644 --- a/security/getCredentials_test.go +++ b/security/getCredentials_test.go @@ -39,7 +39,7 @@ func TestGetCredentialsIDNull(t *testing.T) { func TestGetCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getProfileMapping_test.go b/security/getProfileMapping_test.go index 90b48086..01e409f3 100644 --- a/security/getProfileMapping_test.go +++ b/security/getProfileMapping_test.go @@ -27,7 +27,7 @@ import ( func TestGetProfileMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getProfileRights_test.go b/security/getProfileRights_test.go index a78d5bae..9ffa77a5 100644 --- a/security/getProfileRights_test.go +++ b/security/getProfileRights_test.go @@ -34,7 +34,7 @@ func TestGetProfileRightsIDNull(t *testing.T) { func TestGetProfileRightsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getRoleMapping_test.go b/security/getRoleMapping_test.go index 89c8b02f..dadb4197 100644 --- a/security/getRoleMapping_test.go +++ b/security/getRoleMapping_test.go @@ -27,7 +27,7 @@ import ( func TestGetRoleMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getRole_test.go b/security/getRole_test.go index a11649cf..5f55c0ea 100644 --- a/security/getRole_test.go +++ b/security/getRole_test.go @@ -42,7 +42,7 @@ func TestGetRoleEmptyId(t *testing.T) { func TestGetRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getUserMapping_test.go b/security/getUserMapping_test.go index 839cf558..26ee55e7 100644 --- a/security/getUserMapping_test.go +++ b/security/getUserMapping_test.go @@ -27,7 +27,7 @@ import ( func TestGetUserMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getUserRights_test.go b/security/getUserRights_test.go index a75d23ea..2b0da0f4 100644 --- a/security/getUserRights_test.go +++ b/security/getUserRights_test.go @@ -34,7 +34,7 @@ func TestGetUserRightsIDNull(t *testing.T) { func TestGetUserRightsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/hasCredentials_test.go b/security/hasCredentials_test.go index 35eafeb9..871db2fc 100644 --- a/security/hasCredentials_test.go +++ b/security/hasCredentials_test.go @@ -45,7 +45,7 @@ func TestHasCredentialsIdNull(t *testing.T) { func TestHasCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/mDeleteCredentials_test.go b/security/mDeleteCredentials_test.go index 379a3be5..8ffec27f 100644 --- a/security/mDeleteCredentials_test.go +++ b/security/mDeleteCredentials_test.go @@ -33,7 +33,7 @@ func TestMDeleteCredentialsEmptyIDs(t *testing.T) { func TestMDeleteCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/mDeleteRoles_test.go b/security/mDeleteRoles_test.go index 2034879a..111df8b8 100644 --- a/security/mDeleteRoles_test.go +++ b/security/mDeleteRoles_test.go @@ -33,7 +33,7 @@ func TestMDeleteRolesEmptyIDs(t *testing.T) { func TestMDeleteRolesError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/mDeleteUsers_test.go b/security/mDeleteUsers_test.go index d8e1b14d..83d00636 100644 --- a/security/mDeleteUsers_test.go +++ b/security/mDeleteUsers_test.go @@ -33,7 +33,7 @@ func TestMDeleteUsersEmptyIDs(t *testing.T) { func TestMDeleteUsersError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/replaceUser_test.go b/security/replaceUser_test.go index 74c8f35a..6e22e041 100644 --- a/security/replaceUser_test.go +++ b/security/replaceUser_test.go @@ -41,7 +41,7 @@ func TestReplaceUserContentNull(t *testing.T) { func TestReplaceUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/searchRoles_test.go b/security/searchRoles_test.go index a3f73432..2b985bb6 100644 --- a/security/searchRoles_test.go +++ b/security/searchRoles_test.go @@ -29,7 +29,7 @@ import ( func TestSearchRolesError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/updateCredentials_test.go b/security/updateCredentials_test.go index 13d5edd2..4d7f9252 100644 --- a/security/updateCredentials_test.go +++ b/security/updateCredentials_test.go @@ -33,7 +33,7 @@ func TestUpdateCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "security", request.Controller) assert.Equal(t, "updateCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestUpdateCredentialsQueryError(t *testing.T) { func TestUpdateCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -55,7 +55,7 @@ func TestUpdateCredentialsEmptyStrategy(t *testing.T) { func TestUpdateCredentialsEmptyKuid(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/validateCredentials_test.go b/security/validateCredentials_test.go index 2d840a56..bcf4ddfd 100644 --- a/security/validateCredentials_test.go +++ b/security/validateCredentials_test.go @@ -33,7 +33,7 @@ func TestValidateCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "security", request.Controller) assert.Equal(t, "validateCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestValidateCredentialsQueryError(t *testing.T) { func TestValidateCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -55,7 +55,7 @@ func TestValidateCredentialsEmptyStrategy(t *testing.T) { func TestValidateCredentialsEmptyKuid(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/adminExists_test.go b/server/adminExists_test.go index b3205cb0..03ca60da 100644 --- a/server/adminExists_test.go +++ b/server/adminExists_test.go @@ -33,7 +33,7 @@ func TestAdminExistsQueryError(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "adminExists", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/getAllStats_test.go b/server/getAllStats_test.go index dfdb0fd6..afbfc1e2 100644 --- a/server/getAllStats_test.go +++ b/server/getAllStats_test.go @@ -33,7 +33,7 @@ func TestGetAllStatsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "server", request.Controller) assert.Equal(t, "getAllStats", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/getConfig_test.go b/server/getConfig_test.go index a698007a..9e9cab02 100644 --- a/server/getConfig_test.go +++ b/server/getConfig_test.go @@ -33,7 +33,7 @@ func TestGetConfigQueryError(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "getConfig", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/getLastStats_test.go b/server/getLastStats_test.go index 4d4b4a9e..be941109 100644 --- a/server/getLastStats_test.go +++ b/server/getLastStats_test.go @@ -33,7 +33,7 @@ func TestGetLastStatsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "server", request.Controller) assert.Equal(t, "getLastStats", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/getStats_test.go b/server/getStats_test.go index 153d1f2a..0b85ebc5 100644 --- a/server/getStats_test.go +++ b/server/getStats_test.go @@ -34,7 +34,7 @@ func TestGetStatsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "server", request.Controller) assert.Equal(t, "getLastStats", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/info_test.go b/server/info_test.go index bbda6aea..037bba03 100644 --- a/server/info_test.go +++ b/server/info_test.go @@ -33,7 +33,7 @@ func TestInfoQueryError(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "info", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/now_test.go b/server/now_test.go index f4035446..f6adbf0d 100644 --- a/server/now_test.go +++ b/server/now_test.go @@ -29,7 +29,7 @@ import ( func TestNowQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) From 55757ca216653a8d6ba5fb3fd16bb7da87fcf960 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 24 May 2018 17:21:51 +0200 Subject: [PATCH 154/363] new e2e scenarios --- .../java/gradle/cucumber/Documentdefs.java | 78 ++++++++++ internal/wrappers/features/sdks.feature | 137 +++++++++++++----- 2 files changed, 175 insertions(+), 40 deletions(-) create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java new file mode 100644 index 00000000..6ae83266 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -0,0 +1,78 @@ +package gradle.cucumber; + +import cucumber.api.java.After; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.BadRequestException; +import io.kuzzle.sdk.Kuzzle; +import io.kuzzle.sdk.KuzzleException; +import org.junit.Assert; + +public class Documentdefs { + private Kuzzle k; + private String index; + private String collection; + private String errorMessage; + private String documentId; + + @After + public void after() { + if (documentId != null) { + k.getDocument().delete_(this.index, this.collection, this.documentId); + } + } + + @Given("^Kuzzle Server is running$") + public void kuzzle_Server_is_running() throws Exception { + k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); + } + + @Given("^there is an index \'([^\"]*)\'$") + public void there_is_an_index(String index) throws Exception { + this.index = index; + if (!k.getIndex().exists(index)) { + k.getIndex().create(index); + } + } + + @Given("^it has a collection \'([^\"]*)\'$") + public void it_has_a_collection(String collection) throws Exception { + this.collection = collection; + if (!k.getCollection().exists(this.index, collection)) { + k.getCollection().create(this.index, collection); + } + } + + @Given("^the collection has a document with id \'([^\"]*)\'$") + public void the_collection_has_a_document_with_id(String id) throws Exception { + this.documentId = id; + k.getDocument().create(index, collection, id, "{\"foo\":\"bar\"}"); + } + + @When("^I try to create a new document with id \'([^\"]*)\'$") + public void i_try_to_create_a_new_document_with_id(String id) throws Exception { + this.errorMessage = null; + try { + this.documentId = id; + k.getDocument().create(this.index, this.collection, id, "{\"foo\": \"bar\"}"); + } catch (BadRequestException e) { + this.errorMessage = e.getMessage(); + } + } + + @Then("^I get an error with message \'([^\"]*)\'$") + public void i_get_an_error_with_message(String message) throws Exception { + Assert.assertEquals(message, this.errorMessage); + } + + @Given("^the collection doesn't have a document with id \'([^\"]*)\'$") + public void the_collection_doesn_t_have_a_document_with_id(String id) throws Exception { + Assert.assertFalse(k.getDocument().exists(this.index, this.collection, id)); + } + + @Then("^the document is successfully created$") + public void the_document_is_successfully_created() throws Exception { + Assert.assertNull(this.errorMessage); + } +} diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature index f457fdaa..a65b1153 100644 --- a/internal/wrappers/features/sdks.feature +++ b/internal/wrappers/features/sdks.feature @@ -1,40 +1,97 @@ -Feature: SDK's integration tests - - Scenario: Login user - Given I create a user "useradmin" with password "testpwd" with id "useradmin-id" - When I try to create a document with id "my-document" - Then I check if the document with id "my-document" does not exists - - When I log in as "useradmin":"testpwd" - Then I check the JWT is not null - - When I update my credentials with username "useradmin" and "foo" = "bar" - Then I check my new credentials are valid with username "useradmin", password "testpwd" and "foo" = "bar" - - When I try to create a document with id "my-document" - Then I check if the document with id "my-document" exists - - Given I logout - When I update my credentials with username "useradmin" and "foo" = "barz" - Then I check my new credentials are not valid with username "useradmin", password "testpwd" and "foo" = "barz" - Then I check the JWT is null - - Scenario: Subscribe to a collection and receive notifications - Given I subscribe to "collection" - When I create a document in "collection" - Then I receive a notification - - When I create a document in "collection" - Then I receive a notification - - Given I unsubscribe - When I create a document in "collection" - Then I do not receive a notification - - Scenario: Subscribe to a geofence filter - Given I subscribe to "geofence" collection - When I create a document in "geofence" and inside my geofence - Then I receive a "in" notification - - When I update this document to be outside my geofence - Then I receive a "out" notification \ No newline at end of file +# SDK's integration tests +#======================== + +Feature: Create document with ids + + Scenario: Do not allow creating a document with an _id that already exist in the same collection + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + When I try to create a new document with id 'my-document-id' + Then I get an error with message 'Document already exists' + + Scenario: Allow creating a document with an _id when the _id isn't used yet + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection doesn't have a document with id 'my-document-id' + When I try to create a new document with id 'my-document-id' + Then the document is successfully created + + #Feature: User management + + Scenario Outline: Get a valid JWT when login + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + When I log in as : + Then the JWT is + Examples: + | user-name | user-pwd | jwt_validity | + | 'my-user-name' | 'my-user-pwd' | valid | + | 'my-user-name-w' | 'my-user-pwd' | invalid | + | 'my-user-name' | 'my-user-pwd-w' | invalid | + | 'my-user-name-w' | 'my-user-pwd-w' | invalid | + + Scenario Outline: Set user custom data (updateSelf) + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + And I log in as 'my-user-name':'my-user-pwd' + And I update my user custom data with the pair : + When I get my user info + Then the response '_source' field contains the pair : + And is a + Examples: + | fieldname | fieldvalue | type | + | my_data1 | "mystringvalue" | string | + | my_data2 | 1234 | number | + | my_data2 | -1234 | number | + | my_data2 | 1.234 | number | + | my_data2 | -1.234 | number | + | my_data1 | true | bool | + | my_data1 | false | bool | + + + Scenario: Login out shall revoke the JWT + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + And I login using 'local' authentication, with and password as credentials + And the retrieved JWT is valid + When I logout + Then the JWT is no more valid + + + +# Feature: Realtime subscribtion +# +# Scenario: Receive notifications when a document is created +# Given I subscribe to "collection" +# When I create a document in "collection" +# Then I receive a notification +# +# Scenario: Receive notifications when a document is deleted +# Scenario: Receive notifications when a document is updated +# Scenario: Receive notifications when a document is published +# When I create a document in "collection" +# Then I receive a notification + +# Scenario: Stop recieving notification when I unsubscribe +# Given I unsubscribe +# When I create a document in "collection" +# Then I do not receive a notification + +# Feature: Geofencing subscriptions + +# Scenario Outline: Subscribe to a geofence filter +# Given I subscribe to "geofence" collection +# When I create a document in "geofence" and inside my geofence +# Then I receive a "in" notification +# +# When I update this document to be outside my geofence +# Then I receive a "out" notification +# Examples: +# | lon | lat | in | +# | 43.6108 | 3.8767 | yes | From a3c371c3df8de71d3026a76ace85265c68047d53 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 28 May 2018 15:27:01 +0200 Subject: [PATCH 155/363] e2e test on auth controller for java + fixes --- internal/wrappers/cgo/kuzzle/auth.go | 4 +- internal/wrappers/cgo/kuzzle/destructors.go | 1 - internal/wrappers/cgo/kuzzle/go_to_c.go | 3 +- internal/wrappers/cpp/auth.cpp | 3 + .../java/gradle/cucumber/Documentdefs.java | 4 +- .../java/gradle/cucumber/KuzzleSingleton.java | 16 +++ .../test/java/gradle/cucumber/Logindefs.java | 97 ----------------- .../gradle/cucumber/UserManagementdefs.java | 102 ++++++++++++++++++ internal/wrappers/features/sdks.feature | 24 ++--- 9 files changed, 133 insertions(+), 121 deletions(-) create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/KuzzleSingleton.java delete mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index 2a7a0cd7..c649e1ad 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -170,10 +170,8 @@ func kuzzle_update_my_credentials(a *C.auth, strategy *C.char, credentials *C.ch //export kuzzle_update_self func kuzzle_update_self(a *C.auth, data *C.char, options *C.query_options) *C.user_result { - marshed, _ := json.Marshal(C.GoString(data)) - res, err := (*auth.Auth)(a.instance).UpdateSelf( - marshed, + json.RawMessage(C.GoString(data)), SetQueryOptions(options)) return goToCUserResult(a.kuzzle, res, err) diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index b8ad9186..ddf51b03 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -383,7 +383,6 @@ func kuzzle_free_user_rights_result(st *C.user_rights_result) { //export kuzzle_free_user_result func kuzzle_free_user_result(st *C.user_result) { if st != nil { - kuzzle_free_user(st.result) C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) C.free(unsafe.Pointer(st)) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index fe8413e4..7791a51e 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -559,9 +559,8 @@ func goToCUser(k *C.kuzzle, user *security.User, dest *C.user) (*C.user, error) if err != nil { return nil, err } - jsonO := C.CString(string(cnt)) - cuser.content = jsonO + cuser.content = C.CString(string(cnt)) } if user.ProfileIds != nil { diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp index e7ca859f..8ed4ae63 100644 --- a/internal/wrappers/cpp/auth.cpp +++ b/internal/wrappers/cpp/auth.cpp @@ -63,7 +63,10 @@ namespace kuzzleio { user_result *r = kuzzle_get_current_user(_auth); if (r->error != NULL) throwExceptionFromStatus(r); + + user *ret = r->result; kuzzle_free_user_result(r); + return ret; } std::string Auth::getMyCredentials(const std::string& strategy, query_options *options) Kuz_Throw_KuzzleException { diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index 6ae83266..ec857d5e 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -6,8 +6,8 @@ import cucumber.api.java.en.When; import io.kuzzle.sdk.BadRequestException; import io.kuzzle.sdk.Kuzzle; -import io.kuzzle.sdk.KuzzleException; import org.junit.Assert; +import org.junit.Before; public class Documentdefs { private Kuzzle k; @@ -25,7 +25,7 @@ public void after() { @Given("^Kuzzle Server is running$") public void kuzzle_Server_is_running() throws Exception { - k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); + k = KuzzleSingleton.getInstance(); } @Given("^there is an index \'([^\"]*)\'$") diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/KuzzleSingleton.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/KuzzleSingleton.java new file mode 100644 index 00000000..152afb57 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/KuzzleSingleton.java @@ -0,0 +1,16 @@ +package gradle.cucumber; + +import io.kuzzle.sdk.Kuzzle; + +public class KuzzleSingleton { + private static Kuzzle kuzzle = null; + + public static Kuzzle getInstance() { + if (kuzzle != null) { + return kuzzle; + } + + kuzzle = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); + return kuzzle; + } +} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java deleted file mode 100644 index 3165d9ae..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Logindefs.java +++ /dev/null @@ -1,97 +0,0 @@ -package gradle.cucumber; - -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import io.kuzzle.sdk.*; -import org.junit.Assert; - -public class Logindefs { - private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); - - @Given("^I create a user \"([^\"]*)\" with password \"([^\"]*)\" with id \"([^\"]*)\"$") - public void CreateUser(String user, String password, String id) { - String json = "{\n" + - " \"content\": {\n" + - " \"profileIds\": [\"default\"]" + - " },\n" + - " \"credentials\": {\n" + - " \"local\": {\n" + - " \"username\": \""+user+"\"," + - " \"password\": \""+password+"\"" + - " }\n" + - " }\n" + - "}"; - - KuzzleRequest request = new KuzzleRequest(); - request.setController("security"); - request.setAction("createUser"); - request.setBody(json); - request.setId(id); - - k.query(request); - } - - @When("^I try to create a document with id \"([^\"]*)\"$") - public void CreateDocument(String id) { - try { - k.getDocument().create("index", "collection", id, "{\"foo\":\"bar\"}"); - } catch(Exception e) {} - } - - @Then("^I check if the document with id \"([^\"]*)\"( does not)? exists$") - public void GetDocument(String id, String does_not_exists) { - boolean raised = false; - try { - k.getDocument().get("index", "collection", id); - } catch (Exception e) { - if (does_not_exists == null) { - Assert.fail("Exception raised: " + e.toString()); - } else { - raised = true; - } - } - if (does_not_exists != null) { - Assert.assertTrue("The document has been created and should not have been.", raised); - } - } - - @When("^I log in as \"([^\"]*)\":\"([^\"]*)\"$") - public void Login(String user, String password) { - String jwt = k.getAuth().login("local", "{\"username\": \""+user+"\", \"password\":\""+password+"\" }"); - Assert.assertNotNull("Jwt should not be null after a right login", jwt); - } - - @Then("^I check the JWT is( not)? null$") - public void CheckJwt(String not) { - if (not != null) { - Assert.assertNotEquals("", k.getJwt()); - } else { - Assert.assertEquals("", k.getJwt()); - } - } - - @When("^I update my credentials with username \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") - public void UpdateMyCredentials(String username, String key, String value) { - try { - k.getAuth().updateMyCredentials("local", "{\"username\": \""+username+"\", \""+key+"\":\""+value+"\"}"); - } catch(Exception e) {} - } - - @Then("^I check my new credentials are( not)? valid with username \"([^\"]*)\", password \"([^\"]*)\" and \"([^\"]*)\" = \"([^\"]*)\"$") - public void CheckMyCredentials(String not, String username, String password, String key, String value) { - String credentials = "{\"username\": \""+username+"\", \"password\":\""+password+"\", \""+key+"\":\""+value+"\"}"; - if (not == null) { - Assert.assertTrue(k.getAuth().validateMyCredentials("local", credentials)); - } else { - try { - Assert.assertFalse(k.getAuth().validateMyCredentials("local", credentials)); - } catch(Exception e) {} - } - } - - @Given("^I logout$") - public void Logout() { - k.getAuth().logout(); - } -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java new file mode 100644 index 00000000..adc4f464 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java @@ -0,0 +1,102 @@ +package gradle.cucumber; + +import cucumber.api.PendingException; +import cucumber.api.java.After; +import cucumber.api.java.Before; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.*; +import org.junit.Assert; + +public class UserManagementdefs { + private Kuzzle k; + private String userId; + private User currentUser; + + @Before + public void before() { + k = KuzzleSingleton.getInstance(); + } + + @After + public void after() { + k.getAuth().logout(); + } + + @Given("^there is an user with id \'([^\"]*)\'$") + public void there_is_an_user_with_id(String id) throws Exception { + this.userId = id; + } + + @Given("^the user has 'local' credentials with name \'([^\"]*)\' and password \'([^\"]*)\'$") + public void the_user_has_local_credentials_with_name_and_password(String name, String password) throws Exception { + KuzzleRequest request = new KuzzleRequest(); + String json = "{\n" + + " \"content\": {\n" + + " \"profileIds\": [\"default\"]" + + " },\n" + + " \"credentials\": {\n" + + " \"local\": {\n" + + " \"username\": \""+name+"\"," + + " \"password\": \""+password+"\"" + + " }\n" + + " }\n" + + "}"; + + request.setController("security"); + request.setAction("createUser"); + request.setId(this.userId); + request.setBody(json); + request.setStrategy("local"); + + try { + k.query(request); + } catch(KuzzleException e) { + if (e.getClass() != PreconditionException.class) { + throw e; + } + } + } + + @When("^I log in as \'([^\"]*)\':\'([^\"]*)\'$") + public void i_log_in_as(String name, String password) throws Exception { + try { + k.getAuth().login("local", "{\"username\": \"" + name + "\", \"password\":\"" + password + "\" }"); + } catch (KuzzleException e) { + if (e.getClass() != UnauthorizedException.class) { + throw e; + } + } + } + + @Then("^the JWT is valid$") + public void the_JWT_is_valid() throws Exception { + Assert.assertTrue(k.getAuth().checkToken(k.getJwt()).getValid()); + } + + @Then("^the JWT is invalid$") + public void the_JWT_is_invalid() throws Exception { + Assert.assertFalse(k.getAuth().checkToken(k.getJwt()).getValid()); + } + + @Given("^I update my user custom data with the pair \'([^\"]*)\':\'([^\"]*)\'$") + public void i_update_my_user_custom_data_with_the_pair(String fieldname, String fieldvalue) throws Exception { + k.getAuth().updateSelf("{\""+fieldname+"\": \""+fieldvalue+"\"}"); + } + + @When("^I get my user info$") + public void i_get_my_user_info() throws Exception { + currentUser = k.getAuth().getCurrentUser(); + } + + @Then("^the response '_source' field contains the pair \'([^\"]*)\':\'([^\"]*)\'$") + public void the_response__source_field_contains_the_pair(String key, String value) throws Exception { + Assert.assertEquals(currentUser.getContent(), "{\""+key+"\":\""+value+"\",\"profileIds\":[\"default\"]}"); + } + + @When("^I logout$") + public void i_logout() throws Exception { + k.getAuth().logout(); + } +} diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature index a65b1153..32597f84 100644 --- a/internal/wrappers/features/sdks.feature +++ b/internal/wrappers/features/sdks.feature @@ -39,29 +39,21 @@ Feature: Create document with ids And there is an user with id 'my-user-id' And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' And I log in as 'my-user-name':'my-user-pwd' - And I update my user custom data with the pair : + And I update my user custom data with the pair : When I get my user info - Then the response '_source' field contains the pair : - And is a + Then the response '_source' field contains the pair : Examples: - | fieldname | fieldvalue | type | - | my_data1 | "mystringvalue" | string | - | my_data2 | 1234 | number | - | my_data2 | -1234 | number | - | my_data2 | 1.234 | number | - | my_data2 | -1.234 | number | - | my_data1 | true | bool | - | my_data1 | false | bool | - - + | field-name | field-value | + | 'my_data' | 'mystringvalue' | + Scenario: Login out shall revoke the JWT Given Kuzzle Server is running And there is an user with id 'my-user-id' And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I login using 'local' authentication, with and password as credentials - And the retrieved JWT is valid + And I log in as 'my-user-name':'my-user-pwd' + Then the JWT is valid When I logout - Then the JWT is no more valid + Then the JWT is invalid From d64c12809c3074194c64bda894a985e9443965d0 Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Tue, 29 May 2018 17:41:39 +0200 Subject: [PATCH 156/363] more passings tests --- .gitignore | 5 +- internal/wrappers/cgo/kuzzle/destructors.go | 1 - internal/wrappers/features/sdks2.feature | 18 +- .../features/step_defs_cpp/CMakeLists.txt | 7 +- .../step_defs_cpp/kuzzle-sdk-steps.cpp | 207 +++++++++--------- 5 files changed, 124 insertions(+), 114 deletions(-) diff --git a/.gitignore b/.gitignore index fa30ad69..6d944e3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ .cover .idea +.vscode main.go # Custom test file -test.go \ No newline at end of file +test.go +_build*/ +build/ \ No newline at end of file diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index b8ad9186..ddf51b03 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -383,7 +383,6 @@ func kuzzle_free_user_rights_result(st *C.user_rights_result) { //export kuzzle_free_user_result func kuzzle_free_user_result(st *C.user_result) { if st != nil { - kuzzle_free_user(st.result) C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) C.free(unsafe.Pointer(st)) diff --git a/internal/wrappers/features/sdks2.feature b/internal/wrappers/features/sdks2.feature index ca99190a..f06d6283 100644 --- a/internal/wrappers/features/sdks2.feature +++ b/internal/wrappers/features/sdks2.feature @@ -39,19 +39,19 @@ Feature: Create document with ids And there is an user with id 'my-user-id' And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' And I log in as 'my-user-name':'my-user-pwd' - And I update my user custom data with the pair : + And I update my user custom data with the pair : When I get my user info - Then the response '_source' field contains the pair : + Then the response 'content' field contains the pair : And is a Examples: | fieldname | fieldvalue | type | - | my_data1 | "mystringvalue" | string | - | my_data2 | 1234 | number | - | my_data2 | -1234 | number | - | my_data2 | 1.234 | number | - | my_data2 | -1.234 | number | - | my_data1 | true | bool | - | my_data1 | false | bool | + | my_data | 1.234 | number | + | my_data | -1.234 | number | + | my_data | "mystringvalue" | string | + | my_data | 1234 | number | + | my_data | -1234 | number | + | my_data | true | bool | + | my_data | false | bool | Scenario: Login out shall revoke the JWT diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt index 82ce0ebe..e3981f2e 100644 --- a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt +++ b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt @@ -30,9 +30,6 @@ list(APPEND CUCUMBER_CPP_INCLUDE_PATH "${SOURCE_DIR}/include") message("cucumber-cpp: include path = ${CUCUMBER_CPP_INCLUDE_PATH}") message("cucumber-cpp: library parh = ${CUCUMBER_CPP_LIBRARY_PATH}") -list(APPEND LIB_INCLUDE_DIRS "dir1") -list(APPEND LIB_INCLUDE_DIRS "dir2") - add_library(cucumber-cpp STATIC IMPORTED) # or STATIC instead of SHARED add_dependencies(cucumber-cpp project_cucumber_cpp) set_target_properties(cucumber-cpp PROPERTIES @@ -88,6 +85,8 @@ set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost if(Boost_UNIT_TEST_FRAMEWORK_FOUND) + set (CMAKE_CXX_STANDARD 11) + add_executable(KuzzleSDKStepDefs kuzzle-sdk-steps kuzzle_utils) add_dependencies(KuzzleSDKStepDefs project_cucumber_cpp) @@ -105,5 +104,7 @@ if(Boost_UNIT_TEST_FRAMEWORK_FOUND) ) target_link_libraries(KuzzleSDKStepDefs cpp kuzzlesdk pthread cucumber-cpp json_spirit ${CUKE_EXTRA_LIBRARIES} ${CUKE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ) +else() + message(FATAL_ERROR) endif() diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index ba8a1f8c..1ab2cb7a 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -11,6 +11,8 @@ #include "kuzzle_utils.h" +#include "json_spirit/json_spirit.h" + using cucumber::ScenarioScope; using namespace kuzzleio; @@ -18,9 +20,8 @@ using std::cout; using std::endl; using std::string; -struct KuzzleCtx -{ - Kuzzle *kuzzle = NULL; +struct KuzzleCtx { + Kuzzle* kuzzle = NULL; options kuzzle_options; string user_id; @@ -28,18 +29,15 @@ struct KuzzleCtx string collection; string jwt; - user *currentUser = NULL; + user* currentUser = NULL; + json_spirit::Value_type customUserDataType = json_spirit::null_type; bool success; }; BEFORE() { kuz_log_sep(); } -GIVEN("^I create a user 'useradmin' with password 'testpwd' with id " - "'useradmin-id'$") -{ - pending(); -} +GIVEN("^I create a user 'useradmin' with password 'testpwd' with id 'useradmin-id'$") { pending(); } WHEN("^I try to create a document with id '(my-document)'$") { @@ -47,18 +45,14 @@ WHEN("^I try to create a document with id '(my-document)'$") ScenarioScope ctx; - try - { - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, - "{\"a\":\"document\"}"); - } - catch (KuzzleException e) - { + try { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); + } catch (KuzzleException e) { BOOST_FAIL(e.getMessage()); } } -GIVEN("^I update my user custom data with the pair ([\\w]+) : (.+)$") +GIVEN("^I update my user custom data with the pair ([\\w]+):(.+)$") { REGEX_PARAM(std::string, fieldname); REGEX_PARAM(std::string, fieldvalue); @@ -69,34 +63,93 @@ GIVEN("^I update my user custom data with the pair ([\\w]+) : (.+)$") K_LOG_D("Updating user data with : %s", data.c_str()); - try - { - K_LOG_D("a"); + try { ctx->kuzzle->auth->updateSelf(data); - K_LOG_D("b"); - } - catch (KuzzleException e) - { + } catch (KuzzleException e) { K_LOG_E(e.getMessage().c_str()); } - K_LOG_D("c"); +} + +THEN("^the response 'content' field contains the pair ([\\w]+):(.+)$") +{ + K_LOG_I("Checking user content field"); + REGEX_PARAM(std::string, fieldname); + REGEX_PARAM(std::string, expected_fieldvalue); + + ScenarioScope ctx; + + json_spirit::Value userContentValue; + std::string userContent = ctx->currentUser->content; + json_spirit::read(userContent, userContentValue); + + json_spirit::write_formatted(userContentValue); + + json_spirit::Value fieldvalue = json_spirit::find_value(userContentValue.get_obj(), fieldname); + switch (fieldvalue.type()) { + case json_spirit::str_type: { + std::string s = fieldvalue.get_str(); + K_LOG_D("Field value: \"%s\" of type string", s.c_str()); + BOOST_CHECK("\"" + s + "\"" == expected_fieldvalue); + break; + } + case json_spirit::bool_type: { + auto b = fieldvalue.get_bool(); + string s = b ? "true" : "false"; + K_LOG_D("Field value: \"%s\" of type bool", b ? "true" : "false"); + BOOST_CHECK(s == expected_fieldvalue); + break; + } + case json_spirit::int_type: { + auto i = fieldvalue.get_int(); + K_LOG_D("Field value: %d of type int", i); + string s = std::to_string(i); + BOOST_CHECK(s == expected_fieldvalue); + break; + } + case json_spirit::real_type: { + float f = fieldvalue.get_real(); + K_LOG_D("Field value: %f of type real", f); + float e = std::stof(expected_fieldvalue); + K_LOG_D("Expected value: %f", e); + BOOST_CHECK(f == std::stof(expected_fieldvalue)); + break; + } + // TODO: Add obj test case... + } + + ctx->customUserDataType = fieldvalue.type(); +} + +THEN("^is a string$") +{ + ScenarioScope ctx; + BOOST_CHECK(ctx->customUserDataType == json_spirit::str_type); +} + +THEN("^is a number$") +{ + ScenarioScope ctx; + BOOST_CHECK(ctx->customUserDataType == json_spirit::int_type || ctx->customUserDataType == json_spirit::real_type); +} + +THEN("^is a bool$") +{ + ScenarioScope ctx; + BOOST_CHECK(ctx->customUserDataType == json_spirit::bool_type); } GIVEN("^Kuzzle Server is running$") { K_LOG_I("Connecting to Kuzzle on 'localhost:7512'"); ScenarioScope ctx; - ctx->kuzzle_options = KUZZLE_OPTIONS_DEFAULT; + ctx->kuzzle_options = KUZZLE_OPTIONS_DEFAULT; ctx->kuzzle_options.connect = MANUAL; - try - { + try { ctx->kuzzle = new Kuzzle("localhost", &ctx->kuzzle_options); - } - catch (KuzzleException e) - { + } catch (KuzzleException e) { K_LOG_E(e.getMessage().c_str()); } - char *error = ctx->kuzzle->connect(); + char* error = ctx->kuzzle->connect(); BOOST_CHECK(error == NULL); } @@ -106,21 +159,15 @@ GIVEN("^there is an index '(test-index)'$") ScenarioScope ctx; ctx->index = index_name; - if (!ctx->kuzzle->index->exists(index_name)) - { + if (!ctx->kuzzle->index->exists(index_name)) { K_LOG_D("Creating index: %s", index_name.c_str()); - try - { + try { ctx->kuzzle->index->create(index_name); - } - catch (KuzzleException e) - { + } catch (KuzzleException e) { K_LOG_E(e.getMessage().c_str()); BOOST_FAIL(e.getMessage()); } - } - else - { + } else { K_LOG_D("Using existing index: %s", index_name.c_str()); } } @@ -132,12 +179,9 @@ GIVEN("^it has a collection '(test-collection)'$") ctx->collection = collection_name; K_LOG_D("Creating collection: %s", collection_name.c_str()); - try - { + try { ctx->kuzzle->collection->create(ctx->index, ctx->collection); - } - catch (KuzzleException e) - { + } catch (KuzzleException e) { K_LOG_E(e.getMessage().c_str()); BOOST_FAIL(e.getMessage()); } @@ -149,13 +193,9 @@ GIVEN("^the collection has a document with id '(my-document-id)'$") ScenarioScope ctx; - try - { - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, - "{\"a\":\"document\"}"); - } - catch (KuzzleException e) - { + try { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); + } catch (KuzzleException e) { e.getMessage(); } } @@ -166,12 +206,9 @@ GIVEN("^the collection doesn't have a document with id '(my-document-id)'$") ScenarioScope ctx; - try - { + try { ctx->kuzzle->document->delete_(ctx->index, ctx->collection, document_id); - } - catch (KuzzleException e) - { + } catch (KuzzleException e) { } } @@ -181,13 +218,9 @@ WHEN("^I try to create a new document with id 'my-document-id'$") ScenarioScope ctx; ctx->success = true; - try - { - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, - "{\"a\":\"document\"}"); - } - catch (KuzzleException e) - { + try { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); + } catch (KuzzleException e) { ctx->success = true; } } @@ -234,15 +267,11 @@ WHEN("^I log in as '([\\w\\-]+)':'([\\w\\-]+)'$") ScenarioScope ctx; string jwt; - try - { - jwt = - ctx->kuzzle->auth->login("local", get_login_creds(username, password)); + try { + jwt = ctx->kuzzle->auth->login("local", get_login_creds(username, password)); K_LOG_D("Logged in as '%s'", username.c_str()); K_LOG_D("JWT is: %s", jwt.c_str()); - } - catch (KuzzleException e) - { + } catch (KuzzleException e) { K_LOG_W(e.getMessage().c_str()); } ctx->jwt = jwt; @@ -251,53 +280,31 @@ WHEN("^I log in as '([\\w\\-]+)':'([\\w\\-]+)'$") THEN("^the JWT is valid$") { ScenarioScope ctx; - token_validity *v = ctx->kuzzle->auth->checkToken(ctx->jwt); + token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); BOOST_CHECK(v->valid); } THEN("^the JWT is invalid$") { ScenarioScope ctx; - token_validity *v = ctx->kuzzle->auth->checkToken(ctx->jwt); + token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); BOOST_CHECK(!v->valid); } -GIVEN("^I update my user custom data \\(updateSelf\\) with " - "'\\{\\\\\"foo\\\\\": \\\\\"bar\\\\\"\\}'$") -{ - pending(); -} - WHEN("^I get my user info$") { ScenarioScope ctx; - sleep(5); - - try - { + try { ctx->currentUser = ctx->kuzzle->auth->getCurrentUser(); - } - catch (KuzzleException e) - { - K_LOG_E(e.getMessage().c_str()); - } - - try - { - K_LOG_D("========= getMyCredentials ============"); - K_LOG_D(ctx->kuzzle->auth->getMyCredentials("local").c_str()); - } - catch (KuzzleException e) - { + } catch (KuzzleException e) { K_LOG_E(e.getMessage().c_str()); } K_LOG_D("current user = 0x%p", ctx->currentUser); K_LOG_D("Current user content: %s", ctx->currentUser->content); - BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, - "Failed to retrieve current user"); + BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, "Failed to retrieve current user"); } GIVEN("^I login using 'local' authentication, with and password " From b77939c91359eeb986232041bd5555fb4386b696 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 10:17:16 +0200 Subject: [PATCH 157/363] e2e tests on realtime --- internal/wrappers/cgo/kuzzle/destructors.go | 8 ++- internal/wrappers/cgo/kuzzle/realtime.go | 2 +- internal/wrappers/cpp/collection.cpp | 2 +- internal/wrappers/cpp/document.cpp | 2 +- .../java/gradle/cucumber/Documentdefs.java | 50 ++++++++++------- .../java/gradle/cucumber/Subscribedefs.java | 37 +++++++++++-- .../src/test/java/gradle/cucumber/World.java | 6 ++ internal/wrappers/features/sdks.feature | 55 +++++++++++++------ kuzzle/query.go | 2 +- realtime/publish.go | 10 +++- 10 files changed, 123 insertions(+), 51 deletions(-) create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/World.java diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index ddf51b03..7492c868 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -255,9 +255,11 @@ func kuzzle_free_collection(st *C.collection) { //export kuzzle_free_document func kuzzle_free_document(st *C.document) { - C.free(unsafe.Pointer(st.instance)) - C.free(unsafe.Pointer(st.kuzzle)) - C.free(unsafe.Pointer(st)) + if st != nil { + C.free(unsafe.Pointer(st.instance)) + C.free(unsafe.Pointer(st.kuzzle)) + C.free(unsafe.Pointer(st)) + } } //export kuzzle_free_notification_content diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index 94ed6013..60ee7810 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -59,7 +59,7 @@ func kuzzle_realtime_list(rt *C.realtime, index, collection *C.char) *C.string_r //export kuzzle_realtime_publish func kuzzle_realtime_publish(rt *C.realtime, index, collection, body *C.char) *C.error_result { - err := (*realtime.Realtime)(rt.instance).Publish(C.GoString(index), C.GoString(collection), C.GoString(body)) + err := (*realtime.Realtime)(rt.instance).Publish(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body))) return goToCErrorResult(err) } diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 68be2e6d..40749cb3 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -28,7 +28,7 @@ namespace kuzzleio { Collection::~Collection() { unregisterCollection(_collection); - kuzzle_free_collection(_collection); + delete(_collection); } void Collection::create(const std::string& index, const std::string& collection, query_options *options) Kuz_Throw_KuzzleException { diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index 42982907..ccd8d13a 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -28,7 +28,7 @@ namespace kuzzleio { Document::~Document() { unregisterDocument(_document); - kuzzle_free_document(_document); + delete(_document); } int Document::count_(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index ec857d5e..e0aa4f23 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -1,27 +1,17 @@ package gradle.cucumber; -import cucumber.api.java.After; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import io.kuzzle.sdk.BadRequestException; import io.kuzzle.sdk.Kuzzle; +import io.kuzzle.sdk.QueryOptions; import org.junit.Assert; -import org.junit.Before; public class Documentdefs { private Kuzzle k; - private String index; - private String collection; private String errorMessage; - private String documentId; - - @After - public void after() { - if (documentId != null) { - k.getDocument().delete_(this.index, this.collection, this.documentId); - } - } + private World world; @Given("^Kuzzle Server is running$") public void kuzzle_Server_is_running() throws Exception { @@ -30,7 +20,7 @@ public void kuzzle_Server_is_running() throws Exception { @Given("^there is an index \'([^\"]*)\'$") public void there_is_an_index(String index) throws Exception { - this.index = index; + world.index = index; if (!k.getIndex().exists(index)) { k.getIndex().create(index); } @@ -38,24 +28,31 @@ public void there_is_an_index(String index) throws Exception { @Given("^it has a collection \'([^\"]*)\'$") public void it_has_a_collection(String collection) throws Exception { - this.collection = collection; - if (!k.getCollection().exists(this.index, collection)) { - k.getCollection().create(this.index, collection); + world.collection = collection; + if (!k.getCollection().exists(world.index, collection)) { + k.getCollection().create(world.index, collection); } } @Given("^the collection has a document with id \'([^\"]*)\'$") public void the_collection_has_a_document_with_id(String id) throws Exception { - this.documentId = id; - k.getDocument().create(index, collection, id, "{\"foo\":\"bar\"}"); + QueryOptions options = new QueryOptions(); + options.setRefresh("wait_for"); + + try { + k.getDocument().create(world.index, world.collection, id, "{\"foo\":\"bar\"}", options); + } catch (BadRequestException e) { + if (!e.getMessage().equals("Document already exists")) { + throw e; + } + } } @When("^I try to create a new document with id \'([^\"]*)\'$") public void i_try_to_create_a_new_document_with_id(String id) throws Exception { this.errorMessage = null; try { - this.documentId = id; - k.getDocument().create(this.index, this.collection, id, "{\"foo\": \"bar\"}"); + k.getDocument().create(world.index, world.collection, id, "{\"foo\": \"bar\"}"); } catch (BadRequestException e) { this.errorMessage = e.getMessage(); } @@ -68,11 +65,22 @@ public void i_get_an_error_with_message(String message) throws Exception { @Given("^the collection doesn't have a document with id \'([^\"]*)\'$") public void the_collection_doesn_t_have_a_document_with_id(String id) throws Exception { - Assert.assertFalse(k.getDocument().exists(this.index, this.collection, id)); + QueryOptions options = new QueryOptions(); + options.setRefresh("wait_for"); + + k.getDocument().delete_(world.index, world.collection, id, options); } @Then("^the document is successfully created$") public void the_document_is_successfully_created() throws Exception { Assert.assertNull(this.errorMessage); } + + @When("^I update the document with id \'([^\"]*)\' and content \'([^\"]*)\' = \'([^\"]*)\'$") + public void i_update_the_document_with_id_and_content(String id, String key, String value) throws Exception { + QueryOptions options = new QueryOptions(); + options.setRefresh("wait_for"); + + k.getDocument().update(world.index, world.collection, id, "{\""+key+"\":\""+value+"\"}"); + } } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index 46a07157..bb8ed5dc 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -10,12 +10,21 @@ public class Subscribedefs { private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); private String roomId; private NotificationContent content = null; + private World world; - @Given("^I subscribe to \"([^\"]*)\"$") + @Given("^I subscribe to \'([^\"]*)\'$") public void i_subscribe_to(String collection) throws Exception { - k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }", 40000); + roomId = k.getRealtime().subscribe(world.index, collection, "{}", new NotificationListener() { + @Override + public void onMessage(NotificationResult res) { + content = res.getResult(); + } + }); + } - roomId = k.getRealtime().subscribe("index", collection, "{}", new NotificationListener() { + @Given("^I subscribe to \'([^\"]*)\' with filter \'(.*)\'$") + public void i_subscribe_with_filter(String collection, String filter) throws Exception { + roomId = k.getRealtime().subscribe(world.index, collection, filter, new NotificationListener() { @Override public void onMessage(NotificationResult res) { content = res.getResult(); @@ -25,12 +34,13 @@ public void onMessage(NotificationResult res) { @When("^I create a document in \"([^\"]*)\"$") public void i_create_a_document_in(String collection) throws Exception { - k.getDocument().create("index", collection, "", "{}"); + k.getDocument().create(world.index, collection, "", "{}"); Thread.sleep(1000); } @Then("^I( do not)? receive a notification$") public void i_receive_a_notification(String dont) throws Exception { + Thread.sleep(1000); if (dont == null) { Assert.assertNotNull(content); Assert.assertNotNull(content.getContent()); @@ -40,9 +50,28 @@ public void i_receive_a_notification(String dont) throws Exception { Assert.assertNull(content); } + @Given("^I received a notification$") + public void i_received_a_notification() throws Exception { + Thread.sleep(1000); + Assert.assertNotNull(content); + Assert.assertNotNull(content.getContent()); + content = null; + } + @Given("^I unsubscribe") public void i_unsubscribe() throws Exception { k.getRealtime().unsubscribe(roomId); } + @When("^I delete the document with id \'([^\"]*)\'$") + public void i_delete_the_document_with_id(String id) throws Exception { + k.getDocument().delete_(world.index, world.collection, id); + Thread.sleep(1000); + } + + @When("^I publish a document$") + public void i_publish_a_document() throws Exception { + k.getRealtime().publish(world.index, world.collection, "{}"); + } + } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/World.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/World.java new file mode 100644 index 00000000..7574c8d2 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/World.java @@ -0,0 +1,6 @@ +package gradle.cucumber; + +public class World { + public static String index; + public static String collection; +} diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature index 32597f84..7e95d2a3 100644 --- a/internal/wrappers/features/sdks.feature +++ b/internal/wrappers/features/sdks.feature @@ -55,25 +55,48 @@ Feature: Create document with ids When I logout Then the JWT is invalid + #Feature: Realtime subscription + Scenario: Receive notifications when a document is created + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And I subscribe to 'test-collection' + When I create a document in "test-collection" + Then I receive a notification -# Feature: Realtime subscribtion -# -# Scenario: Receive notifications when a document is created -# Given I subscribe to "collection" -# When I create a document in "collection" -# Then I receive a notification -# -# Scenario: Receive notifications when a document is deleted -# Scenario: Receive notifications when a document is updated -# Scenario: Receive notifications when a document is published -# When I create a document in "collection" -# Then I receive a notification + Scenario: Receive notifications when a document is updated + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + And I subscribe to 'test-collection' with filter '{"equals": {"foo": "barz"}}' + When I update the document with id 'my-document-id' and content 'foo' = 'barz' + Then I receive a notification -# Scenario: Stop recieving notification when I unsubscribe -# Given I unsubscribe -# When I create a document in "collection" -# Then I do not receive a notification + Scenario: Receive notifications when a document is deleted + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + And I subscribe to 'test-collection' + When I delete the document with id 'my-document-id' + Then I receive a notification + + Scenario: Receive notifications when a document is published + Given Kuzzle Server is running + And I subscribe to 'test-collection' + When I publish a document + Then I receive a notification + + Scenario: Stop receiving notification when I unsubscribe + Given Kuzzle Server is running + And I subscribe to 'test-collection' + And the collection has a document with id 'my-document-id' + And I received a notification + And I unsubscribe from 'test-collection' + When I publish a document + Then I do not receive a notification # Feature: Geofencing subscriptions diff --git a/kuzzle/query.go b/kuzzle/query.go index ea460026..820d49cf 100644 --- a/kuzzle/query.go +++ b/kuzzle/query.go @@ -50,7 +50,7 @@ func (k *Kuzzle) Query(query *types.KuzzleRequest, options types.QueryOptions, r if options.Volatile() != nil { query.Volatile = options.Volatile() - var mapped map[string]interface{} + mapped := make(map[string]interface{}) json.Unmarshal(query.Volatile, &mapped) mapped["sdkVersion"] = version diff --git a/realtime/publish.go b/realtime/publish.go index 4b7d5748..8995f392 100644 --- a/realtime/publish.go +++ b/realtime/publish.go @@ -14,11 +14,15 @@ package realtime -import "github.com/kuzzleio/sdk-go/types" +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) // Publish sends a real-time message to Kuzzle -func (r *Realtime) Publish(index string, collection string, body string) error { - if (index == "" || collection == "") || body == "" { +func (r *Realtime) Publish(index string, collection string, body json.RawMessage) error { + if (index == "" || collection == "") || body == nil { return types.NewError("Realtime.Publish: index, collection and body required", 400) } From 3d656ca24ae91d2c359820bcc9a8a2b6449a4595 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 10:24:53 +0200 Subject: [PATCH 158/363] fix unit test --- realtime/publish_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/realtime/publish_test.go b/realtime/publish_test.go index cd13511d..66491091 100644 --- a/realtime/publish_test.go +++ b/realtime/publish_test.go @@ -29,7 +29,7 @@ func TestPublishIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - err := nr.Publish("", "collection", "body") + err := nr.Publish("", "collection", json.RawMessage(`{"body": "foo"}`)) assert.NotNil(t, err) } @@ -38,7 +38,7 @@ func TestPublishCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - err := nr.Publish("index", "", "body") + err := nr.Publish("index", "", json.RawMessage(`{"body": "foo"}`)) assert.NotNil(t, err) } @@ -47,7 +47,7 @@ func TestPublishBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - err := nr.Publish("index", "collection", "") + err := nr.Publish("index", "collection", nil) assert.NotNil(t, err) } @@ -61,7 +61,7 @@ func TestPublishError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nr := realtime.NewRealtime(k) - err := nr.Publish("index", "collection", "body") + err := nr.Publish("index", "collection", json.RawMessage(`{"body": "foo"}`)) assert.NotNil(t, err) } @@ -87,6 +87,6 @@ func TestPublish(t *testing.T) { nr := realtime.NewRealtime(k) - err := nr.Publish("index", "collection", "body") + err := nr.Publish("index", "collection", json.RawMessage(`{"body": "foo"}`)) assert.Nil(t, err) } From 806c01526067346439c2954b87e1c7ddb44956ef Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Wed, 30 May 2018 14:40:50 +0200 Subject: [PATCH 159/363] build: workaround to avoid having to launch build twice --- internal/wrappers/features/step_defs_cpp/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt index e3981f2e..f7d94705 100644 --- a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt +++ b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt @@ -29,6 +29,8 @@ list(APPEND CUCUMBER_CPP_INCLUDE_PATH "${SOURCE_DIR}/include") message("cucumber-cpp: include path = ${CUCUMBER_CPP_INCLUDE_PATH}") message("cucumber-cpp: library parh = ${CUCUMBER_CPP_LIBRARY_PATH}") +file(MAKE_DIRECTORY ${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src) +file(MAKE_DIRECTORY ${SOURCE_DIR}/include) add_library(cucumber-cpp STATIC IMPORTED) # or STATIC instead of SHARED add_dependencies(cucumber-cpp project_cucumber_cpp) From 23b3aefe1897961f411c12954f17f5755fea41e6 Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Wed, 30 May 2018 16:31:10 +0200 Subject: [PATCH 160/363] tests: added logout test --- internal/wrappers/features/sdks2.feature | 6 +++--- .../features/step_defs_cpp/CMakeLists.txt | 11 ++++++++--- .../step_defs_cpp/kuzzle-sdk-steps.cpp | 18 ++++++------------ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/internal/wrappers/features/sdks2.feature b/internal/wrappers/features/sdks2.feature index f06d6283..84cedd88 100644 --- a/internal/wrappers/features/sdks2.feature +++ b/internal/wrappers/features/sdks2.feature @@ -26,7 +26,7 @@ Feature: Create document with ids And there is an user with id 'my-user-id' And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' When I log in as : - Then the JWT is + Then the retrieved JWT is Examples: | user-name | user-pwd | jwt_validity | | 'my-user-name' | 'my-user-pwd' | valid | @@ -58,10 +58,10 @@ Feature: Create document with ids Given Kuzzle Server is running And there is an user with id 'my-user-id' And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I login using 'local' authentication, with and password as credentials + And I log in as 'my-user-name':'my-user-pwd' And the retrieved JWT is valid When I logout - Then the JWT is no more valid + Then the retrieved JWT is invalid diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt index f7d94705..c7ae644f 100644 --- a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt +++ b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt @@ -1,9 +1,12 @@ cmake_minimum_required(VERSION 3.0.0) project(KuzzleSKDTests) - include(ExternalProject) +# +# Cucumber CPP +# + ExternalProject_Add( project_cucumber_cpp GIT_REPOSITORY https://github.com/cucumber/cucumber-cpp @@ -29,6 +32,8 @@ list(APPEND CUCUMBER_CPP_INCLUDE_PATH "${SOURCE_DIR}/include") message("cucumber-cpp: include path = ${CUCUMBER_CPP_INCLUDE_PATH}") message("cucumber-cpp: library parh = ${CUCUMBER_CPP_LIBRARY_PATH}") + +# Workaround to avoid CMake to discard include path that doesn't exist yet file(MAKE_DIRECTORY ${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src) file(MAKE_DIRECTORY ${SOURCE_DIR}/include) @@ -93,13 +98,13 @@ if(Boost_UNIT_TEST_FRAMEWORK_FOUND) add_dependencies(KuzzleSDKStepDefs project_cucumber_cpp) - add_library(kuzzlesdk STATIC IMPORTED) # or STATIC instead of SHARED + add_library(kuzzlesdk SHARED IMPORTED) # or STATIC instead of SHARED set_target_properties(kuzzlesdk PROPERTIES IMPORTED_LOCATION "${KUZZLE_SDK_ROOT}/build/c/libkuzzlesdk.a" INTERFACE_INCLUDE_DIRECTORIES "${KUZZLE_SDK_ROOT}/build/c" ) - add_library(cpp STATIC IMPORTED) # or STATIC instead of SHARED + add_library(cpp SHARED IMPORTED) # or STATIC instead of SHARED set_target_properties(cpp PROPERTIES IMPORTED_LOCATION "${KUZZLE_SDK_ROOT}/build/cpp/libcpp.a" INTERFACE_INCLUDE_DIRECTORIES "${KUZZLE_SDK_ROOT}/headers" diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index 1ab2cb7a..d978a62b 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -277,19 +277,23 @@ WHEN("^I log in as '([\\w\\-]+)':'([\\w\\-]+)'$") ctx->jwt = jwt; } -THEN("^the JWT is valid$") +THEN("^the retrieved JWT is valid$") { ScenarioScope ctx; token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); BOOST_CHECK(v->valid); } -THEN("^the JWT is invalid$") +THEN("^the retrieved JWT is invalid$") { ScenarioScope ctx; token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); BOOST_CHECK(!v->valid); } +WHEN("^I logout$") { + ScenarioScope ctx; + ctx->kuzzle->auth->logout(); +} WHEN("^I get my user info$") { @@ -306,13 +310,3 @@ WHEN("^I get my user info$") BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, "Failed to retrieve current user"); } - -GIVEN("^I login using 'local' authentication, with and password " - " as credentials$") -{ - pending(); -} - -GIVEN("^the retrieved JWT is valid$") { pending(); } - -THEN("^The JWT is no more valid$") { pending(); } From 13add37761db15cf56a8fc4b9dadd838df658592 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 16:34:45 +0200 Subject: [PATCH 161/363] fix test.py --- internal/wrappers/templates/python/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/templates/python/test.py b/internal/wrappers/templates/python/test.py index ec6b1a19..c3582ed1 100644 --- a/internal/wrappers/templates/python/test.py +++ b/internal/wrappers/templates/python/test.py @@ -6,4 +6,4 @@ kuzzle = Kuzzle("localhost") print(kuzzle) -print(kuzzle.now()) +print(kuzzleserver.now()) From f3b30d31df59c8d9045350ea1ef76406f7ca71cb Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 16:34:52 +0200 Subject: [PATCH 162/363] fix test.py --- internal/wrappers/templates/python/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/templates/python/test.py b/internal/wrappers/templates/python/test.py index c3582ed1..fa1fb68a 100644 --- a/internal/wrappers/templates/python/test.py +++ b/internal/wrappers/templates/python/test.py @@ -6,4 +6,4 @@ kuzzle = Kuzzle("localhost") print(kuzzle) -print(kuzzleserver.now()) +print(kuzzle.server.now()) From 89abc36725e8181dccbfe17eb78c609b8231640c Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 16:40:18 +0200 Subject: [PATCH 163/363] remove comments --- internal/wrappers/templates/python/core.i | 62 ----------------------- 1 file changed, 62 deletions(-) diff --git a/internal/wrappers/templates/python/core.i b/internal/wrappers/templates/python/core.i index 29cc8fca..79003626 100644 --- a/internal/wrappers/templates/python/core.i +++ b/internal/wrappers/templates/python/core.i @@ -67,65 +67,3 @@ %include "auth.cpp" %include "index.cpp" %include "server.cpp" - -// %{ -// #define SWIG_FILE_WITH_INIT -// #include -// #include - -// #include "kuzzle.hpp" -// %} - -// %exception kuzzleio::Kuzzle::now { -// try { -// $action -// } catch (...) { -// std::cout << "BBlah"; -// PyObject *o = SWIG_NewPointerObj(new kuzzleio::ForbiddenError, SWIGTYPE_p_kuzzleio__ForbiddenError, SWIG_POINTER_OWN); -// SWIG_Python_Raise(o, (char *)"MyException", SWIGTYPE_p_kuzzleio__ForbiddenError); -// SWIG_fail; -// } -// } - -// %include "stl.i" -// %include "kcore.i" - -// %{ -// #include "core.cpp" -// %} - -// namespace kuzzleio { -// %exceptionclass KuzzleError; -// %extend KuzzleError { -// std::string __str__() const { -// std::ostringstream s; -// s << "[" << $self->status << "] " << $self->what(); -// if (!$self->stack.empty()) { -// s << "\n" << $self->stack; -// } -// return s.str(); -// } -// } -// %exceptionclass BadRequestError; -// %exceptionclass ForbiddenError; - -// %typemap(throws) BadRequestError "(void)$1; throw;"; -// } - -// /* -// %exception kuzzleio::Kuzzle::now { -// try { -// $action -// } catch (...) { -// std::cout << "Blah"; -// PyObject *o = SWIG_NewPointerObj(new kuzzleio::ForbiddenError, SWIGTYPE_p_kuzzleio__ForbiddenError, SWIG_POINTER_OWN); -// SWIG_Python_Raise(o, (char *)"MyException", SWIGTYPE_p_kuzzleio__ForbiddenError); -// SWIG_fail; -// } -// } -// */ - -// %include "core.cpp" - -// //%ignore kuzzle; -// %rename(QueryOptions) query_options; From 28d6c87e4b01106c2cf039c6f9681ddfc3ce06ab Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 16:43:39 +0200 Subject: [PATCH 164/363] added dependencie to python-dev --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6a45897a..e7b03fef 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Before generating the wrappers you will need to install: - [swig](www.swig.org) - [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) (don't forget to set your JAVA_HOME environment variable) +- [Python] You will need to install python-dev to compile the python SDK ### Generate From 807f80815792b00aa95a35ebfd2959d22b39fd66 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 16:48:34 +0200 Subject: [PATCH 165/363] add python to the all rule --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 1fbbf8b0..1df1801c 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -41,7 +41,7 @@ CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) SWIG = swig -all: java +all: java python kcore_wrap.o: kcore_wrap.cxx $(CPP) -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) From c60e951846be72dc6dc56f17d518850ff0690d1d Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 16:49:44 +0200 Subject: [PATCH 166/363] update README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e7b03fef..8071c75b 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,12 @@ make cpp ``` You will find the final .so file in `internal/wrappers/build/cpp` +## Python +```sh +make python +``` +You will find the final .so file in `internal/wrappers/build/python` + ## All at once You can generate all sdk's at once by typing From 003e278beca1ef279ccc7829f26c7412aeb1e38a Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 16:53:03 +0200 Subject: [PATCH 167/363] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8071c75b..7100d8d5 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Before generating the wrappers you will need to install: - [swig](www.swig.org) - [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) (don't forget to set your JAVA_HOME environment variable) -- [Python] You will need to install python-dev to compile the python SDK +- Python You will need to install python-dev to compile the python SDK ### Generate From 2790cf7593d346a893cb357413c572fbc6cb5613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Wed, 30 May 2018 16:53:26 +0200 Subject: [PATCH 168/363] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6a45897a..b94f5e32 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ To run e2e tests ensure you have a kuzzle running and then run Before generating the wrappers you will need to install: +- You will need a g++ compatible C++11 - [swig](www.swig.org) - [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) (don't forget to set your JAVA_HOME environment variable) From 8fb91d10187d7f632b6d8ec17c6973655fe29c2c Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 16:54:13 +0200 Subject: [PATCH 169/363] add C++11 deependencie --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 67d6b458..80a4a2d3 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ To run e2e tests ensure you have a kuzzle running and then run Before generating the wrappers you will need to install: +- You will need a g++ compatible C++11 - [swig](www.swig.org) - [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) (don't forget to set your JAVA_HOME environment variable) - Python You will need to install python-dev to compile the python SDK From 8978821085284146bee4c6a8d369f13b51d30381 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 17:02:47 +0200 Subject: [PATCH 170/363] add cppflags --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 1df1801c..28e9bc78 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -47,7 +47,7 @@ kcore_wrap.o: kcore_wrap.cxx $(CPP) -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) %.o: cpp/%.cpp - $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ -I./headers -I./build/c/ -L./build/c -lkuzzlesdk + $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) -I./headers -I./build/c/ -L./build/c -lkuzzlesdk core: ifeq ($(wildcard $(GOCC)),) From 323c0cc61e8230fcced9c661a419ff57b2c69c6d Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 17:06:29 +0200 Subject: [PATCH 171/363] add cppflags --- internal/wrappers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 28e9bc78..c783b912 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -62,7 +62,7 @@ endif wrapper: $(OBJS) object: - $(CPP) -shared $(OUTDIR)/kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-$(LANGUAGE).so $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) + $(CPP) -shared $(OUTDIR)/kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-$(LANGUAGE).so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) #strip $(OUTDIR)/libkuzzle-wrapper-$(LANGUAGE).so posttask: From 61c3d61fc48e5649e1688b39bece77abef2f8cff Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 18:06:50 +0200 Subject: [PATCH 172/363] remove libraries --- internal/wrappers/templates/python/setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/wrappers/templates/python/setup.py b/internal/wrappers/templates/python/setup.py index ce4b761f..abb03d9f 100644 --- a/internal/wrappers/templates/python/setup.py +++ b/internal/wrappers/templates/python/setup.py @@ -10,9 +10,7 @@ cwd = os.path.dirname(os.path.realpath(__file__)) kuzzle_module = Extension('_kcore', sources=[ cwd + '/kcore_wrap.cxx' ], - swig_opts=['-c++', '-py3'], - library_dirs = ['./'], - libraries = ['kuzzle-wrapper-python'] + swig_opts=['-c++', '-py3'] ) setup (name = 'kcore', From da00b6f9667a272bd50aa883e2a341ccc2000d77 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 30 May 2018 18:09:13 +0200 Subject: [PATCH 173/363] change meta --- internal/wrappers/templates/python/setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/wrappers/templates/python/setup.py b/internal/wrappers/templates/python/setup.py index abb03d9f..3de4f3a6 100644 --- a/internal/wrappers/templates/python/setup.py +++ b/internal/wrappers/templates/python/setup.py @@ -14,9 +14,9 @@ ) setup (name = 'kcore', - version = '0.1', - author = "SWIG Docs", - description = """Simple swig example from docs""", + version = '1.0', + author = "Kuzzle", + description = """Kuzzle sdk""", ext_modules = [kuzzle_module], py_modules = ["kcore"], ) From f5c2b18cec83e62a20ddbb7c45f8e646c5913a18 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 14:31:48 +0200 Subject: [PATCH 174/363] fix Makefile --- internal/wrappers/Makefile | 86 +++++++++++++--------- internal/wrappers/templates/python/test.py | 2 +- 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index c783b912..99f7da31 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -20,14 +20,8 @@ LIBS = -lkuzzlesdk SRCS = kcore_wrap.cxx OBJS = $(SRCS:.cxx=.o) -CPPSRCS = kuzzle.cpp \ - document.cpp \ - collection.cpp \ - realtime.cpp \ - auth.cpp \ - server.cpp \ - index.cpp \ - kcore_wrap.cxx +JAVAINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux +PYTHONINCLUDE = -I$(PYTHON_INCLUDE_DIR) -I$(ROOT_DIR)templates/python CPP_SDK_SRCS = kuzzle.cpp \ document.cpp \ @@ -37,19 +31,22 @@ CPP_SDK_SRCS = kuzzle.cpp \ server.cpp \ index.cpp +CPPSRCS = $(CPP_SDK_SRCS) \ + kcore_wrap.cxx + CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) SWIG = swig -all: java python +all: python java kcore_wrap.o: kcore_wrap.cxx - $(CPP) -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) + $(CPP) -c $< -o $@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) %.o: cpp/%.cpp $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) -I./headers -I./build/c/ -L./build/c -lkuzzlesdk -core: +core_java: ifeq ($(wildcard $(GOCC)),) $(error "Unable to find go compiler") endif @@ -59,57 +56,80 @@ endif $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h -wrapper: $(OBJS) +core_python: +ifeq ($(wildcard $(GOCC)),) + $(error "Unable to find go compiler") +endif + mkdir -p $(GOTARGETDIR) + cd ../../ && go get ./... ; cd - + $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) + $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) + mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h -object: - $(CPP) -shared $(OUTDIR)/kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-$(LANGUAGE).so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) - #strip $(OUTDIR)/libkuzzle-wrapper-$(LANGUAGE).so +wrapper_java: $(OBJS) -posttask: - cp -p $(GOTARGET) $(OUTDIR) - cp -p $(GOTARGETSO) $(OUTDIR) - #rm -f $(OUTDIR)/kcore_wrap.o - #rm -f kcore_wrap.cxx +wrapper_python: $(OBJS) + +java_object: + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-java.so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(JAVAINCLUDE) + strip $(OUTDIR)/libkuzzle-wrapper-java.so + +python_object: + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-python.so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(PYTHONINCLUDE) + strip $(OUTDIR)/libkuzzle-wrapper-python.so swig: mkdir -p $(OUTDIR) $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i +swig_java: + mkdir -p $(OUTDIR) + $(SWIG) -Wall -c++ -java -package io.kuzzle.sdk -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(JAVAINCLUDE) templates/java/core.i + +swig_python: + mkdir -p $(OUTDIR) + $(SWIG) -Wall -c++ -python -py3 -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(PYTHONINCLUDE) templates/python/core.i + + makedir: mkdir -p $(OUTDIR) +java: LANGINCLUDE = $(JAVAINCLUDE) java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk -java: LANGINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -java: LANGUAGE = java -java: SWIGOPTS = -package io.kuzzle.sdk -java: core swig wrapper object posttask - rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so +java: makedir core_java swig_java wrapper_java java_object + #rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class + rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class + cp -p $(GOTARGET) $(OUTDIR) + cp -p $(GOTARGETSO) $(OUTDIR) + rm -f kcore_wrap.o + rm -f kcore_wrap.cxx csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: LANGUAGE = csharp -csharp: SWIGOPTS = -dllimport kuzzlesdk +csharp: SWIGOPTS = -dllimport kuzzlesdk $(OBJS) csharp: core swig wrapper object posttask makedir mcs -t:library $(OUTDIR)/*.cs -out:$(OUTDIR)/libkuzzle-csharp.so rm -f $(OUTDIR)/*.cs +python: LANGINCLUDE = $(PYTHONINCLUDE) python: OUTDIR = $(ROOTOUTDIR)/python -python: LANGINCLUDE = -I$(PYTHON_INCLUDE_DIR) -I$(ROOT_DIR)templates/$(LANGUAGE) -python: LANGUAGE = python -python: SWIGOPTS = -py3 python: CC = g++ python: CFLAGS = -fPIC -python: core swig wrapper object posttask makedir - cp $(ROOT_DIR)templates/$(LANGUAGE)/*.py $(OUTDIR) +python: makedir core_python swig_python wrapper_python python_object + cp $(ROOT_DIR)templates/python/*.py $(OUTDIR) cp $(ROOT_DIR)$(SRCS) $(OUTDIR)/ cp $(ROOT_DIR)kcore_wrap.h $(OUTDIR)/ - python3 $(OUTDIR)/setup.py build_ext -I $(HEADERSDIR):$(CPPDIR):$(OUTDIR):$(GOTARGETDIR):$(OUTDIR)/templates/$(LANGUAGE) -L $(OUTDIR):$(GOTARGETDIR) -R $(GOTARGETDIR) -l kuzzlesdk -b $(OUTDIR) -t $(OUTDIR)/tmp + python3 $(OUTDIR)/setup.py build_ext -I $(HEADERSDIR):$(CPPDIR):$(OUTDIR):$(GOTARGETDIR):$(OUTDIR)/templates/python -L $(OUTDIR):$(GOTARGETDIR) -R $(GOTARGETDIR) -l kuzzlesdk -b $(OUTDIR) -t $(OUTDIR)/tmp + cp -p $(GOTARGET) $(OUTDIR) + cp -p $(GOTARGETSO) $(OUTDIR) + rm -f kcore_wrap.o + rm -f kcore_wrap.cxx cpp: OUTDIR = $(ROOTOUTDIR)/cpp cpp: makedir $(CPPSDK) diff --git a/internal/wrappers/templates/python/test.py b/internal/wrappers/templates/python/test.py index fa1fb68a..5d817a26 100644 --- a/internal/wrappers/templates/python/test.py +++ b/internal/wrappers/templates/python/test.py @@ -6,4 +6,4 @@ kuzzle = Kuzzle("localhost") print(kuzzle) -print(kuzzle.server.now()) +print(kuzzle.server.now()) \ No newline at end of file From 6094cecdfde07d45d9ab7405ed3298d73935dc6f Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 14:45:28 +0200 Subject: [PATCH 175/363] add python-dev as dependency --- .travis.yml | 2 +- internal/wrappers/Makefile | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 33a1c2d6..e2c10217 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ go: - 1.9 dist: trusty install: - - sudo apt-get install build-essential swig oracle-java8-installer g++ + - sudo apt-get install build-essential swig oracle-java8-installer g++ python-dev - go get -t -v ./... script: - bash ./test.sh diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 99f7da31..6c0c567c 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -107,8 +107,6 @@ java: makedir core_java swig_java wrapper_java java_object rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class cp -p $(GOTARGET) $(OUTDIR) cp -p $(GOTARGETSO) $(OUTDIR) - rm -f kcore_wrap.o - rm -f kcore_wrap.cxx csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: LANGUAGE = csharp @@ -128,8 +126,6 @@ python: makedir core_python swig_python wrapper_python python_object python3 $(OUTDIR)/setup.py build_ext -I $(HEADERSDIR):$(CPPDIR):$(OUTDIR):$(GOTARGETDIR):$(OUTDIR)/templates/python -L $(OUTDIR):$(GOTARGETDIR) -R $(GOTARGETDIR) -l kuzzlesdk -b $(OUTDIR) -t $(OUTDIR)/tmp cp -p $(GOTARGET) $(OUTDIR) cp -p $(GOTARGETSO) $(OUTDIR) - rm -f kcore_wrap.o - rm -f kcore_wrap.cxx cpp: OUTDIR = $(ROOTOUTDIR)/cpp cpp: makedir $(CPPSDK) From a59dd2aad26a87b7179ef1bbeb4a075cfccec98a Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 14:49:10 +0200 Subject: [PATCH 176/363] add -y to apt --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e2c10217..61127bc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ go: - 1.9 dist: trusty install: - - sudo apt-get install build-essential swig oracle-java8-installer g++ python-dev + - sudo apt-get install -y build-essential swig oracle-java8-installer g++ python-dev - go get -t -v ./... script: - bash ./test.sh From a2845266d7e6bc461eb776c499e8cf22189e5cfb Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 14:53:19 +0200 Subject: [PATCH 177/363] add python3-dev as dependency --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 61127bc9..96fa8d68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ go: - 1.9 dist: trusty install: - - sudo apt-get install -y build-essential swig oracle-java8-installer g++ python-dev + - sudo apt-get install -y build-essential swig oracle-java8-installer g++ python3-dev - go get -t -v ./... script: - bash ./test.sh From 8affb1b1119702f4fcc7009b76776f6cdf10d38e Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 15:05:54 +0200 Subject: [PATCH 178/363] use pkg-config --- internal/wrappers/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 6c0c567c..15e4a93f 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -3,7 +3,7 @@ ROOTOUTDIR = $(ROOT_DIR)build GOROOT ?= /usr/local/go GOCC = $(GOROOT)/bin/go JAVA_HOME ?= /usr/local -PYTHON_INCLUDE_DIR ?= /usr/include/python3.5 +PYTHON_INCLUDE_DIR ?= `pkg-config --cflags python3` GOFLAGS = -buildmode=c-archive GOSRC = ./cgo/kuzzle/ GOTARGETDIR = $(ROOTOUTDIR)/c @@ -21,7 +21,7 @@ SRCS = kcore_wrap.cxx OBJS = $(SRCS:.cxx=.o) JAVAINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -PYTHONINCLUDE = -I$(PYTHON_INCLUDE_DIR) -I$(ROOT_DIR)templates/python +PYTHONINCLUDE = $(PYTHON_INCLUDE_DIR) -I$(ROOT_DIR)templates/python CPP_SDK_SRCS = kuzzle.cpp \ document.cpp \ From 03d45f856042f240d4da2383c774938568fcb94d Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 15:18:31 +0200 Subject: [PATCH 179/363] add g++6 as dependency --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96fa8d68..e98c0eef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ go: - 1.9 dist: trusty install: - - sudo apt-get install -y build-essential swig oracle-java8-installer g++ python3-dev + - sudo apt-get install -y build-essential swig oracle-java8-installer g++-6 python3-dev - go get -t -v ./... script: - bash ./test.sh From 95f7647f49e7bf98eeb5172639243db197d03d80 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 15:33:02 +0200 Subject: [PATCH 180/363] add g++6 as dependency --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e98c0eef..fcae54ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ go: - 1.9 dist: trusty install: + - apt-cache search g++ - sudo apt-get install -y build-essential swig oracle-java8-installer g++-6 python3-dev - go get -t -v ./... script: From e2b4e7308f5cea2e79624182d6d0943837b519a6 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 15:59:18 +0200 Subject: [PATCH 181/363] wip --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fcae54ef..96fa8d68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,7 @@ go: - 1.9 dist: trusty install: - - apt-cache search g++ - - sudo apt-get install -y build-essential swig oracle-java8-installer g++-6 python3-dev + - sudo apt-get install -y build-essential swig oracle-java8-installer g++ python3-dev - go get -t -v ./... script: - bash ./test.sh From 05a10e079ac49b353d4f3fcc7557f8a37daea47e Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 16:06:50 +0200 Subject: [PATCH 182/363] remove auto --- README.md | 1 - internal/wrappers/Makefile | 2 +- internal/wrappers/cpp/index.cpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 80a4a2d3..67d6b458 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,6 @@ To run e2e tests ensure you have a kuzzle running and then run Before generating the wrappers you will need to install: -- You will need a g++ compatible C++11 - [swig](www.swig.org) - [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) (don't forget to set your JAVA_HOME environment variable) - Python You will need to install python-dev to compile the python SDK diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 15e4a93f..d65e69bc 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -13,7 +13,7 @@ CPPDIR = $(ROOT_DIR)cpp HEADERSDIR = $(ROOT_DIR)headers CPP = $(CXX) -CPPFLAGS = -g -fPIC -std=c++11 +CPPFLAGS = -g -fPIC INCS = -I$(HEADERSDIR) -I$(CPPDIR) -I$(ROOT_DIR)templates -I$(GOTARGETDIR) LDFLAGS = -L$(GOTARGETDIR) LIBS = -lkuzzlesdk diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index e770a001..55ea05b5 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -50,7 +50,7 @@ namespace kuzzleio { std::vector Index::mDelete(const std::vector& indexes, query_options *options) Kuz_Throw_KuzzleException { char **indexesArray = new char *[indexes.size()]; int i = 0; - for (auto const& index : indexes) { + for (std::string index : indexes) { indexesArray[i] = const_cast(index.c_str()); i++; } From 19578eff92a8bf5fdb0c95f4733e498b2bdb180d Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 16:13:05 +0200 Subject: [PATCH 183/363] remove auto --- internal/wrappers/cpp/index.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index 55ea05b5..42891319 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -49,10 +49,8 @@ namespace kuzzleio { std::vector Index::mDelete(const std::vector& indexes, query_options *options) Kuz_Throw_KuzzleException { char **indexesArray = new char *[indexes.size()]; - int i = 0; - for (std::string index : indexes) { - indexesArray[i] = const_cast(index.c_str()); - i++; + for (int i = 0; i < indexes.size(); i++) { + indexesArray[i] = const_cast(indexes[i].c_str()); } string_array_result *r = kuzzle_index_mdelete(_index, indexesArray, indexes.size(), options); From 9f5cb61bef14b618188c5fc25a2a7ed234cb5445 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 16:20:54 +0200 Subject: [PATCH 184/363] remove auto --- internal/wrappers/cpp/document.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index ccd8d13a..1853f35e 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -166,9 +166,8 @@ namespace kuzzleio { std::vector Document::mDelete(const std::string& index, const std::string& collection, const std::vector& ids, query_options *options) Kuz_Throw_KuzzleException { char **idsArray = new char *[ids.size()]; - int i = 0; - for (auto const& id : ids) { - idsArray[i] = const_cast(id.c_str()); + for (int i = 0; i < ids.size(); i++) { + idsArray[i] = const_cast(ids[i].c_str()); i++; } @@ -187,9 +186,8 @@ namespace kuzzleio { std::string Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options) Kuz_Throw_KuzzleException { char **idsArray = new char *[ids.size()]; - int i = 0; - for (auto const& id : ids) { - idsArray[i] = const_cast(id.c_str()); + for (int i = 0; i < ids.size(); i++) { + idsArray[i] = const_cast(ids[i].c_str()); i++; } From 4bc60ab6ecbeb04a419f6bbd74444ac596191f2e Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 17:14:15 +0200 Subject: [PATCH 185/363] csharp sdk --- internal/wrappers/Makefile | 32 +++++++--- internal/wrappers/cgo/kuzzle/destructors.go | 19 ------ internal/wrappers/cgo/kuzzle/errors.go | 5 -- internal/wrappers/headers/kuzzlesdk.h | 12 ---- internal/wrappers/templates/csharp/core.i | 70 +++++++++++++++++++++ internal/wrappers/templates/csharp/test.cs | 10 +++ 6 files changed, 105 insertions(+), 43 deletions(-) create mode 100644 internal/wrappers/templates/csharp/core.i create mode 100644 internal/wrappers/templates/csharp/test.cs diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index d65e69bc..ad1c5888 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -38,7 +38,7 @@ CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) SWIG = swig -all: python java +all: python java cshqrp kcore_wrap.o: kcore_wrap.cxx $(CPP) -c $< -o $@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) @@ -66,10 +66,22 @@ endif $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h +core_csharp: +ifeq ($(wildcard $(GOCC)),) + $(error "Unable to find go compiler") +endif + mkdir -p $(GOTARGETDIR) + cd ../../ && go get ./... ; cd - + $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) + $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) + mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h + wrapper_java: $(OBJS) wrapper_python: $(OBJS) +wrapper_csharp: $(OBJS) + java_object: $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-java.so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(JAVAINCLUDE) strip $(OUTDIR)/libkuzzle-wrapper-java.so @@ -78,6 +90,10 @@ python_object: $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-python.so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(PYTHONINCLUDE) strip $(OUTDIR)/libkuzzle-wrapper-python.so +csharp_object: + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-csharp.so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) + strip $(OUTDIR)/libkuzzle-wrapper-csharp.so + swig: mkdir -p $(OUTDIR) $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i @@ -90,6 +106,10 @@ swig_python: mkdir -p $(OUTDIR) $(SWIG) -Wall -c++ -python -py3 -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(PYTHONINCLUDE) templates/python/core.i +swig_csharp: + mkdir -p $(OUTDIR) + $(SWIG) -Wall -c++ -csharp -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i + makedir: mkdir -p $(OUTDIR) @@ -109,11 +129,9 @@ java: makedir core_java swig_java wrapper_java java_object cp -p $(GOTARGETSO) $(OUTDIR) csharp: OUTDIR = $(ROOTOUTDIR)/csharp -csharp: LANGUAGE = csharp -csharp: SWIGOPTS = -dllimport kuzzlesdk $(OBJS) -csharp: core swig wrapper object posttask makedir - mcs -t:library $(OUTDIR)/*.cs -out:$(OUTDIR)/libkuzzle-csharp.so - rm -f $(OUTDIR)/*.cs +csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object + mcs -t:library $(OUTDIR)/*.cs -out:$(OUTDIR)/libkuzzle-csharp.dll + #rm -f $(OUTDIR)/*.cs python: LANGINCLUDE = $(PYTHONINCLUDE) python: OUTDIR = $(ROOTOUTDIR)/python @@ -135,7 +153,7 @@ cpp: core g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build/c build/java/src build/java/io build/java/build kcore_wrap.cxx kcore_wrap.h + rm -rf build/c build/java/src build/java/io build/java/build kcore_wrap.cxx kcore_wrap.h build/csharp build/python rm -rf build/io .PHONY: all java csharp python wrapper swig clean object core diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 7492c868..4bf897c8 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -704,25 +704,6 @@ func kuzzle_free_specification_search_result(st *C.specification_search_result) } } -//export kuzzle_free_mapping -func kuzzle_free_mapping(st *C.mapping) { - if st != nil { - C.free(unsafe.Pointer(st.mapping)) - kuzzle_free_collection(st.collection) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_mapping_result -func kuzzle_free_mapping_result(st *C.mapping_result) { - if st != nil { - kuzzle_free_mapping(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - //export kuzzle_free_error_result func kuzzle_free_error_result(st *C.error_result) { if st != nil { diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index 880ee0d8..b97fb4b1 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -95,11 +95,6 @@ func Set_search_result_error(s *C.search_result, err error) { setErr(&s.status, &s.error, &s.stack, err) } -// apply a types.KuzzleError on a search_result* C struct -func Set_mapping_result_error(s *C.mapping_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - // apply a types.KuzzleError on a all_statistics_result* C struct func Set_all_statistics_error(s *C.all_statistics_result, err error) { setErr(&s.status, &s.error, &s.stack, err) diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 40615298..1de605af 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -648,18 +648,6 @@ typedef struct specification_search_result { char *stack; } specification_search_result; -typedef struct { - char *mapping; - collection *collection; -} mapping; - -typedef struct mapping_result { - mapping *result; - int status; - char *error; - char *stack; -} mapping_result; - typedef struct { bool persisted; char* name; diff --git a/internal/wrappers/templates/csharp/core.i b/internal/wrappers/templates/csharp/core.i new file mode 100644 index 00000000..7782f0f2 --- /dev/null +++ b/internal/wrappers/templates/csharp/core.i @@ -0,0 +1,70 @@ +%rename(TokenValidity) token_validity; +%rename(AckResponse) ack_response; +%rename(queueTTL) queue_ttl; +%rename(Options, match="class") options; +%rename(QueryOptions) query_options; +%rename(JsonObject) json_object; +%rename(JsonResult) json_result; +%rename(LoginResult) login_result; +%rename(BoolResult) bool_result; +%rename(Statistics) statistics; +%rename(AllStatisticsResult) all_statistics_result; +%rename(StatisticsResult) statistics_result; +%rename(CollectionsList) collection_entry; +%rename(CollectionsListResult) collection_entry_result; +%rename(StringArrayResult) string_array_result; +%rename(KuzzleResponse) kuzzle_response; +%rename(KuzzleRequest) kuzzle_request; +%rename(ShardsResult) shards_result; +%rename(DateResult) date_result; +%rename(UserData) user_data; +%rename(User, match="class") user; +%rename(RoomOptions) room_options; +%rename(SearchFilters) search_filters; +%rename(SearchResult) search_result; +%rename(NotificationResult) notification_result; +%rename(NotificationContent) notification_content; +%rename(SubscribeToSelf) subscribe_to_self; +%rename(Mapping, match="class") mapping; + +%ignore *::error; +%ignore *::status; +%ignore *::stack; + +%feature("director") NotificationListener; +%feature("director") EventListener; +%feature("director") SubscribeListener; + +%{ +#include "kuzzle.cpp" +#include "collection.cpp" +#include "auth.cpp" +#include "index.cpp" +#include "server.cpp" +#include "document.cpp" +#include "realtime.cpp" + +#define SWIG_FILE_WITH_INIT +%} + +%include "stl.i" +%include "../../kcore.i" + +%extend options { + options() { + options *o = kuzzle_new_options(); + return o; + } + + ~options() { + free($self); + } +} + +%include "kuzzle.cpp" +%include "collection.cpp" +%include "document.cpp" +%include "realtime.cpp" +%include "auth.cpp" +%include "index.cpp" +%include "server.cpp" diff --git a/internal/wrappers/templates/csharp/test.cs b/internal/wrappers/templates/csharp/test.cs new file mode 100644 index 00000000..384b0880 --- /dev/null +++ b/internal/wrappers/templates/csharp/test.cs @@ -0,0 +1,10 @@ +using System; + +public class Example +{ + public static void Main() + { + Kuzzle k = new Kuzzle("localhost"); + Console.WriteLine(k.server.now()); + } +} \ No newline at end of file From 7fdf4506c30654ed6370a4f695ed34b608b7c21e Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 17:15:28 +0200 Subject: [PATCH 186/363] update readme --- README.md | 7 +++++++ internal/wrappers/Makefile | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 67d6b458..22baf685 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,13 @@ make python ``` You will find the final .so file in `internal/wrappers/build/python` +## CSHARP + +```sh +make csharp +``` +You will find the final .dll file in `internal/wrappers/build/csharp` + ## All at once You can generate all sdk's at once by typing diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index ad1c5888..e39b4cbc 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -38,7 +38,7 @@ CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) SWIG = swig -all: python java cshqrp +all: python java csharp kcore_wrap.o: kcore_wrap.cxx $(CPP) -c $< -o $@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) @@ -131,7 +131,7 @@ java: makedir core_java swig_java wrapper_java java_object csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object mcs -t:library $(OUTDIR)/*.cs -out:$(OUTDIR)/libkuzzle-csharp.dll - #rm -f $(OUTDIR)/*.cs + rm -f $(OUTDIR)/*.cs python: LANGINCLUDE = $(PYTHONINCLUDE) python: OUTDIR = $(ROOTOUTDIR)/python From 0e7c0d53f69025a69747b17095b4a1cc27369ebc Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 17:24:16 +0200 Subject: [PATCH 187/363] add mono-mcs dependency --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96fa8d68..9e3892f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ go: - 1.9 dist: trusty install: - - sudo apt-get install -y build-essential swig oracle-java8-installer g++ python3-dev + - sudo apt-get install -y build-essential swig oracle-java8-installer g++ python3-dev mono-mcs - go get -t -v ./... script: - bash ./test.sh From e93b96381bd5b9bcd8140363788042f54c84cd97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Thu, 31 May 2018 17:42:53 +0200 Subject: [PATCH 188/363] Remove pointer type on KuzzleError (#153) * remove pointers type on KuzzleError --- auth/checkToken.go | 2 +- auth/checkToken_test.go | 3 +-- auth/createMyCredentials.go | 2 +- auth/createMyCredentials_test.go | 4 ++-- auth/credentialsExist.go | 2 +- auth/credentialsExist_test.go | 2 +- auth/deleteMyCredentials.go | 6 +++++- auth/deleteMyCredentials_test.go | 4 ++-- auth/getCurrentUser.go | 2 +- auth/getCurrentUser_test.go | 2 +- auth/getMyCredentials.go | 3 +-- auth/getMyCredentials_test.go | 2 +- auth/getMyRights.go | 2 +- auth/getMyRights_test.go | 2 +- auth/getStrategies.go | 2 +- auth/getStrategies_test.go | 2 +- auth/login.go | 2 +- auth/login_test.go | 2 +- auth/logout.go | 2 +- auth/logout_test.go | 2 +- auth/update_my_credentials.go | 2 +- auth/update_my_credentials_test.go | 4 ++-- auth/update_self.go | 2 +- auth/update_self_test.go | 2 +- auth/validate_my_credentials.go | 2 +- auth/validate_my_credentials_test.go | 2 +- collection/create.go | 4 ++++ collection/create_test.go | 2 +- collection/delete_specifications.go | 2 +- collection/delete_specifications_test.go | 2 +- collection/exists.go | 2 +- collection/exists_test.go | 2 +- collection/get_mapping.go | 2 +- collection/get_mapping_test.go | 2 +- collection/get_specifications.go | 2 +- collection/get_specifications_test.go | 2 +- collection/list.go | 2 +- collection/list_test.go | 2 +- collection/search_specifications.go | 2 +- collection/search_specifications_test.go | 2 +- collection/truncate.go | 2 +- collection/truncate_test.go | 2 +- collection/update_mapping.go | 2 +- collection/update_mapping_test.go | 2 +- collection/update_specifications.go | 2 +- collection/update_specifications_test.go | 2 +- collection/validate_specifications.go | 2 +- collection/validate_specifications_test.go | 2 +- connection/websocket/web_socket.go | 2 +- document/count.go | 2 +- document/count_test.go | 2 +- document/create.go | 2 +- document/createOrReplace.go | 2 +- document/createOrReplace_test.go | 2 +- document/create_test.go | 2 +- document/delete.go | 2 +- document/deleteByQuery.go | 2 +- document/deleteByQuery_test.go | 2 +- document/delete_test.go | 2 +- document/exists.go | 2 +- document/exists_test.go | 2 +- document/get.go | 2 +- document/get_test.go | 2 +- document/mCreate.go | 2 +- document/mCreateOrReplace.go | 2 +- document/mCreateOrReplace_test.go | 2 +- document/mCreate_test.go | 2 +- document/mDelete.go | 2 +- document/mDelete_test.go | 2 +- document/mGet.go | 2 +- document/mGet_test.go | 2 +- document/mReplace.go | 2 +- document/mReplace_test.go | 2 +- document/mUpdate.go | 2 +- document/mUpdate_test.go | 2 +- document/replace.go | 2 +- document/replace_test.go | 2 +- document/search.go | 2 +- document/search_test.go | 2 +- document/update.go | 2 +- document/update_test.go | 2 +- document/validate.go | 2 +- document/validate_test.go | 2 +- index/create.go | 2 +- index/create_test.go | 2 +- index/delete.go | 2 +- index/delete_test.go | 2 +- index/exists.go | 2 +- index/exists_test.go | 2 +- index/getAutoRefresh.go | 2 +- index/getAutoRefresh_test.go | 2 +- index/list.go | 2 +- index/list_test.go | 2 +- index/mDelete.go | 2 +- index/mDelete_test.go | 2 +- index/refresh.go | 5 ++++- index/refreshInternal.go | 3 +-- index/refreshInternal_test.go | 4 ++-- index/refresh_test.go | 4 ++-- index/setAutoRefresh.go | 2 +- index/setAutoRefresh_test.go | 2 +- internal/wrappers/cgo/kuzzle/errors.go | 2 +- internal/wrappers/cgo/kuzzle/go_to_c.go | 4 ++-- internal/wrappers/cgo/kuzzle/memory_storage.go | 2 +- kuzzle/kuzzle_test.go | 2 +- ms/append.go | 2 +- ms/append_test.go | 2 +- ms/bitcount.go | 2 +- ms/bitcount_test.go | 2 +- ms/bitop.go | 2 +- ms/bitop_test.go | 2 +- ms/bitpos.go | 2 +- ms/bitpos_test.go | 2 +- ms/dbsize.go | 2 +- ms/dbsize_test.go | 2 +- ms/decr.go | 2 +- ms/decr_test.go | 2 +- ms/decrby.go | 2 +- ms/decrby_test.go | 2 +- ms/del.go | 2 +- ms/del_test.go | 2 +- ms/exists.go | 2 +- ms/exists_test.go | 2 +- ms/expire.go | 2 +- ms/expire_test.go | 2 +- ms/expireat.go | 2 +- ms/expireat_test.go | 2 +- ms/flushdb.go | 6 +++++- ms/flushdb_test.go | 5 +++-- ms/geoadd.go | 2 +- ms/geoadd_test.go | 2 +- ms/geodist.go | 2 +- ms/geodist_test.go | 2 +- ms/geohash.go | 2 +- ms/geohash_test.go | 2 +- ms/geopos.go | 2 +- ms/geopos_test.go | 2 +- ms/georadius.go | 2 +- ms/georadius_test.go | 2 +- ms/georadiusbymember.go | 2 +- ms/georadiusbymember_test.go | 2 +- ms/get.go | 2 +- ms/get_test.go | 2 +- ms/getbit.go | 2 +- ms/getbit_test.go | 2 +- ms/getrange.go | 2 +- ms/getrange_test.go | 2 +- ms/getset.go | 2 +- ms/getset_test.go | 2 +- ms/hdel.go | 2 +- ms/hdel_test.go | 2 +- ms/hexists.go | 2 +- ms/hexists_test.go | 2 +- ms/hget.go | 2 +- ms/hget_test.go | 2 +- ms/hgetall.go | 2 +- ms/hgetall_test.go | 2 +- ms/hincrby.go | 2 +- ms/hincrby_test.go | 2 +- ms/hincrbyfloat.go | 2 +- ms/hincrbyfloat_test.go | 2 +- ms/hkeys.go | 2 +- ms/hkeys_test.go | 2 +- ms/hlen.go | 2 +- ms/hlen_test.go | 2 +- ms/hmget.go | 2 +- ms/hmget_test.go | 2 +- ms/hmset.go | 5 ++++- ms/hmset_test.go | 5 +++-- ms/hscan.go | 2 +- ms/hscan_test.go | 2 +- ms/hset.go | 2 +- ms/hset_test.go | 2 +- ms/hsetnx.go | 2 +- ms/hsetnx_test.go | 2 +- ms/hstrlen.go | 2 +- ms/hstrlen_test.go | 2 +- ms/hvals.go | 2 +- ms/hvals_test.go | 2 +- ms/incr.go | 2 +- ms/incr_test.go | 2 +- ms/incrby.go | 2 +- ms/incrby_test.go | 2 +- ms/incrbyfloat.go | 2 +- ms/incrbyfloat_test.go | 2 +- ms/keys.go | 2 +- ms/keys_test.go | 2 +- ms/lindex.go | 2 +- ms/lindex_test.go | 2 +- ms/linsert.go | 2 +- ms/linsert_test.go | 2 +- ms/llen.go | 2 +- ms/llen_test.go | 2 +- ms/lpop.go | 2 +- ms/lpop_test.go | 2 +- ms/lpush.go | 2 +- ms/lpush_test.go | 2 +- ms/lpushx.go | 2 +- ms/lpushx_test.go | 2 +- ms/lrange.go | 2 +- ms/lrange_test.go | 2 +- ms/lrem.go | 2 +- ms/lrem_test.go | 2 +- ms/lset.go | 5 ++++- ms/lset_test.go | 5 +++-- ms/ltrim.go | 6 +++++- ms/ltrim_test.go | 5 +++-- ms/mget.go | 2 +- ms/mget_test.go | 2 +- ms/mset.go | 5 ++++- ms/mset_test.go | 5 +++-- ms/msetnx.go | 2 +- ms/msetnx_test.go | 2 +- ms/object.go | 2 +- ms/object_test.go | 2 +- ms/persist.go | 2 +- ms/persist_test.go | 2 +- ms/pexpire.go | 2 +- ms/pexpire_test.go | 2 +- ms/pexpireat.go | 2 +- ms/pexpireat_test.go | 2 +- ms/pfadd.go | 2 +- ms/pfadd_test.go | 2 +- ms/pfcount.go | 2 +- ms/pfcount_test.go | 2 +- ms/pfmerge.go | 5 ++++- ms/pfmerge_test.go | 5 +++-- ms/ping.go | 2 +- ms/ping_test.go | 2 +- ms/psetex.go | 5 ++++- ms/psetex_test.go | 5 +++-- ms/pttl.go | 2 +- ms/pttl_test.go | 2 +- ms/randomkey.go | 2 +- ms/randomkey_test.go | 2 +- ms/rename.go | 5 ++++- ms/rename_test.go | 5 +++-- ms/renamenx.go | 2 +- ms/renamenx_test.go | 2 +- ms/rpop.go | 2 +- ms/rpop_test.go | 2 +- ms/rpoplpush.go | 2 +- ms/rpoplpush_test.go | 2 +- ms/rpush.go | 2 +- ms/rpush_test.go | 2 +- ms/rpushx.go | 2 +- ms/rpushx_test.go | 2 +- ms/sadd.go | 2 +- ms/sadd_test.go | 2 +- ms/scan.go | 2 +- ms/scan_test.go | 2 +- ms/scard.go | 2 +- ms/scard_test.go | 2 +- ms/sdiff.go | 2 +- ms/sdiff_test.go | 2 +- ms/sdiffstore.go | 2 +- ms/sdiffstore_test.go | 2 +- ms/set.go | 5 ++++- ms/set_test.go | 5 +++-- ms/setex.go | 5 ++++- ms/setex_test.go | 5 +++-- ms/setnx.go | 2 +- ms/setnx_test.go | 2 +- ms/sinter.go | 2 +- ms/sinter_test.go | 2 +- ms/sinterstore.go | 2 +- ms/sinterstore_test.go | 2 +- ms/sismember.go | 2 +- ms/sismember_test.go | 2 +- ms/smembers.go | 2 +- ms/smembers_test.go | 2 +- ms/smove.go | 2 +- ms/smove_test.go | 2 +- ms/sort.go | 2 +- ms/sort_test.go | 2 +- ms/spop.go | 2 +- ms/spop_test.go | 2 +- ms/srandmember.go | 2 +- ms/srandmember_test.go | 2 +- ms/srem.go | 2 +- ms/srem_test.go | 2 +- ms/sscan.go | 2 +- ms/sscan_test.go | 2 +- ms/strlen.go | 2 +- ms/strlen_test.go | 2 +- ms/sunion.go | 2 +- ms/sunion_test.go | 2 +- ms/sunionstore.go | 2 +- ms/sunionstore_test.go | 2 +- ms/time.go | 2 +- ms/time_test.go | 2 +- ms/touch.go | 2 +- ms/touch_test.go | 2 +- ms/ttl.go | 2 +- ms/ttl_test.go | 2 +- ms/type.go | 2 +- ms/type_test.go | 2 +- ms/zadd.go | 2 +- ms/zadd_test.go | 2 +- ms/zcard.go | 2 +- ms/zcard_test.go | 2 +- ms/zcount.go | 2 +- ms/zcount_test.go | 2 +- ms/zincrby.go | 2 +- ms/zincrby_test.go | 2 +- ms/zinterstore.go | 2 +- ms/zinterstore_test.go | 2 +- ms/zlexcount.go | 2 +- ms/zlexcount_test.go | 2 +- ms/zrange.go | 2 +- ms/zrange_test.go | 2 +- ms/zrangebylex.go | 2 +- ms/zrangebylex_test.go | 2 +- ms/zrangebyscore.go | 2 +- ms/zrangebyscore_test.go | 2 +- ms/zrank.go | 2 +- ms/zrank_test.go | 2 +- ms/zrem.go | 2 +- ms/zrem_test.go | 2 +- ms/zremrangebylex.go | 2 +- ms/zremrangebylex_test.go | 2 +- ms/zremrangebyrank.go | 2 +- ms/zremrangebyrank_test.go | 2 +- ms/zremrangebyscore.go | 2 +- ms/zremrangebyscore_test.go | 2 +- ms/zrevrange.go | 2 +- ms/zrevrange_test.go | 2 +- ms/zrevrangebylex.go | 2 +- ms/zrevrangebylex_test.go | 2 +- ms/zrevrangebyscore.go | 2 +- ms/zrevrangebyscore_test.go | 2 +- ms/zrevrank.go | 2 +- ms/zrevrank_test.go | 2 +- ms/zscan.go | 2 +- ms/zscan_test.go | 2 +- ms/zscore.go | 2 +- ms/zscore_test.go | 2 +- ms/zunionstore.go | 2 +- ms/zunionstore_test.go | 2 +- realtime/count.go | 2 +- realtime/count_test.go | 2 +- realtime/join.go | 2 +- realtime/list.go | 2 +- realtime/list_test.go | 2 +- realtime/publish.go | 2 +- realtime/subscribe.go | 2 +- realtime/subscribe_test.go | 4 ++-- realtime/unsubscribe.go | 2 +- realtime/validate.go | 2 +- security/createCredentials.go | 2 +- security/createCredentials_test.go | 2 +- security/createFirstAdmin.go | 2 +- security/createFirstAdmin_test.go | 2 +- security/createOrReplaceProfile.go | 2 +- security/createOrReplaceProfile_test.go | 2 +- security/createOrReplaceRole.go | 2 +- security/createOrReplaceRole_test.go | 2 +- security/createProfile.go | 2 +- security/createProfile_test.go | 2 +- security/createRestrictedUser.go | 2 +- security/createRestrictedUser_test.go | 2 +- security/createRole.go | 2 +- security/createRole_test.go | 2 +- security/createUser.go | 2 +- security/createUser_test.go | 2 +- security/deleteCredentials.go | 2 +- security/deleteCredentials_test.go | 2 +- security/deleteProfile.go | 2 +- security/deleteProfile_test.go | 2 +- security/deleteRole.go | 2 +- security/deleteRole_test.go | 2 +- security/deleteUser.go | 2 +- security/deleteUser_test.go | 2 +- security/getAllCredentialFields.go | 2 +- security/getAllCredentialFields_test.go | 2 +- security/getCredentialFields.go | 2 +- security/getCredentialFields_test.go | 4 ++-- security/getCredentials.go | 2 +- security/getCredentialsById.go | 2 +- security/getCredentialsById_test.go | 2 +- security/getCredentials_test.go | 2 +- security/getProfile.go | 2 +- security/getProfileMapping.go | 2 +- security/getProfileMapping_test.go | 2 +- security/getProfileRights.go | 2 +- security/getProfileRights_test.go | 2 +- security/getRole.go | 2 +- security/getRoleMapping.go | 2 +- security/getRoleMapping_test.go | 2 +- security/getRole_test.go | 2 +- security/getUser.go | 2 +- security/getUserMapping.go | 2 +- security/getUserMapping_test.go | 2 +- security/getUserRights.go | 2 +- security/getUserRights_test.go | 2 +- security/hasCredentials.go | 2 +- security/hasCredentials_test.go | 2 +- security/mDeleteCredentials.go | 2 +- security/mDeleteCredentials_test.go | 2 +- security/mDeleteRoles.go | 2 +- security/mDeleteRoles_test.go | 2 +- security/mDeleteUsers.go | 2 +- security/mDeleteUsers_test.go | 2 +- security/mGetProfiles.go | 2 +- security/mGetRoles.go | 2 +- security/replaceUser.go | 2 +- security/replaceUser_test.go | 2 +- security/searchProfiles.go | 2 +- security/searchRoles.go | 2 +- security/searchRoles_test.go | 2 +- security/searchUsers.go | 2 +- security/updateCredentials.go | 2 +- security/updateCredentials_test.go | 6 +++--- security/updateProfile.go | 2 +- security/updateProfileMapping.go | 2 +- security/updateRole.go | 2 +- security/updateRoleMapping.go | 2 +- security/updateUser.go | 2 +- security/updateUserMapping.go | 2 +- security/validateCredentials.go | 2 +- security/validateCredentials_test.go | 6 +++--- server/adminExists.go | 2 +- server/adminExists_test.go | 2 +- server/getAllStats.go | 2 +- server/getAllStats_test.go | 2 +- server/getConfig.go | 2 +- server/getConfig_test.go | 2 +- server/getLastStats.go | 2 +- server/getLastStats_test.go | 2 +- server/getStats.go | 2 +- server/getStats_test.go | 2 +- server/info.go | 2 +- server/info_test.go | 2 +- server/now.go | 2 +- server/now_test.go | 2 +- types/kuzzle_response.go | 10 +++++----- 436 files changed, 514 insertions(+), 464 deletions(-) diff --git a/auth/checkToken.go b/auth/checkToken.go index 8c7db868..eaadf565 100644 --- a/auth/checkToken.go +++ b/auth/checkToken.go @@ -48,7 +48,7 @@ func (a *Auth) CheckToken(token string) (*TokenValidity, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go index 1f465760..037f00f2 100644 --- a/auth/checkToken_test.go +++ b/auth/checkToken_test.go @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - package auth_test import ( @@ -42,7 +41,7 @@ func TestCheckTokenQueryError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) _, err := k.Auth.CheckToken("token") assert.NotNil(t, err) - assert.Equal(t, 123, err.(*types.KuzzleError).Status) + assert.Equal(t, 123, err.(types.KuzzleError).Status) } func TestCheckToken(t *testing.T) { diff --git a/auth/createMyCredentials.go b/auth/createMyCredentials.go index cdb394f0..003ea06f 100644 --- a/auth/createMyCredentials.go +++ b/auth/createMyCredentials.go @@ -37,7 +37,7 @@ func (a *Auth) CreateMyCredentials(strategy string, credentials json.RawMessage, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/createMyCredentials_test.go b/auth/createMyCredentials_test.go index 8285ac4e..272219fd 100644 --- a/auth/createMyCredentials_test.go +++ b/auth/createMyCredentials_test.go @@ -33,7 +33,7 @@ func TestCreateMyCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "createMyCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestCreateMyCredentialsQueryError(t *testing.T) { func TestCreateMyCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/credentialsExist.go b/auth/credentialsExist.go index 57203459..c665ab52 100644 --- a/auth/credentialsExist.go +++ b/auth/credentialsExist.go @@ -36,7 +36,7 @@ func (a *Auth) CredentialsExist(strategy string, options types.QueryOptions) (bo res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/auth/credentialsExist_test.go b/auth/credentialsExist_test.go index 8bdbf354..3aef1184 100644 --- a/auth/credentialsExist_test.go +++ b/auth/credentialsExist_test.go @@ -41,7 +41,7 @@ func TestCredentialsExistQueryError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "credentialsExist", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/deleteMyCredentials.go b/auth/deleteMyCredentials.go index 2697d8cc..8136b55d 100644 --- a/auth/deleteMyCredentials.go +++ b/auth/deleteMyCredentials.go @@ -39,5 +39,9 @@ func (a *Auth) DeleteMyCredentials(strategy string, options types.QueryOptions) res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + + return nil } diff --git a/auth/deleteMyCredentials_test.go b/auth/deleteMyCredentials_test.go index d4b8d5d3..7315cbac 100644 --- a/auth/deleteMyCredentials_test.go +++ b/auth/deleteMyCredentials_test.go @@ -33,7 +33,7 @@ func TestDeleteMyCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "deleteMyCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestDeleteMyCredentialsQueryError(t *testing.T) { func TestDeleteMyCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/getCurrentUser.go b/auth/getCurrentUser.go index 51966638..a0e9027e 100644 --- a/auth/getCurrentUser.go +++ b/auth/getCurrentUser.go @@ -34,7 +34,7 @@ func (a *Auth) GetCurrentUser() (*security.User, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/getCurrentUser_test.go b/auth/getCurrentUser_test.go index e97ac068..4c079682 100644 --- a/auth/getCurrentUser_test.go +++ b/auth/getCurrentUser_test.go @@ -34,7 +34,7 @@ func TestGetCurrentUserQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "getCurrentUser", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/getMyCredentials.go b/auth/getMyCredentials.go index 0e66bc0a..955300ab 100644 --- a/auth/getMyCredentials.go +++ b/auth/getMyCredentials.go @@ -37,9 +37,8 @@ func (a *Auth) GetMyCredentials(strategy string, options types.QueryOptions) (js res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } - return res.Result, nil } diff --git a/auth/getMyCredentials_test.go b/auth/getMyCredentials_test.go index ecf33ddb..2d65f283 100644 --- a/auth/getMyCredentials_test.go +++ b/auth/getMyCredentials_test.go @@ -34,7 +34,7 @@ func TestGetMyCredentialsQueryError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "getMyCredentials", request.Action) assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/getMyRights.go b/auth/getMyRights.go index e2847c30..59f3abb3 100644 --- a/auth/getMyRights.go +++ b/auth/getMyRights.go @@ -37,7 +37,7 @@ func (a *Auth) GetMyRights(options types.QueryOptions) ([]*types.UserRights, err res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/getMyRights_test.go b/auth/getMyRights_test.go index 97cedff7..54ae9a64 100644 --- a/auth/getMyRights_test.go +++ b/auth/getMyRights_test.go @@ -34,7 +34,7 @@ func TestGetMyRightsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "getMyRights", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/getStrategies.go b/auth/getStrategies.go index a58fee21..8cc24ef0 100644 --- a/auth/getStrategies.go +++ b/auth/getStrategies.go @@ -32,7 +32,7 @@ func (a *Auth) GetStrategies(options types.QueryOptions) ([]string, error) { res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/getStrategies_test.go b/auth/getStrategies_test.go index d7d56453..2f2b815f 100644 --- a/auth/getStrategies_test.go +++ b/auth/getStrategies_test.go @@ -33,7 +33,7 @@ func TestGetStrategiesError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "getStrategies", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/login.go b/auth/login.go index 49f1469f..9b907a32 100644 --- a/auth/login.go +++ b/auth/login.go @@ -58,7 +58,7 @@ func (a *Auth) Login(strategy string, credentials json.RawMessage, expiresIn *in json.Unmarshal(res.Result, &token) - if res.Error != nil { + if res.Error.Error() != "" { a.kuzzle.EmitEvent(event.LoginAttempt, &types.LoginAttempt{Success: false, Error: res.Error}) return "", res.Error } diff --git a/auth/login_test.go b/auth/login_test.go index a906367a..06484eff 100644 --- a/auth/login_test.go +++ b/auth/login_test.go @@ -41,7 +41,7 @@ func TestLoginError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "login", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, MockEmitEvent: func(e int, arg interface{}) { assert.Equal(t, event.LoginAttempt, e) diff --git a/auth/logout.go b/auth/logout.go index 75bed61f..96e2f2a8 100644 --- a/auth/logout.go +++ b/auth/logout.go @@ -30,7 +30,7 @@ func (a *Auth) Logout() error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/auth/logout_test.go b/auth/logout_test.go index 743c1b29..ce11ffe5 100644 --- a/auth/logout_test.go +++ b/auth/logout_test.go @@ -34,7 +34,7 @@ func TestLogoutError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "logout", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } diff --git a/auth/update_my_credentials.go b/auth/update_my_credentials.go index ac6d761e..3827b278 100644 --- a/auth/update_my_credentials.go +++ b/auth/update_my_credentials.go @@ -38,7 +38,7 @@ func (a *Auth) UpdateMyCredentials(strategy string, credentials json.RawMessage, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/update_my_credentials_test.go b/auth/update_my_credentials_test.go index 3488238f..91671a7f 100644 --- a/auth/update_my_credentials_test.go +++ b/auth/update_my_credentials_test.go @@ -33,7 +33,7 @@ func TestUpdateMyCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "auth", request.Controller) assert.Equal(t, "updateMyCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestUpdateMyCredentialsQueryError(t *testing.T) { func TestUpdateMyCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/update_self.go b/auth/update_self.go index 2c45d0f2..0fddbfdd 100644 --- a/auth/update_self.go +++ b/auth/update_self.go @@ -38,7 +38,7 @@ func (a *Auth) UpdateSelf(data json.RawMessage, options types.QueryOptions) (*se res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/auth/update_self_test.go b/auth/update_self_test.go index ee9c918e..71891fc8 100644 --- a/auth/update_self_test.go +++ b/auth/update_self_test.go @@ -29,7 +29,7 @@ import ( func TestUpdateSelfQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/auth/validate_my_credentials.go b/auth/validate_my_credentials.go index 97774bb5..bc57ed67 100644 --- a/auth/validate_my_credentials.go +++ b/auth/validate_my_credentials.go @@ -35,7 +35,7 @@ func (a *Auth) ValidateMyCredentials(strategy string, credentials json.RawMessag res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/auth/validate_my_credentials_test.go b/auth/validate_my_credentials_test.go index 4c0a4cbb..7c6b5930 100644 --- a/auth/validate_my_credentials_test.go +++ b/auth/validate_my_credentials_test.go @@ -34,7 +34,7 @@ func TestValidateMyCredentialsQueryError(t *testing.T) { assert.Equal(t, "auth", request.Controller) assert.Equal(t, "validateMyCredentials", request.Action) assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/create.go b/collection/create.go index cccc8464..ea633ae0 100644 --- a/collection/create.go +++ b/collection/create.go @@ -40,5 +40,9 @@ func (dc *Collection) Create(index string, collection string, options types.Quer res := <-ch + if res.Error.Error() == "" { + return nil + } + return res.Error } diff --git a/collection/create_test.go b/collection/create_test.go index b1e21012..b57f31be 100644 --- a/collection/create_test.go +++ b/collection/create_test.go @@ -50,7 +50,7 @@ func TestCreateError(t *testing.T) { nc := collection.NewCollection(k) err := nc.Create("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestCreate(t *testing.T) { diff --git a/collection/delete_specifications.go b/collection/delete_specifications.go index 7ea8b01e..acc4e58f 100644 --- a/collection/delete_specifications.go +++ b/collection/delete_specifications.go @@ -38,7 +38,7 @@ func (dc *Collection) DeleteSpecifications(index string, collection string, opti res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/collection/delete_specifications_test.go b/collection/delete_specifications_test.go index 16aa09e1..2cade018 100644 --- a/collection/delete_specifications_test.go +++ b/collection/delete_specifications_test.go @@ -50,7 +50,7 @@ func TestDeleteSpecificationsError(t *testing.T) { nc := collection.NewCollection(k) err := nc.DeleteSpecifications("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestDeleteSpecifications(t *testing.T) { diff --git a/collection/exists.go b/collection/exists.go index 933eba45..d6f2c0c5 100644 --- a/collection/exists.go +++ b/collection/exists.go @@ -43,7 +43,7 @@ func (dc *Collection) Exists(index string, collection string, options types.Quer res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/collection/exists_test.go b/collection/exists_test.go index cbd7bd5a..0fbc1ac8 100644 --- a/collection/exists_test.go +++ b/collection/exists_test.go @@ -50,7 +50,7 @@ func TestExistsError(t *testing.T) { nc := collection.NewCollection(k) _, err := nc.Exists("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestExists(t *testing.T) { diff --git a/collection/get_mapping.go b/collection/get_mapping.go index 5994ec53..a48ea342 100644 --- a/collection/get_mapping.go +++ b/collection/get_mapping.go @@ -42,7 +42,7 @@ func (dc *Collection) GetMapping(index string, collection string, options types. res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/get_mapping_test.go b/collection/get_mapping_test.go index 46f2e0ef..be0b0e85 100644 --- a/collection/get_mapping_test.go +++ b/collection/get_mapping_test.go @@ -51,7 +51,7 @@ func TestGetMappingError(t *testing.T) { nc := collection.NewCollection(k) _, err := nc.GetMapping("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestGetMapping(t *testing.T) { diff --git a/collection/get_specifications.go b/collection/get_specifications.go index 5cc54e6f..fa6511f5 100644 --- a/collection/get_specifications.go +++ b/collection/get_specifications.go @@ -42,7 +42,7 @@ func (dc *Collection) GetSpecifications(index string, collection string, options res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/get_specifications_test.go b/collection/get_specifications_test.go index 863cbafa..d4e825e6 100644 --- a/collection/get_specifications_test.go +++ b/collection/get_specifications_test.go @@ -51,7 +51,7 @@ func TestGetSpecificationsError(t *testing.T) { nc := collection.NewCollection(k) _, err := nc.GetSpecifications("index", "collection", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestGetSpecifications(t *testing.T) { diff --git a/collection/list.go b/collection/list.go index 35307553..f06af938 100644 --- a/collection/list.go +++ b/collection/list.go @@ -38,7 +38,7 @@ func (dc *Collection) List(index string, options types.QueryOptions) (json.RawMe res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/list_test.go b/collection/list_test.go index fda61153..c6257647 100644 --- a/collection/list_test.go +++ b/collection/list_test.go @@ -46,7 +46,7 @@ func TestListError(t *testing.T) { _, err := nc.List("index", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestList(t *testing.T) { diff --git a/collection/search_specifications.go b/collection/search_specifications.go index 3a6a672c..3cae4a56 100644 --- a/collection/search_specifications.go +++ b/collection/search_specifications.go @@ -33,7 +33,7 @@ func (dc *Collection) SearchSpecifications(options types.QueryOptions) (*types.S res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go index b7cd70aa..f7bbced2 100644 --- a/collection/search_specifications_test.go +++ b/collection/search_specifications_test.go @@ -29,7 +29,7 @@ import ( func TestSearchSpecificationsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/truncate.go b/collection/truncate.go index 4e7d075c..dc0d687b 100644 --- a/collection/truncate.go +++ b/collection/truncate.go @@ -40,7 +40,7 @@ func (dc *Collection) Truncate(index string, collection string, options types.Qu res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/collection/truncate_test.go b/collection/truncate_test.go index 394e0855..31c86f7c 100644 --- a/collection/truncate_test.go +++ b/collection/truncate_test.go @@ -44,7 +44,7 @@ func TestTruncateCollectionNull(t *testing.T) { func TestTruncateError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/update_mapping.go b/collection/update_mapping.go index 7f24a5d3..ef3b4f36 100644 --- a/collection/update_mapping.go +++ b/collection/update_mapping.go @@ -47,7 +47,7 @@ func (dc *Collection) UpdateMapping(index string, collection string, body json.R res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/collection/update_mapping_test.go b/collection/update_mapping_test.go index 3ab797af..9d3134f2 100644 --- a/collection/update_mapping_test.go +++ b/collection/update_mapping_test.go @@ -52,7 +52,7 @@ func TestUpdateMappingBodyNull(t *testing.T) { func TestUpdateMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/update_specifications.go b/collection/update_specifications.go index 67b63f57..4164a560 100644 --- a/collection/update_specifications.go +++ b/collection/update_specifications.go @@ -47,7 +47,7 @@ func (dc *Collection) UpdateSpecifications(index string, collection string, body res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/collection/update_specifications_test.go b/collection/update_specifications_test.go index 2743ec58..3145f111 100644 --- a/collection/update_specifications_test.go +++ b/collection/update_specifications_test.go @@ -50,7 +50,7 @@ func TestUpdateSpecificationsBodyNull(t *testing.T) { func TestUpdateSpecificationsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go index 7d6a87b1..b524d203 100644 --- a/collection/validate_specifications.go +++ b/collection/validate_specifications.go @@ -38,7 +38,7 @@ func (dc *Collection) ValidateSpecifications(body json.RawMessage, options types res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index 22fe35b3..f299613f 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -38,7 +38,7 @@ func TestValidateSpecificationsBodyNull(t *testing.T) { func TestValidateSpecificationsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/connection/websocket/web_socket.go b/connection/websocket/web_socket.go index 35ab3f80..81a72ec6 100644 --- a/connection/websocket/web_socket.go +++ b/connection/websocket/web_socket.go @@ -348,7 +348,7 @@ func (ws *webSocket) listen() { } } else if c, found := ws.channelsResult.Load(message.RequestId); found { - if message.Error != nil && message.Error.Message == "Token expired" { + if message.Error.Error() != "" && message.Error.Message == "Token expired" { ws.EmitEvent(event.TokenExpired, nil) } diff --git a/document/count.go b/document/count.go index 9333595b..4f799a1c 100644 --- a/document/count.go +++ b/document/count.go @@ -51,7 +51,7 @@ func (d *Document) Count(index string, collection string, body json.RawMessage, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/document/count_test.go b/document/count_test.go index 93fae122..e84a21e2 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -56,7 +56,7 @@ func TestCountDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Count("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestCountDocument(t *testing.T) { diff --git a/document/create.go b/document/create.go index 292479ea..56d4497d 100644 --- a/document/create.go +++ b/document/create.go @@ -56,7 +56,7 @@ func (d *Document) Create(index string, collection string, id string, body json. res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/createOrReplace.go b/document/createOrReplace.go index 07dcff6b..68577d4b 100644 --- a/document/createOrReplace.go +++ b/document/createOrReplace.go @@ -60,7 +60,7 @@ func (d *Document) CreateOrReplace(index string, collection string, _id string, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/createOrReplace_test.go b/document/createOrReplace_test.go index db7b1f2a..9032180c 100644 --- a/document/createOrReplace_test.go +++ b/document/createOrReplace_test.go @@ -63,7 +63,7 @@ func TestCreateOrReplaceDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.CreateOrReplace("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestCreateOrReplaceDocument(t *testing.T) { diff --git a/document/create_test.go b/document/create_test.go index d4ec5f0d..c62b887e 100644 --- a/document/create_test.go +++ b/document/create_test.go @@ -56,7 +56,7 @@ func TestCreateDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Create("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestCreateDocument(t *testing.T) { diff --git a/document/delete.go b/document/delete.go index ad5cf25a..3a96d483 100644 --- a/document/delete.go +++ b/document/delete.go @@ -48,7 +48,7 @@ func (d *Document) Delete(index string, collection string, _id string, options t res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go index f6c81973..536fba22 100644 --- a/document/deleteByQuery.go +++ b/document/deleteByQuery.go @@ -48,7 +48,7 @@ func (d *Document) DeleteByQuery(index string, collection string, body string, o res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/document/deleteByQuery_test.go b/document/deleteByQuery_test.go index 66341bcb..8779e673 100644 --- a/document/deleteByQuery_test.go +++ b/document/deleteByQuery_test.go @@ -60,7 +60,7 @@ func TestDeleteByQueryDocumentError(t *testing.T) { _, err := d.DeleteByQuery("index", "collection", "body", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestDeleteByQueryDocument(t *testing.T) { diff --git a/document/delete_test.go b/document/delete_test.go index 85c6b48c..7657933d 100644 --- a/document/delete_test.go +++ b/document/delete_test.go @@ -56,7 +56,7 @@ func TestDeleteDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Delete("index", "collection", "id1", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestDeleteDocument(t *testing.T) { diff --git a/document/exists.go b/document/exists.go index d9a88ab4..0d63db82 100644 --- a/document/exists.go +++ b/document/exists.go @@ -48,7 +48,7 @@ func (d *Document) Exists(index string, collection string, _id string, options t res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/document/exists_test.go b/document/exists_test.go index b90bed5e..5ac25827 100644 --- a/document/exists_test.go +++ b/document/exists_test.go @@ -56,7 +56,7 @@ func TestExistsDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Exists("index", "collection", "id1", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestExistsDocument(t *testing.T) { diff --git a/document/get.go b/document/get.go index 161e8552..1cd4fd90 100644 --- a/document/get.go +++ b/document/get.go @@ -48,7 +48,7 @@ func (d *Document) Get(index string, collection string, _id string, options type res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/get_test.go b/document/get_test.go index 4e6a03d4..c70a0771 100644 --- a/document/get_test.go +++ b/document/get_test.go @@ -56,7 +56,7 @@ func TestGetDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Get("index", "collection", "id1", nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestGetDocument(t *testing.T) { diff --git a/document/mCreate.go b/document/mCreate.go index 0412c4c8..03759d88 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -48,7 +48,7 @@ func (d *Document) MCreate(index string, collection string, body json.RawMessage res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index 7a262054..28a78c87 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -48,7 +48,7 @@ func (d *Document) MCreateOrReplace(index string, collection string, body json.R res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index 9a6a3377..61aa8fe8 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -60,7 +60,7 @@ func TestMCreateOrReplaceDocumentError(t *testing.T) { _, err := d.MCreateOrReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMCreateOrReplaceDocument(t *testing.T) { diff --git a/document/mCreate_test.go b/document/mCreate_test.go index d2ca06d0..7357dc2c 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -60,7 +60,7 @@ func TestMCreateDocumentError(t *testing.T) { _, err := d.MCreate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMCreateDocument(t *testing.T) { diff --git a/document/mDelete.go b/document/mDelete.go index 5ff59bf0..bc8fdeac 100644 --- a/document/mDelete.go +++ b/document/mDelete.go @@ -48,7 +48,7 @@ func (d *Document) MDelete(index string, collection string, ids []string, option res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/document/mDelete_test.go b/document/mDelete_test.go index b4399c17..5f7f4a37 100644 --- a/document/mDelete_test.go +++ b/document/mDelete_test.go @@ -67,7 +67,7 @@ func TestMDeleteDocumentError(t *testing.T) { ids = append(ids, "id1") _, err := d.MDelete("index", "collection", ids, nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMDeleteDocument(t *testing.T) { diff --git a/document/mGet.go b/document/mGet.go index ec4dcd67..b6619217 100644 --- a/document/mGet.go +++ b/document/mGet.go @@ -53,7 +53,7 @@ func (d *Document) MGet(index string, collection string, ids []string, includeTr res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mGet_test.go b/document/mGet_test.go index 254e98d6..2ea63f34 100644 --- a/document/mGet_test.go +++ b/document/mGet_test.go @@ -63,7 +63,7 @@ func TestMGetDocumentError(t *testing.T) { ids = append(ids, "id1") _, err := d.MGet("index", "collection", ids, true, nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMGetDocument(t *testing.T) { diff --git a/document/mReplace.go b/document/mReplace.go index 586b5bea..d3718b64 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -48,7 +48,7 @@ func (d *Document) MReplace(index string, collection string, body json.RawMessag res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mReplace_test.go b/document/mReplace_test.go index 8f322e2a..d5fc2bae 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -60,7 +60,7 @@ func TestMReplaceDocumentError(t *testing.T) { _, err := d.MReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMReplaceDocument(t *testing.T) { diff --git a/document/mUpdate.go b/document/mUpdate.go index 8ca4a26f..8a567bb5 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -48,7 +48,7 @@ func (d *Document) MUpdate(index string, collection string, body json.RawMessage res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index c8e2bb54..944fd826 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -60,7 +60,7 @@ func TestMUpdateDocumentError(t *testing.T) { _, err := d.MUpdate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestMUpdateDocument(t *testing.T) { diff --git a/document/replace.go b/document/replace.go index 0cc297bb..6cbdddd9 100644 --- a/document/replace.go +++ b/document/replace.go @@ -53,7 +53,7 @@ func (d *Document) Replace(index string, collection string, _id string, body jso res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/replace_test.go b/document/replace_test.go index 5a113a4f..a0986802 100644 --- a/document/replace_test.go +++ b/document/replace_test.go @@ -68,7 +68,7 @@ func TestReplaceDocumentError(t *testing.T) { _, err := d.Replace("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestReplaceDocument(t *testing.T) { diff --git a/document/search.go b/document/search.go index 8487ff37..827c60ac 100644 --- a/document/search.go +++ b/document/search.go @@ -48,7 +48,7 @@ func (d *Document) Search(index string, collection string, body json.RawMessage, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/document/search_test.go b/document/search_test.go index eb6cc447..dc2c3cfe 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -60,7 +60,7 @@ func TestSearchDocumentError(t *testing.T) { _, err := d.Search("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestSearchDocument(t *testing.T) { diff --git a/document/update.go b/document/update.go index 1f8cb349..0d5cc1f1 100644 --- a/document/update.go +++ b/document/update.go @@ -53,7 +53,7 @@ func (d *Document) Update(index string, collection string, id string, body json. res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/document/update_test.go b/document/update_test.go index 97148d54..3e66559b 100644 --- a/document/update_test.go +++ b/document/update_test.go @@ -68,7 +68,7 @@ func TestUpdateDocumentError(t *testing.T) { _, err := d.Update("index", "collection", "id1", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestUpdateDocument(t *testing.T) { diff --git a/document/validate.go b/document/validate.go index 662f5104..13c84019 100644 --- a/document/validate.go +++ b/document/validate.go @@ -48,7 +48,7 @@ func (d *Document) Validate(index string, collection string, body json.RawMessag res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/document/validate_test.go b/document/validate_test.go index 1ca00457..ddaface1 100644 --- a/document/validate_test.go +++ b/document/validate_test.go @@ -56,7 +56,7 @@ func TestValidateDocumentError(t *testing.T) { d := document.NewDocument(k) _, err := d.Validate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestValidateDocument(t *testing.T) { diff --git a/index/create.go b/index/create.go index c6114cda..cbd2245e 100644 --- a/index/create.go +++ b/index/create.go @@ -35,7 +35,7 @@ func (i *Index) Create(index string, options types.QueryOptions) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/index/create_test.go b/index/create_test.go index dd881b97..6501c4e8 100644 --- a/index/create_test.go +++ b/index/create_test.go @@ -37,7 +37,7 @@ func TestCreateNull(t *testing.T) { func TestCreateQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/delete.go b/index/delete.go index e06dc9dd..ef29ec08 100644 --- a/index/delete.go +++ b/index/delete.go @@ -33,7 +33,7 @@ func (i *Index) Delete(index string, options types.QueryOptions) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/index/delete_test.go b/index/delete_test.go index d36ee38e..54c8079e 100644 --- a/index/delete_test.go +++ b/index/delete_test.go @@ -37,7 +37,7 @@ func TestDeleteNull(t *testing.T) { func TestDeleteQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/exists.go b/index/exists.go index b61abead..16797714 100644 --- a/index/exists.go +++ b/index/exists.go @@ -39,7 +39,7 @@ func (i *Index) Exists(index string, options types.QueryOptions) (bool, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/index/exists_test.go b/index/exists_test.go index edca4a25..87f96636 100644 --- a/index/exists_test.go +++ b/index/exists_test.go @@ -37,7 +37,7 @@ func TestExistsNull(t *testing.T) { func TestExistsQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/getAutoRefresh.go b/index/getAutoRefresh.go index fee0ae9e..4afc079b 100644 --- a/index/getAutoRefresh.go +++ b/index/getAutoRefresh.go @@ -39,7 +39,7 @@ func (i *Index) GetAutoRefresh(index string, options types.QueryOptions) (bool, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/index/getAutoRefresh_test.go b/index/getAutoRefresh_test.go index 793ec953..b99f2121 100644 --- a/index/getAutoRefresh_test.go +++ b/index/getAutoRefresh_test.go @@ -37,7 +37,7 @@ func TestGetAutoRefreshNull(t *testing.T) { func TestGetAutoRefreshQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/list.go b/index/list.go index f4516a76..b5469907 100644 --- a/index/list.go +++ b/index/list.go @@ -34,7 +34,7 @@ func (i *Index) List(options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/index/list_test.go b/index/list_test.go index 16b115ed..da6bce85 100644 --- a/index/list_test.go +++ b/index/list_test.go @@ -37,7 +37,7 @@ func TestListError(t *testing.T) { i := index.NewIndex(k) _, err := i.List(nil) assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestList(t *testing.T) { diff --git a/index/mDelete.go b/index/mDelete.go index 0edeab75..6a3d0b86 100644 --- a/index/mDelete.go +++ b/index/mDelete.go @@ -38,7 +38,7 @@ func (i *Index) MDelete(indexes []string, options types.QueryOptions) ([]string, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/index/mDelete_test.go b/index/mDelete_test.go index fa69a345..d8fe7695 100644 --- a/index/mDelete_test.go +++ b/index/mDelete_test.go @@ -38,7 +38,7 @@ func TestMDeleteNull(t *testing.T) { func TestMDeleteQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/index/refresh.go b/index/refresh.go index 6bce1ba5..10b27071 100644 --- a/index/refresh.go +++ b/index/refresh.go @@ -35,5 +35,8 @@ func (i *Index) Refresh(index string, options types.QueryOptions) error { res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/index/refreshInternal.go b/index/refreshInternal.go index bd9df7a6..7f2089d6 100644 --- a/index/refreshInternal.go +++ b/index/refreshInternal.go @@ -30,9 +30,8 @@ func (i *Index) RefreshInternal(options types.QueryOptions) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } - return nil } diff --git a/index/refreshInternal_test.go b/index/refreshInternal_test.go index 34916d0b..82e1d98b 100644 --- a/index/refreshInternal_test.go +++ b/index/refreshInternal_test.go @@ -30,7 +30,7 @@ import ( func TestRefreshInternalQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -68,7 +68,7 @@ func ExampleIndex_RefreshInternal() { k, _ := kuzzle.NewKuzzle(conn, nil) i := index.NewIndex(k) err := i.RefreshInternal(nil) - if err != nil { + if err.Error() != "" { fmt.Println(err.Error()) return } diff --git a/index/refresh_test.go b/index/refresh_test.go index b48fc5d3..419bc82b 100644 --- a/index/refresh_test.go +++ b/index/refresh_test.go @@ -37,7 +37,7 @@ func TestRefreshNull(t *testing.T) { func TestRefreshQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -77,7 +77,7 @@ func ExampleIndex_Refresh() { i := index.NewIndex(k) i.Create("index", nil) err := i.Refresh("index", nil) - if err != nil { + if err.Error() != "" { fmt.Println(err.Error()) return } diff --git a/index/setAutoRefresh.go b/index/setAutoRefresh.go index 9537a1bd..977af516 100644 --- a/index/setAutoRefresh.go +++ b/index/setAutoRefresh.go @@ -37,7 +37,7 @@ func (i *Index) SetAutoRefresh(index string, autoRefresh bool, options types.Que res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/index/setAutoRefresh_test.go b/index/setAutoRefresh_test.go index 4b09edbc..7731dc4a 100644 --- a/index/setAutoRefresh_test.go +++ b/index/setAutoRefresh_test.go @@ -37,7 +37,7 @@ func TestSetAutoRefreshNull(t *testing.T) { func TestSetAutoRefreshQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go index 744564a8..880ee0d8 100644 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ b/internal/wrappers/cgo/kuzzle/errors.go @@ -174,7 +174,7 @@ func Set_room_result_error(s *C.room_result, err error) { } func setErr(status *C.int, error **C.char, stack **C.char, err error) { - kuzzleError := err.(*types.KuzzleError) + kuzzleError := err.(types.KuzzleError) *status = C.int(kuzzleError.Status) *error = C.CString(kuzzleError.Message) diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index bd27bb71..fe8413e4 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -85,7 +85,7 @@ func goToCNotificationContent(gNotifContent *types.NotificationResult) *C.notifi func goToCNotificationResult(gNotif *types.KuzzleNotification) *C.notification_result { result := (*C.notification_result)(C.calloc(1, C.sizeof_notification_result)) - if gNotif.Error != nil { + if gNotif.Error.Error() != "" { Set_notification_result_error(result, gNotif.Error) return result } @@ -127,7 +127,7 @@ func goToCKuzzleResponse(gRes *types.KuzzleResponse) *C.kuzzle_response { result.channel = C.CString(gRes.Channel) result.status = C.int(gRes.Status) - if gRes.Error != nil { + if gRes.Error.Error() != "" { // The error might be a partial error Set_kuzzle_response_error(result, gRes.Error) } diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go index a59a27d3..d2c51d11 100644 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ b/internal/wrappers/cgo/kuzzle/memory_storage.go @@ -197,7 +197,7 @@ func kuzzle_ms_geopos(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, SetQueryOptions(options)) if err != nil { - kuzzleError := err.(*types.KuzzleError) + kuzzleError := err.(types.KuzzleError) result.status = C.int(kuzzleError.Status) result.error = C.CString(kuzzleError.Message) diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index 8585c86b..1a4bf791 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -119,7 +119,7 @@ func TestSetDefaultIndex(t *testing.T) { request := types.KuzzleRequest{} json.Unmarshal(query, &request) assert.Equal(t, "myindex", request.Index) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/append.go b/ms/append.go index 06a9a6d1..8dc0b5cc 100755 --- a/ms/append.go +++ b/ms/append.go @@ -37,7 +37,7 @@ func (ms *Ms) Append(key string, value string, options types.QueryOptions) (int, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/append_test.go b/ms/append_test.go index 505f7f5e..9ca7bc7b 100755 --- a/ms/append_test.go +++ b/ms/append_test.go @@ -28,7 +28,7 @@ import ( func TestAppendError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/bitcount.go b/ms/bitcount.go index 3ed0c776..a8d45764 100755 --- a/ms/bitcount.go +++ b/ms/bitcount.go @@ -43,7 +43,7 @@ func (ms *Ms) Bitcount(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/bitcount_test.go b/ms/bitcount_test.go index 40ad0e21..a3d33247 100755 --- a/ms/bitcount_test.go +++ b/ms/bitcount_test.go @@ -28,7 +28,7 @@ import ( func TestBitcountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/bitop.go b/ms/bitop.go index ed5b6a97..19c4899e 100755 --- a/ms/bitop.go +++ b/ms/bitop.go @@ -38,7 +38,7 @@ func (ms *Ms) Bitop(key string, operation string, keys []string, options types.Q res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/bitop_test.go b/ms/bitop_test.go index 72220a2b..dbd544d8 100755 --- a/ms/bitop_test.go +++ b/ms/bitop_test.go @@ -28,7 +28,7 @@ import ( func TestBitopError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/bitpos.go b/ms/bitpos.go index 758d44a1..a060440f 100755 --- a/ms/bitpos.go +++ b/ms/bitpos.go @@ -44,7 +44,7 @@ func (ms *Ms) Bitpos(key string, bit int, options types.QueryOptions) (int, erro res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/bitpos_test.go b/ms/bitpos_test.go index 925c244b..b420dc5e 100755 --- a/ms/bitpos_test.go +++ b/ms/bitpos_test.go @@ -28,7 +28,7 @@ import ( func TestBitposError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/dbsize.go b/ms/dbsize.go index b101acc3..5bff76d9 100755 --- a/ms/dbsize.go +++ b/ms/dbsize.go @@ -31,7 +31,7 @@ func (ms *Ms) Dbsize(options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/dbsize_test.go b/ms/dbsize_test.go index ce38f98a..fd0e26e5 100755 --- a/ms/dbsize_test.go +++ b/ms/dbsize_test.go @@ -28,7 +28,7 @@ import ( func TestDbsizeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/decr.go b/ms/decr.go index 6edf534e..652202b3 100755 --- a/ms/decr.go +++ b/ms/decr.go @@ -33,7 +33,7 @@ func (ms *Ms) Decr(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/decr_test.go b/ms/decr_test.go index fe2bc794..355ebf0a 100755 --- a/ms/decr_test.go +++ b/ms/decr_test.go @@ -28,7 +28,7 @@ import ( func TestDecrError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/decrby.go b/ms/decrby.go index 3a88fb41..6c1d2fb1 100755 --- a/ms/decrby.go +++ b/ms/decrby.go @@ -38,7 +38,7 @@ func (ms *Ms) Decrby(key string, value int, options types.QueryOptions) (int, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/decrby_test.go b/ms/decrby_test.go index 88603fe8..263d21ab 100755 --- a/ms/decrby_test.go +++ b/ms/decrby_test.go @@ -28,7 +28,7 @@ import ( func TestDecrbyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/del.go b/ms/del.go index b3b3b808..6b325206 100755 --- a/ms/del.go +++ b/ms/del.go @@ -41,7 +41,7 @@ func (ms *Ms) Del(keys []string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/del_test.go b/ms/del_test.go index fd2bd8f0..41a1e219 100755 --- a/ms/del_test.go +++ b/ms/del_test.go @@ -36,7 +36,7 @@ func TestDelEmptyList(t *testing.T) { func TestDelError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/exists.go b/ms/exists.go index c082e54b..bf1b0aca 100755 --- a/ms/exists.go +++ b/ms/exists.go @@ -37,7 +37,7 @@ func (ms *Ms) Exists(keys []string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/exists_test.go b/ms/exists_test.go index d3f6150c..c56be0ba 100755 --- a/ms/exists_test.go +++ b/ms/exists_test.go @@ -28,7 +28,7 @@ import ( func TestExistsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/expire.go b/ms/expire.go index 1696ea9e..c38fd1c9 100755 --- a/ms/expire.go +++ b/ms/expire.go @@ -38,7 +38,7 @@ func (ms *Ms) Expire(key string, seconds int, options types.QueryOptions) (bool, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/expire_test.go b/ms/expire_test.go index 1cfff4cc..cf3b2bf8 100755 --- a/ms/expire_test.go +++ b/ms/expire_test.go @@ -28,7 +28,7 @@ import ( func TestExpireError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/expireat.go b/ms/expireat.go index a2e9ab9e..29cb23d9 100755 --- a/ms/expireat.go +++ b/ms/expireat.go @@ -38,7 +38,7 @@ func (ms *Ms) Expireat(key string, timestamp int, options types.QueryOptions) (b res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/expireat_test.go b/ms/expireat_test.go index 5b7c52cf..4741dc36 100755 --- a/ms/expireat_test.go +++ b/ms/expireat_test.go @@ -28,7 +28,7 @@ import ( func TestExpireatError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/flushdb.go b/ms/flushdb.go index 1f24f15d..d49ecb63 100755 --- a/ms/flushdb.go +++ b/ms/flushdb.go @@ -30,5 +30,9 @@ func (ms *Ms) Flushdb(options types.QueryOptions) error { res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + + return nil } diff --git a/ms/flushdb_test.go b/ms/flushdb_test.go index 8754ab9c..87c1d1eb 100755 --- a/ms/flushdb_test.go +++ b/ms/flushdb_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestFlushdbError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/geoadd.go b/ms/geoadd.go index c41f33c5..030bca97 100755 --- a/ms/geoadd.go +++ b/ms/geoadd.go @@ -37,7 +37,7 @@ func (ms *Ms) Geoadd(key string, points []*types.GeoPoint, options types.QueryOp res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/geoadd_test.go b/ms/geoadd_test.go index 897231a6..a829bc10 100755 --- a/ms/geoadd_test.go +++ b/ms/geoadd_test.go @@ -28,7 +28,7 @@ import ( func TestGeoaddError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/geodist.go b/ms/geodist.go index 57dfbd91..413c11e1 100755 --- a/ms/geodist.go +++ b/ms/geodist.go @@ -39,7 +39,7 @@ func (ms *Ms) Geodist(key string, member1 string, member2 string, options types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult float64 diff --git a/ms/geodist_test.go b/ms/geodist_test.go index ee0ec04c..a41db166 100755 --- a/ms/geodist_test.go +++ b/ms/geodist_test.go @@ -28,7 +28,7 @@ import ( func TestGeodistError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/geohash.go b/ms/geohash.go index 3a4f9b5b..eeced2d1 100755 --- a/ms/geohash.go +++ b/ms/geohash.go @@ -33,7 +33,7 @@ func (ms *Ms) Geohash(key string, members []string, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/geohash_test.go b/ms/geohash_test.go index 7a68c24e..a7b64193 100755 --- a/ms/geohash_test.go +++ b/ms/geohash_test.go @@ -28,7 +28,7 @@ import ( func TestGeohashError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/geopos.go b/ms/geopos.go index fefbec6d..c33d7c03 100755 --- a/ms/geopos.go +++ b/ms/geopos.go @@ -34,7 +34,7 @@ func (ms *Ms) Geopos(key string, members []string, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var stringResults [][]string diff --git a/ms/geopos_test.go b/ms/geopos_test.go index 1841b4b7..9713db74 100755 --- a/ms/geopos_test.go +++ b/ms/geopos_test.go @@ -28,7 +28,7 @@ import ( func TestGeoposError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/georadius.go b/ms/georadius.go index 6c2bbbd0..47f71a62 100755 --- a/ms/georadius.go +++ b/ms/georadius.go @@ -115,7 +115,7 @@ func (ms *Ms) Georadius(key string, lon float64, lat float64, distance float64, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/georadius_test.go b/ms/georadius_test.go index 5a135256..a81911b7 100755 --- a/ms/georadius_test.go +++ b/ms/georadius_test.go @@ -28,7 +28,7 @@ import ( func TestGeoradiusError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/georadiusbymember.go b/ms/georadiusbymember.go index 3d7d5104..8dca0d8e 100755 --- a/ms/georadiusbymember.go +++ b/ms/georadiusbymember.go @@ -37,7 +37,7 @@ func (ms *Ms) Georadiusbymember(key string, member string, distance float64, uni res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/georadiusbymember_test.go b/ms/georadiusbymember_test.go index 413dd46b..11b1652b 100755 --- a/ms/georadiusbymember_test.go +++ b/ms/georadiusbymember_test.go @@ -28,7 +28,7 @@ import ( func TestGeoradiusbymemberError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/get.go b/ms/get.go index a8ed00f1..c89658bb 100755 --- a/ms/get.go +++ b/ms/get.go @@ -33,7 +33,7 @@ func (ms *Ms) Get(key string, options types.QueryOptions) (*string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/get_test.go b/ms/get_test.go index 2ec3a2d6..7972cc34 100755 --- a/ms/get_test.go +++ b/ms/get_test.go @@ -28,7 +28,7 @@ import ( func TestGetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/getbit.go b/ms/getbit.go index 4b865e36..0e8cc4d0 100755 --- a/ms/getbit.go +++ b/ms/getbit.go @@ -34,7 +34,7 @@ func (ms *Ms) Getbit(key string, offset int, options types.QueryOptions) (int, e res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/ms/getbit_test.go b/ms/getbit_test.go index 8ceb14d0..91523e3c 100755 --- a/ms/getbit_test.go +++ b/ms/getbit_test.go @@ -28,7 +28,7 @@ import ( func TestGetbitError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/getrange.go b/ms/getrange.go index 7bcfc1c2..39fb3c21 100755 --- a/ms/getrange.go +++ b/ms/getrange.go @@ -35,7 +35,7 @@ func (ms *Ms) Getrange(key string, start int, end int, options types.QueryOption res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } var returnedResult string diff --git a/ms/getrange_test.go b/ms/getrange_test.go index e7668bd9..6385a97d 100755 --- a/ms/getrange_test.go +++ b/ms/getrange_test.go @@ -28,7 +28,7 @@ import ( func TestGetrangeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/getset.go b/ms/getset.go index badc03f4..cef1751d 100755 --- a/ms/getset.go +++ b/ms/getset.go @@ -37,7 +37,7 @@ func (ms *Ms) Getset(key string, value string, options types.QueryOptions) (*str res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/getset_test.go b/ms/getset_test.go index def70498..0004df14 100755 --- a/ms/getset_test.go +++ b/ms/getset_test.go @@ -28,7 +28,7 @@ import ( func TestGetsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hdel.go b/ms/hdel.go index 681c8659..8266f2cb 100755 --- a/ms/hdel.go +++ b/ms/hdel.go @@ -42,7 +42,7 @@ func (ms *Ms) Hdel(key string, fields []string, options types.QueryOptions) (int res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/ms/hdel_test.go b/ms/hdel_test.go index 88db905a..eb2c9471 100755 --- a/ms/hdel_test.go +++ b/ms/hdel_test.go @@ -36,7 +36,7 @@ func TestHdelEmptyFields(t *testing.T) { func TestHdelError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hexists.go b/ms/hexists.go index 50967349..1ef4d73c 100755 --- a/ms/hexists.go +++ b/ms/hexists.go @@ -34,7 +34,7 @@ func (ms *Ms) Hexists(key string, field string, options types.QueryOptions) (boo res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/hexists_test.go b/ms/hexists_test.go index 0e5da70c..02b17f1a 100755 --- a/ms/hexists_test.go +++ b/ms/hexists_test.go @@ -28,7 +28,7 @@ import ( func TestHexistsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hget.go b/ms/hget.go index f1492dd7..b0013d5e 100755 --- a/ms/hget.go +++ b/ms/hget.go @@ -34,7 +34,7 @@ func (ms *Ms) Hget(key string, field string, options types.QueryOptions) (*strin res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/hget_test.go b/ms/hget_test.go index 179e0b14..52e4c93d 100755 --- a/ms/hget_test.go +++ b/ms/hget_test.go @@ -28,7 +28,7 @@ import ( func TestHgetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hgetall.go b/ms/hgetall.go index 4dafc7af..fd547b40 100755 --- a/ms/hgetall.go +++ b/ms/hgetall.go @@ -33,7 +33,7 @@ func (ms *Ms) Hgetall(key string, options types.QueryOptions) (map[string]string res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } returnedResult := map[string]string{} diff --git a/ms/hgetall_test.go b/ms/hgetall_test.go index 7d55014c..8577dda8 100755 --- a/ms/hgetall_test.go +++ b/ms/hgetall_test.go @@ -28,7 +28,7 @@ import ( func TestHgetallError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hincrby.go b/ms/hincrby.go index 3a591de2..40f3b8d8 100755 --- a/ms/hincrby.go +++ b/ms/hincrby.go @@ -39,7 +39,7 @@ func (ms *Ms) Hincrby(key string, field string, value int, options types.QueryOp res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/hincrby_test.go b/ms/hincrby_test.go index 7b8837bb..3039cea9 100755 --- a/ms/hincrby_test.go +++ b/ms/hincrby_test.go @@ -28,7 +28,7 @@ import ( func TestHincrbyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hincrbyfloat.go b/ms/hincrbyfloat.go index 9cf36de3..d585c4f7 100755 --- a/ms/hincrbyfloat.go +++ b/ms/hincrbyfloat.go @@ -40,7 +40,7 @@ func (ms *Ms) Hincrbyfloat(key string, field string, value float64, options type res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/hincrbyfloat_test.go b/ms/hincrbyfloat_test.go index 69aaba56..7602bb1e 100755 --- a/ms/hincrbyfloat_test.go +++ b/ms/hincrbyfloat_test.go @@ -28,7 +28,7 @@ import ( func TestHincrbyfloatError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hkeys.go b/ms/hkeys.go index 54f885b2..ce50e32a 100755 --- a/ms/hkeys.go +++ b/ms/hkeys.go @@ -33,7 +33,7 @@ func (ms *Ms) Hkeys(key string, options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/hkeys_test.go b/ms/hkeys_test.go index 40654c7a..fc25d413 100755 --- a/ms/hkeys_test.go +++ b/ms/hkeys_test.go @@ -28,7 +28,7 @@ import ( func TestHkeysError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hlen.go b/ms/hlen.go index 0f8cbecf..7237aae1 100755 --- a/ms/hlen.go +++ b/ms/hlen.go @@ -33,7 +33,7 @@ func (ms *Ms) Hlen(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } var returnedResult int diff --git a/ms/hlen_test.go b/ms/hlen_test.go index 373e7006..83e40b3d 100755 --- a/ms/hlen_test.go +++ b/ms/hlen_test.go @@ -28,7 +28,7 @@ import ( func TestHlenError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hmget.go b/ms/hmget.go index 2dda4e11..5746b049 100755 --- a/ms/hmget.go +++ b/ms/hmget.go @@ -34,7 +34,7 @@ func (ms *Ms) Hmget(key string, fields []string, options types.QueryOptions) ([] res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/hmget_test.go b/ms/hmget_test.go index 0cd04c65..a1a4c594 100755 --- a/ms/hmget_test.go +++ b/ms/hmget_test.go @@ -28,7 +28,7 @@ import ( func TestHmgetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hmset.go b/ms/hmset.go index 651e150b..40bbd091 100755 --- a/ms/hmset.go +++ b/ms/hmset.go @@ -41,5 +41,8 @@ func (ms *Ms) Hmset(key string, entries []*types.MsHashField, options types.Quer res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/hmset_test.go b/ms/hmset_test.go index 444f8d50..b8567f7e 100755 --- a/ms/hmset_test.go +++ b/ms/hmset_test.go @@ -17,12 +17,13 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestHmsetEmptyEntries(t *testing.T) { @@ -37,7 +38,7 @@ func TestHmsetEmptyEntries(t *testing.T) { func TestHmsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hscan.go b/ms/hscan.go index 2ac46da8..7bd9edaf 100755 --- a/ms/hscan.go +++ b/ms/hscan.go @@ -50,7 +50,7 @@ func (ms *Ms) Hscan(key string, cursor int, options types.QueryOptions) (*HscanR res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/hscan_test.go b/ms/hscan_test.go index be3203f7..3b7b2014 100755 --- a/ms/hscan_test.go +++ b/ms/hscan_test.go @@ -29,7 +29,7 @@ import ( func TestHscanError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hset.go b/ms/hset.go index fe0dfc9a..fa2a7c00 100755 --- a/ms/hset.go +++ b/ms/hset.go @@ -40,7 +40,7 @@ func (ms *Ms) Hset(key string, field string, value string, options types.QueryOp res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/hset_test.go b/ms/hset_test.go index 9487e77a..7ff73874 100755 --- a/ms/hset_test.go +++ b/ms/hset_test.go @@ -28,7 +28,7 @@ import ( func TestHsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hsetnx.go b/ms/hsetnx.go index aa4bb0a9..a72d1852 100755 --- a/ms/hsetnx.go +++ b/ms/hsetnx.go @@ -39,7 +39,7 @@ func (ms *Ms) Hsetnx(key string, field string, value string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/hsetnx_test.go b/ms/hsetnx_test.go index 1e9ac11e..731d5e80 100755 --- a/ms/hsetnx_test.go +++ b/ms/hsetnx_test.go @@ -28,7 +28,7 @@ import ( func TestHsetnxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hstrlen.go b/ms/hstrlen.go index c80629a7..d6b25bc7 100755 --- a/ms/hstrlen.go +++ b/ms/hstrlen.go @@ -34,7 +34,7 @@ func (ms *Ms) Hstrlen(key string, field string, options types.QueryOptions) (int res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/ms/hstrlen_test.go b/ms/hstrlen_test.go index 5d2ca689..0025315d 100755 --- a/ms/hstrlen_test.go +++ b/ms/hstrlen_test.go @@ -28,7 +28,7 @@ import ( func TestHstrlenError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/hvals.go b/ms/hvals.go index b5d88592..5be35b49 100755 --- a/ms/hvals.go +++ b/ms/hvals.go @@ -33,7 +33,7 @@ func (ms *Ms) Hvals(key string, options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/hvals_test.go b/ms/hvals_test.go index c9a116f0..0540e15f 100755 --- a/ms/hvals_test.go +++ b/ms/hvals_test.go @@ -28,7 +28,7 @@ import ( func TestHvalsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/incr.go b/ms/incr.go index 67b78ecc..99073e1d 100755 --- a/ms/incr.go +++ b/ms/incr.go @@ -34,7 +34,7 @@ func (ms *Ms) Incr(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/incr_test.go b/ms/incr_test.go index 2de475ab..536f7295 100755 --- a/ms/incr_test.go +++ b/ms/incr_test.go @@ -28,7 +28,7 @@ import ( func TestIncrError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/incrby.go b/ms/incrby.go index 1b1900f1..eac9db96 100755 --- a/ms/incrby.go +++ b/ms/incrby.go @@ -39,7 +39,7 @@ func (ms *Ms) Incrby(key string, value int, options types.QueryOptions) (int, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/incrby_test.go b/ms/incrby_test.go index c44ca049..d3f39f8b 100755 --- a/ms/incrby_test.go +++ b/ms/incrby_test.go @@ -28,7 +28,7 @@ import ( func TestIncrbyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/incrbyfloat.go b/ms/incrbyfloat.go index d12ce6e6..53ab1a00 100755 --- a/ms/incrbyfloat.go +++ b/ms/incrbyfloat.go @@ -40,7 +40,7 @@ func (ms *Ms) Incrbyfloat(key string, value float64, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/incrbyfloat_test.go b/ms/incrbyfloat_test.go index f534469d..59a2c2f2 100755 --- a/ms/incrbyfloat_test.go +++ b/ms/incrbyfloat_test.go @@ -28,7 +28,7 @@ import ( func TestIncrbyfloatError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/keys.go b/ms/keys.go index 19a302e1..128b1dd5 100755 --- a/ms/keys.go +++ b/ms/keys.go @@ -33,7 +33,7 @@ func (ms *Ms) Keys(pattern string, options types.QueryOptions) ([]string, error) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/keys_test.go b/ms/keys_test.go index b58dc57e..56e2e0ce 100755 --- a/ms/keys_test.go +++ b/ms/keys_test.go @@ -28,7 +28,7 @@ import ( func TestKeysError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lindex.go b/ms/lindex.go index 8d2acaaa..0be52022 100755 --- a/ms/lindex.go +++ b/ms/lindex.go @@ -34,7 +34,7 @@ func (ms *Ms) Lindex(key string, index int, options types.QueryOptions) (*string res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/lindex_test.go b/ms/lindex_test.go index f1184808..284b2f53 100755 --- a/ms/lindex_test.go +++ b/ms/lindex_test.go @@ -28,7 +28,7 @@ import ( func TestLindexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/linsert.go b/ms/linsert.go index bb172953..42583304 100755 --- a/ms/linsert.go +++ b/ms/linsert.go @@ -44,7 +44,7 @@ func (ms *Ms) Linsert(key string, position string, pivot string, value string, o res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } var returnedResult int diff --git a/ms/linsert_test.go b/ms/linsert_test.go index 7cda3468..074c2daf 100755 --- a/ms/linsert_test.go +++ b/ms/linsert_test.go @@ -36,7 +36,7 @@ func TestLinsertInvalidPivot(t *testing.T) { func TestLinsertError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/llen.go b/ms/llen.go index 74bdfb08..bdde6bd5 100755 --- a/ms/llen.go +++ b/ms/llen.go @@ -33,7 +33,7 @@ func (ms *Ms) Llen(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/llen_test.go b/ms/llen_test.go index 1be8bcf7..8d1c1553 100755 --- a/ms/llen_test.go +++ b/ms/llen_test.go @@ -28,7 +28,7 @@ import ( func TestLlenError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lpop.go b/ms/lpop.go index 2065f3e8..bad1f3da 100755 --- a/ms/lpop.go +++ b/ms/lpop.go @@ -33,7 +33,7 @@ func (ms *Ms) Lpop(key string, options types.QueryOptions) (*string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/lpop_test.go b/ms/lpop_test.go index aabd06b0..90f825f0 100755 --- a/ms/lpop_test.go +++ b/ms/lpop_test.go @@ -28,7 +28,7 @@ import ( func TestLpopError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lpush.go b/ms/lpush.go index 294e3d98..4885f6f1 100755 --- a/ms/lpush.go +++ b/ms/lpush.go @@ -44,7 +44,7 @@ func (ms *Ms) Lpush(key string, values []string, options types.QueryOptions) (in res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/lpush_test.go b/ms/lpush_test.go index b0790234..251a681c 100755 --- a/ms/lpush_test.go +++ b/ms/lpush_test.go @@ -37,7 +37,7 @@ func TestLpushEmptyValues(t *testing.T) { func TestLpushError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lpushx.go b/ms/lpushx.go index c41b9213..08022838 100755 --- a/ms/lpushx.go +++ b/ms/lpushx.go @@ -39,7 +39,7 @@ func (ms *Ms) Lpushx(key string, value string, options types.QueryOptions) (int, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/lpushx_test.go b/ms/lpushx_test.go index d956f1a2..b2870245 100755 --- a/ms/lpushx_test.go +++ b/ms/lpushx_test.go @@ -28,7 +28,7 @@ import ( func TestLpushxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lrange.go b/ms/lrange.go index 46d325df..13c42713 100755 --- a/ms/lrange.go +++ b/ms/lrange.go @@ -35,7 +35,7 @@ func (ms *Ms) Lrange(key string, start int, stop int, options types.QueryOptions res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/lrange_test.go b/ms/lrange_test.go index 3cf74514..628ea131 100755 --- a/ms/lrange_test.go +++ b/ms/lrange_test.go @@ -28,7 +28,7 @@ import ( func TestLrangeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lrem.go b/ms/lrem.go index 3e34778b..6f1d31b3 100755 --- a/ms/lrem.go +++ b/ms/lrem.go @@ -39,7 +39,7 @@ func (ms *Ms) Lrem(key string, count int, value string, options types.QueryOptio res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/lrem_test.go b/ms/lrem_test.go index 96d86414..2db0ace7 100755 --- a/ms/lrem_test.go +++ b/ms/lrem_test.go @@ -28,7 +28,7 @@ import ( func TestLremError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/lset.go b/ms/lset.go index 1b3df115..e635ceea 100755 --- a/ms/lset.go +++ b/ms/lset.go @@ -38,5 +38,8 @@ func (ms *Ms) Lset(key string, index int, value string, options types.QueryOptio res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/lset_test.go b/ms/lset_test.go index 8c90088f..cfbd8b2a 100755 --- a/ms/lset_test.go +++ b/ms/lset_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestLsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/ltrim.go b/ms/ltrim.go index 7ad496cc..ffc0aeab 100755 --- a/ms/ltrim.go +++ b/ms/ltrim.go @@ -39,5 +39,9 @@ func (ms *Ms) Ltrim(key string, start int, stop int, options types.QueryOptions) res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + + return nil } diff --git a/ms/ltrim_test.go b/ms/ltrim_test.go index 3e7a3eb4..38fa93db 100755 --- a/ms/ltrim_test.go +++ b/ms/ltrim_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestLtrimError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/mget.go b/ms/mget.go index 0a1c80a0..aa789487 100755 --- a/ms/mget.go +++ b/ms/mget.go @@ -36,7 +36,7 @@ func (ms *Ms) Mget(keys []string, options types.QueryOptions) ([]*string, error) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []*string diff --git a/ms/mget_test.go b/ms/mget_test.go index b982ea5e..c6618c3f 100755 --- a/ms/mget_test.go +++ b/ms/mget_test.go @@ -37,7 +37,7 @@ func TestMgetEmptyKeys(t *testing.T) { func TestMgetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/mset.go b/ms/mset.go index 04f4ec2d..50674719 100755 --- a/ms/mset.go +++ b/ms/mset.go @@ -40,5 +40,8 @@ func (ms *Ms) Mset(entries []*types.MSKeyValue, options types.QueryOptions) erro res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/mset_test.go b/ms/mset_test.go index 07cbf491..5cb26e18 100755 --- a/ms/mset_test.go +++ b/ms/mset_test.go @@ -17,12 +17,13 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestMsetEmptyEntries(t *testing.T) { @@ -36,7 +37,7 @@ func TestMsetEmptyEntries(t *testing.T) { func TestMsetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/msetnx.go b/ms/msetnx.go index 7d9b43cb..202bb4de 100755 --- a/ms/msetnx.go +++ b/ms/msetnx.go @@ -41,7 +41,7 @@ func (ms *Ms) Msetnx(entries []*types.MSKeyValue, options types.QueryOptions) (b res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/msetnx_test.go b/ms/msetnx_test.go index 498d0a6b..92a3e9cb 100755 --- a/ms/msetnx_test.go +++ b/ms/msetnx_test.go @@ -37,7 +37,7 @@ func TestMsetnxEmptyEntries(t *testing.T) { func TestMsetnxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/object.go b/ms/object.go index 3bcf702b..3e62e576 100755 --- a/ms/object.go +++ b/ms/object.go @@ -37,7 +37,7 @@ func (ms *Ms) Object(key string, subcommand string, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/object_test.go b/ms/object_test.go index ddc30ec6..8bd3df0a 100755 --- a/ms/object_test.go +++ b/ms/object_test.go @@ -37,7 +37,7 @@ func TestObjectInvalidSubcommand(t *testing.T) { func TestObjectError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/persist.go b/ms/persist.go index 31aa39be..e2daca1d 100755 --- a/ms/persist.go +++ b/ms/persist.go @@ -32,7 +32,7 @@ func (ms *Ms) Persist(key string, options types.QueryOptions) (bool, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/persist_test.go b/ms/persist_test.go index 58135e59..3c254861 100755 --- a/ms/persist_test.go +++ b/ms/persist_test.go @@ -28,7 +28,7 @@ import ( func TestPersistError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pexpire.go b/ms/pexpire.go index 604763b5..b27fd443 100755 --- a/ms/pexpire.go +++ b/ms/pexpire.go @@ -38,7 +38,7 @@ func (ms *Ms) Pexpire(key string, ttl int, options types.QueryOptions) (bool, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/pexpire_test.go b/ms/pexpire_test.go index 2e6701a3..69dbf1a1 100755 --- a/ms/pexpire_test.go +++ b/ms/pexpire_test.go @@ -28,7 +28,7 @@ import ( func TestPexpireError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pexpireat.go b/ms/pexpireat.go index 06b9ad2a..77d27a72 100755 --- a/ms/pexpireat.go +++ b/ms/pexpireat.go @@ -39,7 +39,7 @@ func (ms *Ms) Pexpireat(key string, timestamp int, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/pexpireat_test.go b/ms/pexpireat_test.go index 80dcc547..4a90240e 100755 --- a/ms/pexpireat_test.go +++ b/ms/pexpireat_test.go @@ -28,7 +28,7 @@ import ( func TestPexpireatError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pfadd.go b/ms/pfadd.go index c3db6e02..c4a66a82 100755 --- a/ms/pfadd.go +++ b/ms/pfadd.go @@ -41,7 +41,7 @@ func (ms *Ms) Pfadd(key string, elements []string, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/pfadd_test.go b/ms/pfadd_test.go index 1aaa429b..bd7b25d0 100755 --- a/ms/pfadd_test.go +++ b/ms/pfadd_test.go @@ -37,7 +37,7 @@ func TestPfaddEmptyElements(t *testing.T) { func TestPfaddError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pfcount.go b/ms/pfcount.go index 1367de88..e5af6821 100755 --- a/ms/pfcount.go +++ b/ms/pfcount.go @@ -41,7 +41,7 @@ func (ms *Ms) Pfcount(keys []string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/pfcount_test.go b/ms/pfcount_test.go index 424a4198..9cd2902b 100755 --- a/ms/pfcount_test.go +++ b/ms/pfcount_test.go @@ -37,7 +37,7 @@ func TestPfcountEmptyKeys(t *testing.T) { func TestPfcountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pfmerge.go b/ms/pfmerge.go index afbe7428..97f96ac1 100755 --- a/ms/pfmerge.go +++ b/ms/pfmerge.go @@ -41,5 +41,8 @@ func (ms *Ms) Pfmerge(key string, sources []string, options types.QueryOptions) res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/pfmerge_test.go b/ms/pfmerge_test.go index 4eb8041f..5ae450dc 100755 --- a/ms/pfmerge_test.go +++ b/ms/pfmerge_test.go @@ -17,12 +17,13 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestPfmergeEmptySources(t *testing.T) { @@ -37,7 +38,7 @@ func TestPfmergeEmptySources(t *testing.T) { func TestPfmergeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/ping.go b/ms/ping.go index 426f2635..6921e169 100755 --- a/ms/ping.go +++ b/ms/ping.go @@ -31,7 +31,7 @@ func (ms *Ms) Ping(options types.QueryOptions) (string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } var returnedResult string diff --git a/ms/ping_test.go b/ms/ping_test.go index bf3951b7..2de17788 100755 --- a/ms/ping_test.go +++ b/ms/ping_test.go @@ -28,7 +28,7 @@ import ( func TestPingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/psetex.go b/ms/psetex.go index 053bcc09..303c943f 100755 --- a/ms/psetex.go +++ b/ms/psetex.go @@ -38,5 +38,8 @@ func (ms *Ms) Psetex(key string, value string, ttl int, options types.QueryOptio res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/psetex_test.go b/ms/psetex_test.go index 0cff49c5..065342c2 100755 --- a/ms/psetex_test.go +++ b/ms/psetex_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestPsetexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/pttl.go b/ms/pttl.go index a45f1703..60b11d28 100755 --- a/ms/pttl.go +++ b/ms/pttl.go @@ -32,7 +32,7 @@ func (ms *Ms) Pttl(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/pttl_test.go b/ms/pttl_test.go index 09c426df..c2493a2f 100755 --- a/ms/pttl_test.go +++ b/ms/pttl_test.go @@ -28,7 +28,7 @@ import ( func TestPttlError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/randomkey.go b/ms/randomkey.go index 423892f7..4a42ad8f 100755 --- a/ms/randomkey.go +++ b/ms/randomkey.go @@ -31,7 +31,7 @@ func (ms *Ms) Randomkey(options types.QueryOptions) (*string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/randomkey_test.go b/ms/randomkey_test.go index ac67f2ab..027c51a3 100755 --- a/ms/randomkey_test.go +++ b/ms/randomkey_test.go @@ -28,7 +28,7 @@ import ( func TestRandomkeyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rename.go b/ms/rename.go index c7b07ae2..27fe6702 100755 --- a/ms/rename.go +++ b/ms/rename.go @@ -36,5 +36,8 @@ func (ms *Ms) Rename(key string, newkey string, options types.QueryOptions) erro res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/rename_test.go b/ms/rename_test.go index 211fc996..f436c1d2 100755 --- a/ms/rename_test.go +++ b/ms/rename_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestRenameError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/renamenx.go b/ms/renamenx.go index 21d0f6a6..875a6a2d 100755 --- a/ms/renamenx.go +++ b/ms/renamenx.go @@ -37,7 +37,7 @@ func (ms *Ms) Renamenx(key string, newkey string, options types.QueryOptions) (b res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/renamenx_test.go b/ms/renamenx_test.go index ab355f5e..6ea434bd 100755 --- a/ms/renamenx_test.go +++ b/ms/renamenx_test.go @@ -28,7 +28,7 @@ import ( func TestRenamenxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rpop.go b/ms/rpop.go index dcfafd84..b14b5f92 100755 --- a/ms/rpop.go +++ b/ms/rpop.go @@ -36,7 +36,7 @@ func (ms *Ms) Rpop(key string, options types.QueryOptions) (*string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult *string diff --git a/ms/rpop_test.go b/ms/rpop_test.go index 998c1770..6dc757e7 100755 --- a/ms/rpop_test.go +++ b/ms/rpop_test.go @@ -28,7 +28,7 @@ import ( func TestRpopError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rpoplpush.go b/ms/rpoplpush.go index b2be7190..a0f49d20 100755 --- a/ms/rpoplpush.go +++ b/ms/rpoplpush.go @@ -38,7 +38,7 @@ func (ms *Ms) Rpoplpush(source string, destination string, options types.QueryOp res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult string diff --git a/ms/rpoplpush_test.go b/ms/rpoplpush_test.go index 389e7cb0..001fe987 100755 --- a/ms/rpoplpush_test.go +++ b/ms/rpoplpush_test.go @@ -28,7 +28,7 @@ import ( func TestRpoplpushError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rpush.go b/ms/rpush.go index 5715221f..79ff0ffd 100755 --- a/ms/rpush.go +++ b/ms/rpush.go @@ -42,7 +42,7 @@ func (ms *Ms) Rpush(source string, values []string, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/rpush_test.go b/ms/rpush_test.go index eddff84d..85bcd123 100755 --- a/ms/rpush_test.go +++ b/ms/rpush_test.go @@ -37,7 +37,7 @@ func TestRpushEmptyValues(t *testing.T) { func TestRpushError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/rpushx.go b/ms/rpushx.go index 79c0045f..a7c14149 100755 --- a/ms/rpushx.go +++ b/ms/rpushx.go @@ -38,7 +38,7 @@ func (ms *Ms) Rpushx(key string, value string, options types.QueryOptions) (int, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/rpushx_test.go b/ms/rpushx_test.go index ea320706..2bbcf780 100755 --- a/ms/rpushx_test.go +++ b/ms/rpushx_test.go @@ -28,7 +28,7 @@ import ( func TestRpushxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sadd.go b/ms/sadd.go index 07164d84..c148c454 100755 --- a/ms/sadd.go +++ b/ms/sadd.go @@ -42,7 +42,7 @@ func (ms *Ms) Sadd(key string, values []string, options types.QueryOptions) (int res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/sadd_test.go b/ms/sadd_test.go index be9d4a55..af5e620c 100755 --- a/ms/sadd_test.go +++ b/ms/sadd_test.go @@ -37,7 +37,7 @@ func TestSaddEmptyValues(t *testing.T) { func TestSaddError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/scan.go b/ms/scan.go index 81c416a2..237afb72 100755 --- a/ms/scan.go +++ b/ms/scan.go @@ -47,7 +47,7 @@ func (ms *Ms) Scan(cursor int, options types.QueryOptions) (*types.MSScanRespons res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/scan_test.go b/ms/scan_test.go index 883f1377..996a787e 100755 --- a/ms/scan_test.go +++ b/ms/scan_test.go @@ -28,7 +28,7 @@ import ( func TestScanError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/scard.go b/ms/scard.go index fdcc64f9..14da843c 100755 --- a/ms/scard.go +++ b/ms/scard.go @@ -33,7 +33,7 @@ func (ms *Ms) Scard(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/scard_test.go b/ms/scard_test.go index a76afdbf..d2bd58a3 100755 --- a/ms/scard_test.go +++ b/ms/scard_test.go @@ -28,7 +28,7 @@ import ( func TestScardError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sdiff.go b/ms/sdiff.go index bcdae67b..fb0e19d2 100755 --- a/ms/sdiff.go +++ b/ms/sdiff.go @@ -38,7 +38,7 @@ func (ms *Ms) Sdiff(key string, sets []string, options types.QueryOptions) ([]st res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/sdiff_test.go b/ms/sdiff_test.go index 28693fe0..358cd6ad 100755 --- a/ms/sdiff_test.go +++ b/ms/sdiff_test.go @@ -37,7 +37,7 @@ func TestSdiffEmptySets(t *testing.T) { func TestSdiffError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sdiffstore.go b/ms/sdiffstore.go index bbab8922..6e79600c 100755 --- a/ms/sdiffstore.go +++ b/ms/sdiffstore.go @@ -45,7 +45,7 @@ func (ms *Ms) Sdiffstore(key string, sets []string, destination string, options res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/sdiffstore_test.go b/ms/sdiffstore_test.go index c614c228..5bc5f900 100755 --- a/ms/sdiffstore_test.go +++ b/ms/sdiffstore_test.go @@ -37,7 +37,7 @@ func TestSdiffstoreEmptySets(t *testing.T) { func TestSdiffstoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/set.go b/ms/set.go index 41ce01ca..6819471b 100755 --- a/ms/set.go +++ b/ms/set.go @@ -56,5 +56,8 @@ func (ms *Ms) Set(key string, value interface{}, options types.QueryOptions) err res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/set_test.go b/ms/set_test.go index 8a925eb2..651e0cef 100755 --- a/ms/set_test.go +++ b/ms/set_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestSetError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/setex.go b/ms/setex.go index 02dc7717..bdd424f0 100755 --- a/ms/setex.go +++ b/ms/setex.go @@ -39,5 +39,8 @@ func (ms *Ms) Setex(key string, value interface{}, ttl int, options types.QueryO res := <-result - return res.Error + if res.Error.Error() != "" { + return res.Error + } + return nil } diff --git a/ms/setex_test.go b/ms/setex_test.go index 6c564455..d6b72c2c 100755 --- a/ms/setex_test.go +++ b/ms/setex_test.go @@ -17,18 +17,19 @@ package ms_test import ( "encoding/json" "fmt" + "testing" + "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" - "testing" ) func TestSetexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/setnx.go b/ms/setnx.go index ab31a781..3b83f779 100755 --- a/ms/setnx.go +++ b/ms/setnx.go @@ -38,7 +38,7 @@ func (ms *Ms) Setnx(key string, value interface{}, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/setnx_test.go b/ms/setnx_test.go index 9d5a99e3..c60de735 100755 --- a/ms/setnx_test.go +++ b/ms/setnx_test.go @@ -28,7 +28,7 @@ import ( func TestSetnxError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sinter.go b/ms/sinter.go index 3faf5695..7bc536f0 100755 --- a/ms/sinter.go +++ b/ms/sinter.go @@ -37,7 +37,7 @@ func (ms *Ms) Sinter(keys []string, options types.QueryOptions) ([]string, error res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []string diff --git a/ms/sinter_test.go b/ms/sinter_test.go index 8a3e17a2..d5431c7b 100755 --- a/ms/sinter_test.go +++ b/ms/sinter_test.go @@ -37,7 +37,7 @@ func TestSinterEmptyKeys(t *testing.T) { func TestSinterError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sinterstore.go b/ms/sinterstore.go index 35fcea30..59e4f869 100755 --- a/ms/sinterstore.go +++ b/ms/sinterstore.go @@ -44,7 +44,7 @@ func (ms *Ms) Sinterstore(destination string, keys []string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/sinterstore_test.go b/ms/sinterstore_test.go index 4bad90aa..4b449555 100755 --- a/ms/sinterstore_test.go +++ b/ms/sinterstore_test.go @@ -37,7 +37,7 @@ func TestSinterstoreEmptyKeys(t *testing.T) { func TestSinterstoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sismember.go b/ms/sismember.go index e41f506f..405ac988 100755 --- a/ms/sismember.go +++ b/ms/sismember.go @@ -34,7 +34,7 @@ func (ms *Ms) Sismember(key string, member string, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } var returnedResult int diff --git a/ms/sismember_test.go b/ms/sismember_test.go index 8c435701..9b65ad2f 100755 --- a/ms/sismember_test.go +++ b/ms/sismember_test.go @@ -28,7 +28,7 @@ import ( func TestSismemberError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/smembers.go b/ms/smembers.go index 085b3b68..8d04c564 100755 --- a/ms/smembers.go +++ b/ms/smembers.go @@ -33,7 +33,7 @@ func (ms *Ms) Smembers(key string, options types.QueryOptions) ([]string, error) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/smembers_test.go b/ms/smembers_test.go index 6c808230..c0929f1d 100755 --- a/ms/smembers_test.go +++ b/ms/smembers_test.go @@ -28,7 +28,7 @@ import ( func TestSmembersError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/smove.go b/ms/smove.go index c7e09b38..1ca24ad2 100755 --- a/ms/smove.go +++ b/ms/smove.go @@ -39,7 +39,7 @@ func (ms *Ms) Smove(key string, destination string, member string, options types res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/ms/smove_test.go b/ms/smove_test.go index edd29299..df4ed525 100755 --- a/ms/smove_test.go +++ b/ms/smove_test.go @@ -28,7 +28,7 @@ import ( func TestSmoveError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sort.go b/ms/sort.go index 4193c495..95d82a33 100755 --- a/ms/sort.go +++ b/ms/sort.go @@ -67,7 +67,7 @@ func (ms *Ms) Sort(key string, options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/sort_test.go b/ms/sort_test.go index b211b371..3f648f08 100755 --- a/ms/sort_test.go +++ b/ms/sort_test.go @@ -28,7 +28,7 @@ import ( func TestSortError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/spop.go b/ms/spop.go index cd038d1a..c6ebdc71 100755 --- a/ms/spop.go +++ b/ms/spop.go @@ -39,7 +39,7 @@ func (ms *Ms) Spop(key string, options types.QueryOptions) ([]string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/spop_test.go b/ms/spop_test.go index 5db40f1c..af5b3874 100755 --- a/ms/spop_test.go +++ b/ms/spop_test.go @@ -28,7 +28,7 @@ import ( func TestSpopError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/srandmember.go b/ms/srandmember.go index 44233fe3..4bde048c 100755 --- a/ms/srandmember.go +++ b/ms/srandmember.go @@ -46,7 +46,7 @@ func (ms *Ms) Srandmember(key string, options types.QueryOptions) ([]string, err res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/srandmember_test.go b/ms/srandmember_test.go index 2519a42b..5152c067 100755 --- a/ms/srandmember_test.go +++ b/ms/srandmember_test.go @@ -28,7 +28,7 @@ import ( func TestSrandmemberError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/srem.go b/ms/srem.go index 7cfca649..1c99d9ea 100755 --- a/ms/srem.go +++ b/ms/srem.go @@ -42,7 +42,7 @@ func (ms *Ms) Srem(key string, valuesToRemove []string, options types.QueryOptio res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/srem_test.go b/ms/srem_test.go index 7cd5d62c..87802082 100755 --- a/ms/srem_test.go +++ b/ms/srem_test.go @@ -37,7 +37,7 @@ func TestSremEmptyValues(t *testing.T) { func TestSremError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sscan.go b/ms/sscan.go index 9ad371d6..9482816f 100755 --- a/ms/sscan.go +++ b/ms/sscan.go @@ -44,7 +44,7 @@ func (ms *Ms) Sscan(key string, cursor int, options types.QueryOptions) (*types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/sscan_test.go b/ms/sscan_test.go index 42174fb5..00e2c5b3 100755 --- a/ms/sscan_test.go +++ b/ms/sscan_test.go @@ -28,7 +28,7 @@ import ( func TestSscanError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/strlen.go b/ms/strlen.go index 6be3d8ec..2c3e295f 100755 --- a/ms/strlen.go +++ b/ms/strlen.go @@ -33,7 +33,7 @@ func (ms *Ms) Strlen(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/strlen_test.go b/ms/strlen_test.go index 3f219c0a..30ff1e7b 100755 --- a/ms/strlen_test.go +++ b/ms/strlen_test.go @@ -28,7 +28,7 @@ import ( func TestStrlenError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sunion.go b/ms/sunion.go index b47507cd..79ec6fd3 100755 --- a/ms/sunion.go +++ b/ms/sunion.go @@ -37,7 +37,7 @@ func (ms *Ms) Sunion(sets []string, options types.QueryOptions) ([]string, error res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/sunion_test.go b/ms/sunion_test.go index a88610ac..6b987006 100755 --- a/ms/sunion_test.go +++ b/ms/sunion_test.go @@ -37,7 +37,7 @@ func TestSunionEmptySet(t *testing.T) { func TestSunionError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/sunionstore.go b/ms/sunionstore.go index 76c91fa9..c45284c1 100755 --- a/ms/sunionstore.go +++ b/ms/sunionstore.go @@ -43,7 +43,7 @@ func (ms *Ms) Sunionstore(destination string, sets []string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/sunionstore_test.go b/ms/sunionstore_test.go index a7420101..02aa73df 100755 --- a/ms/sunionstore_test.go +++ b/ms/sunionstore_test.go @@ -37,7 +37,7 @@ func TestSunionstoreEmptySet(t *testing.T) { func TestSunionStoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/time.go b/ms/time.go index a44cf04f..2ece24ba 100755 --- a/ms/time.go +++ b/ms/time.go @@ -31,7 +31,7 @@ func (ms *Ms) Time(options types.QueryOptions) ([]int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } var returnedResult []int diff --git a/ms/time_test.go b/ms/time_test.go index 7bc3d3b3..e30316f6 100755 --- a/ms/time_test.go +++ b/ms/time_test.go @@ -28,7 +28,7 @@ import ( func TestTimeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/touch.go b/ms/touch.go index 67e03f88..a999feae 100755 --- a/ms/touch.go +++ b/ms/touch.go @@ -40,7 +40,7 @@ func (ms *Ms) Touch(keys []string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/touch_test.go b/ms/touch_test.go index c9230dcc..7734b04f 100755 --- a/ms/touch_test.go +++ b/ms/touch_test.go @@ -37,7 +37,7 @@ func TestTouchEmptyKeys(t *testing.T) { func TestTouchError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/ttl.go b/ms/ttl.go index 77cfb54e..d21a8d13 100755 --- a/ms/ttl.go +++ b/ms/ttl.go @@ -37,7 +37,7 @@ func (ms *Ms) Ttl(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } var returnedResult int diff --git a/ms/ttl_test.go b/ms/ttl_test.go index fc7c281e..f10c18fe 100755 --- a/ms/ttl_test.go +++ b/ms/ttl_test.go @@ -28,7 +28,7 @@ import ( func TestTtlError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/type.go b/ms/type.go index 6cdc657c..f8b40063 100755 --- a/ms/type.go +++ b/ms/type.go @@ -33,7 +33,7 @@ func (ms *Ms) Type(key string, options types.QueryOptions) (string, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } var returnedResult string diff --git a/ms/type_test.go b/ms/type_test.go index 1c3d3cc7..a35b58c9 100755 --- a/ms/type_test.go +++ b/ms/type_test.go @@ -28,7 +28,7 @@ import ( func TestTypeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zadd.go b/ms/zadd.go index b9a19e54..6b3247cb 100755 --- a/ms/zadd.go +++ b/ms/zadd.go @@ -59,7 +59,7 @@ func (ms *Ms) Zadd(key string, elements []*types.MSSortedSet, options types.Quer res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zadd_test.go b/ms/zadd_test.go index b4d9fbb4..6092db7f 100755 --- a/ms/zadd_test.go +++ b/ms/zadd_test.go @@ -37,7 +37,7 @@ func TestZaddEmptyElements(t *testing.T) { func TestZaddError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zcard.go b/ms/zcard.go index 83030dbb..598e8d10 100755 --- a/ms/zcard.go +++ b/ms/zcard.go @@ -33,7 +33,7 @@ func (ms *Ms) Zcard(key string, options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zcard_test.go b/ms/zcard_test.go index edb53b25..4723610b 100755 --- a/ms/zcard_test.go +++ b/ms/zcard_test.go @@ -28,7 +28,7 @@ import ( func TestZcardError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zcount.go b/ms/zcount.go index 761bb620..28e70ddf 100755 --- a/ms/zcount.go +++ b/ms/zcount.go @@ -38,7 +38,7 @@ func (ms *Ms) Zcount(key string, min int, max int, options types.QueryOptions) ( res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zcount_test.go b/ms/zcount_test.go index dbb99bda..bf0c11ea 100755 --- a/ms/zcount_test.go +++ b/ms/zcount_test.go @@ -28,7 +28,7 @@ import ( func TestZcountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zincrby.go b/ms/zincrby.go index 54575d6c..2f2d58c5 100755 --- a/ms/zincrby.go +++ b/ms/zincrby.go @@ -40,7 +40,7 @@ func (ms *Ms) Zincrby(key string, member string, increment float64, options type res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zincrby_test.go b/ms/zincrby_test.go index 688135d2..e3e9f189 100755 --- a/ms/zincrby_test.go +++ b/ms/zincrby_test.go @@ -28,7 +28,7 @@ import ( func TestZincrbyError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zinterstore.go b/ms/zinterstore.go index 580c1877..61720c24 100755 --- a/ms/zinterstore.go +++ b/ms/zinterstore.go @@ -57,7 +57,7 @@ func (ms *Ms) Zinterstore(destination string, keys []string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zinterstore_test.go b/ms/zinterstore_test.go index 05b11aa5..b62a362e 100755 --- a/ms/zinterstore_test.go +++ b/ms/zinterstore_test.go @@ -37,7 +37,7 @@ func TestZinterstoreEmptyKeys(t *testing.T) { func TestZinterstoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zlexcount.go b/ms/zlexcount.go index e8a153e6..6500594d 100755 --- a/ms/zlexcount.go +++ b/ms/zlexcount.go @@ -39,7 +39,7 @@ func (ms *Ms) Zlexcount(key string, min string, max string, options types.QueryO res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zlexcount_test.go b/ms/zlexcount_test.go index db0234fa..27e37642 100755 --- a/ms/zlexcount_test.go +++ b/ms/zlexcount_test.go @@ -46,7 +46,7 @@ func TestZlexcountEmptyMax(t *testing.T) { func TestZlexcountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrange.go b/ms/zrange.go index 93157c10..b58cdb08 100755 --- a/ms/zrange.go +++ b/ms/zrange.go @@ -41,7 +41,7 @@ func (ms *Ms) Zrange(key string, start int, stop int, options types.QueryOptions res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrange_test.go b/ms/zrange_test.go index 3d4adece..6a4411cc 100755 --- a/ms/zrange_test.go +++ b/ms/zrange_test.go @@ -28,7 +28,7 @@ import ( func TestZrangeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrangebylex.go b/ms/zrangebylex.go index e0c2966d..c4d1a3aa 100755 --- a/ms/zrangebylex.go +++ b/ms/zrangebylex.go @@ -41,7 +41,7 @@ func (ms *Ms) Zrangebylex(key string, min string, max string, options types.Quer res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrangebylex_test.go b/ms/zrangebylex_test.go index eeeca540..c2b840df 100755 --- a/ms/zrangebylex_test.go +++ b/ms/zrangebylex_test.go @@ -46,7 +46,7 @@ func TestZrangebylexEmptyMax(t *testing.T) { func TestZrangebylexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrangebyscore.go b/ms/zrangebyscore.go index 22b286fc..68379b81 100755 --- a/ms/zrangebyscore.go +++ b/ms/zrangebyscore.go @@ -38,7 +38,7 @@ func (ms *Ms) Zrangebyscore(key string, min float64, max float64, options types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrangebyscore_test.go b/ms/zrangebyscore_test.go index a3edd5fe..e6b8c7e7 100755 --- a/ms/zrangebyscore_test.go +++ b/ms/zrangebyscore_test.go @@ -28,7 +28,7 @@ import ( func TestZrangebyscoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrank.go b/ms/zrank.go index f7873882..d79c1c82 100755 --- a/ms/zrank.go +++ b/ms/zrank.go @@ -34,7 +34,7 @@ func (ms *Ms) Zrank(key string, member string, options types.QueryOptions) (int, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zrank_test.go b/ms/zrank_test.go index 954663e9..066cabeb 100755 --- a/ms/zrank_test.go +++ b/ms/zrank_test.go @@ -28,7 +28,7 @@ import ( func TestZrankError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrem.go b/ms/zrem.go index 38d26e1b..fa71f2c4 100755 --- a/ms/zrem.go +++ b/ms/zrem.go @@ -42,7 +42,7 @@ func (ms *Ms) Zrem(key string, members []string, options types.QueryOptions) (in res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zrem_test.go b/ms/zrem_test.go index 0f842cf3..430890de 100755 --- a/ms/zrem_test.go +++ b/ms/zrem_test.go @@ -37,7 +37,7 @@ func TestZremEmptyMembers(t *testing.T) { func TestZremError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zremrangebylex.go b/ms/zremrangebylex.go index 78fe1cca..7c9522d7 100755 --- a/ms/zremrangebylex.go +++ b/ms/zremrangebylex.go @@ -43,7 +43,7 @@ func (ms *Ms) Zremrangebylex(key string, min string, max string, options types.Q res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zremrangebylex_test.go b/ms/zremrangebylex_test.go index 12cf70de..5c76f64a 100755 --- a/ms/zremrangebylex_test.go +++ b/ms/zremrangebylex_test.go @@ -46,7 +46,7 @@ func TestZremrangebylexEmptyMax(t *testing.T) { func TestZremrangebylexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zremrangebyrank.go b/ms/zremrangebyrank.go index f0bf4556..417c47c0 100755 --- a/ms/zremrangebyrank.go +++ b/ms/zremrangebyrank.go @@ -42,7 +42,7 @@ func (ms *Ms) Zremrangebyrank(key string, min int, max int, options types.QueryO res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zremrangebyrank_test.go b/ms/zremrangebyrank_test.go index d8e10bb2..eced5369 100755 --- a/ms/zremrangebyrank_test.go +++ b/ms/zremrangebyrank_test.go @@ -28,7 +28,7 @@ import ( func TestZremrangebyrankError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zremrangebyscore.go b/ms/zremrangebyscore.go index 4f79236b..98880da6 100755 --- a/ms/zremrangebyscore.go +++ b/ms/zremrangebyscore.go @@ -40,7 +40,7 @@ func (ms *Ms) Zremrangebyscore(key string, min float64, max float64, options typ res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zremrangebyscore_test.go b/ms/zremrangebyscore_test.go index 21d194a1..904388fa 100755 --- a/ms/zremrangebyscore_test.go +++ b/ms/zremrangebyscore_test.go @@ -28,7 +28,7 @@ import ( func TestZremrangebyscoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrevrange.go b/ms/zrevrange.go index c7354fd5..ff6e24a7 100755 --- a/ms/zrevrange.go +++ b/ms/zrevrange.go @@ -37,7 +37,7 @@ func (ms *Ms) Zrevrange(key string, start int, stop int, options types.QueryOpti res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrevrange_test.go b/ms/zrevrange_test.go index 82b42f44..d714baf0 100755 --- a/ms/zrevrange_test.go +++ b/ms/zrevrange_test.go @@ -28,7 +28,7 @@ import ( func TestZrevrangeError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrevrangebylex.go b/ms/zrevrangebylex.go index db9488d4..c571319c 100755 --- a/ms/zrevrangebylex.go +++ b/ms/zrevrangebylex.go @@ -41,7 +41,7 @@ func (ms *Ms) Zrevrangebylex(key string, min string, max string, options types.Q res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrevrangebylex_test.go b/ms/zrevrangebylex_test.go index 400e7a9b..1debf93d 100755 --- a/ms/zrevrangebylex_test.go +++ b/ms/zrevrangebylex_test.go @@ -46,7 +46,7 @@ func TestZrevrangebylexEmptyMax(t *testing.T) { func TestZrevrangebylexError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrevrangebyscore.go b/ms/zrevrangebyscore.go index 58aee6c6..f98b47f7 100755 --- a/ms/zrevrangebyscore.go +++ b/ms/zrevrangebyscore.go @@ -38,7 +38,7 @@ func (ms *Ms) Zrevrangebyscore(key string, min float64, max float64, options typ res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zrevrangebyscore_test.go b/ms/zrevrangebyscore_test.go index 408423d5..2dfaf470 100755 --- a/ms/zrevrangebyscore_test.go +++ b/ms/zrevrangebyscore_test.go @@ -28,7 +28,7 @@ import ( func TestZrevrangebyscoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zrevrank.go b/ms/zrevrank.go index 40549013..08dca5d5 100755 --- a/ms/zrevrank.go +++ b/ms/zrevrank.go @@ -34,7 +34,7 @@ func (ms *Ms) Zrevrank(key string, member string, options types.QueryOptions) (i res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zrevrank_test.go b/ms/zrevrank_test.go index e4305121..241b0d35 100755 --- a/ms/zrevrank_test.go +++ b/ms/zrevrank_test.go @@ -28,7 +28,7 @@ import ( func TestZrevrankError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zscan.go b/ms/zscan.go index 35050058..7ab5df31 100755 --- a/ms/zscan.go +++ b/ms/zscan.go @@ -50,7 +50,7 @@ func (ms *Ms) Zscan(key string, cursor int, options types.QueryOptions) (*types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/ms/zscan_test.go b/ms/zscan_test.go index 4c973b12..70549123 100755 --- a/ms/zscan_test.go +++ b/ms/zscan_test.go @@ -28,7 +28,7 @@ import ( func TestZscanError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zscore.go b/ms/zscore.go index bd37b568..5d0832f8 100755 --- a/ms/zscore.go +++ b/ms/zscore.go @@ -35,7 +35,7 @@ func (ms *Ms) Zscore(key string, member string, options types.QueryOptions) (flo res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zscore_test.go b/ms/zscore_test.go index 6f367801..b16b7f45 100755 --- a/ms/zscore_test.go +++ b/ms/zscore_test.go @@ -28,7 +28,7 @@ import ( func TestZscoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/ms/zunionstore.go b/ms/zunionstore.go index 5b185514..3079bddb 100755 --- a/ms/zunionstore.go +++ b/ms/zunionstore.go @@ -57,7 +57,7 @@ func (ms *Ms) Zunionstore(destination string, keys []string, options types.Query res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return 0, res.Error } diff --git a/ms/zunionstore_test.go b/ms/zunionstore_test.go index 26b66941..9cbe0637 100755 --- a/ms/zunionstore_test.go +++ b/ms/zunionstore_test.go @@ -37,7 +37,7 @@ func TestZunionstoreEmptyKeys(t *testing.T) { func TestZunionstoreError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/realtime/count.go b/realtime/count.go index 4e68dd62..e7b70066 100644 --- a/realtime/count.go +++ b/realtime/count.go @@ -42,7 +42,7 @@ func (r *Realtime) Count(index, collection, roomID string) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/realtime/count_test.go b/realtime/count_test.go index 933db29a..9215f84a 100644 --- a/realtime/count_test.go +++ b/realtime/count_test.go @@ -56,7 +56,7 @@ func TestCountRoomIDNull(t *testing.T) { func TestCountError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/realtime/join.go b/realtime/join.go index f1004902..8011c7ad 100644 --- a/realtime/join.go +++ b/realtime/join.go @@ -56,7 +56,7 @@ func (r *Realtime) Join(index, collection, roomID string, options types.RoomOpti go r.k.Query(query, opts, result) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/realtime/list.go b/realtime/list.go index a3449fd6..1f31c087 100644 --- a/realtime/list.go +++ b/realtime/list.go @@ -39,7 +39,7 @@ func (r *Realtime) List(index string, collection string) (json.RawMessage, error res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/realtime/list_test.go b/realtime/list_test.go index 4726a35d..52740281 100644 --- a/realtime/list_test.go +++ b/realtime/list_test.go @@ -54,7 +54,7 @@ func TestListError(t *testing.T) { _, err := nr.List("index", "collection") assert.NotNil(t, err) - assert.Equal(t, "Unit test error", err.(*types.KuzzleError).Message) + assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } func TestList(t *testing.T) { diff --git a/realtime/publish.go b/realtime/publish.go index 4eb539a8..4b7d5748 100644 --- a/realtime/publish.go +++ b/realtime/publish.go @@ -36,7 +36,7 @@ func (r *Realtime) Publish(index string, collection string, body string) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/realtime/subscribe.go b/realtime/subscribe.go index c13c4f62..13d0f186 100644 --- a/realtime/subscribe.go +++ b/realtime/subscribe.go @@ -56,7 +56,7 @@ func (r *Realtime) Subscribe(index, collection string, filters json.RawMessage, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/realtime/subscribe_test.go b/realtime/subscribe_test.go index 6bd682b2..fd5eb9bc 100644 --- a/realtime/subscribe_test.go +++ b/realtime/subscribe_test.go @@ -76,7 +76,7 @@ func TestSubscribeQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "ah!"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "ah!"}} }, } k, _ = kuzzle.NewKuzzle(c, nil) @@ -134,7 +134,7 @@ func TestRoomSubscribeNotConnected(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Not Connected"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Not Connected"}} }, } diff --git a/realtime/unsubscribe.go b/realtime/unsubscribe.go index 59ae22c4..13c2a77d 100644 --- a/realtime/unsubscribe.go +++ b/realtime/unsubscribe.go @@ -38,7 +38,7 @@ func (r *Realtime) Unsubscribe(roomID string) error { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/realtime/validate.go b/realtime/validate.go index f761e401..d99ccdfa 100644 --- a/realtime/validate.go +++ b/realtime/validate.go @@ -40,7 +40,7 @@ func (r *Realtime) Validate(index string, collection string, body string) (bool, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/security/createCredentials.go b/security/createCredentials.go index 09da3952..e8535108 100644 --- a/security/createCredentials.go +++ b/security/createCredentials.go @@ -39,7 +39,7 @@ func (s *Security) CreateCredentials(strategy, id string, body json.RawMessage, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createCredentials_test.go b/security/createCredentials_test.go index fa39bc9d..6454ca1b 100644 --- a/security/createCredentials_test.go +++ b/security/createCredentials_test.go @@ -45,7 +45,7 @@ func TestCreateCredentialsBodyNull(t *testing.T) { func TestCreateCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createFirstAdmin.go b/security/createFirstAdmin.go index 9e3bdd26..d2666f2e 100644 --- a/security/createFirstAdmin.go +++ b/security/createFirstAdmin.go @@ -42,7 +42,7 @@ func (s *Security) CreateFirstAdmin(body json.RawMessage, options types.QueryOpt res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createFirstAdmin_test.go b/security/createFirstAdmin_test.go index 8a48c48f..32f0dcf9 100644 --- a/security/createFirstAdmin_test.go +++ b/security/createFirstAdmin_test.go @@ -33,7 +33,7 @@ func TestCreateFirstAdminBodyNull(t *testing.T) { func TestCreateFirstAdminError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createOrReplaceProfile.go b/security/createOrReplaceProfile.go index aa6f5363..c4433786 100644 --- a/security/createOrReplaceProfile.go +++ b/security/createOrReplaceProfile.go @@ -38,7 +38,7 @@ func (s *Security) CreateOrReplaceProfile(id string, body json.RawMessage, optio res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createOrReplaceProfile_test.go b/security/createOrReplaceProfile_test.go index 86897eb8..f518f7b1 100644 --- a/security/createOrReplaceProfile_test.go +++ b/security/createOrReplaceProfile_test.go @@ -33,7 +33,7 @@ func TestCreateOrReplaceProfileBodyNull(t *testing.T) { func TestCreateOrReplaceProfileError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createOrReplaceRole.go b/security/createOrReplaceRole.go index e345a161..232ff2fa 100644 --- a/security/createOrReplaceRole.go +++ b/security/createOrReplaceRole.go @@ -38,7 +38,7 @@ func (s *Security) CreateOrReplaceRole(id string, body json.RawMessage, options res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createOrReplaceRole_test.go b/security/createOrReplaceRole_test.go index a0fa73e2..7503da0a 100644 --- a/security/createOrReplaceRole_test.go +++ b/security/createOrReplaceRole_test.go @@ -33,7 +33,7 @@ func TestCreateOrReplaceRoleBodyNull(t *testing.T) { func TestCreateOrReplaceRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createProfile.go b/security/createProfile.go index d9f613b1..b9ebdb39 100644 --- a/security/createProfile.go +++ b/security/createProfile.go @@ -38,7 +38,7 @@ func (s *Security) CreateProfile(id string, body json.RawMessage, options types. res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createProfile_test.go b/security/createProfile_test.go index 149759bb..1b859535 100644 --- a/security/createProfile_test.go +++ b/security/createProfile_test.go @@ -39,7 +39,7 @@ func TestCreateProfileBodyNull(t *testing.T) { func TestCreateProfileError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createRestrictedUser.go b/security/createRestrictedUser.go index b44493e4..e8f38728 100644 --- a/security/createRestrictedUser.go +++ b/security/createRestrictedUser.go @@ -41,7 +41,7 @@ func (s *Security) CreateRestrictedUser(body json.RawMessage, options types.Quer res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createRestrictedUser_test.go b/security/createRestrictedUser_test.go index 71f5cadd..87c5caf9 100644 --- a/security/createRestrictedUser_test.go +++ b/security/createRestrictedUser_test.go @@ -33,7 +33,7 @@ func TestCreateRestrictedUserBodyNull(t *testing.T) { func TestCreateRestrictedUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createRole.go b/security/createRole.go index 78dde2bf..7da27a64 100644 --- a/security/createRole.go +++ b/security/createRole.go @@ -38,7 +38,7 @@ func (s *Security) CreateRole(id string, body json.RawMessage, options types.Que res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createRole_test.go b/security/createRole_test.go index 2f193918..b2709d4d 100644 --- a/security/createRole_test.go +++ b/security/createRole_test.go @@ -39,7 +39,7 @@ func TestCreateRoleBodyNull(t *testing.T) { func TestCreateRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/createUser.go b/security/createUser.go index a1780fad..4adf657f 100644 --- a/security/createUser.go +++ b/security/createUser.go @@ -37,7 +37,7 @@ func (s *Security) CreateUser(body json.RawMessage, options types.QueryOptions) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/createUser_test.go b/security/createUser_test.go index 7045d893..fc4a7f25 100644 --- a/security/createUser_test.go +++ b/security/createUser_test.go @@ -33,7 +33,7 @@ func TestCreateUserBodyNull(t *testing.T) { func TestCreateUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/deleteCredentials.go b/security/deleteCredentials.go index a3ba5fae..a1760c55 100644 --- a/security/deleteCredentials.go +++ b/security/deleteCredentials.go @@ -36,7 +36,7 @@ func (s *Security) DeleteCredentials(strategy, id string, options types.QueryOpt res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/deleteCredentials_test.go b/security/deleteCredentials_test.go index d190bb22..8c84e941 100644 --- a/security/deleteCredentials_test.go +++ b/security/deleteCredentials_test.go @@ -39,7 +39,7 @@ func TestDeleteCredentialsIDNull(t *testing.T) { func TestDeleteCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/deleteProfile.go b/security/deleteProfile.go index 6aaa901c..2862e316 100644 --- a/security/deleteProfile.go +++ b/security/deleteProfile.go @@ -37,7 +37,7 @@ func (s *Security) DeleteProfile(id string, options types.QueryOptions) (string, res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/security/deleteProfile_test.go b/security/deleteProfile_test.go index c384896b..663abfbd 100644 --- a/security/deleteProfile_test.go +++ b/security/deleteProfile_test.go @@ -33,7 +33,7 @@ func TestDeleteProfileIDNull(t *testing.T) { func TestDeleteProfileError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/deleteRole.go b/security/deleteRole.go index 35be04f2..8c522f3b 100644 --- a/security/deleteRole.go +++ b/security/deleteRole.go @@ -37,7 +37,7 @@ func (s *Security) DeleteRole(id string, options types.QueryOptions) (string, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/security/deleteRole_test.go b/security/deleteRole_test.go index ca69b472..248332e1 100644 --- a/security/deleteRole_test.go +++ b/security/deleteRole_test.go @@ -33,7 +33,7 @@ func TestDeleteRoleIDNull(t *testing.T) { func TestDeleteRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/deleteUser.go b/security/deleteUser.go index bd3a516f..c1329a76 100644 --- a/security/deleteUser.go +++ b/security/deleteUser.go @@ -37,7 +37,7 @@ func (s *Security) DeleteUser(id string, options types.QueryOptions) (string, er res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return "", res.Error } diff --git a/security/deleteUser_test.go b/security/deleteUser_test.go index 1f170c6f..0b56e980 100644 --- a/security/deleteUser_test.go +++ b/security/deleteUser_test.go @@ -33,7 +33,7 @@ func TestDeleteUserIDNull(t *testing.T) { func TestDeleteUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getAllCredentialFields.go b/security/getAllCredentialFields.go index 74cdd609..f7c632f3 100644 --- a/security/getAllCredentialFields.go +++ b/security/getAllCredentialFields.go @@ -32,7 +32,7 @@ func (s *Security) GetAllCredentialFields(options types.QueryOptions) (json.RawM res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getAllCredentialFields_test.go b/security/getAllCredentialFields_test.go index 77a61fbd..c8ec1c09 100644 --- a/security/getAllCredentialFields_test.go +++ b/security/getAllCredentialFields_test.go @@ -33,7 +33,7 @@ func TestGetAllCredentialFieldsError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "security", request.Controller) assert.Equal(t, "getAllCredentialFields", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getCredentialFields.go b/security/getCredentialFields.go index 36b327e6..16d5b81b 100644 --- a/security/getCredentialFields.go +++ b/security/getCredentialFields.go @@ -37,7 +37,7 @@ func (s *Security) GetCredentialFields(strategy string, options types.QueryOptio res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getCredentialFields_test.go b/security/getCredentialFields_test.go index 1c9a8a90..3d57e2c5 100644 --- a/security/getCredentialFields_test.go +++ b/security/getCredentialFields_test.go @@ -29,7 +29,7 @@ import ( func TestGetCredentialFieldsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -45,7 +45,7 @@ func TestGetCredentialFieldsError(t *testing.T) { assert.Equal(t, "security", request.Controller) assert.Equal(t, "getCredentialFields", request.Action) assert.Equal(t, "local", request.Strategy) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getCredentials.go b/security/getCredentials.go index 2c782de4..8377be10 100644 --- a/security/getCredentials.go +++ b/security/getCredentials.go @@ -37,7 +37,7 @@ func (s *Security) GetCredentials(strategy, id string, options types.QueryOption res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getCredentialsById.go b/security/getCredentialsById.go index 5f983e20..e4991721 100644 --- a/security/getCredentialsById.go +++ b/security/getCredentialsById.go @@ -38,7 +38,7 @@ func (s *Security) GetCredentialsByID(strategy, id string, options types.QueryOp res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getCredentialsById_test.go b/security/getCredentialsById_test.go index 9dee3d19..ed626294 100644 --- a/security/getCredentialsById_test.go +++ b/security/getCredentialsById_test.go @@ -39,7 +39,7 @@ func TestGetCredentialsByIDIDNull(t *testing.T) { func TestGetCredentialsByIDError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getCredentials_test.go b/security/getCredentials_test.go index 35327c86..00fede1c 100644 --- a/security/getCredentials_test.go +++ b/security/getCredentials_test.go @@ -39,7 +39,7 @@ func TestGetCredentialsIDNull(t *testing.T) { func TestGetCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getProfile.go b/security/getProfile.go index e5955b83..9620759b 100644 --- a/security/getProfile.go +++ b/security/getProfile.go @@ -37,7 +37,7 @@ func (s *Security) GetProfile(id string, options types.QueryOptions) (*Profile, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getProfileMapping.go b/security/getProfileMapping.go index 304977c5..d76deeaf 100644 --- a/security/getProfileMapping.go +++ b/security/getProfileMapping.go @@ -32,7 +32,7 @@ func (s *Security) GetProfileMapping(options types.QueryOptions) (json.RawMessag res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getProfileMapping_test.go b/security/getProfileMapping_test.go index 90b48086..01e409f3 100644 --- a/security/getProfileMapping_test.go +++ b/security/getProfileMapping_test.go @@ -27,7 +27,7 @@ import ( func TestGetProfileMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getProfileRights.go b/security/getProfileRights.go index b313762d..dbd85ead 100644 --- a/security/getProfileRights.go +++ b/security/getProfileRights.go @@ -37,7 +37,7 @@ func (s *Security) GetProfileRights(id string, options types.QueryOptions) (json res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getProfileRights_test.go b/security/getProfileRights_test.go index a78d5bae..9ffa77a5 100644 --- a/security/getProfileRights_test.go +++ b/security/getProfileRights_test.go @@ -34,7 +34,7 @@ func TestGetProfileRightsIDNull(t *testing.T) { func TestGetProfileRightsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getRole.go b/security/getRole.go index 2ac7c9c0..d7f80fb0 100644 --- a/security/getRole.go +++ b/security/getRole.go @@ -36,7 +36,7 @@ func (s *Security) GetRole(id string, options types.QueryOptions) (*Role, error) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getRoleMapping.go b/security/getRoleMapping.go index f043cb4f..d9d34982 100644 --- a/security/getRoleMapping.go +++ b/security/getRoleMapping.go @@ -32,7 +32,7 @@ func (s *Security) GetRoleMapping(options types.QueryOptions) (json.RawMessage, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getRoleMapping_test.go b/security/getRoleMapping_test.go index 89c8b02f..dadb4197 100644 --- a/security/getRoleMapping_test.go +++ b/security/getRoleMapping_test.go @@ -27,7 +27,7 @@ import ( func TestGetRoleMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getRole_test.go b/security/getRole_test.go index a11649cf..5f55c0ea 100644 --- a/security/getRole_test.go +++ b/security/getRole_test.go @@ -42,7 +42,7 @@ func TestGetRoleEmptyId(t *testing.T) { func TestGetRoleError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getUser.go b/security/getUser.go index d59aeed8..9fcef592 100644 --- a/security/getUser.go +++ b/security/getUser.go @@ -36,7 +36,7 @@ func (s *Security) GetUser(id string, options types.QueryOptions) (*User, error) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getUserMapping.go b/security/getUserMapping.go index bd905c21..9e4c01fd 100644 --- a/security/getUserMapping.go +++ b/security/getUserMapping.go @@ -32,7 +32,7 @@ func (s *Security) GetUserMapping(options types.QueryOptions) (json.RawMessage, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getUserMapping_test.go b/security/getUserMapping_test.go index 839cf558..26ee55e7 100644 --- a/security/getUserMapping_test.go +++ b/security/getUserMapping_test.go @@ -27,7 +27,7 @@ import ( func TestGetUserMappingError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/getUserRights.go b/security/getUserRights.go index d982bd15..bcf50992 100644 --- a/security/getUserRights.go +++ b/security/getUserRights.go @@ -37,7 +37,7 @@ func (s *Security) GetUserRights(id string, options types.QueryOptions) (json.Ra res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/getUserRights_test.go b/security/getUserRights_test.go index a75d23ea..2b0da0f4 100644 --- a/security/getUserRights_test.go +++ b/security/getUserRights_test.go @@ -34,7 +34,7 @@ func TestGetUserRightsIDNull(t *testing.T) { func TestGetUserRightsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/hasCredentials.go b/security/hasCredentials.go index 83a12ee9..fff05732 100644 --- a/security/hasCredentials.go +++ b/security/hasCredentials.go @@ -38,7 +38,7 @@ func (s *Security) HasCredentials(strategy, id string, options types.QueryOption res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/security/hasCredentials_test.go b/security/hasCredentials_test.go index 35eafeb9..871db2fc 100644 --- a/security/hasCredentials_test.go +++ b/security/hasCredentials_test.go @@ -45,7 +45,7 @@ func TestHasCredentialsIdNull(t *testing.T) { func TestHasCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/mDeleteCredentials.go b/security/mDeleteCredentials.go index 3e86795b..a5b8166f 100644 --- a/security/mDeleteCredentials.go +++ b/security/mDeleteCredentials.go @@ -39,7 +39,7 @@ func (s *Security) MDeleteCredentials(ids []string, options types.QueryOptions) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/mDeleteCredentials_test.go b/security/mDeleteCredentials_test.go index 379a3be5..8ffec27f 100644 --- a/security/mDeleteCredentials_test.go +++ b/security/mDeleteCredentials_test.go @@ -33,7 +33,7 @@ func TestMDeleteCredentialsEmptyIDs(t *testing.T) { func TestMDeleteCredentialsError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/mDeleteRoles.go b/security/mDeleteRoles.go index e1b9fae2..12c32f56 100644 --- a/security/mDeleteRoles.go +++ b/security/mDeleteRoles.go @@ -39,7 +39,7 @@ func (s *Security) MDeleteRoles(ids []string, options types.QueryOptions) ([]str res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/mDeleteRoles_test.go b/security/mDeleteRoles_test.go index 2034879a..111df8b8 100644 --- a/security/mDeleteRoles_test.go +++ b/security/mDeleteRoles_test.go @@ -33,7 +33,7 @@ func TestMDeleteRolesEmptyIDs(t *testing.T) { func TestMDeleteRolesError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/mDeleteUsers.go b/security/mDeleteUsers.go index 04c59299..68112bf6 100644 --- a/security/mDeleteUsers.go +++ b/security/mDeleteUsers.go @@ -39,7 +39,7 @@ func (s *Security) MDeleteUsers(ids []string, options types.QueryOptions) ([]str res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/mDeleteUsers_test.go b/security/mDeleteUsers_test.go index d8e1b14d..83d00636 100644 --- a/security/mDeleteUsers_test.go +++ b/security/mDeleteUsers_test.go @@ -33,7 +33,7 @@ func TestMDeleteUsersEmptyIDs(t *testing.T) { func TestMDeleteUsersError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/mGetProfiles.go b/security/mGetProfiles.go index 692758cc..d9436ded 100644 --- a/security/mGetProfiles.go +++ b/security/mGetProfiles.go @@ -39,7 +39,7 @@ func (s *Security) MGetProfiles(ids []string, options types.QueryOptions) ([]*Pr res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/mGetRoles.go b/security/mGetRoles.go index ec3b4bc0..38905c5f 100644 --- a/security/mGetRoles.go +++ b/security/mGetRoles.go @@ -39,7 +39,7 @@ func (s *Security) MGetRoles(ids []string, options types.QueryOptions) ([]*Role, res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/replaceUser.go b/security/replaceUser.go index bb15e783..64286398 100644 --- a/security/replaceUser.go +++ b/security/replaceUser.go @@ -38,7 +38,7 @@ func (s *Security) ReplaceUser(id string, content json.RawMessage, options types res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/replaceUser_test.go b/security/replaceUser_test.go index 74c8f35a..6e22e041 100644 --- a/security/replaceUser_test.go +++ b/security/replaceUser_test.go @@ -41,7 +41,7 @@ func TestReplaceUserContentNull(t *testing.T) { func TestReplaceUserError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/searchProfiles.go b/security/searchProfiles.go index e703726a..31629c74 100644 --- a/security/searchProfiles.go +++ b/security/searchProfiles.go @@ -43,7 +43,7 @@ func (s *Security) SearchProfiles(body json.RawMessage, options types.QueryOptio res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/searchRoles.go b/security/searchRoles.go index 5ec694c9..eba93fea 100644 --- a/security/searchRoles.go +++ b/security/searchRoles.go @@ -43,7 +43,7 @@ func (s *Security) SearchRoles(body json.RawMessage, options types.QueryOptions) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } jsonSearchResult := &jsonRoleSearchResult{} diff --git a/security/searchRoles_test.go b/security/searchRoles_test.go index a3f73432..2b985bb6 100644 --- a/security/searchRoles_test.go +++ b/security/searchRoles_test.go @@ -29,7 +29,7 @@ import ( func TestSearchRolesError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "Unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/searchUsers.go b/security/searchUsers.go index 6f3c6534..f6fbdef8 100644 --- a/security/searchUsers.go +++ b/security/searchUsers.go @@ -43,7 +43,7 @@ func (s *Security) SearchUsers(body json.RawMessage, options types.QueryOptions) res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/updateCredentials.go b/security/updateCredentials.go index 70cf528f..bfd64863 100644 --- a/security/updateCredentials.go +++ b/security/updateCredentials.go @@ -39,7 +39,7 @@ func (s *Security) UpdateCredentials(strategy string, kuid string, body json.Raw res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/updateCredentials_test.go b/security/updateCredentials_test.go index 13d5edd2..4d7f9252 100644 --- a/security/updateCredentials_test.go +++ b/security/updateCredentials_test.go @@ -33,7 +33,7 @@ func TestUpdateCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "security", request.Controller) assert.Equal(t, "updateCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestUpdateCredentialsQueryError(t *testing.T) { func TestUpdateCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -55,7 +55,7 @@ func TestUpdateCredentialsEmptyStrategy(t *testing.T) { func TestUpdateCredentialsEmptyKuid(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/security/updateProfile.go b/security/updateProfile.go index d1930a86..665654df 100644 --- a/security/updateProfile.go +++ b/security/updateProfile.go @@ -37,7 +37,7 @@ func (s *Security) UpdateProfile(id string, body json.RawMessage, options types. res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/updateProfileMapping.go b/security/updateProfileMapping.go index bcd09103..897fe411 100644 --- a/security/updateProfileMapping.go +++ b/security/updateProfileMapping.go @@ -36,7 +36,7 @@ func (s *Security) UpdateProfileMapping(body json.RawMessage, options types.Quer res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/updateRole.go b/security/updateRole.go index 94274d58..e3216479 100644 --- a/security/updateRole.go +++ b/security/updateRole.go @@ -37,7 +37,7 @@ func (s *Security) UpdateRole(id string, body json.RawMessage, options types.Que res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/updateRoleMapping.go b/security/updateRoleMapping.go index dc3dfbe5..16bbfcab 100644 --- a/security/updateRoleMapping.go +++ b/security/updateRoleMapping.go @@ -36,7 +36,7 @@ func (s *Security) UpdateRoleMapping(body json.RawMessage, options types.QueryOp res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/updateUser.go b/security/updateUser.go index 3bcc0f69..043ff4d7 100644 --- a/security/updateUser.go +++ b/security/updateUser.go @@ -37,7 +37,7 @@ func (s *Security) UpdateUser(id string, body json.RawMessage, options types.Que res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/security/updateUserMapping.go b/security/updateUserMapping.go index 86c37acc..f5a7f534 100644 --- a/security/updateUserMapping.go +++ b/security/updateUserMapping.go @@ -36,7 +36,7 @@ func (s *Security) UpdateUserMapping(body json.RawMessage, options types.QueryOp res := <-ch - if res.Error != nil { + if res.Error.Error() != "" { return res.Error } diff --git a/security/validateCredentials.go b/security/validateCredentials.go index ae5dc95e..43e34b38 100644 --- a/security/validateCredentials.go +++ b/security/validateCredentials.go @@ -39,7 +39,7 @@ func (s *Security) ValidateCredentials(strategy string, kuid string, body json.R res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/security/validateCredentials_test.go b/security/validateCredentials_test.go index 2d840a56..bcf4ddfd 100644 --- a/security/validateCredentials_test.go +++ b/security/validateCredentials_test.go @@ -33,7 +33,7 @@ func TestValidateCredentialsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "security", request.Controller) assert.Equal(t, "validateCredentials", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -44,7 +44,7 @@ func TestValidateCredentialsQueryError(t *testing.T) { func TestValidateCredentialsEmptyStrategy(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) @@ -55,7 +55,7 @@ func TestValidateCredentialsEmptyStrategy(t *testing.T) { func TestValidateCredentialsEmptyKuid(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "unit test error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "Unit test error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/adminExists.go b/server/adminExists.go index 975c9545..6e27455a 100644 --- a/server/adminExists.go +++ b/server/adminExists.go @@ -33,7 +33,7 @@ func (s *Server) AdminExists(options types.QueryOptions) (bool, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return false, res.Error } diff --git a/server/adminExists_test.go b/server/adminExists_test.go index b3205cb0..03ca60da 100644 --- a/server/adminExists_test.go +++ b/server/adminExists_test.go @@ -33,7 +33,7 @@ func TestAdminExistsQueryError(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "adminExists", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/getAllStats.go b/server/getAllStats.go index 551378eb..fd846a7a 100644 --- a/server/getAllStats.go +++ b/server/getAllStats.go @@ -33,7 +33,7 @@ func (s *Server) GetAllStats(options types.QueryOptions) (json.RawMessage, error res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } return res.Result, nil diff --git a/server/getAllStats_test.go b/server/getAllStats_test.go index dfdb0fd6..afbfc1e2 100644 --- a/server/getAllStats_test.go +++ b/server/getAllStats_test.go @@ -33,7 +33,7 @@ func TestGetAllStatsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "server", request.Controller) assert.Equal(t, "getAllStats", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/getConfig.go b/server/getConfig.go index 52e7a8a9..8859c0e4 100644 --- a/server/getConfig.go +++ b/server/getConfig.go @@ -32,7 +32,7 @@ func (s *Server) GetConfig(options types.QueryOptions) (json.RawMessage, error) res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/server/getConfig_test.go b/server/getConfig_test.go index a698007a..9e9cab02 100644 --- a/server/getConfig_test.go +++ b/server/getConfig_test.go @@ -33,7 +33,7 @@ func TestGetConfigQueryError(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "getConfig", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/getLastStats.go b/server/getLastStats.go index 3ed13540..c9a534af 100644 --- a/server/getLastStats.go +++ b/server/getLastStats.go @@ -33,7 +33,7 @@ func (s *Server) GetLastStats(options types.QueryOptions) (json.RawMessage, erro res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/server/getLastStats_test.go b/server/getLastStats_test.go index 4d4b4a9e..be941109 100644 --- a/server/getLastStats_test.go +++ b/server/getLastStats_test.go @@ -33,7 +33,7 @@ func TestGetLastStatsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "server", request.Controller) assert.Equal(t, "getLastStats", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/getStats.go b/server/getStats.go index 8267621e..666effba 100644 --- a/server/getStats.go +++ b/server/getStats.go @@ -48,7 +48,7 @@ func (s *Server) GetStats(startTime *time.Time, stopTime *time.Time, options typ res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/server/getStats_test.go b/server/getStats_test.go index 153d1f2a..0b85ebc5 100644 --- a/server/getStats_test.go +++ b/server/getStats_test.go @@ -34,7 +34,7 @@ func TestGetStatsQueryError(t *testing.T) { json.Unmarshal(query, &request) assert.Equal(t, "server", request.Controller) assert.Equal(t, "getLastStats", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/info.go b/server/info.go index 03717897..e60b935d 100644 --- a/server/info.go +++ b/server/info.go @@ -32,7 +32,7 @@ func (s *Server) Info(options types.QueryOptions) (json.RawMessage, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return nil, res.Error } diff --git a/server/info_test.go b/server/info_test.go index bbda6aea..037bba03 100644 --- a/server/info_test.go +++ b/server/info_test.go @@ -33,7 +33,7 @@ func TestInfoQueryError(t *testing.T) { assert.Equal(t, "server", request.Controller) assert.Equal(t, "info", request.Action) - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/server/now.go b/server/now.go index 0b5bcca2..881a76d5 100644 --- a/server/now.go +++ b/server/now.go @@ -32,7 +32,7 @@ func (s *Server) Now(options types.QueryOptions) (int, error) { res := <-result - if res.Error != nil { + if res.Error.Error() != "" { return -1, res.Error } diff --git a/server/now_test.go b/server/now_test.go index f4035446..f6adbf0d 100644 --- a/server/now_test.go +++ b/server/now_test.go @@ -29,7 +29,7 @@ import ( func TestNowQueryError(t *testing.T) { c := &internal.MockedConnection{ MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - return &types.KuzzleResponse{Error: &types.KuzzleError{Message: "error"}} + return &types.KuzzleResponse{Error: types.KuzzleError{Message: "error"}} }, } k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/types/kuzzle_response.go b/types/kuzzle_response.go index b6b1cc6a..22ffb077 100644 --- a/types/kuzzle_response.go +++ b/types/kuzzle_response.go @@ -68,7 +68,7 @@ type ( Channel string `json:"channel"` Timestamp int `json:"timestamp"` Status int `json:"status"` - Error *KuzzleError `json:"error"` + Error KuzzleError `json:"error"` } // KuzzleResponse is a response to a KuzzleRequest @@ -83,7 +83,7 @@ type ( RoomId string `json:"room"` Channel string `json:"channel"` Status int `json:"status"` - Error *KuzzleError `json:"error"` + Error KuzzleError `json:"error"` } SpecificationField struct { @@ -263,7 +263,7 @@ type ( } ) -func (e *KuzzleError) Error() string { +func (e KuzzleError) Error() string { msg := e.Message if len(e.Stack) > 0 { @@ -278,8 +278,8 @@ func (e *KuzzleError) Error() string { } // NewError instanciates a new KuzzleError -func NewError(msg string, status ...int) *KuzzleError { - err := &KuzzleError{Message: msg} +func NewError(msg string, status ...int) KuzzleError { + err := KuzzleError{Message: msg} if len(status) == 1 { err.Status = status[0] From b3b4bf750d87f4c9eab1c097a996bd23ead237a4 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 17:54:43 +0200 Subject: [PATCH 189/363] add namespace --- internal/wrappers/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index e39b4cbc..91f3437e 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -108,7 +108,7 @@ swig_python: swig_csharp: mkdir -p $(OUTDIR) - $(SWIG) -Wall -c++ -csharp -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i + $(SWIG) -Wall -c++ -csharp -namespace kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i makedir: @@ -131,7 +131,7 @@ java: makedir core_java swig_java wrapper_java java_object csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object mcs -t:library $(OUTDIR)/*.cs -out:$(OUTDIR)/libkuzzle-csharp.dll - rm -f $(OUTDIR)/*.cs + #rm -f $(OUTDIR)/*.cs python: LANGINCLUDE = $(PYTHONINCLUDE) python: OUTDIR = $(ROOTOUTDIR)/python From e939d926b9a127084c6a9dc9718d7e930e652b0d Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 18:03:10 +0200 Subject: [PATCH 190/363] c# namespace --- internal/wrappers/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 91f3437e..6c7496df 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -130,8 +130,8 @@ java: makedir core_java swig_java wrapper_java java_object csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object - mcs -t:library $(OUTDIR)/*.cs -out:$(OUTDIR)/libkuzzle-csharp.dll - #rm -f $(OUTDIR)/*.cs + mcs -t:library $(OUTDIR)/*.cs -namespace io.kuzzle.sdk -out:$(OUTDIR)/libkuzzle-csharp.dll + rm -f $(OUTDIR)/*.cs python: LANGINCLUDE = $(PYTHONINCLUDE) python: OUTDIR = $(ROOTOUTDIR)/python From 13701a2e0899e292e11a3579aeb5118d65d379ae Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 18:04:57 +0200 Subject: [PATCH 191/363] c# namespace --- internal/wrappers/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 6c7496df..1095dc7d 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -108,7 +108,7 @@ swig_python: swig_csharp: mkdir -p $(OUTDIR) - $(SWIG) -Wall -c++ -csharp -namespace kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i + $(SWIG) -Wall -c++ -csharp -namespace io.kuzzle.sdk -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i makedir: @@ -130,7 +130,7 @@ java: makedir core_java swig_java wrapper_java java_object csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object - mcs -t:library $(OUTDIR)/*.cs -namespace io.kuzzle.sdk -out:$(OUTDIR)/libkuzzle-csharp.dll + mcs -t:library $(OUTDIR)/*.cs -out:$(OUTDIR)/libkuzzle-csharp.dll rm -f $(OUTDIR)/*.cs python: LANGINCLUDE = $(PYTHONINCLUDE) From cad8f50a59626fcb893a32cc04ede12b26c106b0 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 19:46:39 +0200 Subject: [PATCH 192/363] update test --- internal/wrappers/Makefile | 4 ++-- internal/wrappers/templates/csharp/test.cs | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 1095dc7d..b7fdde56 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -108,7 +108,7 @@ swig_python: swig_csharp: mkdir -p $(OUTDIR) - $(SWIG) -Wall -c++ -csharp -namespace io.kuzzle.sdk -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i + $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i makedir: @@ -130,7 +130,7 @@ java: makedir core_java swig_java wrapper_java java_object csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object - mcs -t:library $(OUTDIR)/*.cs -out:$(OUTDIR)/libkuzzle-csharp.dll + mcs -t:library $(OUTDIR)/*.cs -sdk:2 -out:$(OUTDIR)/libkuzzle-csharp.dll rm -f $(OUTDIR)/*.cs python: LANGINCLUDE = $(PYTHONINCLUDE) diff --git a/internal/wrappers/templates/csharp/test.cs b/internal/wrappers/templates/csharp/test.cs index 384b0880..054280f3 100644 --- a/internal/wrappers/templates/csharp/test.cs +++ b/internal/wrappers/templates/csharp/test.cs @@ -1,10 +1,13 @@ using System; +using Kuzzleio; public class Example { + public static Kuzzle k; + public static void Main() { - Kuzzle k = new Kuzzle("localhost"); - Console.WriteLine(k.server.now()); + k = new Kuzzle("localhost", null); + k.server.now(); } } \ No newline at end of file From 5e0b4f6332480f52a481c73e9814b28f3c1a989d Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 31 May 2018 20:03:10 +0200 Subject: [PATCH 193/363] update Makefile --- internal/wrappers/Makefile | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index b7fdde56..e17e1bac 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -56,25 +56,9 @@ endif $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h -core_python: -ifeq ($(wildcard $(GOCC)),) - $(error "Unable to find go compiler") -endif - mkdir -p $(GOTARGETDIR) - cd ../../ && go get ./... ; cd - - $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) - $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) - mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h +core_python: core_java -core_csharp: -ifeq ($(wildcard $(GOCC)),) - $(error "Unable to find go compiler") -endif - mkdir -p $(GOTARGETDIR) - cd ../../ && go get ./... ; cd - - $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) - $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) - mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h +core_csharp: core_java wrapper_java: $(OBJS) From cfe571b86eb8f90031d931b3bfc41e05c8e1c966 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 1 Jun 2018 08:38:12 +0200 Subject: [PATCH 194/363] fix Makefile --- internal/wrappers/Makefile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index d65e69bc..6c127d49 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -56,15 +56,7 @@ endif $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h -core_python: -ifeq ($(wildcard $(GOCC)),) - $(error "Unable to find go compiler") -endif - mkdir -p $(GOTARGETDIR) - cd ../../ && go get ./... ; cd - - $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) - $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) - mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h +core_python: core_java wrapper_java: $(OBJS) From 91510c7debda106f9564d51710a4b98daa1fe1af Mon Sep 17 00:00:00 2001 From: Eric Trousset Date: Fri, 1 Jun 2018 10:01:39 +0200 Subject: [PATCH 195/363] feature files: split feature files by tested feature --- internal/wrappers/features/auth.feature | 44 +++++++++ internal/wrappers/features/documents.feature | 17 ++++ internal/wrappers/features/sdks.feature | 40 -------- internal/wrappers/features/sdks2.feature | 97 -------------------- 4 files changed, 61 insertions(+), 137 deletions(-) create mode 100644 internal/wrappers/features/auth.feature create mode 100644 internal/wrappers/features/documents.feature delete mode 100644 internal/wrappers/features/sdks.feature delete mode 100644 internal/wrappers/features/sdks2.feature diff --git a/internal/wrappers/features/auth.feature b/internal/wrappers/features/auth.feature new file mode 100644 index 00000000..e5e2bb57 --- /dev/null +++ b/internal/wrappers/features/auth.feature @@ -0,0 +1,44 @@ +Feature: User management + + Scenario Outline: Get a valid JWT when login + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + When I log in as : + Then the JWT is + Examples: + | user-name | user-pwd | jwt_validity | + | 'my-user-name' | 'my-user-pwd' | valid | + | 'my-user-name-w' | 'my-user-pwd' | invalid | + | 'my-user-name' | 'my-user-pwd-w' | invalid | + | 'my-user-name-w' | 'my-user-pwd-w' | invalid | + + Scenario Outline: Set user custom data (updateSelf) + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + And I log in as 'my-user-name':'my-user-pwd' + And I update my user custom data with the pair : + When I get my user info + Then the response '_source' field contains the pair : + And is a + Examples: + | fieldname | fieldvalue | type | + | my_data1 | "mystringvalue" | string | + | my_data2 | 1234 | number | + | my_data2 | -1234 | number | + | my_data2 | 1.234 | number | + | my_data2 | -1.234 | number | + | my_data1 | true | bool | + | my_data1 | false | bool | + + + Scenario: Login out shall revoke the JWT + Given Kuzzle Server is running + And there is an user with id 'my-user-id' + And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' + And I login using 'local' authentication, with and password as credentials + And the retrieved JWT is valid + When I logout + Then the JWT is no more valid + diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature new file mode 100644 index 00000000..72a5849c --- /dev/null +++ b/internal/wrappers/features/documents.feature @@ -0,0 +1,17 @@ +Feature: Create document with ids + + Scenario: Do not allow creating a document with an _id that already exist in the same collection + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + When I try to create a new document with id 'my-document-id' + Then I get an error with message 'document alread exists' + + Scenario: Allow creating a document with an _id when the _id isn't used yet + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection doesn't have a document with id 'my-document-id' + When I try to create a new document with id 'my-document-id' + Then the document is successfully created diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature deleted file mode 100644 index f457fdaa..00000000 --- a/internal/wrappers/features/sdks.feature +++ /dev/null @@ -1,40 +0,0 @@ -Feature: SDK's integration tests - - Scenario: Login user - Given I create a user "useradmin" with password "testpwd" with id "useradmin-id" - When I try to create a document with id "my-document" - Then I check if the document with id "my-document" does not exists - - When I log in as "useradmin":"testpwd" - Then I check the JWT is not null - - When I update my credentials with username "useradmin" and "foo" = "bar" - Then I check my new credentials are valid with username "useradmin", password "testpwd" and "foo" = "bar" - - When I try to create a document with id "my-document" - Then I check if the document with id "my-document" exists - - Given I logout - When I update my credentials with username "useradmin" and "foo" = "barz" - Then I check my new credentials are not valid with username "useradmin", password "testpwd" and "foo" = "barz" - Then I check the JWT is null - - Scenario: Subscribe to a collection and receive notifications - Given I subscribe to "collection" - When I create a document in "collection" - Then I receive a notification - - When I create a document in "collection" - Then I receive a notification - - Given I unsubscribe - When I create a document in "collection" - Then I do not receive a notification - - Scenario: Subscribe to a geofence filter - Given I subscribe to "geofence" collection - When I create a document in "geofence" and inside my geofence - Then I receive a "in" notification - - When I update this document to be outside my geofence - Then I receive a "out" notification \ No newline at end of file diff --git a/internal/wrappers/features/sdks2.feature b/internal/wrappers/features/sdks2.feature deleted file mode 100644 index 84cedd88..00000000 --- a/internal/wrappers/features/sdks2.feature +++ /dev/null @@ -1,97 +0,0 @@ -# SDK's integration tests -#======================== - -Feature: Create document with ids - - Scenario: Do not allow creating a document with an _id that already exist in the same collection - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - When I try to create a new document with id 'my-document-id' - Then I get an error with message 'document alread exists' - - Scenario: Allow creating a document with an _id when the _id isn't used yet - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection doesn't have a document with id 'my-document-id' - When I try to create a new document with id 'my-document-id' - Then the document is successfully created - - #Feature: User management - - Scenario Outline: Get a valid JWT when login - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - When I log in as : - Then the retrieved JWT is - Examples: - | user-name | user-pwd | jwt_validity | - | 'my-user-name' | 'my-user-pwd' | valid | - | 'my-user-name-w' | 'my-user-pwd' | invalid | - | 'my-user-name' | 'my-user-pwd-w' | invalid | - | 'my-user-name-w' | 'my-user-pwd-w' | invalid | - - Scenario Outline: Set user custom data (updateSelf) - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I log in as 'my-user-name':'my-user-pwd' - And I update my user custom data with the pair : - When I get my user info - Then the response 'content' field contains the pair : - And is a - Examples: - | fieldname | fieldvalue | type | - | my_data | 1.234 | number | - | my_data | -1.234 | number | - | my_data | "mystringvalue" | string | - | my_data | 1234 | number | - | my_data | -1234 | number | - | my_data | true | bool | - | my_data | false | bool | - - - Scenario: Login out shall revoke the JWT - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I log in as 'my-user-name':'my-user-pwd' - And the retrieved JWT is valid - When I logout - Then the retrieved JWT is invalid - - - -# Feature: Realtime subscribtion -# -# Scenario: Receive notifications when a document is created -# Given I subscribe to "collection" -# When I create a document in "collection" -# Then I receive a notification -# -# Scenario: Receive notifications when a document is deleted -# Scenario: Receive notifications when a document is updated -# Scenario: Receive notifications when a document is published -# When I create a document in "collection" -# Then I receive a notification - -# Scenario: Stop recieving notification when I unsubscribe -# Given I unsubscribe -# When I create a document in "collection" -# Then I do not receive a notification - -# Feature: Geofencing subscriptions - -# Scenario Outline: Subscribe to a geofence filter -# Given I subscribe to "geofence" collection -# When I create a document in "geofence" and inside my geofence -# Then I receive a "in" notification -# -# When I update this document to be outside my geofence -# Then I receive a "out" notification -# Examples: -# | lon | lat | in | -# | 43.6108 | 3.8767 | yes | From 3f95bb2cb863610c0803b9f46173b4502e51b713 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 1 Jun 2018 10:04:47 +0200 Subject: [PATCH 196/363] change module name --- internal/wrappers/kcore.i | 2 +- internal/wrappers/templates/java/core.i | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/wrappers/kcore.i b/internal/wrappers/kcore.i index 3eded97a..2b88794b 100644 --- a/internal/wrappers/kcore.i +++ b/internal/wrappers/kcore.i @@ -1,6 +1,6 @@ /* File : kcore.i */ -%module(directors="1") kcore +%module(directors="1") kuzzlesdk %{ #include "listeners.hpp" #include "exceptions.hpp" diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index ad674c1c..8387b24f 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -67,7 +67,7 @@ System.loadLibrary("kuzzle-wrapper-java"); } catch (UnsatisfiedLinkError e) { try { - java.io.InputStream inputStream = kcoreJNI.class.getResourceAsStream("/libkuzzle-wrapper-java.so"); + java.io.InputStream inputStream = kuzzlesdk.class.getResourceAsStream("/libkuzzle-wrapper-java.so"); java.nio.file.Path path = java.nio.file.FileSystems.getDefault().getPath("").toAbsolutePath(); String sharedObject = path.toString() + "/libs/libkuzzle-wrapper-java.so"; From cfbf4c4d50114ecae146b50dd5c2d1d989142c6e Mon Sep 17 00:00:00 2001 From: Eric <31733541+etrousset@users.noreply.github.com> Date: Fri, 1 Jun 2018 10:09:32 +0200 Subject: [PATCH 197/363] Update kuzzlesdk.h removed const long --- internal/wrappers/headers/kuzzlesdk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 7abb61ac..40615298 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -66,7 +66,7 @@ typedef struct { const char *scope; const char *state; const char *user; - const long start; + long start; long stop; long end; unsigned char bit; From 245968c3829b0340eeb3678c44fc5b3b40bc873b Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 4 Jun 2018 10:36:35 +0200 Subject: [PATCH 198/363] enhance clean rule --- internal/wrappers/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 6c127d49..2a8cf39f 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -127,7 +127,11 @@ cpp: core g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive clean: - rm -rf build/c build/java/src build/java/io build/java/build kcore_wrap.cxx kcore_wrap.h + rm -rf build/c + rm -rf build/java/src build/java/io build/java/build + rm -rf build/python + rm -rf build/cpp + rm -rf kcore_wrap.cxx kcore_wrap.h kcore_wrap.o rm -rf build/io .PHONY: all java csharp python wrapper swig clean object core From 0b3ae4d55fa10543b21f0511d0f26b205e8b46e1 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 4 Jun 2018 11:57:02 +0200 Subject: [PATCH 199/363] finalize e2e test --- internal/wrappers/Makefile | 2 +- internal/wrappers/features/auth.feature | 21 ++-- internal/wrappers/features/documents.feature | 2 +- internal/wrappers/features/realtime.feature | 42 +++++++ internal/wrappers/features/sdks.feature | 112 ------------------- 5 files changed, 51 insertions(+), 128 deletions(-) create mode 100644 internal/wrappers/features/realtime.feature delete mode 100644 internal/wrappers/features/sdks.feature diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 2a8cf39f..3e641c82 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -96,7 +96,7 @@ java: makedir core_java swig_java wrapper_java java_object mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - - rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class + #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class cp -p $(GOTARGET) $(OUTDIR) cp -p $(GOTARGETSO) $(OUTDIR) diff --git a/internal/wrappers/features/auth.feature b/internal/wrappers/features/auth.feature index e5e2bb57..ecae1dbb 100644 --- a/internal/wrappers/features/auth.feature +++ b/internal/wrappers/features/auth.feature @@ -18,27 +18,20 @@ Feature: User management And there is an user with id 'my-user-id' And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' And I log in as 'my-user-name':'my-user-pwd' - And I update my user custom data with the pair : + And I update my user custom data with the pair : When I get my user info - Then the response '_source' field contains the pair : - And is a + Then the response '_source' field contains the pair : Examples: - | fieldname | fieldvalue | type | - | my_data1 | "mystringvalue" | string | - | my_data2 | 1234 | number | - | my_data2 | -1234 | number | - | my_data2 | 1.234 | number | - | my_data2 | -1.234 | number | - | my_data1 | true | bool | - | my_data1 | false | bool | + | field-name | field-value | + | 'my_data' | 'mystringvalue' | Scenario: Login out shall revoke the JWT Given Kuzzle Server is running And there is an user with id 'my-user-id' And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I login using 'local' authentication, with and password as credentials - And the retrieved JWT is valid + And I log in as 'my-user-name':'my-user-pwd' + Then the JWT is valid When I logout - Then the JWT is no more valid + Then the JWT is invalid diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index 72a5849c..a92de44b 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -6,7 +6,7 @@ Feature: Create document with ids And it has a collection 'test-collection' And the collection has a document with id 'my-document-id' When I try to create a new document with id 'my-document-id' - Then I get an error with message 'document alread exists' + Then I get an error with message 'Document already exists' Scenario: Allow creating a document with an _id when the _id isn't used yet Given Kuzzle Server is running diff --git a/internal/wrappers/features/realtime.feature b/internal/wrappers/features/realtime.feature new file mode 100644 index 00000000..db681523 --- /dev/null +++ b/internal/wrappers/features/realtime.feature @@ -0,0 +1,42 @@ +Feature: Realtime subscription + + Scenario: Receive notifications when a document is created + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And I subscribe to 'test-collection' + When I create a document in "test-collection" + Then I receive a notification + + Scenario: Receive notifications when a document is updated + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + And I subscribe to 'test-collection' with filter '{"equals": {"foo": "barz"}}' + When I update the document with id 'my-document-id' and content 'foo' = 'barz' + Then I receive a notification + + Scenario: Receive notifications when a document is deleted + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + And I subscribe to 'test-collection' + When I delete the document with id 'my-document-id' + Then I receive a notification + + Scenario: Receive notifications when a document is published + Given Kuzzle Server is running + And I subscribe to 'test-collection' + When I publish a document + Then I receive a notification + + Scenario: Stop receiving notification when I unsubscribe + Given Kuzzle Server is running + And I subscribe to 'test-collection' + And the collection has a document with id 'my-document-id' + And I received a notification + And I unsubscribe from 'test-collection' + When I publish a document + Then I do not receive a notification \ No newline at end of file diff --git a/internal/wrappers/features/sdks.feature b/internal/wrappers/features/sdks.feature deleted file mode 100644 index 7e95d2a3..00000000 --- a/internal/wrappers/features/sdks.feature +++ /dev/null @@ -1,112 +0,0 @@ -# SDK's integration tests -#======================== - -Feature: Create document with ids - - Scenario: Do not allow creating a document with an _id that already exist in the same collection - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - When I try to create a new document with id 'my-document-id' - Then I get an error with message 'Document already exists' - - Scenario: Allow creating a document with an _id when the _id isn't used yet - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection doesn't have a document with id 'my-document-id' - When I try to create a new document with id 'my-document-id' - Then the document is successfully created - - #Feature: User management - - Scenario Outline: Get a valid JWT when login - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - When I log in as : - Then the JWT is - Examples: - | user-name | user-pwd | jwt_validity | - | 'my-user-name' | 'my-user-pwd' | valid | - | 'my-user-name-w' | 'my-user-pwd' | invalid | - | 'my-user-name' | 'my-user-pwd-w' | invalid | - | 'my-user-name-w' | 'my-user-pwd-w' | invalid | - - Scenario Outline: Set user custom data (updateSelf) - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I log in as 'my-user-name':'my-user-pwd' - And I update my user custom data with the pair : - When I get my user info - Then the response '_source' field contains the pair : - Examples: - | field-name | field-value | - | 'my_data' | 'mystringvalue' | - - Scenario: Login out shall revoke the JWT - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I log in as 'my-user-name':'my-user-pwd' - Then the JWT is valid - When I logout - Then the JWT is invalid - - #Feature: Realtime subscription - - Scenario: Receive notifications when a document is created - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And I subscribe to 'test-collection' - When I create a document in "test-collection" - Then I receive a notification - - Scenario: Receive notifications when a document is updated - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - And I subscribe to 'test-collection' with filter '{"equals": {"foo": "barz"}}' - When I update the document with id 'my-document-id' and content 'foo' = 'barz' - Then I receive a notification - - Scenario: Receive notifications when a document is deleted - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - And I subscribe to 'test-collection' - When I delete the document with id 'my-document-id' - Then I receive a notification - - Scenario: Receive notifications when a document is published - Given Kuzzle Server is running - And I subscribe to 'test-collection' - When I publish a document - Then I receive a notification - - Scenario: Stop receiving notification when I unsubscribe - Given Kuzzle Server is running - And I subscribe to 'test-collection' - And the collection has a document with id 'my-document-id' - And I received a notification - And I unsubscribe from 'test-collection' - When I publish a document - Then I do not receive a notification - -# Feature: Geofencing subscriptions - -# Scenario Outline: Subscribe to a geofence filter -# Given I subscribe to "geofence" collection -# When I create a document in "geofence" and inside my geofence -# Then I receive a "in" notification -# -# When I update this document to be outside my geofence -# Then I receive a "out" notification -# Examples: -# | lon | lat | in | -# | 43.6108 | 3.8767 | yes | From ef66e7eff7a84a84fd54deb5d786dd38383a0549 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 4 Jun 2018 12:03:07 +0200 Subject: [PATCH 200/363] update README --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 80a4a2d3..45326a6f 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,20 @@ You can also get html coverage by running ``` ### e2e tests -To run e2e tests ensure you have a kuzzle running and then run +#### JAVA + +```sh +cd internal/wrappers/features/java +gradle cucumber +``` + +#### C++ + ```sh -./internal/wrappers/features/e2e.sh +cd internal/wrappers +./build_cpp_tests.sh̀ +./_build_cpp_tests/KuzzleSDKStepDefs & +cucumber features/*.features ``` ## Wrappers @@ -89,7 +100,7 @@ make java You will find the final jars files in `internal/wrappers/build/java/build/libs` -## CP +## CPP ```sh make cpp From f357de79899b56afe89b89b50c83bf684a215b7a Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 4 Jun 2018 14:29:33 +0200 Subject: [PATCH 201/363] wip --- internal/wrappers/features/auth.feature | 2 -- internal/wrappers/features/index.feature | 12 ++++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 internal/wrappers/features/index.feature diff --git a/internal/wrappers/features/auth.feature b/internal/wrappers/features/auth.feature index ecae1dbb..0c447aeb 100644 --- a/internal/wrappers/features/auth.feature +++ b/internal/wrappers/features/auth.feature @@ -25,7 +25,6 @@ Feature: User management | field-name | field-value | | 'my_data' | 'mystringvalue' | - Scenario: Login out shall revoke the JWT Given Kuzzle Server is running And there is an user with id 'my-user-id' @@ -34,4 +33,3 @@ Feature: User management Then the JWT is valid When I logout Then the JWT is invalid - diff --git a/internal/wrappers/features/index.feature b/internal/wrappers/features/index.feature new file mode 100644 index 00000000..a109092f --- /dev/null +++ b/internal/wrappers/features/index.feature @@ -0,0 +1,12 @@ +Feature: Index controller + + Scenario: Create should create an index + Given Kuzzle Server is running + When I create an index called 'test-index' + Then the index should exists + + Scenario: Create should return an error when the index already exists + Given Given Kuzzle Server is running + And there is an index 'test-index' + When I create an index called 'test-index' + Then I get an error \ No newline at end of file From 0f525d082e21d0f1b3e357fe9c003b6d1d589f7f Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 5 Jun 2018 12:49:42 +0200 Subject: [PATCH 202/363] wip --- document/get.go | 15 +-- internal/wrappers/cgo/kuzzle/document.go | 3 +- internal/wrappers/cpp/realtime.cpp | 7 +- internal/wrappers/features/documents.feature | 55 ++++++++- .../java/gradle/cucumber/Documentdefs.java | 112 ++++++++++++++++-- 5 files changed, 166 insertions(+), 26 deletions(-) diff --git a/document/get.go b/document/get.go index 1cd4fd90..7da96e0b 100644 --- a/document/get.go +++ b/document/get.go @@ -21,17 +21,17 @@ import ( ) // Get retrieves a Document using its provided unique id. -func (d *Document) Get(index string, collection string, _id string, options types.QueryOptions) (string, error) { +func (d *Document) Get(index string, collection string, _id string, options types.QueryOptions) (json.RawMessage, error) { if index == "" { - return "", types.NewError("Document.Get: index required", 400) + return nil, types.NewError("Document.Get: index required", 400) } if collection == "" { - return "", types.NewError("Document.Get: collection required", 400) + return nil, types.NewError("Document.Get: collection required", 400) } if _id == "" { - return "", types.NewError("Document.Get: id required", 400) + return nil, types.NewError("Document.Get: id required", 400) } ch := make(chan *types.KuzzleResponse) @@ -49,11 +49,8 @@ func (d *Document) Get(index string, collection string, _id string, options type res := <-ch if res.Error.Error() != "" { - return "", res.Error + return nil, res.Error } - var doc string - json.Unmarshal(res.Result, &doc) - - return doc, nil + return res.Result, nil } diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index 0da39dae..6ae28aae 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -92,7 +92,8 @@ func kuzzle_document_delete_by_query(d *C.document, index *C.char, collection *C //export kuzzle_document_get func kuzzle_document_get(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.query_options) *C.string_result { res, err := (*document.Document)(d.instance).Get(C.GoString(index), C.GoString(collection), C.GoString(id), SetQueryOptions(options)) - return goToCStringResult(&res, err) + s := string(res) + return goToCStringResult(&s, err) } //export kuzzle_document_replace diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index 28a3a6c2..d2500eb1 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -30,7 +30,12 @@ namespace kuzzleio { } void call_subscribe_cb(notification_result* res, void* data) { - ((Realtime*)data)->getListener(res->room_id)->onMessage(res); + if (data) { + NotificationListener *listener = ((Realtime*)data)->getListener(res->room_id); + if (listener) { + listener->onMessage(res); + } + } } void Realtime::join(const std::string& index, const std::string collection, const std::string roomId, room_options* options, NotificationListener* cb) Kuz_Throw_KuzzleException { diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index a92de44b..9d8712db 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -1,17 +1,64 @@ -Feature: Create document with ids +Feature: Document management Scenario: Do not allow creating a document with an _id that already exist in the same collection Given Kuzzle Server is running And there is an index 'test-index' And it has a collection 'test-collection' And the collection has a document with id 'my-document-id' - When I try to create a new document with id 'my-document-id' + When I create a document with id 'my-document-id' Then I get an error with message 'Document already exists' - Scenario: Allow creating a document with an _id when the _id isn't used yet + Scenario: Create a document with create Given Kuzzle Server is running And there is an index 'test-index' And it has a collection 'test-collection' And the collection doesn't have a document with id 'my-document-id' - When I try to create a new document with id 'my-document-id' + When I create a document with id 'my-document-id' Then the document is successfully created + + Scenario: Create a document with createOrReplace if it does not exists + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection doesn't have a document with id 'my-document-id' + When I createOrReplace a document with id 'my-document-id' + Then the document is successfully created + + Scenario: Replace a document if it exists + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I createOrReplace a document with id 'my-document-id' + Then the document is successfully replaced + + Scenario: Replace a document + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'replace-my-document-id' + When I replace a document with id 'replace-my-document-id' + Then the document is successfully replaced + + Scenario: Delete a document + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'delete-my-document-id' + When I delete the document with id 'delete-my-document-id' + Then the document is successfully deleted + + Scenario: Update a document + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'update-my-document-id' + When I update a document with id 'update-my-document-id' + Then the document is successfully updated + + Scenario: Search a document by id + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'search-my-document-id' + When I search a document with id 'search-my-document-id' + Then the document is successfully found \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index e0aa4f23..bef1558d 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -1,17 +1,24 @@ package gradle.cucumber; +import cucumber.api.java.After; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; -import io.kuzzle.sdk.BadRequestException; -import io.kuzzle.sdk.Kuzzle; -import io.kuzzle.sdk.QueryOptions; +import gherkin.deps.com.google.gson.Gson; +import gherkin.deps.com.google.gson.JsonObject; +import io.kuzzle.sdk.*; import org.junit.Assert; public class Documentdefs { private Kuzzle k; private String errorMessage; private World world; + private String documentId; + private SearchResult documents; + + class Source { + JsonObject _source; + } @Given("^Kuzzle Server is running$") public void kuzzle_Server_is_running() throws Exception { @@ -41,6 +48,7 @@ public void the_collection_has_a_document_with_id(String id) throws Exception { try { k.getDocument().create(world.index, world.collection, id, "{\"foo\":\"bar\"}", options); + this.documentId = id; } catch (BadRequestException e) { if (!e.getMessage().equals("Document already exists")) { throw e; @@ -48,11 +56,13 @@ public void the_collection_has_a_document_with_id(String id) throws Exception { } } - @When("^I try to create a new document with id \'([^\"]*)\'$") + @When("^I create a document with id \'([^\"]*)\'$") public void i_try_to_create_a_new_document_with_id(String id) throws Exception { this.errorMessage = null; try { k.getDocument().create(world.index, world.collection, id, "{\"foo\": \"bar\"}"); + this.documentId = id; + this.errorMessage = null; } catch (BadRequestException e) { this.errorMessage = e.getMessage(); } @@ -63,6 +73,41 @@ public void i_get_an_error_with_message(String message) throws Exception { Assert.assertEquals(message, this.errorMessage); } + @Then("^the document is successfully created$") + public void the_document_is_successfully_created() throws Exception { + Assert.assertNull(this.errorMessage); + } + + @When("^I update the document with id \'([^\"]*)\' and content \'([^\"]*)\' = \'([^\"]*)\'$") + public void i_update_the_document_with_id_and_content(String id, String key, String value) throws Exception { + QueryOptions options = new QueryOptions(); + options.setRefresh("wait_for"); + + k.getDocument().update(world.index, world.collection, id, "{\""+key+"\":\""+value+"\"}"); + } + + @When("^I createOrReplace a document with id \'([^\"]*)\'$") + public void i_createOrReplace_a_new_document_with_id(String id) throws Exception { + this.errorMessage = null; + try { + k.getDocument().createOrReplace(world.index, world.collection, id, "{\"foo\": \"barz\"}"); + this.documentId = id; + this.errorMessage = null; + } catch (BadRequestException e) { + this.errorMessage = e.getMessage(); + } + } + + @Then("^the document is successfully replaced$") + public void the_document_is_successfully_replaced() throws Exception { + String doc = k.getDocument().get(world.index, world.collection, this.documentId); + Assert.assertNull(this.errorMessage); + + Gson gson = new Gson(); + Source s = gson.fromJson(doc, Source.class); + Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + } + @Given("^the collection doesn't have a document with id \'([^\"]*)\'$") public void the_collection_doesn_t_have_a_document_with_id(String id) throws Exception { QueryOptions options = new QueryOptions(); @@ -71,16 +116,61 @@ public void the_collection_doesn_t_have_a_document_with_id(String id) throws Exc k.getDocument().delete_(world.index, world.collection, id, options); } - @Then("^the document is successfully created$") - public void the_document_is_successfully_created() throws Exception { + @When("^I replace a document with id \'([^\"]*)\'$") + public void i_replace_a_document_with_id(String id) throws Exception { + this.errorMessage = null; + try { + k.getDocument().replace(world.index, world.collection, id, "{\"foo\": \"barz\"}"); + this.documentId = id; + } catch (BadRequestException e) { + this.errorMessage = e.getMessage(); + } + } + + @When("^I delete a document with id \'([^\"]*)\'$") + public void i_delete_a_document_with_id(String id) throws Exception { + this.errorMessage = null; + try { + k.getDocument().delete_(world.index, world.collection, id); + } catch (KuzzleException e) { + this.errorMessage = e.getMessage(); + } + } + + @Then("^the document is successfully deleted") + public void the_document_is_successfully_deleted() throws Exception { Assert.assertNull(this.errorMessage); } - @When("^I update the document with id \'([^\"]*)\' and content \'([^\"]*)\' = \'([^\"]*)\'$") - public void i_update_the_document_with_id_and_content(String id, String key, String value) throws Exception { - QueryOptions options = new QueryOptions(); - options.setRefresh("wait_for"); + @When("^I update a document with id \'([^\"]*)\'$") + public void i_update_a_document_with_id(String id) throws Exception { + this.errorMessage = null; + try { + k.getDocument().update(world.index, world.collection, id, "{\"foo\": \"barz\"}"); + this.documentId = id; + } catch (BadRequestException e) { + this.errorMessage = e.getMessage(); + } + } - k.getDocument().update(world.index, world.collection, id, "{\""+key+"\":\""+value+"\"}"); + @Then("^the document is successfully updated") + public void the_document_is_successfully_updated() throws Exception { + String doc = k.getDocument().get(world.index, world.collection, this.documentId); + Assert.assertNull(this.errorMessage); + + Gson gson = new Gson(); + Source s = gson.fromJson(doc, Source.class); + Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + } + + @When("^I search a document with id \'([^\"]*)\'$") + public void i_search_a_document_with_id(String id) throws Exception { + this.errorMessage = null; + try { + String document = k.getDocument().search(world.index, world.collection, id, "{\"foo\": \"barz\"}"); + this.document = id; + } catch (BadRequestException e) { + this.errorMessage = e.getMessage(); + } } } From 3ffdefaa6f35c090d25373e07eec7e68e7e6ae58 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 5 Jun 2018 13:37:56 +0200 Subject: [PATCH 203/363] wip --- README.md | 18 ++- internal/wrappers/Makefile | 180 +++++++++++----------- internal/wrappers/templates/csharp/core.i | 7 + 3 files changed, 111 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index 10dd7897..520f904b 100644 --- a/README.md +++ b/README.md @@ -104,10 +104,20 @@ You will find the final .so file in `internal/wrappers/build/python` ## CSHARP -```sh -make csharp -``` -You will find the final .dll file in `internal/wrappers/build/csharp` +### Build on Windows + +#### Prerequisites +- Visual Studio 2017 +- Windows SDK +- Go - https://golang.org/doc/install +- Mono (x64) - https://www.mono-project.com/download/stable/ +- Make (GNU - Windows) - http://gnuwin32.sourceforge.net/packages/make.htm +- MinGW (x64 - Posix) - https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/ + +#### Compiling Csharp +- Add Go/Mono/Make/MinGW intallation directory to PATH +- Run Visual Studio developper command line tool +- Execute `make csharp` ## All at once diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index e17e1bac..ac620dc8 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -1,17 +1,40 @@ ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +ifeq ($(OS),Windows_NT) + STATICLIB := .lib + DYNLIB := .dll + GOROOT ?= C:/Go + GOCC ?= $(GOROOT)bin\go + SEP = \\ + RM = del /Q /F + RRM = rmdir /Q /S + MV = rename + MKDIR = mkdir + CMDSEP=& + ROOT_DIR_CLEAN = $(subst /,\\,$(ROOT_DIR)) +else + STATICLIB := .a + DYNLIB := .so + GOROOT ?= /usr/local/go + GOCC ?= $(GOROOT)/bin/go + SEP = \ + RM = rm -f + RRM = rm -f -r + MV = mv -f + MKDIR = mkdir -p + CMDSEP=; + ROOT_DIR_CLEAN = $(ROOT_DIR) +endif +PATHSEP = $(strip $(SEP)) ROOTOUTDIR = $(ROOT_DIR)build -GOROOT ?= /usr/local/go -GOCC = $(GOROOT)/bin/go JAVA_HOME ?= /usr/local PYTHON_INCLUDE_DIR ?= `pkg-config --cflags python3` GOFLAGS = -buildmode=c-archive -GOSRC = ./cgo/kuzzle/ +GOSRC = .$(PATHSEP)cgo$(PATHSEP)kuzzle$(PATHSEP) GOTARGETDIR = $(ROOTOUTDIR)/c -GOTARGET = $(GOTARGETDIR)/libkuzzlesdk.a -GOTARGETSO = $(GOTARGETDIR)/libkuzzlesdk.so +GOTARGET = $(GOTARGETDIR)$(PATHSEP)libkuzzlesdk$(STATICLIB) +GOTARGETSO = $(GOTARGETDIR)$(PATHSEP)libkuzzlesdk$(DYNLIB) CPPDIR = $(ROOT_DIR)cpp HEADERSDIR = $(ROOT_DIR)headers - CPP = $(CXX) CPPFLAGS = -g -fPIC INCS = -I$(HEADERSDIR) -I$(CPPDIR) -I$(ROOT_DIR)templates -I$(GOTARGETDIR) @@ -19,128 +42,105 @@ LDFLAGS = -L$(GOTARGETDIR) LIBS = -lkuzzlesdk SRCS = kcore_wrap.cxx OBJS = $(SRCS:.cxx=.o) - JAVAINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux PYTHONINCLUDE = $(PYTHON_INCLUDE_DIR) -I$(ROOT_DIR)templates/python - CPP_SDK_SRCS = kuzzle.cpp \ - document.cpp \ - collection.cpp \ - realtime.cpp \ - auth.cpp \ - server.cpp \ - index.cpp - + document.cpp \ + collection.cpp \ + realtime.cpp \ + auth.cpp \ + server.cpp \ + index.cpp CPPSRCS = $(CPP_SDK_SRCS) \ - kcore_wrap.cxx - + kcore_wrap.cxx CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) - SWIG = swig - all: python java csharp - kcore_wrap.o: kcore_wrap.cxx - $(CPP) -c $< -o $@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) - + $(CPP) -c $< -o $@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) %.o: cpp/%.cpp - $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) -I./headers -I./build/c/ -L./build/c -lkuzzlesdk - + $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) -I./headers -I./build/c/ -L./build/c -lkuzzlesdk core_java: -ifeq ($(wildcard $(GOCC)),) - $(error "Unable to find go compiler") + cd ..$(PATHSEP)..$(PATHSEP) && go get .$(PATHSEP)... $(CMDSEP) cd internal$(PATHSEP)wrappers + $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) + $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) +ifeq ($(OS),Windows_NT) + $(MV) $(subst /,\\,$(GOTARGETDIR)$(PATHSEP)libkuzzlesdk.h) kuzzle.h +else + $(MV) $(GOTARGETDIR)$(PATHSEP)libkuzzlesdk.h $(GOTARGETDIR)$(PATHSEP)kuzzle.h endif - mkdir -p $(GOTARGETDIR) - cd ../../ && go get ./... ; cd - - $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) - $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) - mv -f $(GOTARGETDIR)/libkuzzlesdk.h $(GOTARGETDIR)/kuzzle.h - core_python: core_java - core_csharp: core_java - wrapper_java: $(OBJS) - wrapper_python: $(OBJS) - wrapper_csharp: $(OBJS) - java_object: - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-java.so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(JAVAINCLUDE) - strip $(OUTDIR)/libkuzzle-wrapper-java.so - + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-java$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(JAVAINCLUDE) + strip $(OUTDIR)/libkuzzle-wrapper-java$(DYNLIB) python_object: - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-python.so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(PYTHONINCLUDE) - strip $(OUTDIR)/libkuzzle-wrapper-python.so - + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-python$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(PYTHONINCLUDE) + strip $(OUTDIR)/libkuzzle-wrapper-python$(DYNLIB) csharp_object: - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-csharp.so $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) - strip $(OUTDIR)/libkuzzle-wrapper-csharp.so - +ifeq ($(OS),Windows_NT) + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) -lWinmm -lntdll -lWS2_32 +else + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) +endif + strip $(OUTDIR)/libkuzzle-wrapper-csharp$(DYNLIB) swig: - mkdir -p $(OUTDIR) - $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i - + $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i swig_java: - mkdir -p $(OUTDIR) - $(SWIG) -Wall -c++ -java -package io.kuzzle.sdk -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(JAVAINCLUDE) templates/java/core.i - + $(SWIG) -Wall -c++ -java -package io.kuzzle.sdk -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(JAVAINCLUDE) templates/java/core.i swig_python: - mkdir -p $(OUTDIR) - $(SWIG) -Wall -c++ -python -py3 -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(PYTHONINCLUDE) templates/python/core.i - + $(SWIG) -Wall -c++ -python -py3 -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(PYTHONINCLUDE) templates/python/core.i swig_csharp: - mkdir -p $(OUTDIR) - $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i - - + $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i makedir: - mkdir -p $(OUTDIR) - +ifeq ($(OS),Windows_NT) + @if not exist $(subst /,\\,$(OUTDIR)) mkdir $(subst /,\\,$(OUTDIR)) + @if not exist $(ROOT_DIR_CLEAN) mkdir $(ROOT_DIR_CLEAN) +else + mkdir $(ROOT_DIR_CLEAN) + mkdir $(OUTDIR) +endif java: LANGINCLUDE = $(JAVAINCLUDE) java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk java: makedir core_java swig_java wrapper_java java_object - #rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so - taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources - mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources - mkdir -p $(ROOTOUTDIR)/java/src/main/java - ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ - cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - - rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class - cp -p $(GOTARGET) $(OUTDIR) - cp -p $(GOTARGETSO) $(OUTDIR) - +#rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so + taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java + mkdir $(ROOTOUTDIR)/io/kuzzle/sdk/resources + mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources + mkdir $(ROOTOUTDIR)/java/src/main/java + ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ + cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - + rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class + cp -p $(GOTARGET) $(OUTDIR) + cp -p $(GOTARGETSO) $(OUTDIR) csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object - mcs -t:library $(OUTDIR)/*.cs -sdk:2 -out:$(OUTDIR)/libkuzzle-csharp.dll - rm -f $(OUTDIR)/*.cs - + mcs -t:library $(OUTDIR)/*.cs -sdk:2 -out:$(OUTDIR)/libkuzzle-csharp$(DYNLIB) + $(RM) -f $(OUTDIR)/*.cs python: LANGINCLUDE = $(PYTHONINCLUDE) python: OUTDIR = $(ROOTOUTDIR)/python python: CC = g++ python: CFLAGS = -fPIC python: makedir core_python swig_python wrapper_python python_object - cp $(ROOT_DIR)templates/python/*.py $(OUTDIR) - cp $(ROOT_DIR)$(SRCS) $(OUTDIR)/ - cp $(ROOT_DIR)kcore_wrap.h $(OUTDIR)/ - python3 $(OUTDIR)/setup.py build_ext -I $(HEADERSDIR):$(CPPDIR):$(OUTDIR):$(GOTARGETDIR):$(OUTDIR)/templates/python -L $(OUTDIR):$(GOTARGETDIR) -R $(GOTARGETDIR) -l kuzzlesdk -b $(OUTDIR) -t $(OUTDIR)/tmp - cp -p $(GOTARGET) $(OUTDIR) - cp -p $(GOTARGETSO) $(OUTDIR) - + cp $(ROOT_DIR)templates/python/*.py $(OUTDIR) + cp $(ROOT_DIR)$(SRCS) $(OUTDIR)/ + cp $(ROOT_DIR)kcore_wrap.h $(OUTDIR)/ + python3 $(OUTDIR)/setup.py build_ext -I $(HEADERSDIR):$(CPPDIR):$(OUTDIR):$(GOTARGETDIR):$(OUTDIR)/templates/python -L $(OUTDIR):$(GOTARGETDIR) -R $(GOTARGETDIR) -l kuzzlesdk -b $(OUTDIR) -t $(OUTDIR)/tmp + cp -p $(GOTARGET) $(OUTDIR) + cp -p $(GOTARGETSO) $(OUTDIR) cpp: OUTDIR = $(ROOTOUTDIR)/cpp cpp: makedir $(CPPSDK) cpp: LANGUAGE = c++ cpp: core - ar rvs $(OUTDIR)/libcpp.a $(OUTDIR)/*.o - g++ -shared -fPIC -o $(OUTDIR)/libcpp.so -Wl,--whole-archive $(OUTDIR)/libcpp.a build/c/libkuzzlesdk.a -Wl,--no-whole-archive - + ar rvs $(OUTDIR)/libcpp$(STATICLIB) $(OUTDIR)/*.o + g++ -shared -fPIC -o $(OUTDIR)/libcpp$(DYNLIB) -Wl,--whole-archive $(OUTDIR)/libcpp$(STATICLIB) build/c/libkuzzlesdk$(STATICLIB) -Wl,--no-whole-archive clean: - rm -rf build/c build/java/src build/java/io build/java/build kcore_wrap.cxx kcore_wrap.h build/csharp build/python - rm -rf build/io - + $(RM) kcore_wrap.cxx + $(RM) kcore_wrap.h + $(RRM) build$(PATHSEP)c build$(PATHSEP)java$(PATHSEP)src build$(PATHSEP)java$(PATHSEP)io build$(PATHSEP)java$(PATHSEP)build build$(PATHSEP)csharp build$(PATHSEP)python + $(RRM) build$(PATHSEP)java .PHONY: all java csharp python wrapper swig clean object core - - .DEFAULT_GOAL := all diff --git a/internal/wrappers/templates/csharp/core.i b/internal/wrappers/templates/csharp/core.i index 7782f0f2..8cd4e630 100644 --- a/internal/wrappers/templates/csharp/core.i +++ b/internal/wrappers/templates/csharp/core.i @@ -27,6 +27,13 @@ %rename(SubscribeToSelf) subscribe_to_self; %rename(Mapping, match="class") mapping; +%rename(_auth, match="class") auth; +%rename(_kuzzle, match="class) kuzzle; +%rename(_realtime, match="class) realtime; +%rename(_collection, match="class) collection; +%rename(_document, match="class) document; +%rename(_server, match="class) server; + %ignore *::error; %ignore *::status; %ignore *::stack; From d777686fa23e12170ad45df573602f3d6442a631 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 5 Jun 2018 13:40:19 +0200 Subject: [PATCH 204/363] csharp sdk for windows --- internal/wrappers/Makefile | 40 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index ac620dc8..7c4d9f4a 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -5,12 +5,13 @@ ifeq ($(OS),Windows_NT) GOROOT ?= C:/Go GOCC ?= $(GOROOT)bin\go SEP = \\ - RM = del /Q /F - RRM = rmdir /Q /S + RM = del /Q /F /S + RRM = rmdir /S /Q MV = rename MKDIR = mkdir CMDSEP=& - ROOT_DIR_CLEAN = $(subst /,\\,$(ROOT_DIR)) + ROOT_DIR_CLEAN = $(subst /,\,$(ROOT_DIR)) + LIB_PREFIX = else STATICLIB := .a DYNLIB := .so @@ -23,6 +24,7 @@ else MKDIR = mkdir -p CMDSEP=; ROOT_DIR_CLEAN = $(ROOT_DIR) + LIB_PREFIX = lib endif PATHSEP = $(strip $(SEP)) ROOTOUTDIR = $(ROOT_DIR)build @@ -31,8 +33,8 @@ PYTHON_INCLUDE_DIR ?= `pkg-config --cflags python3` GOFLAGS = -buildmode=c-archive GOSRC = .$(PATHSEP)cgo$(PATHSEP)kuzzle$(PATHSEP) GOTARGETDIR = $(ROOTOUTDIR)/c -GOTARGET = $(GOTARGETDIR)$(PATHSEP)libkuzzlesdk$(STATICLIB) -GOTARGETSO = $(GOTARGETDIR)$(PATHSEP)libkuzzlesdk$(DYNLIB) +GOTARGET = $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk$(STATICLIB) +GOTARGETSO = $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk$(DYNLIB) CPPDIR = $(ROOT_DIR)cpp HEADERSDIR = $(ROOT_DIR)headers CPP = $(CXX) @@ -65,9 +67,9 @@ core_java: $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) ifeq ($(OS),Windows_NT) - $(MV) $(subst /,\\,$(GOTARGETDIR)$(PATHSEP)libkuzzlesdk.h) kuzzle.h + $(MV) $(subst /,\,$(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk.h) kuzzle.h else - $(MV) $(GOTARGETDIR)$(PATHSEP)libkuzzlesdk.h $(GOTARGETDIR)$(PATHSEP)kuzzle.h + $(MV) $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk.h $(GOTARGETDIR)$(PATHSEP)kuzzle.h endif core_python: core_java core_csharp: core_java @@ -75,18 +77,18 @@ wrapper_java: $(OBJS) wrapper_python: $(OBJS) wrapper_csharp: $(OBJS) java_object: - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-java$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(JAVAINCLUDE) - strip $(OUTDIR)/libkuzzle-wrapper-java$(DYNLIB) + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-java$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(JAVAINCLUDE) + strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-java$(DYNLIB) python_object: - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-python$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(PYTHONINCLUDE) - strip $(OUTDIR)/libkuzzle-wrapper-python$(DYNLIB) + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-python$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(PYTHONINCLUDE) + strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-python$(DYNLIB) csharp_object: ifeq ($(OS),Windows_NT) - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) -lWinmm -lntdll -lWS2_32 + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) -lWinmm -lntdll -lWS2_32 else - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/libkuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) endif - strip $(OUTDIR)/libkuzzle-wrapper-csharp$(DYNLIB) + strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) swig: $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i swig_java: @@ -97,7 +99,7 @@ swig_csharp: $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i makedir: ifeq ($(OS),Windows_NT) - @if not exist $(subst /,\\,$(OUTDIR)) mkdir $(subst /,\\,$(OUTDIR)) + @if not exist $(subst /,\,$(OUTDIR)) mkdir $(subst /,\,$(OUTDIR)) @if not exist $(ROOT_DIR_CLEAN) mkdir $(ROOT_DIR_CLEAN) else mkdir $(ROOT_DIR_CLEAN) @@ -109,7 +111,7 @@ java: makedir core_java swig_java wrapper_java java_object #rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java mkdir $(ROOTOUTDIR)/io/kuzzle/sdk/resources - mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources + mv build/java/io/kuzzle/sdk/$(LIB_PREFIX)kuzzle-wrapper-java.so build/io/kuzzle/sdk/resources mkdir $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - @@ -118,8 +120,8 @@ java: makedir core_java swig_java wrapper_java java_object cp -p $(GOTARGETSO) $(OUTDIR) csharp: OUTDIR = $(ROOTOUTDIR)/csharp csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object - mcs -t:library $(OUTDIR)/*.cs -sdk:2 -out:$(OUTDIR)/libkuzzle-csharp$(DYNLIB) - $(RM) -f $(OUTDIR)/*.cs + mcs -t:library $(OUTDIR)/*.cs -sdk:2 -out:$(OUTDIR)/$(LIB_PREFIX)kuzzle-csharp$(DYNLIB) + $(RM) "$(subst /,\,$(OUTDIR))$(PATHSEP)*.cs" python: LANGINCLUDE = $(PYTHONINCLUDE) python: OUTDIR = $(ROOTOUTDIR)/python python: CC = g++ @@ -136,7 +138,7 @@ cpp: makedir $(CPPSDK) cpp: LANGUAGE = c++ cpp: core ar rvs $(OUTDIR)/libcpp$(STATICLIB) $(OUTDIR)/*.o - g++ -shared -fPIC -o $(OUTDIR)/libcpp$(DYNLIB) -Wl,--whole-archive $(OUTDIR)/libcpp$(STATICLIB) build/c/libkuzzlesdk$(STATICLIB) -Wl,--no-whole-archive + g++ -shared -fPIC -o $(OUTDIR)/libcpp$(DYNLIB) -Wl,--whole-archive $(OUTDIR)/libcpp$(STATICLIB) build/c/$(LIB_PREFIX)kuzzlesdk$(STATICLIB) -Wl,--no-whole-archive clean: $(RM) kcore_wrap.cxx $(RM) kcore_wrap.h From d4c1669c41b4d7d6e99a113698fa37d6fae3927a Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 5 Jun 2018 13:51:00 +0200 Subject: [PATCH 205/363] fix Makefile --- internal/wrappers/Makefile | 333 ++++++++++-------- internal/wrappers/build/java/build.gradle | 101 ------ .../java/gradle/wrapper/gradle-wrapper.jar | Bin 54333 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 - internal/wrappers/build/java/gradlew | 172 --------- internal/wrappers/build/java/gradlew.bat | 84 ----- internal/wrappers/build/java/settings.gradle | 10 - internal/wrappers/templates/csharp/core.i | 10 +- 8 files changed, 190 insertions(+), 525 deletions(-) delete mode 100644 internal/wrappers/build/java/build.gradle delete mode 100644 internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.jar delete mode 100644 internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties delete mode 100755 internal/wrappers/build/java/gradlew delete mode 100644 internal/wrappers/build/java/gradlew.bat delete mode 100644 internal/wrappers/build/java/settings.gradle diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 7c4d9f4a..57ea8d65 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -1,148 +1,185 @@ -ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -ifeq ($(OS),Windows_NT) - STATICLIB := .lib - DYNLIB := .dll - GOROOT ?= C:/Go - GOCC ?= $(GOROOT)bin\go - SEP = \\ - RM = del /Q /F /S - RRM = rmdir /S /Q - MV = rename - MKDIR = mkdir - CMDSEP=& - ROOT_DIR_CLEAN = $(subst /,\,$(ROOT_DIR)) - LIB_PREFIX = -else - STATICLIB := .a - DYNLIB := .so - GOROOT ?= /usr/local/go - GOCC ?= $(GOROOT)/bin/go - SEP = \ - RM = rm -f - RRM = rm -f -r - MV = mv -f - MKDIR = mkdir -p - CMDSEP=; - ROOT_DIR_CLEAN = $(ROOT_DIR) - LIB_PREFIX = lib -endif -PATHSEP = $(strip $(SEP)) -ROOTOUTDIR = $(ROOT_DIR)build -JAVA_HOME ?= /usr/local -PYTHON_INCLUDE_DIR ?= `pkg-config --cflags python3` -GOFLAGS = -buildmode=c-archive -GOSRC = .$(PATHSEP)cgo$(PATHSEP)kuzzle$(PATHSEP) -GOTARGETDIR = $(ROOTOUTDIR)/c -GOTARGET = $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk$(STATICLIB) -GOTARGETSO = $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk$(DYNLIB) -CPPDIR = $(ROOT_DIR)cpp -HEADERSDIR = $(ROOT_DIR)headers -CPP = $(CXX) -CPPFLAGS = -g -fPIC -INCS = -I$(HEADERSDIR) -I$(CPPDIR) -I$(ROOT_DIR)templates -I$(GOTARGETDIR) -LDFLAGS = -L$(GOTARGETDIR) -LIBS = -lkuzzlesdk -SRCS = kcore_wrap.cxx -OBJS = $(SRCS:.cxx=.o) -JAVAINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -PYTHONINCLUDE = $(PYTHON_INCLUDE_DIR) -I$(ROOT_DIR)templates/python -CPP_SDK_SRCS = kuzzle.cpp \ - document.cpp \ - collection.cpp \ - realtime.cpp \ - auth.cpp \ - server.cpp \ - index.cpp -CPPSRCS = $(CPP_SDK_SRCS) \ - kcore_wrap.cxx -CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) -SWIG = swig -all: python java csharp -kcore_wrap.o: kcore_wrap.cxx - $(CPP) -c $< -o $@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) -%.o: cpp/%.cpp - $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) -I./headers -I./build/c/ -L./build/c -lkuzzlesdk -core_java: - cd ..$(PATHSEP)..$(PATHSEP) && go get .$(PATHSEP)... $(CMDSEP) cd internal$(PATHSEP)wrappers - $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) - $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) -ifeq ($(OS),Windows_NT) - $(MV) $(subst /,\,$(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk.h) kuzzle.h -else - $(MV) $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk.h $(GOTARGETDIR)$(PATHSEP)kuzzle.h -endif -core_python: core_java -core_csharp: core_java -wrapper_java: $(OBJS) -wrapper_python: $(OBJS) -wrapper_csharp: $(OBJS) -java_object: - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-java$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(JAVAINCLUDE) - strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-java$(DYNLIB) -python_object: - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-python$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(PYTHONINCLUDE) - strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-python$(DYNLIB) -csharp_object: -ifeq ($(OS),Windows_NT) - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) -lWinmm -lntdll -lWS2_32 -else - $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) -endif - strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) -swig: - $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i -swig_java: - $(SWIG) -Wall -c++ -java -package io.kuzzle.sdk -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(JAVAINCLUDE) templates/java/core.i -swig_python: - $(SWIG) -Wall -c++ -python -py3 -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(PYTHONINCLUDE) templates/python/core.i -swig_csharp: - $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i -makedir: -ifeq ($(OS),Windows_NT) - @if not exist $(subst /,\,$(OUTDIR)) mkdir $(subst /,\,$(OUTDIR)) - @if not exist $(ROOT_DIR_CLEAN) mkdir $(ROOT_DIR_CLEAN) -else - mkdir $(ROOT_DIR_CLEAN) - mkdir $(OUTDIR) -endif -java: LANGINCLUDE = $(JAVAINCLUDE) -java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk -java: makedir core_java swig_java wrapper_java java_object -#rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so - taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java - mkdir $(ROOTOUTDIR)/io/kuzzle/sdk/resources - mv build/java/io/kuzzle/sdk/$(LIB_PREFIX)kuzzle-wrapper-java.so build/io/kuzzle/sdk/resources - mkdir $(ROOTOUTDIR)/java/src/main/java - ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ - cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - - rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class - cp -p $(GOTARGET) $(OUTDIR) - cp -p $(GOTARGETSO) $(OUTDIR) -csharp: OUTDIR = $(ROOTOUTDIR)/csharp -csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object - mcs -t:library $(OUTDIR)/*.cs -sdk:2 -out:$(OUTDIR)/$(LIB_PREFIX)kuzzle-csharp$(DYNLIB) - $(RM) "$(subst /,\,$(OUTDIR))$(PATHSEP)*.cs" -python: LANGINCLUDE = $(PYTHONINCLUDE) -python: OUTDIR = $(ROOTOUTDIR)/python -python: CC = g++ -python: CFLAGS = -fPIC -python: makedir core_python swig_python wrapper_python python_object - cp $(ROOT_DIR)templates/python/*.py $(OUTDIR) - cp $(ROOT_DIR)$(SRCS) $(OUTDIR)/ - cp $(ROOT_DIR)kcore_wrap.h $(OUTDIR)/ - python3 $(OUTDIR)/setup.py build_ext -I $(HEADERSDIR):$(CPPDIR):$(OUTDIR):$(GOTARGETDIR):$(OUTDIR)/templates/python -L $(OUTDIR):$(GOTARGETDIR) -R $(GOTARGETDIR) -l kuzzlesdk -b $(OUTDIR) -t $(OUTDIR)/tmp - cp -p $(GOTARGET) $(OUTDIR) - cp -p $(GOTARGETSO) $(OUTDIR) -cpp: OUTDIR = $(ROOTOUTDIR)/cpp -cpp: makedir $(CPPSDK) -cpp: LANGUAGE = c++ -cpp: core - ar rvs $(OUTDIR)/libcpp$(STATICLIB) $(OUTDIR)/*.o - g++ -shared -fPIC -o $(OUTDIR)/libcpp$(DYNLIB) -Wl,--whole-archive $(OUTDIR)/libcpp$(STATICLIB) build/c/$(LIB_PREFIX)kuzzlesdk$(STATICLIB) -Wl,--no-whole-archive -clean: - $(RM) kcore_wrap.cxx - $(RM) kcore_wrap.h - $(RRM) build$(PATHSEP)c build$(PATHSEP)java$(PATHSEP)src build$(PATHSEP)java$(PATHSEP)io build$(PATHSEP)java$(PATHSEP)build build$(PATHSEP)csharp build$(PATHSEP)python - $(RRM) build$(PATHSEP)java -.PHONY: all java csharp python wrapper swig clean object core -.DEFAULT_GOAL := all +ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +ifeq ($(OS),Windows_NT) + STATICLIB := .lib + DYNLIB := .dll + GOROOT ?= C:/Go + GOCC ?= $(GOROOT)bin\go + SEP = \\ + RM = del /Q /F /S + RRM = rmdir /S /Q + MV = rename + CMDSEP = & + ROOT_DIR_CLEAN = $(subst /,\,$(ROOT_DIR)) + LIB_PREFIX = +else + STATICLIB := .a + DYNLIB := .so + GOROOT ?= /usr/local/go + GOCC ?= $(GOROOT)/bin/go + SEP = / + RM = rm -f + RRM = rm -f -r + MV = mv -f + CMDSEP = ; + ROOT_DIR_CLEAN = $(ROOT_DIR) + LIB_PREFIX = lib +endif + + +PATHSEP = $(strip $(SEP)) +ROOTOUTDIR = $(ROOT_DIR)build +JAVA_HOME ?= /usr/local +PYTHON_INCLUDE_DIR ?= `pkg-config --cflags python3` +GOFLAGS = -buildmode=c-archive +GOSRC = .$(PATHSEP)cgo$(PATHSEP)kuzzle$(PATHSEP) +GOTARGETDIR = $(ROOTOUTDIR)/c +GOTARGET = $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk$(STATICLIB) +GOTARGETSO = $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk$(DYNLIB) +CPPDIR = $(ROOT_DIR)cpp +HEADERSDIR = $(ROOT_DIR)headers + +CPP = $(CXX) +CPPFLAGS = -g -fPIC +INCS = -I$(HEADERSDIR) -I$(CPPDIR) -I$(ROOT_DIR)templates -I$(GOTARGETDIR) +LDFLAGS = -L$(GOTARGETDIR) +LIBS = -lkuzzlesdk +SRCS = kcore_wrap.cxx +OBJS = $(SRCS:.cxx=.o) + +JAVAINCLUDE = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux +PYTHONINCLUDE = $(PYTHON_INCLUDE_DIR) -I$(ROOT_DIR)templates/python + +CPP_SDK_SRCS = kuzzle.cpp \ + document.cpp \ + collection.cpp \ + realtime.cpp \ + auth.cpp \ + server.cpp \ + index.cpp + +CPPSRCS = $(CPP_SDK_SRCS) \ + kcore_wrap.cxx + +CPPSDK = $(CPP_SDK_SRCS:.cpp=.o) + +SWIG = swig + +all: python java csharp + +kcore_wrap.o: kcore_wrap.cxx + $(CPP) -c $< -o $@ $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(LANGINCLUDE) + +%.o: cpp/%.cpp + $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) -I./headers -I./build/c/ -L./build/c -lkuzzlesdk + +core_java: + cd ..$(PATHSEP)..$(PATHSEP) && go get .$(PATHSEP)... $(CMDSEP) cd internal$(PATHSEP)wrappers + $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) + $(GOCC) build -o $(GOTARGETSO) $(GOFLAGS) $(GOSRC) +ifeq ($(OS),Windows_NT) + $(MV) $(subst /,\,$(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk.h) kuzzle.h +else + $(MV) $(GOTARGETDIR)$(PATHSEP)$(LIB_PREFIX)kuzzlesdk.h $(GOTARGETDIR)$(PATHSEP)kuzzle.h +endif + +core_python: core_java + +core_csharp: core_java + +wrapper_java: $(OBJS) + +wrapper_python: $(OBJS) + +wrapper_csharp: $(OBJS) + +java_object: + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-java$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(JAVAINCLUDE) + strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-java$(DYNLIB) + +python_object: + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-python$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) $(PYTHONINCLUDE) + strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-python$(DYNLIB) + +csharp_object: +ifeq ($(OS),Windows_NT) + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) -lWinmm -lntdll -lWS2_32 +else + $(CPP) -shared kcore_wrap.o -o $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(INCS) +endif + strip $(OUTDIR)/$(LIB_PREFIX)kuzzle-wrapper-csharp$(DYNLIB) + +swig: + $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i + +swig_java: + $(SWIG) -Wall -c++ -java -package io.kuzzle.sdk -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(JAVAINCLUDE) templates/java/core.i + +swig_python: + $(SWIG) -Wall -c++ -python -py3 -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(PYTHONINCLUDE) templates/python/core.i + +swig_csharp: + $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i + + +makedir: +ifeq ($(OS),Windows_NT) + @if not exist $(subst /,\,$(OUTDIR)) mkdir $(subst /,\,$(OUTDIR)) + @if not exist $(ROOT_DIR_CLEAN) mkdir $(ROOT_DIR_CLEAN) +else + mkdir -p $(ROOT_DIR_CLEAN) + mkdir -p $(OUTDIR) +endif + + +java: LANGINCLUDE = $(JAVAINCLUDE) +java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk +java: makedir core_java swig_java wrapper_java java_object +#rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so + taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java + mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources + mv build/java/io/kuzzle/sdk/$(LIB_PREFIX)kuzzle-wrapper-java.so build/io/kuzzle/sdk/resources + mkdir -p $(ROOTOUTDIR)/java/src/main/java + ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ + cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - + rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class + cp -p $(GOTARGET) $(OUTDIR) + cp -p $(GOTARGETSO) $(OUTDIR) + +csharp: OUTDIR = $(ROOTOUTDIR)/csharp +csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object + mcs -t:library $(OUTDIR)/*.cs -sdk:2 -out:$(OUTDIR)/$(LIB_PREFIX)kuzzle-csharp$(DYNLIB) +ifeq ($(OS),Windows_NT) + $(RM) "$(subst /,\,$(OUTDIR))$(PATHSEP)*.cs" +else + $(RM) $(OUTDIR)$(PATHSEP)*.cs +endif + +python: LANGINCLUDE = $(PYTHONINCLUDE) +python: OUTDIR = $(ROOTOUTDIR)/python +python: CC = g++ +python: CFLAGS = -fPIC +python: makedir core_python swig_python wrapper_python python_object + cp $(ROOT_DIR)templates/python/*.py $(OUTDIR) + cp $(ROOT_DIR)$(SRCS) $(OUTDIR)/ + cp $(ROOT_DIR)kcore_wrap.h $(OUTDIR)/ + python3 $(OUTDIR)/setup.py build_ext -I $(HEADERSDIR):$(CPPDIR):$(OUTDIR):$(GOTARGETDIR):$(OUTDIR)/templates/python -L $(OUTDIR):$(GOTARGETDIR) -R $(GOTARGETDIR) -l kuzzlesdk -b $(OUTDIR) -t $(OUTDIR)/tmp + cp -p $(GOTARGET) $(OUTDIR) + cp -p $(GOTARGETSO) $(OUTDIR) + +cpp: OUTDIR = $(ROOTOUTDIR)/cpp +cpp: makedir $(CPPSDK) +cpp: LANGUAGE = c++ +cpp: core + ar rvs $(OUTDIR)/libcpp$(STATICLIB) $(OUTDIR)/*.o + g++ -shared -fPIC -o $(OUTDIR)/libcpp$(DYNLIB) -Wl,--whole-archive $(OUTDIR)/libcpp$(STATICLIB) build/c/$(LIB_PREFIX)kuzzlesdk$(STATICLIB) -Wl,--no-whole-archive + +clean: + $(RM) kcore_wrap.cxx + $(RM) kcore_wrap.h + $(RRM) build$(PATHSEP)c build$(PATHSEP)java$(PATHSEP)src build$(PATHSEP)java$(PATHSEP)io build$(PATHSEP)java$(PATHSEP)build build$(PATHSEP)csharp build$(PATHSEP)python + $(RRM) build$(PATHSEP)java + +.PHONY: all java csharp python wrapper swig clean object core + + +.DEFAULT_GOAL := all diff --git a/internal/wrappers/build/java/build.gradle b/internal/wrappers/build/java/build.gradle deleted file mode 100644 index 6848fca3..00000000 --- a/internal/wrappers/build/java/build.gradle +++ /dev/null @@ -1,101 +0,0 @@ -buildscript { - repositories { - jcenter() - } -} - -plugins { - id "com.jfrog.bintray" version "1.7.3" -} - -group = 'io.kuzzle' -version = '1.0.0' - -allprojects { - repositories { - jcenter() - } - apply plugin: 'maven-publish' - apply plugin: 'java' - apply plugin: 'java-library' -} - -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource -} - -javadoc.failOnError = false -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -bintray { - user = System.getenv('BINTRAY_USER') - key = System.getenv('BINTRAY_KEY') - publications = ['MyPublication'] - - pkg { - repo = 'maven' - name = 'kuzzle-sdk-' + System.getenv('ARCH') - userOrg = 'kuzzle' - licenses = ['Apache-2.0'] - desc = 'Kuzzle JAVA SDK' - vcsUrl = 'https://github.com/kuzzleio/sdk-go.git' - websiteUrl = 'https://kuzzle.io' - issueTrackerUrl = 'https://github.com/kuzzleio/sdk-go/issues' - publicDownloadNumbers = true - publish = true - } -} - -def pomConfig = { - licenses { - license { - name "The Apache Software License, Version 2.0" - url "http://www.apache.org/licenses/LICENSE-2.0.txt" - distribution "repo" - } - } - developers { - developer { - id "kuzzle" - name "kuzzle" - email "support@kuzzle.io" - } - } - - scm { - url "https://github.com/kuzzleio/sdk-go" - } -} - -publishing { - publications { - MyPublication(MavenPublication) { - from components.java - artifact sourcesJar - artifact javadocJar - groupId 'io.kuzzle' - artifactId 'kuzzle-sdk-' + System.getenv('ARCH') - version version - pom.withXml { - def root = asNode() - root.appendNode('description', 'Kuzzle JAVA SDK') - root.appendNode('name', 'kuzzle-sdk') - root.appendNode('url', 'https://github.com/kuzzleio/sdk-go') - root.children().last() + pomConfig - } - } - } -} - -dependencies { - compile fileTree(dir: 'src/main/java', include: ['*.so']) -} - -artifacts { - archives sourcesJar - archives javadocJar -} \ No newline at end of file diff --git a/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.jar b/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index c44b679acd3f794ddbb3aa5e919244914911014a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 54333 zcmagFV|ZrKvM!pAZQHhO+qP}9lTNfnHSl14(}!ze#uNJ zOwq~Ee}g>(n5P|-=+d-fQIs8&nEo1Q%{s|E!?|<4b^Z2lL;fA*|Ct;3-)|>ZtN&|S z|6d)r|I)E?H8Hoh_#ai#{#Dh>)x_D^!u9_$x%Smfzy3S)@4vr>;Xj**Iyt$!x&O6S zFtKq|b2o8yw{T@Nvo~>bi`CTeTF^xPLZ3(@6UVgr1|-kXM%ou=mdwiYxeB+94NgzDs+mE)Ga+Ly^k_UH5C z*$Tw4Ux`)JTW`clSj;wSpTkMxf3h5LYZ1X_d)yXW39j4pj@5OViiw2LqS+g3&3DWCnmgtrSQI?dL z?736Cw-uVf{12@tn8aO-Oj#09rPV4r!sQb^CA#PVOYHVQ3o4IRb=geYI24u(TkJ_i zeIuFQjqR?9MV`{2zUTgY&5dir>e+r^4-|bz zj74-^qyKBQV;#1R!8px8%^jiw!A6YsZkWLPO;$jv-(VxTfR1_~!I*Ys2nv?I7ysM0 z7K{`Zqkb@Z6lPyZmo{6M9sqY>f5*Kxy8XUbR9<~DHaC-1vv_JhtwqML&;rnKLSx&ip0h7nfzl)zBI70rUw7GZa>0*W8ARZjPnUuaPO!C08To znN$lYRGtyx)d$qTbYC^yIq&}hvN86-JEfSOr=Yk3K+pnGXWh^}0W_iMI@ z#=E=vL~t~qMd}^8FwgE_Mh}SWQp}xh?Ptbx$dzRPv77DIaRJ6o>qaYHSfE+_iS}ln z;@I!?iQl?8_2qITV{flaG_57C@=ALS|2|j7vjAC>jO<&MGec#;zQk%z4%%092eYXS z$fem@kSEJ6vQ-mH7!LNN>6H<_FOv{e5MDoMMwlg-afq#-w|Zp`$bZd80?qenAuQDk z@eKC-BaSg(#_Mhzv-DkTBi^iqwhm+jr8Jk2l~Ov2PKb&p^66tp9fM#(X?G$bNO0Qi#d^7jA2|Yb{Dty# z%ZrTuE9^^3|C$RP+WP{0rkD?)s2l$4{Trw&a`MBWP^5|ePiRe)eh1Krh{58%6G`pp zynITQL*j8WTo+N)p9HdEIrj0Sk^2vNlH_(&Cx0|VryTNz?8rT;(%{mcd2hFfqoh+7 z%)@$#TT?X0%)UQOD6wQ@!e3UK20`qWR$96Bs_lLEKCz0CM~I;EhNQ)YC8*fhAp;-y zG9ro^VEXfQj~>oiXu^b~#H=cDFq1m~pQM-f9r{}qrS#~je-yDxh1&sV2w@HhbD%rQ zvqF(aK|1^PfDY)2QmT*?RbqHsa?*q%=?fqC^^43G)W3!c>kxCx;=d>6@4rI!pHEJ4 zCoe~PClhmWmVca=0Wk`&1I)-_+twVqbe>EhaLa(aej;ZQMt%`{F?$#pnW~;_IHaAz zA#|5>{v!dxN&ouieHdb~fuGo>qW(ax^of8<3X{&(+Br@1bJ-0D6Chg$u$TReI=h+y zn=&-aBZ`g+mci#-+(2$LD5yFHMAVg8vNINQOHN6e4|jQhIb$~sO;+G?IYshZf)V{ZewQR z?(|^o>0Xre^gj!6e}> zTHb#iYu$Pe=|&3Y8bm`B=667b-*KMXwSbr9({a6%5J<}HiX`8&@sTKOHJuGG}oFsx9y^}APB2zP0xIzxS_Hyg5{(XFBs z^>x@qc<{m0R5JuE`~*Xx7j+Mlh8yU;#jl1$rp4`hqz$;RC(C47%q!OKCIUijULB^8 z@%X9OuE)qY7Y3_p2)FZG`{jy-MTvXFVG>m?arA&;;8L#XXv_zYE+xzlG3w?7{|{(+ z2PBOSHD7x?RN0^yTs(HvAFmAfOrff>@4q|H*h<19zai;uT@_RhlZef4L?;a`f&ps% z144>YiGZ|W%_IOSwunC&S$T1Z&LDI1EpAN4{D|F_9c^cK8`g zQ4t*yzU*=>_rK=h1_qv3NR56)5-ZsGV}C?MxA2mI>g$u>i9xQqxTY3CP6SFlmqT*kJm+Vp&6|Rd&HVjVV2iE;dO7g%DBvpKxz}%|=eqatxbO9J z26Tmn5nFnvGuWhCeQ?Xl{9b3Zn?76X;Ed_yB`4Tuh{@)~0u0g-+Z&_LbVuvfXZ0hi z<)Dcp(7mi{4J2=wr$jn!SYp3yKg*nj)GwiiYeB6=Jz5 ze_>nw@IjCW&>1ztev$h~1=OFs*n#QYa*6y3!u>`NWVdsD^W6FZ)$O=LbgMzY=6aNW zplFoLX0&iKqna6%IMp|Pv~7NW-SmpI>TkgLhX&(~iQtdJ4)~YUD3|+3J-`WfB|P2T zKia5&pE5L|hjvX`9gmw7v=bVal$_n*B&#A(4ZvvYVPfl@PI(5e!i4KS_sd`yS0R*R zt|Yp((|SofnsEsS8|&NyWo{U<<66>|)Ny{8(!hRcc&anv%ru(Oac)?%qn}g3etD=i zt6c#E^r&Ee#V}}Gw*0b1*n829iQ&QWLudUqSuO3_7xb~%Y!oRTVaOEei3o>?hmsf) z;_S_U>QXOG$fT6jv$dsI*kSvnPz=lrX#`RUNgb><2ex!06DPaN9^bVm^9pB1w&da} zI*&uh$!}B4)}{XY$ZZ6Nm0DP#+Y&@Ip9K%wCd;-QFPlDRJHLtFX~{V>`?TLxj8*x9 z*jS4bpX>d!Y&MZQ6EDrOY)o3BTi4E%6^Mp#l zq~RuQGD*{Kt9jrupV_gAjFggPSviGh)%1f35fvMk zrQGJZx2EnWQBy8XP+BjYan<&eGzs{tifUr7v1YdZH&>PQ$B7|UWPCr_Dp`oC%^0Rx zRsQMQ7@_=I8}s$7eOHa7i>cw?BIWKXa(W9-?dj+%`j)E%hfDjn$ywH=Zkko}o96NuqwWpty9I2QtUU6%Hh#}_->hVJ-f711&8$r7V~O^7sth1qdm+?fD?&gIjAc zyqFI*LNCe9r)#GW?r@x@=2cx756awNnnx7U6`y?7hMG~_*tSv_iX)jBjoam}%=SnL zQ>U^OCihLy24_3n!SV-gS zOc&9qhB7Ek%eZMq6j(?A@-DKtoAhCsG+Uuq3MlDQHgk4SY)xK$_R~$fy+|1^I3G2_ z%5Ss|QBcETpy^7Fak21m_;GRNFx4lC$y8Fsv?Ai^RuL6`{ZB<{Vh#&W=x%}TG%(@; zT)NU7Dy$MnbU{*R-74J&=92U75>jfM3qQ=|sBrk_gUpJ|3@m-(S} zqrmISaynDD_ioO6)*i^7o0;!bDMmWp0YMpaG8btAu^OJ)=_<07isXtT+3lF76nBJ{ z`;coD)dJ6*+R@2)aG#M$ba<~O=E&W~Ufgk7r@zL&qQ~h_DGzk<>-6*EUF#I+(fVvF zF0q3(GM8?WRWvoMY~XEg>9%PN1tw>wLt5DP-`2`e)KL%jgPt=`R_Tf+MJBwzz@6P` zYkcqgt{25RF6%_*@D6opLzleQ)7W@Gs4H3i#4LADwy$Js;!`pfiwBoJts0Aw#g{Mb zYooE6OW7NcUMd1}sH)Ri=3(K0WmBtvK!2KaY?U&Htr#Q|+gK<+)P!19dIyUlV-~ZD zWTnl`xcUr)m5@2S1Lk4U(6nbH$;vl%qb5Vh|G5KA{_*04p!LOkPsWhxMRz}sl&mDWMOvz5;Kq0`+&T6$VoLdpvEBn-UN`Yb8ZZ0wMcv3XC z&vdicA-t=}LW3(&B6Kj(>TT!YHdrG%6Mp}$B2)7 z+;)t8QsBkfxDOo?z_{=$3mKym5Go;g$Mk=-laVV$8~3tYKU*>B?!wZzsj%|0`(rDZ zQlak~9a?7KG<`P_r`)fK5tmRtfJx2_{|%4C{wGh4l@LS$tQ$Tbg&CH~tGKZcy%EgW z`Ej2=-Hlzs6Deb(!HzY)2>45_jU5(2ZZtAeg#)2VsD^#*$8x<;w5s&*^tt+nA0nto#6hJ&M?xQ5=lhI*Tap+o@#YI~Hi-l#@sdjZ4PCVcFr zrtJF2C$N~X&6L4W47_$Flt4D!po1W~)1L9HNr#|W_L09d`a-4_H0Mx`rv5icDMbTk zjgibis*{cth+j!U;jr1ejW?${hBE1{p6EKm8=(ABt9m z73d7-{oHvvZQ4|t%Yl|k2ISat%`52J25OJ=M|CD{m|Q`~Q%t0|TS>zV%Z(g_Tfm4* zrnW_nWqsh&V(Vg+lY`u)?gp>c{g&12){~5SxL)&$i>$($pDhnsXK=$u3m0Cx-kD$+ z5Sf?E*TYQ#^KvHWJU1%*={yG9NjM(7`Q)rS7&uMenLoOe2N*xk(vN5F{sf(%CH8#I;sdqf1dw%kBI&pS`K)){>EF18AT6CAYZz0_Bc|Ws1Nh3 z%twB`i+Lm2(%hoXJP|J5lGpD^-5BDO7S(}JJ>5B*GC`HoszjIH2&%(H9^gwUpLh!i z3Qy1nE2J}h@;Ak+bcPP0N_i9XP zGP%F-_xo6mx<}RTyu}Gtjo&rvdJ)cjDjdsF2#cIzUZPQ4jw3ooBicqI*=>s6PhTHP zUbqtt70zm3RGvU{bmEBy@7>pUvN*V&xd}e^Utpe0V;b_!mCArr(MJKQnMqizhhON$ z0PU2%@B_9xKJKKe6`VjcwmWC;Y0r{P@{$)pR~JK z7W*a7V+;ltQ(0F8#ai=9MTrhuKUuc?XHbAd#{@4h9w}rzVRuq6yXejFE!8sdL8=54 zlMy{taj5+w=D#noC@!#8;au}K+eZu|Qu0-kgkp6xNYzcURuN-6Kl%)%2VR8!wVGU1 zWZEqJTSbol6_)?Gn*57aSh-rbxyjqOxm!5?6VUdE?S~B!MwhszTd>6tpLmj(o$a(h zAs07xg*#7|8#vhWTd4=LC(iu_{`BjJsuC)6y+j zVt~bjACA>0y~vnuy8LtP`50?}Sv@t*JN-yL!!hVgrCPk1MZ}gKt0uixMw>b}LVSYT zO2tkmt!7v#jQQ>8j*U6`G)hEPOU>LGS_Bb0_fM;F-V(W)wq65Rk*aya3yO z_E*B&%-+Mz#?wO5#@<52%(}O6W4o%BNVbB8s4!4(PR*gSb z$j7Eencvf9?_))K7b19T597Ql)q~!PlMm$u$j3)NoBF(=YuwSFa=2J3EM=@!qJ=bK z2UY^`gcpl_0a{Nbh&mL-S}|dXDc@FYTzkR9u>DlO|r9zMbY9 zcvi~*Sn!-XdibS9>V|VmH54$J!N;-k>U|!e$!EePWpr0wZn4~|?w4vo%-Ffcx{+}N z74+Dx>^&$SsYtq~oLkztY&j;cG5S5NN)rYFS~F@`)MVA%911fMO^vLB+%;E2kGcx|C?bj%K*Y#Btv7K6inqIt~eN9{d@I&&(VF z1}bT14cQy!1jpa|7DiCJuBh_{+56)f_l3}qLWwox4&D>1NwX@~lG&(9Cp!ZS@vbCbV>$9jV0PWrUoc zGQm`Y5){E1K~q2RUK#=U*e^6&?8-y!fP9=6o+W+4nm+mSQeDNJD5!E8CaU;I#+HM)Gt`;3%$yq7H_kqm0#(U8c<8HUpZ5@8zRzEG5L^AX4{< zwDEN(lUW!^k%H!t&T_;T6To1i4r0S|tu+lWr|`3wjbo+~>MjOj62{&D3H$OiWs=Dw z`m6MW^8|~J3*ER5G^h~UbH*UPW$7ZHfg&@9%r2u(d@8YN94k?}pzw`3tuCNVl%MV&<#4ESfo@VX7dX=)C-e#!(E` z#+;b>rvW^#ug1(yr&cS%w96I($;2(O*FuVoTK-KiA2Qgwkhs0^Xt=eXkh&mx)iBSK z+r|&Xi($%(!3BO6G7f)2qliGTP)G50)i_iAAQYn_^v$7h=>j<98G2H|p1$BA(xe5i z0+-b-VX6A*!r*B>W<`WMPAsKiypzr_G25*NMBd*U0dSwuCz+0CPmX1%rGDw|L|sg- zFo|-kDGXpl#GVVhHIe#KRr^fX8dd>odTlP=D0<~ke(zU1xB8^1);p2#8t_>~o&?jKIG49W)EmhTo5fZ|aP=E2~}6=bv=O`0e4FpgaP@U~KHt>V*oR z{wKtxe`uCFdgYHlbLL2`H>|$?L@G&exvem8R^wQppk+Gu8BI;LR4v=pU`U4vlmwFw zxYbNZXbzdqO{7#b`Eo2>XlNcQEFC-Gk2v__^hqHG{bb%6gvMRe9ikQ>94zOK3o85` z)Ew{!is}|b0%g#qa2H+$A1i=5;*y)hv$5m)&;Z~CTv zpdZz#9k)yhrLH%G>|ly;%|Fe`K{}d{6vyNO^Gk$ZYOIL$3&5XuJTqse&XvY7TH(_z zb3L0aT`$6i&c(dBQVcLsV?yM^@BTj>C_2=Ih6Yxsk zP5r-Yg34bu;lJUUrT!1Gt>I?jD(&Q8A@Ag5=i&TcT(g><60QjPmt>;B(xYk(bt}+T z4_t3m_flhFXrd}o9hw+M$vh0Ej(*GdO21EJaL-eD*b$UHHZnUN|OJ z0Jp^;Ep{EvhbQw6K_&t~eB7m4_csSE=CWXyWY4sLL-`>gdwbXUqW8FqVwQ((K>Hes z6?QDu2SZjI&_Oqc`A&D$)~oa&r%dn2G?-*9nvEt&L!4PeU(lyXCgK1^guGj|F$M$j z(GuZXkiyMXV}lhNuz5oi;9>+0nCgNO|gp>9FS%CFa9W(t_WRn1h zi*Vk4IQG@3-{J`U=9`Ky!DmF2O%ld1w#`8Drc@C6KGz2^NhY^gQZo9SG}}BF9G0<> zUIO))F&%dt6uAb`cN%_jf&q5I)?_7J^9T09fb~#ll%%T{?}PznT^_22(*OROJ`X;tg`78+=eW z{nLQs1%;?R)4yhs=QXy;Ww3ta7dfE~<&UNFZ#6bKVY=m1@p+4G(=Yx{7vDsa`}d$v2%*jQt+wTN!@Q4~!T4`0#GI8YfG!RD zA-RJ))sAlYej5x5RQ-^2I`1%|`iFfD*JoRd`hJ1Hjq_1EjBZ7V)S;?@^TS;{^==d= z)f-C;4#XD*THtvXh>{A80hZC?O(tJ)M}tK1Z4n%Y}= z7G#ciWgC-qm?9fE0?893;j3|Em(+qaH${U|Z^A^QleR%Z7 z1tb3_8mwUDjv6g+M+PH*#OmXvrsOq;C|~Oa;`LR+=Ou;zBgy?^)d&PxR|BoHj6&sQLvauxiJO7V_3Dc#Yum zGB>eK>>aZ64e9dY{FHaG&8nfRUW*u+r;2EK&_#d;m#{&#@xVG;SRy=AUe9+PcYYs7 zj96WKYn5YVi{SKZ^0v}b<>~7D3U^W@eJTVKCDk#O!fc5%`1KJ%473-~Ep)z$w6SC^ zTLzy~^~c+8J4q^gv9G_h((u6+#9K|Hwyv?kkbEpaO6^U013F*&bbnuxwtH~v%F9#0 zmtLmWALa{|zD`KnzKOv=DK^Qdb+qyOnd??*IXEprOa{&tVKg3pExuAFe~YQ4t|)j) zij8hA%U)XCd1Xs~{O?y^$^Ay>@J#8GF%+8%LcH*p@gmDRZXB5qIXD z8>)QYQpTPLtK)oS#azTHeBGCqsnlj9NCIGNEpJb;iSSJPZ2?lGVE8nj#y*wRnoLNP zUDvlQvp`STbAjrwgsMtnowuaK;8{D_vB36%w zJv*S667QTThf?Cmh=Z!={xFo+ID2<-Vy`H~ArX{AKl+?KW=|8LZO0Np%7v|KE(}&? zkm-iqK;uMF5)cH3KYs+zl0BM%jvE+hMDx-L*xqRy;-OS_rAK2sX;%0n1!Ma{5Lmy9 z^imumWb?xIHBgd8Q<3ZITO&oZe53WDFt~k-gkZB#xr?4x**{ecHCK=){(+%{U)emp7C}WTX-ec@8h(}WY4jqVq71BVnXwP*x&;{_d zN*3_vi&qrs&)e8zxt-odRm_T)R;UhvD$t{UlTf!SlB8E1GF4cNqHtgHu}%8Q8%zI^ zpO2!5*(g*etB5GgYL`Ac=M!b)Xq2bNT3ITjN-o2|WjTohM*|Zlubs@v$LuHc` zZ9L$4X`?POL_=tgyId{qVRj|31h_W~uwSBS8Ah`MRZtYNw3)JW;zH~Pv)aMi=uCgq z#Os}gx^be(^r#pj-M0If8r_YMPZT)4&1&7mrz) zh!z$uE9c|~q;;`W8Ai3H!KF-#GtuGf98}gBI3*2zD4rHswCwmtL-<*{PH$;(Ich%i zT*e+^HTbEiukgv7AMqKZ_!%!^91tMZXJ&a+eBiBB>)uZd6=!3wJGNOlZBqfyTo_(Jq z52h7Y#wYwKScBP<{-&F}%`x@JiQDol9`9Y82JRmh8^6_R_^6I7I(oY45vsM)2Mg0! zNA^4MWmRnm?JM)uuzN;;ogInuA5}Qk;oaQ$cs9Ai)!zvU7TmWOs>`bxrdCQ#mnxk} z5Qpoyg#i0duj8%&Cc)XL_UW9Y?IgF{#`HuraxSoAO7mma*cOEu@T)wAF;<^bOp|dR zADP}}$WhfJnAd^kp5&R5b(nQw_sNEB!jZ-p!ty@M!(=`!YrVm5qzwmXy!+l^Qp||H zv)&M{iBPo$VxFKnW{T}^(SSQhrcO8bGeIkBJ=JR;#?sW8mMt~^yS(gY`@?F17Z%jH zb{eMek^AG53t{vvM+t+R{@qK?fCZn7^EkTA!lZMl?}J59=&K`ZSgNCVJpfBBkb%)0eYGJXVS%p1UU)y*F6#Od-P`RT#1*&Ua*G-rTNAwiZ_43phR z$Tt_#Lfj(r=Zu@nx5yBV zF=8b~y8XrjculznaTL$d_A?<3CJzV%`@=R?nu3qGhpnniU7b64jQx=U%#3e_@5n7P z9CZn~<+hnXIoahha&pWlKH!M&^LRKwKLg-_J)&7>fN$!Zhh*IevmsWNm%}J!& zx5esSGz=)HgFY>*tW#_Bh8hH?clu~3dMZr!u|cf<&P_Ks1R4orwjF4Qmy<{9I7j2^-P1Qe-E$ZHv^Y2|8)>4abo8@^ExNA7B+Oy;0NIqz z!#d;E2rU+kkB0P#KYyn7N;Nuo2k!qQugm($Hr+YiqO^0y2CRX2m^!SZq@xDICbo~5 z6K1##iSi zz-lajV(rBC^a}AEt3AqMcJSKZsorc=(iiiCwip4!9->vgGF5(@L;ix&mq$LxsQ;yn zCD@C_!;8(Kv^6$mb||Lfhhf5I6~WBlJ&cje30%f>NXFsAPq<6#QkQbOXF|Tn)4360 z9ZbI~k=SJ5#>G^Tk#7(x7#q*dL8Sx?4!s4*FGxDT3=jA- zd3uD7(hY0)XnNaS4GSis{9xF|$|=it<}R2GMf5Wql`jRfCIlWupKy@#xLkR# zzy28n_OG7iR%5>`{zXeUk^Xy69o^hb?Ct;Aua~R!?uV|06R7mWI$`-8S=U+5dQNhM z9s#aU873GO#z8Dy7*7=3%%h3V9+Hyn{DMBc>JiWew5`@Gwe3-l_Nq*xKzBH=U3-iE z^S$p)>!sqFt2ukqJ`MWF=P8G0+duu;f17Wc$LD>!z8BIM?+Xa8che3}l(H+vip?rN zmY_r$9RkS~39e{MO_?Yzg1K;KPT?$jv_RTuk&)P+*soxUT1qYm&lKDw?VqTQ%1uUT zmCPM}PwG>IM$|7Qv1``k--JdqO2vCC<1Y(PqH-1)%9q(|e$hwGPd83}5d~GExM|@R zBpbvU{*sds{b~YOaqyS#(!m;7!FP>%-U9*#Xa%fS%Lbx0X!c_gTQ_QIyy)Dc6#Hr4 z2h++MI(zSGDx;h_rrWJ%@OaAd34-iHC9B05u6e0yO^4aUl?u6zeTVJm*kFN~0_QlT zNv9T613ncxsZW(l%w`Lcf8uh@QgOnrm@^!>hcB=(a!3*OzFIV{R;wE73{p_aFYtg2 zzCY5;Ui~l_OVU;KGeSM9-wd66)uL6N3DqJHJ0L6rET&y2=f)>fP6;^5N)R`BXeL+& zo6QZ-BrVcmm1m{!!%^&u^*L!e>>{Tg?Du<%-A6<{O8xZCvmdNv?|;Xmm;55oj300) zByD!GlJZaPau!g@XX#!j!>VHPl5bWf^qk=Z+M%N_!myUu=dg$C;S{|)(pcrOI5b6g zcV*=qSI|KVEI(o_(QiDzss>!+>B>W5IhxlS^Eop*rIB0e3~F_Ry*d7(0zb2SYv%Kb z_K~7;{#bI4uy<>P8(6oG^->yVwA%#Ga{s{Xn{$C^=B;Y4GEp4m=&suBjN6XN-ws|h z6tG__V^Wl+rCfTPUf8trHW>GCue? z58?dkGg|8!;YQ(dl}+2_Im{K0{l$)Ec5rW*Y2Z!w?tGQ@ZkO%A?&@KMXBFF9EHi`i zOwT#+Fz~do?#nt1Hz3;_?3rEQU^K$J2BgxOX2AT>!bmMv8&0nQSVYKW83j(9ZEV#w zjN&G|L)`7uiV;>?**_x)mP$&Zg}sh;>8W-$u!qozJS8IH9zQ1|+90mWT-zni7m2b0$Anx2<6 zpgF=^bxuc|t#XClG*jIl^LA3hx?Z^%49PiWfiUKeVVv(xH_AIRe8-Pl=_1S?FaEF$ zZ!IPxsXgx_Sl%jaPlB<1tvQ^!2ii2R`W@xr@#^kRW!y^B-x4+3`V!9)HHE^F%>IqO zh;0Ul3|&UwF?&L-&5@Spcs2w(uSgY{aIB{MbAqjDb%)nrZUw`=7S+4d)K9AS5NS1B ztX^Dm+m$5hO#;9xtxqoNB6(|gHUyBn4`2C_<%a8abEB~01nwRf!?+T#Big__!bMbF zt|-LS;8LPy3a$3$gAD6^;xulrXsZXjKW-1pFu829!mWo?yqwx&THb1Th-c*q*u2^k zeefe7T+G~7CiS=Z5~B?}bW-J>-WuqL13Xx~@Q^)QhHxDgk+x*nyVFjnX8tR1^Sdl-R(PR#|j?hx!oryI`_wmmB4z4{7wrEBF>sclHoe z2JB6c#_$aL%lp4!UAb@_!sLIi3O&()fDr#T(f=PY@t^ItF#Z^atwL1KN7GYN4G^O3 zHDst`gr4lwxJkr~B*Z2x#CzmkNiiD~)46h}=bA*Cx|c;BZ5Un^r5fs}?6g3Svj=j;fV|OR^i@=cCh)VMW_5+L*;k;r!;9t>|w{@)`;;)E->kUinNJ?X8kN! z8`}GhsA>#DPeGkd8dg4r`L zyS19T8YH@ihS=4~WrkUhg$=sYId}&g^9vO>KCnTIzZ66a=?JDsc*B=vngxfB?;*qV zL|Xu(P(H={Trz4ndsE#KyKv}^sWN(EEpcsO6`4%x-hL6fp-yZ@=m!LME{*J|u;(PU zhn!*SVlA=jA^0#&C;}}4DRC|Tk)2eG1v`?uIH(hb7|mL7IBeI~W6fP_36}|0t9q!} z@!h`tf|zFCFY8G0K$!&iwF*jOb@C9E-u5s?^Rlaad%bCX{YDpPTBm z829R2aPrE$*^pP7-pjT|pATPS5NnI|WwT++-L34$e1-}4%*dsYYnu}Hm#92MgFE{o~NjJ{EMM1=Mai)NW%TmhhCo7lUYkk_3rXFLXs;*u? zgRA~x>&_K>WvT0`Pd9_t44Z?otM8lH}ukI$yM3RtOb}S@I`i-+*_MWx=B>k@KtGEN8>e7{~g_4w!LHb-T8%?i{F01C+zU_~n>ZWyA#$r92il-{03qE7w z=Cpz1(vmmZVhNpscjG0M0K4$Tenmdqi6Sa_1=KMJKbaxz-TB2#j| z6%G1&3`Cs*FXeBf5(kCLyAWQvCo0ZsL(P{pXxPqF2l6D7M->xL%)qCYEkc|mAi<}j zM!2f7X2*gpVHIkatPI>>9cVyXLNiS%vFL9?smnYBm z(8k{xAaDSFG3*O+n{p-<+h z7l32L?Kv`Udr$(2lSmFBW$yYNd>T2?L+3N;I5dSOJ3s}q5#UX0X^z@DgEB$HV&10A zh$rhWVb)Pj!doaXx0#;$Bcn=|-z~XKopH&SA^!)ZkvcurJVErdUW4&BwdCV8j+VY$ zciQn&1L7%B8%%^|UFw={uTc`symy1L3LMfFY3N*^yU?cSJQCgLc%}394vUB-)Itp( z))pWllOb*Nj8O0}RkoI!FBX!U4yC?kPD@vFu|>qeg`S&VXlPQMy2}GEa<|}5e#^L&lXX^D1U!rce9c0+G>TC7~L+bTW5AF8gv#eYG z_;WNQQpE>x&kqA*?^}TS2B(=Mr5>Ase_e4xngO--eRT4DtMq`h?QLjn;YW)HTixlc zpnP+~DkXWgh7H1Lu2wUeE>u&y<%4N*+>;F)+x=UWvKjon(XuB@r$%7Jb7cQh^@qdO zM9XJ}Xo(M1KWX8xU^Y0d(B!s?4bx`v-M6p0@$DZP?GrT3lb%%H>>?4TX%etz)cC`dOmZ__G2X+AGcJoGFy@wtQ zeakz$cBhhehjg_(SuL#qVk-xYE(aUTzIG8AK3XD0mZM0EJ13YVzUS$oZg^^hO{b+^ zWy#6}LqU}|3q#lZqO#g=>*2Az7iHbW68sdBHa@f4CwB*}eQsFu7Tt1TJhp;6vXBue z4Z&aWG#~BbN)h`=E<(Vw-4-1?9pAqoG$@yitG#M$ z{V)~zAZdJ9n{7$_oi$!R(XyIv*uawdn?iLi0_|*UpE{z}H(+r#IfP9?u^% z!kKxcc+??s1pNs5YaXS!5+zbthP-;O;!^z!rLXWNUgHa3&8% zFnn7A;Y{bf;(_n0W1vs@RX}8v>GhLDF1~V3{R_i?vJdlO68|#BgDk4eW|fA=Px|8~ zxE(@omgp2MOi2Be%RhF!?{Ga)FTRJW;ECWYF+u9F?c_jdOf1i1BmIzVaa^@Hjh%Dc z?F+^by1;e_#f|(klA^TO3A`*eE5&0ZPj%0yYALQ9XCW@RI&St+OHRvu1>@Onb5fQeP=E$YVLhC zMpkEIz*}74t>;PK?7p#~Z%%f?7~v`0DRg{|bgVzLd*4!|S_D~Bs^i}}-~bm7W%PuM#$_t2fExWw_|WAamWxY6S=i?9Vv z%r%BcXG@HRZ58<(=pqR3&TX^GGZa(U>rmsz|48$YB!5Mbd}P5~h{T9z78BD2Hc~3x zKc=D%SQ$%P6OieeGg?oR7gqz4+_JkSUx-yl&y1FKX^s)nU<6PVuXc@ z5Q^F76 z{SeBk&t7-TvH9etn33qag}(s;Y#{$}DuS}%Dsh-D+#S{21Xu}Sk&DG)xHL^Qw|H>V zxET9a!QifM%L2`JPex5!_AtdT_*%k`VeIDQ?HT<-M)oaKV}&lR%R{pCedOz43WD^xnWfcqCkBF@ z9VL7YK`@>c7LO}V=2TqML`PYb>%P~dvj3iOGBECvD{|;Qxf^$-ay$lo8O#nsR?je@BD*SU*98?E={03WiP!k{}RCQ9m z$}#Jzcn)I25#^-Qz>JN^??=RtAucr-Jg~DzhqOS$;j`Nvn04M4em6Ki1o7#9mexRO za1Xpdyz4D?3QY~9CFGp2%?f=2jo6e$v!*L(L}2VrIGXj$Qo`z2<~wn>{lP=(&WO_z z%zI*bMxNYxqS^^Q%LdYtVK#tB?aiXO4M+CB82bvCy5B5q+}+)^xE3hx?(XjHPO%Hc zp}4!dLve~*ad&rj`|j+_?#}#o_RA)akU$`p-?{HO?{gm6pZ01@yeN33rIEH6_h#S& zAtyDiJrVMTQI^fsYm9y9uY^o2bTA1eX3xK4_JcOpgRO?X!s>CM^h@c2{%VH*gzC+X zm|DU@rf9<$tml$Jms2>4!=KJ6d8-32{Whg&RZ)|_&kVZ0FTt!Gs9OJ(PnX+!>5)Qh zUlC8RiylPF@@L#Kl%)qKKc6ZzJ_2|rcY##{ID-2IQXd(&W*dO0U`Xf^_O3hzv+xkb zyWZ`jB(PC_st2sEDep$CoUQ^V_XIDXDA&I?s}bkBW^0jQ{7$(3#>|Pt&`$Eg+Gz5E z;1W~$+#bKU41|KrdzjU-}M$(v|Z_GtP$3uCNzu7r6tT zbL<-Yzs4_hl6Ar@TVoqX`_{xb0v&U6)YpWp#kj60veHC!+z-J61{@B5su999=xpMx-gS$e@eFvqMEK%gabP9K}#r0IvW%eC!?X4N_8L|4?qdX5#mx^1+!K`l5>-B!e?Zi&>J~yXe z^EiDXWNlAa=vKuV@D7qCAc#+)(rDN_h$lAQQr1NEM1~of6g0s&*Wa7$zfuqBC5F}q zIq_;)KITrRf4ja2p8@)7#`a)Uf-R*tDDuh~r5&3r|B*a)_||C;726hD33bKC@ZHC# z?zQfi_d71~w6Ulk;z5n@cnfKt56Ynic~^~u?4{Um-f)^FWFF-Hjo6)cC(RcWV-pld zUNDj_5A{hC~NfI(fVO2HkQ=y;Tzvm zhzHk*XBGZ<414*^20jeoP6fycxbX_4ZS-C0#Q+>;R*@QA_E_mUo$Lovdi=e6WBOgM zO$r}XbX2^Ad<4XtiE?#6K{o?sk1)A-V?YF^rd4z8@D$1MWZh^By(-wVH{ANZNZ60f z`VxgC22Jem%k!#k8&%#{WvT_rZ6&fo>ti-xff|7Cr6BIfkKPk5o&VJAoeS+3ZoU3Q zL%3tr>%#lX%>{;tPj-YL-?vb2jzl<>z-(*JU z#NgY(Xne)TUG*ZAJQ~DTMCGtEk1WReb_%|XglxGE-9F|)dF+enZ>5s#WpS}MuE!-@ ziZ2T!lpxm^3#caGuE!u+G$4Kc$I<|Ba8vj-l~>D5_%~He?)uB4i9Xj9SE#HO$E#r> z%SJ-{)O`xKRWCpsauH)Y634V#LG!Q&%L|cQ$cB+6KQfQH;8??vi0OE&;IYY{7e2}( zPBTv-c$2rgimyl;^vpeKO)1 zC>_sX@V&--z}6m#@s^0ExO@gZZ00=}D9*iM!~N(*W$uoP@(KSg!J}Dzov788kl!IyaRHISj`d0HO8AS*(KzxG4!kYWX6Be=3xjN< zV%-thv=OdVJ8<&z&!_kFH8GbI&!(@bU42xP_wdQ*z53EX9#7aJ7_5DVSbVFZ`SET9PA)Q2Zam@YoV458Nf#{uQ=< z*0n=~x)Z7MRDC<29^87p{+*hVetwUQGQXeloWGij(}&7UV7_rhwUrEpP-{6 z89MJ56vT+HDYZ9OyOa!|aM)$#DV}GS5vvZUGUy$*#TXqk#4F<6jEK&6BG4hJ=6u%z z2MikfzN)%;`||E559&09Mq+2T(8yCPP?-RXH3>x65|@udly}iJ+A$ zo8$4>0ZgZ|dGG{Se=jM2*dmF_;^7h$#|vu~>g%)#8*9+)-wK|3kY=^6^>_YV6f_jnm&w=h6F^A2G_%6x=JIK*F2`2&_J#h>IR zsS<`$vYK4_hShk9N*a}W>ZapIGBmH8qE*(CFsWe|LaNsDH?o}gH-M!dV2QOA0@iG% zhVgrYi(|5UGoK^sH_#_Fkjdw*MC6$6ly3Swx{xk;(pUJSHG-^uOzDe)F;MLSMw7eA z*P|%G6b}ncolp%}eR9e5;4%Ltf^6h1;nkuIvg~FF?Kv4whK`gOgc)m|&>0SzLfjdd zP#(f97vZEs-ga$#{7>Y&gOCy^=D&M}0 z_){+OQ@U62Do>z?SdEtrFjI=+yOieg%ILB*){Pwi(lJoMJ#JV9gRCHTH%>6+*Kwyr z^<>8}9IKkcym=InL#D3PQG@pEzgA8scXeaJQF?~LiI;Zqn~-7UM^u2-^rZ}80P6Gg zh9Qa1gsAnP7qM#jO>9W#$=$Wo^oZ?k+}1*UGX*`n>K6e-AGxw_SSYkU@ddPzyg#FR zyZJUzXjpbNlMhYSNG?f5AzLJJMb(r+MP8;Jzp|CxZVxUZc!zX2 zaH$O%^6W=WDKb%(Ia@)*cwtZs`FaSx4W#0%FewwWUN?eh7U1RiA_or`9lf z!_HZGo3ni_pdx6=>xh9TB3Nchzk=j|hWwm)c=nB;)t5;^hg|UvU;fTJMEK4e;xXzJ z35z}~O=*12Yz~>8ROkntnYjr))^l)lRI&+qfqf&9ky$0?t(@dyxFi>RNBlG<98cJwCS3?L< zwfHWqfkm?qag5EV9UT^5{7uwDCW-5Hnl5T;1NCb^OaVnl+xEt4Y-+iorirEqn`C-O z?S*;-pZwBqG21j;ZeISj&feB;Rz}wT_oKGoXIvRO>J!c&WIt^vhA^V*$@1CV&>h$a6Jih&0ef@ghZ?jshYO&hn z1PN!tTQ_tvx6rPH^z?%(8=h)`lT+qvbQ!~9EkW!-+Y?E6RXvZZQ(B-&^&d{IQF{V)}sp8;a@Ff3w$ zr)od6lhObk9u;uUy?E6KC}FN3jkMC=>rCc&gYjVJh0fAw#~tt-pg%y=>5mmVq<*5s z9kF~$s}#R>LF`63PH8RJdiz%6Sa(f_*}cFVthI5nwnzTOzhJxNDJx>r<_Y|xbX(!6 zA&3!qiE6@Za6)*&IXWo!C6Xp;rzXf!qW2mrP5sa8QdW&-b(_`MbAv~|D(wNf`iPuu zEi-ztT6HUIH@o=nhl;4wzRfESL=T`vOu4A9#+n=FS3yLMHItj*$-zhsBR2ezjOK^{ zOHVyC<_NuoY|{_pprRz^EYSh)jW6qDslRoUBy*w-%@^%)PCHPMyC=p*`bT;Xta&%) z<_A0RPNkbGPt5nZYZAzJMn~yz{B=BdXlRcW?X5^#gDo=f?BPYmKC+BrZ&;wfO6-vSrP6UXzH3F#y-XVoW@84{!B^gdOcUL3TqNoPPR;XJ`$F_QW8jxE4=puGt2L z=SPF&tssz>hvkS;)dIB^Sv#?Qan6Z8wvhzHyCD@bdJnSE76@`;)mW#cFHRPbdQbx!K`kJr}j1`2ZH@+vcv z;73k-7__tN5+9qW1K%&MPBgOo4ZIf~=yFd->Xyjg(r*ZC^Pd2VX9SgxYQME;Cjtp* zlMB;&pd^{z55DV>B`o$z6#6-B2&^u%s3V+`DLtO&1(n|CXmyVgIgVe(j<%)R z_01L&JobJ=h^zCb{bkk8I->rLKDz>|%4}mM`EEn@XGlQvMIJoyJ#XopX0KY!@bfXs zQ+*kOyZ7*rNE@kCZ%+|F55WrV2|S<1KtEzEH7+iWOsbP*RN>F1-Nub!X@zwgFOrrzV52|(o%AJ8e2`QP_S6)&Ke*bXQy20CrJTA8^>8rcJFI{(WoQ%6Nd4da7T zii?zBw3A&@r?4qRN0~{IvhfQB1tu6JOp*QxX(m+|z-4Dd3e@5LMcaVD;w0DsX_9Ml zE`@nG%I{I4Y*U_WZ(-E5{$a(&&*!|UyJ=DW4;g!#DNO_nb8 zx|clK;W^h(U7k$&SKgK#qzl}EpJiVmwh}j^WF5_b9I-0BlxHRCm}dzpoo3Qb^4eZ8 zwhjN<;4kG4>Va3Z7a{VCEfL7{Ah*EgC2dwKqhvyJ++l71mKYV8>;luinuhg-KsWE)oR|7{or&9mR%(J&>yyjbg7mJj1}~D zm19gUVwyr5%{*N4qA+N<*-Dc_;alzW(+Jq|!)?=6TSr1&v2J~fyb=OgDZOzTOT_h#9L9xJ?gm>~7dz%=_p8`qzqgwWIB3>(C z(PFj%jv%zP=M57VLvk17+TJZG+ztS;&p7`j7?M&n1sRH>?d&mX=vLo2PZhmDO;5*M;4-=0lOB>pJ$Gp7$b&~* zWsN1k<{yo7M^z~}bOV{1R~xSMhrXnGegm5qB!jXsRW#O;Us-5A%kcfUKl@0%7~W0U z@J!$9*EEl-k*hmijx@VU7|N|$`I1Y~B&)h<1k;j6JgOq#ZKnMN-9q5ntT}7Ee4FAK zFi)1!RH1NeE)1qQ3iHbIQ*R1m(F2N%L(7?R?+4>M@~cD|M^Y!0?xYQgW6|IZI^^$L zt|?;H?HyFe;0~D#OY&J z(xvYT&XC+{5t*wx@8|fM8vH8Z2_Pcw6A^iTBTeKGe-ICoaJJl9Y=L%LW5Dcw9U<~A z2vb}{nijn)Yd#>*#>wXhYmWD86u_O#+Xcx2n~n$1#PSR|Rc(hDT=(}tvRHZJb`|Km zn%-+8@E+vzM{dgb!@c*or)P1@*Tapi{`kR-Oe}@ zxRKu#4Rept=nlmrZAHWteObcWt|KDlij{WWF_=!`n6jxc#_4XyLbun3K9qRVWszBi zS&3f0*CT1A$rse1q{g^d9j%yVwGM4L5 z;vQtP%ub!$%GKXr*&5hxbKcK&Utg!D3_uR9Xu@PtM+`Y538D}#oCJm@c)vcjdG$;P z<3(EWn*MpP6Sz84|5~dTW>o8B>CcKd1Q%5`abJQEy73ZmtbHQ?Je{b>4Mh4ar4H)3aYnb{VV7&MMNw%0C~<#U*|vScop8mbF-HllyNf z$EXs^3rI{}@`)x{ww8vA%$|GuEWl@6`l~i=X?@@!Vj@iI8`v|}aGdX!4r
K7|BUm`^7>V&Zk%^_d-%A~k@lFe zJ29@)d6R=}098x)iL_mZLWI0K!FqBf3ZpOzvy+Jct8hK3BkXB|;{d;X&YC^=&6Ir$ z7dO(0F~nn3Gr|Rt;+c_XW1`>ZY0JmUlh|dGco5o?f9f0Y-h5b}XYwKP?NvN;_U?Fa}eW-)d@m zG(?{8rVK0|*ho7_Opp&!{iFuJUdcgq((l3@m?b)KL^()Va<63&5uKdl;a(6D;1J`U z;42^^7JCB#5|pAZ^5rG-lbPu`C$c)l**QEUMp7;DOxo5PJjDmn=^+bWzE_JJ6Cn$8 zu(?@2m4>yoN2Kw4Tlx-N@a-PQ`@>cYdaLXnZ};Y9Yl|Y6K*=+viVLwZ=+Q}QT4m_h z-|1S6u2bLQ(SKvVIDwGu(ezr)jS5pX;6-V$ z69nqiOAC@Y@k%a3swx&M%ck9gofsP2yXq=0h`^4o8Llly(mCHXN z_$=78d#||+)1kiO`H(mp6tWZ;8C)v zw57vIxFga4uE_TD%gVGst)f!7dE(gSY)5}W8SyFns3>ErCf;*(=u)gdI|nDFSIjM8 zAG5*H68om6K~IYM8gN5e2)jA*1HBHtB{`m0nJGn$@o?;v6(RCW1^)euPhonpc?3RO z=>f*`@?Jr3)E_%ZSUV488l!;_1?;w$b&LA6?1_X;PSw==cO zl}tiKT(g>~wqIhS)<3OjJsKp=f6*1P7?jqQWqnbSvM3`Mq<~OZjhjfE0$AOj4v>wg zWhTv%d7UTdD5=2c;2QM3eCo081+|D%{OgNFV~$963&5P8R6e#XN-r}+ly?+?+x`aE z6?s|Lcd4@4Hg=+Ph1a3pi`t>xt919pGj)P+AT@}1E3Ax=7B#21RIh@Ttd}ZN;V~JzPXAQu>+Kf+;v2mA zTLP{ezh6Sol3k*+7AlRs{4^Us3r93A>TDH3nE@@1g#pk>q`TJv^DRcB8=7)+##Zfh zysozdV|-_B!q>^W$ncNJ@dT;DstI3!;+4c3ZHNHf6FjvTmI>*bTJPr7Bg#kKR?bsO zhzPj2DuwS|l)an;@wEB*7!y`w6n~k`a%uLX+p&4NqJHHyUUK$?&WVzJLd&vVqLkmS4BiD*$uoMxW|#zjBghEf zY->VN$QZ=^kVjRrBuRBO*WSJ83fY8tAsg0l4|WlN_+nr@QSG@h*@8frYlEN-HPD1+ z`FI;aELzQa!+P+#7Fls+gknx*QCm{g5+etHEy7SQ-sm`bL zwSRn%Ds>`0Jvt3wc^|bBgeU3=7VV5E<*_Ayi3`&gb4>};7jbO~>k2#SC-UZ-<|FbZ zCtJ(4BHSioFh5ygXChtqJE9%|&2LvypvyG_ojC$K5#Nm$GlRfFAz&!ziu#lJ9lvlI zYb^vLI>Ha82K^5rjx#8+u;f+3wO2^a&)NI6*69k5C21dTc} z|1>T$_9>GhO>y;W_Sku|#_@vr4IPuqrXQV64;y?B8=V-bN4yKm8K>tHh{Cn&8>^O= zc4$5sO!;ntp4|fv{Jk3R{JpN$NHuA`e*io@_d4j68wf-i^V=#Q6X~%&DSu77!sv8bj+L-tmN`f&~!4M zn zNlj=wAdNpZP58T$EAVUF#aA@U+-K6A*kA3l#>ix~@x#qtw%wrIM9b=fF}v_f++UJ^ zjV|eBP`wwrg2)xtCs3Ud6k)2d24r)UXXm=u-mE~L;ZkZ`o+?lr)}?$r>V@$3xInMV z6Pme_r%TnQ`C7TpH!CB4@4=&Kk1nJVMzt+&i}p1_&+n^jvM;X2j4!U1ek?N%QnXJ` z$_wzG%1U1rV#6nHzO@Ljo8UWhVm{-d5$Z2=>6+yx-n(rIE8z_bzSyRf{l+p9KP}WX zURd?s^C2jaA6osgRg~^2AY3p+guC8LBb-c>||BvcYtTmjhlS=k&c39kJgP}vh<5m z#DK|O@2;kt))IjF$7dpS%y~7#-#%g(I(VYl$YQEOo^rz%D)BopnuLe$N>WIu>DPRy?#93>CyCkM<1{ADA#8~Vq92si`*Ew}%}xc={9A`JgX2x0h- zWDiH+{)f@=zkm!nn$am~IY!!MIVNe@5vh5($&tM;Unb~A#^stI|ALbMf9ro`ngEq{ z|B-3(_dmg8Vr%t30!ZS9?~-|e*A5lne)KP%ZGZc5A>+SAkC?cMIM~?%(G*!Ldo$qm z!ySmP{3ouGr1}qkdH6`W=5V{J%|FQd1+J_7X~L2))0V>Js58HZ%y1X&3{wz93Ih5z z^O@MEe-m%TvTkU_DJD1G869qL`&_oU9Bix$1O$9QIfj#i!=4>2aiH|ZfD%q6Jqmkq z6M7Ls5{dyl2kv#X%)$?DN)WWyFC78%fYa-rMl};+W7Zz9QeS;nPqMZ9)LvmrN2V^m z=gnP(n(*|UxVBk&=rt@5Ng6HJUp#szFDjY3ZGJlxc2+W9Y8}6C`pmgJq7qF~uh6CB zTqhz&7-}0#bF)v=8*>?N!N}JfV_W+5fZJlmO$?BXq$HTBZw?QtmYT6)oadt-j(%id z*$OhU(eD}W-GpYr=sZeH!mXqYJ>?E;rm-?**7vLPGHCDm`loKlvErB~n=&k@`pnRZ zGk+A?mH125Zf%4$PP?#dDUg3n442XEu14ITac^fZFV)v$2N-u-OcI5Cl}hE3+#y23 zjrf|10+{Qd0-RHdhK`Mk&WEs_IVs3z2qWg9zU}b{iMYEgPJMrwG435_?$G6GeD+Ep zXc>j8rl$#u90d8 zR8uVCY+Xh&oxWhQN+~=4Ra~9?*E4*4EOvM{hBUclsIpVY(gw`+ zsVdH){1;k>tc}{9UkVB#`6`~@!xAed<6*ftsSk061kwiuil3x!c z>V_?U-HUE}4Km9D5xzs9`OCNeS-JmNivNx8{qIFtrLLoa4+Q(GF{6_x!M7ahWFY`Eia6a#=vSjmD34{Uan&@^(KaL~Sjp7T}ZlmY8!PGYq_P z=a7Gka6k=*Pwy(7JtMU zTx*@E3Ye}euE4*y7UCeL359bC(kdubZN^mDb&aH5dQBg21p0~Xi!Q55V{#}}TK;hD zt(PmZbVw7IqqzuvIPLpJt3%GF@I&aE`}u z=0|I<1WxVh$pm{ca;v%}S3rkL> zo0ZEdY@*Z4w3Fd!m*_J1?Xp?djlPILD%l1@lXC{wd5i9f4Ux>Rs2yM*vbRUBV;`2f zJ9|}oL>6~216K(b4pmC388BkJ#U}@i_0>!EZULU>z7NNo-tx7NuTXo|_E<=B`B_ok zS_nm-C-wTBNj%v4Ux9o%d#rgMyc(s-Zh8H^X48%zQh>Tycc76iE^b3A>UDIKM?Cg* zRTMQzH1|j0_xy0Qfc%K1pGt#WFmi*S*%76~rNSvjx#Avg%~6+va&!pA(Y!b6)GJe_-2G1@o=K0G zrw~{iXTF6@{p5x794aZ~pXj0r0?dUkb?4JIKCLS`6mm%3cCEV!Hz-lA&7SHFo@3Fj zE;vw43#o-|3q^le_=EKsCsao_0V}oZk7pv@E+>rB@6|Rf?WI6`sjh7ZNrA?Mjm zxf}P|`jJ}>P|4FhXBr!pFmmU62q5cx>ZA7))CK!Q@AX`qeZf+KT`BvDs`&(Y#!cv( zn(x+Q24F_qXsHHa+=U~7@nvs)wYACF{Wj7O{G2?EC-rL8jR*gRv{@a{8z|61_lIha z0AgVm32I?iGy)0AL*E-wIM*%WyZr1WYu{cxd8(DR4Vj~Y(TfGeS7~$_;gu+4 zTXFbJ7#LE}PhlDoUZ*SZ(`kY3!JK&L?#LIoB8;2X1{bQFK@UN#{_06K!dJc<$F3CS!f+xY8?03k& z2DA*$?9oY4X9rW(58Fw@*FC|@a>4L@D`-|8yOqi4N}k8C|MfcB{jX5Q5jom;QTlDIRR~(-v%F1?P)AptH3e=Z|MM?&fAxLX&FMI8E9sTCx`UPqWVFC?qiPdOT zY+Wq4hx;(7gfHkNFF=8~49F(*ephuub&mx=gvxN6L#XAzyJrlL7el#XSQQLo7|IGxw|yk_`!be_nV0k;E*cX( zHiQaRi}fR1ug+iRlh+t+IkkN2jSfc84fT-YS^eW>5r{TUv+j%hf0?PMAtVuSfltK( z_*8&W%D)ah|MXP;GQC7A$;tE!qWH}&49?Y*Q%{kx!-?0((Ml>|fWg6Tv>dnFN`0+g zPyFCS{s0L`Y?aG{_$iE?oaNPU3CsdJd_2YP;hQ9MCCo(2q)>scM$FrUFR|@?OQhZI z#;IQB+82WLAyn`(2CIQX<%t~&3BXG$YYS!z!k5ZR9pRu}n}ffwk!co3d@%8&-F-S~Fzqd@`dZac6XMtZNmTjU zl=x5oUxj}v^(=KA4|HG`rb0|($6Z0QoOQ;AD}=S1(-zbgqG_>alC+@{3$bD?4xW`w zm2C}=csym=8u+?D0PP4{IjYT=<9lWCBrV8hH^$QsRs;yzID_qcp$&DBWvg zB{NpqD0N`(E~5NQqKPmb!Vr-{SPX5U1k@wwh>Hc;CflylCsVr0>#I1FE=N@1FKbN@ zCH>*Az>X-_t7C`tIrSJSR}o>rs&8m6!iFyxI?5|m&#TYJJa1d2uC zUL9Q&YQbBR4pVgmMakovWd~u;<#i z4VhX{@xQ|4f6j;)zNBb9YQ=|X3N=_Pgf!4{pu|mf4K`sJ?T%SLhg9Igl9zoqgj)ES zLJlfGTJF~NP_p1Adwso^^v&~A#lP2H>z6~PDS5JbHBN_?f#IX6*w>qMAYrIUbtdAO zwn|qWzEYcW{^rVx`kFHlRMHILO;H1*aaHdu(fdFp2-yHPlBrymL$NxJqDArL!Si^+H z)VFdA-FI|mK9~BQb>OEhDKzA3twArhZ!t+Q#!v6EhipA{M<@$Sf>Qgr4S9Rt7$-=B zEt&1tq@bGXXrP$!XnjgrmGC;P$VPk8{Wo*B`08@%S2uNDUXSZHt7Mv|YRT}E3;1E) z#iWf#R;r*1RW3Kas&(Tz$LZ%e5B;PB%W@vbxPo-*q6^ilN|YPJ*#pboi;UuJukPBfA zD2pP(`WqcN0jfbJ4Qp>yAvYcG?4PWY-q?#s#&Nf#ll~I;eQ#aK{$RB47*dh~cKE3+F-?Q%V{b>dz(36dJ*lD1p;Wv;FZ zqRF#EE-xXNE^RL&>`@Hr#eJ&`c6p%X(Y%|KGOsyBrop`i=D)#P8BwBT-+AhG@r_H1ajPoqlC0pc1&p%uBN0#b) z^pDjnws|zUV=#q+j1SXqB~k|sfkCH`4~NKU(6=^`(}1`>nK=ZYEpP+%2b$pJrIFF;P~hEhPn5D!-QzJ#Rd4{)Y8QP&0= z_BelO1Byn@ zKoi;jH1Y|J68c;4p4g{llQz8jetWo$$dn=mgjg^7Z}(CLD=?{hM@HW7VQ4D4?T-An z0>tJUr|+I%!zf`eBBCKjw)V|ic2%jh!*Z+AdKWem)K-M6ZseB2bWUl-`fsqV0V0!cR%56K-%{izCQQ zuqaDQxRtYutBRZP zKfe8U!sdYbsXV$8%Ex4LZ7qW$%9jmPx}yP4 zkWFxO#4kUtbAH6`h~ONaVbNo?hsHe}j%TKEZ>FVXrSSoAl6NSQKr`5?xD2ZwGM2&g z@wUTZMr-ISWIOzeQBo)@j5~qhu(15H(s5UkzfDkS0ph1k>TmWhu%EB@JQ` z>TSi$t~Y}*bY&GnSdqxQL;8WndSE*15m_pH z$9^fcKRcmL6nwP$B2c}}<6#?by?7rKsryCsqwLJ ze=T;$RN*6lBjB0F+8uT0C1Rq}BB<$lc;$=FJ<0JfQHm30EqA&sg-NSW3wP<|Gz8PM>Jxd$)RlO5u27E$yScHz zA14qe4&n4-=2eN?4bVb0dk>IJYYJ(yfHTGAdXGJ6XlT<&OAB1rI(lK-Wq0Z`UDrK% zxRz-dd&dhTCoo7t2^f!USjWVV`baIf=p2mm)aA`o{AVLh6;MW^z(^btE^`;7Z`PAy zC`}D`4J=Sjp+^{Ixk>uE>lAHLcgY&U#7Yq9N1|W_TMAVW35AcSelQ=BGKQmchJltV zbnkze^F3crR|@|&<3sk|?^scj8e`dkqOQ9k@aEW4^;R zmw>}epDDY5kCz8pc(ld;$YKU^?M+ zems4sBF0ReVAXfD6QHKYeWztCxn37~zG;S&6XlWfg^faE?MtuAOl`ByW^;#y?<(n- z;YgKZ$vB_RNgm7b3`OWN2194mWa#V|)BYzGfV1x%a0D;A8QPMy8 z=WFK!*GScUQSEHoKJ8Nj1~F}_pH$=yY7mmY&0`TW;Ykg+K`~bn?WXRI4CG=ac5**| zVT~fRfDLZGxbVh2&129pX`Qf8$4V1}(t2)>7h___ghz<1yFJm zb)t(DTQg7PRzhZ#%`tt&Jy6&nbPeA1NHWSl7yXr`K{^?`EmETYiHwMDHxMA#!oaw0 zs9(jubjzoIFj+mnPp&8)*p+HE{6L(@C#H;yv20;_On#1P1s9E*MJPBO%_MpDvphFv z<6ZL4=;4u3#-AlDXH$IpcJf#iK@utYfO#hk|{z)s`~j2Yqm|6XqY z(TRl3%pIJ8i6j5E71^nvYhd`>*E>2jSV|%$HCq-6kuZgTe34RwpKC$;VVB5RYWLMh zPUEMZMMD`dUO40f{@W~)_F(fS&n(kB@jGf(_Ah)9=0L<4ws&WPNxuv3DZhuchQ}IU zQ$iHP1Cok<&#+jtvi52243EUs(vwHZfa(rn#wh$Y4K-2g;ZGvn{W8=mNQ!h!c2Nw6-y=xAlkgMQp;n`IhsDNLrcjfqr526Ym5fA z9bsGTJkQE%(Y3+|J7Ygt0cyY4$Z|nj&W@cuh`}o%>cLf%8d3Ejm+$v6KYV|!6^7k> zJ-mYLIy+aFA&%3KJ-v40$l`+QNBm1?dU=^Rhgu`Udg(zs1KY;jFJE-%ZfmtrSG|v; z)ik7RQD^82Fgf_w;xd2m7Q$FpNj1v>F8T~z*_eW15WvtSMN)@WNtWv^Uk19IHv28Y zwEqLkuvmkY8jYMNQjEKidFUFPype1#&BkGCe;jW@l<}<|WX4m%E*&JLEsJOeg{mX+ zBQ9%p`~_Yt;%(V9Ij#a>W8oG(6-0#t&JHxRW?lJ2yZMqvj#}eFiNLBeu2qp(y?ASQ zhD&_e$lx5kh$E8#{JwJxU_^bmrcvvWSK&Q468nme&{NTi<9G!xi z%&NjsZs>D?fn&SI#<92MPAduEzAHkpJ4ITZ4zp@HoN;1$U;Aj6f2y@Ey;)yoT{$Ow zr)^3ww6c5|;gH9wJ?+NZp~NayNSrzKEUXs``WSbq8KI&yo3r#;!H`HZ7&nKn*4vju)9<*BOh7mmu#(tK#|C4A_ zN%tZ&`!69EfqQBC4|v}?Ph;qh9LtOTusI@Z8(UCtTU1bYBI0{-Qrl$C&boZzDVK5FX4ouZ+T!b>!Sso#I`O9deKCT+uHEPPCCB$vqh7b}m1?EaDwv?70Hw5fgiox3mc zO0iogzg@f#cUUq982UoXK6P)lLGKM@ZUX)lw(M?(E$0I^&IRCpMg0GAhKLxsm`T~Y znAy8nxdP*hRDjwudkf%H>u3bz9sXywbdk!c{j4Ag->L2zR2ZNUQBhS}I=4;ftDg{! z5`?I51O}*bd6z>%^zvvO-D=qr<_9TL2gVQR-)sRPt&=P2C~_o{G^3MePvdFayVoU` zmjWQAyENd00|@GK@qK)5Ym0R?eUyZlgldEw09O?rR!bHN>3wv7=_(-{psCvR_w7h4 zQ-{e$3vI$>JGgz0qe8h4fh<%_;Z*JHLDvyim!mK4u*)<&@3E$xhwmUCQ7cjKv=hO0 zlikH@5L&jo-V`fCEV7*ulC2e*`*>Df`AdRN*HwfJ4L-sPNrw{tYtaR*z+v$O;aF5$ z^s{7}2=|2+iC#(d-8iUuY^>z6VvIOKrOS_Zu}@Wmph4flwdw2cprrm~?cO4YIzE2G zif`EL{niTFNXS&u4z~)3a$r^&-GI5w#U-+G*{Li~@N3y}4b4(8$7%_VXn1pG)0mNSMNtbXqfydnD`XI+KT7laJ>1yP296NHJ{ zUs2h`d9xB?T6bxbd1c(w6S)~u$($f%qu(qYMyBJ6*s6lg*s2p8L_sP^k(=n)`?$PB zk0_RXo7@9MZC(+TS5@|@OW2A#glm~38)}AY9hjG5F1?!Ny-?wmIF8 zyuf~uejq&v`(Q8jWpm&;rIp)mV`=TF`~O7>=b+2oy$J;ZQi}?t`2SxDRK^~d?*8}5 z?(c0+#ns5w?C&$)y5{lUfXB~H&hrr09yA(F#i*GX&UN@87|`JpgIftcfdI>sMCs$C>8fy!80c8 zkg}s^mFea|M$8lU7iC9ZevP!JT;C~J{j`k@V8bdSohapsN{KV7;7`5WqFMt-o@TN& z>|6`Jc?ZA!m%0#bVmZtEDshF_{Gk;Nz4g-6Wb5SU6az}dBW;w{1G4;T1Sf2

Qox z0`xkkAPQweAlfOtBr;PCpCyY@I(B}_q2#9zd3W%J|3eWKpVLA(TO z5%Zf>!cM)^YQ?&n@bvEeMq7qf)_Rqe86vho+bO6^&4TNMJrCK9V`zKRuXfd8M5%~s`9IYm95q_DwQl# zw{#U3?nojDov=wtw2sQ^BnoussoxlxR&D21ZG+h=hHHPRxddwfoNLfm=2*#>S;;QV z!b3X2P@Y~tG@ zEsv?a$avqb z!A;+xKmVyOCP2?u_M?6ro!|6p3hE1XWYaW#CmFc3%s^$13Jd-mV|FHKD;5_gD8=oL zv9{Lt);bu_WV&2XT749?b+HvE@zDP45=p1BaTTD|Ujs_}Pptcu-!Z)p9f!fEsGcW0 zNI*A-;X6d73JsXdwnqOVLo}*B?BqJxV>?b(wQd&e?en)d{)G}U1e&OCD|aImZ`3H6ub*NDlQpCW z7Fvb22s61l4U30fGmyZE_9%KpbX?j2jtpKREvCcg;qd6)+bMk%rMajuBY7%4@T_MqDUPcc-On;3{h}TDaHHiD8llM)Y zenv30d7+wIdgsx!>bknt{ArjL-`i3>%>zm7b1aEWPdW0}Dn`+tNiz|#nDU#_Mw2GC zF??~VSmm`iB5JmNJnfW{;S|zFTxex&mW5Oa^r*W%uJM>*pmo=TO24r~ap-AG@Z^z& z@ag%!NpczPaLM}v-G7twO{k8Y@*^M&%;gdP$@biw`0`qQ$SNmi*8mkopTL?V(*&}c zBLjqsFZ6T@g5&L+aa)+Qr61|;9SRLU@j)Cb*v4VnqP&h-Cqz$)nB3x)s@C4u!g%pM zEyb*^R3|r3{4MKBUPH?(D8W81Y2Wi>?d83MZ{MQ=!DaVyWJQG-->ZYzQh6mm-2RAr zwJeG0GKJdfJyLuoeXc_f?Ancb`$9pUO=9Ebr%&VtFna#h@=(gm!2vLt`(x|`>{9<} z;LQAwbHwG{$}BQEX-KrBUk$h+Oe|hb=vXisNt!NgrwZ!qNZKii4fNz~AIrU&Cthe& z52`m1Pr}7=!w75=OcL=4TjSp2n8D(|{FJg?rBNVX+2cqF#nR*srLf3GN^A4tb~jU^ zw^00dk6n`pHdS@eyf=nvnjNK@PwmDHX|tg8hQda*<{Z&cN~6kAkK*PmYn!Yzdc&qo zZRN_;yI>xRqWF|ahf0Yk&#(p9mfqqvcEXjhG7XuCqJKPLZjihSvsrMYmv?GtZtpBC zygaAfZLcR?ncPb{QqRN2JsWmcosmDIY;l(-I{^F9WE4l-zK$g{sJwQ;rCrzj0d1cdA`jz{$1?pXrG=acA{?JbGvy(oh&ivO9cX;@g)xX}$b5Kq948PdDBiJbiYt zR0vER&T`jt{Dj;JtKbTgsy#L^0Zs{7FHT^NL1-580djJX)=Wk;e1aj-1UzILng@P` zgo%F__Zz9(sqT9~vJ}FxsRdQtC%d@`Y#?J>qrJisrL;3PxBXf$=g6%%F_Kn$wT!uy>CK@uaU z0F>zhy{(7o7W{}c*oBRdoE}3X9G68iyzT}{29wew58xymHl3&f zuKG?e$hb&uX*2Ki=|a54*X&bX`B`dyny*-oDJu~g-4!B*9?~JIa+lH+$w8>&CeB|M zHvac;C8+@GF9lftZ_OM3ZT2pD_C|l3H&!SuSWnBsak1EK_1KA#TB#1nPbCna#xZ|L zpr$O$`yj6vKXAO9!cL#;+Jqw2C99vUJ7z+5)ek$x)ON(BhmLXEvqt zE!l_#8jiyN2{>H4nZuoy$hkMW7~ZA(&|1LI{Yc%}K>^G0u+8Mhn>+&O@;9PmZ+CBO zd<`V`uQ_1;u#fK2XLP6rV;~bO>TAn7O zQMZ>EM(ELT)0mClcC7IkY##L4t!cV?uT^+Uv(ezz;AQS!p56^|2ln2^-NffhZ58{8k5t*V zK`^yH?32h(0seh<&w7XO%$Z1y)w53NfD`s^S{ugGPuHN8_N`V=MyaLW6}=7_9keUc zvywH`bHX{CBFadUFYkPsYx=p;Pq^#j9gMo|hCtf!oZMZ6X~|VEMT>W)6bPXLuT2Ap zJ%ZZk@$w9(`$o7^Iy-RnM@|Xu={|tY$Y&YlR*My=zA-==mW?tW$O31Vktg8KK&8c| zt&F3QqchlLNVw7JK-*T|@o?4G%0i>wMA$*6Ho#wB=#~XnqUXjFR}?T@Q0ZC4cK~uy zai|eukdf#KcZjRHEmS(8y5K?=Gy&|vDh_o+kTdxq`%T@zMMso0AuN*p|hGHue ztCRZL7%~=DgK+i8FgEJPi?!01K5?H;fX!C`Y@X$J)=Gca{L9sQqSC)S;ohgSlXA>x zl|!Cx$o0kf70i=VQyK_; z&K^)rtR@yP*;m_RzF|SzbaP7PBWHUc?&b|#+I6n2Hfgbm;0k9HKrS{`Z4Dakb4dY*Nn57C#) z=ECn}*Y1u~%pvL}>{5-!9ou<#23Q+=AWl%|Fh%D`@94AW$~9{*_^6gdOv_vO&i4#0 zi>d7wf0OY^@!GR6z5U_yf%%@H zb_*}SllSF=(a5w$dA9WgP&+VDPtU-lb%--Yg=2F}3b)WP0VEyFbgc;K0!u_p1{4rl zuT+SIC>2yD51g9c>`p3T&p2+oQL(5e|2W(B$-NV`5TnJLPXMj)X95zlFc(T zV;*6TyX^>C`K+kBi4bGJ>i#^BW(A^ z2R?pZE|5he!8_?UlcB|w%_0M@^j3}-P=KiErPlGVW3{%4&fPv#IAO4uW)`Fs%HdX0 z4uXay5=!}E#1_g(zlx6i4*S=UAd|qct{89ztmyBuO26J4`s1zm+aQoAuk}+_iK|wv z)>%rbE^X5#f=rmq8cBx`-;@{04=R@PmRT(5WWZS2n1skDm#0`Jkoy++K0nNb`4v30 znKSlSX6s(oFqg~Iu@@rhE)gMy+y%s!B#=XC5lrSbcUrKR$z_rHy{EXWQk4a zmmK_S-=qaodySWOuo0Yn0BnhzJa^IL{EV%fVr%SpfN3d4*xzu`(i-(9^dQMw_P_=J3AAf)c! zAse)jx9GXO<_2en3`Uh-2z8`DF&5mVd9kgOIN~Y#PHsnmFyg$b8z^Yy(D02 zoKEp6SSnKeg4dW0^j?V;Nn5Msgfom9_Ra|-8Eq(DM2}Po zznRFri~2Y@(7*&=g{uWLz>v=P+NbkQ%-4S*!O-i6?^~ojVUXKfh^9Jb%7Ug488T`; zw%)u^R7wXUN^k!Ch~9-yz2O91qMVV+)k#Se#gDM&Z-nT)& z`UYdx9f?)jAU1d0MkwkmwszZ9x^9G4YoBv2mCTx!u*`eK7){fT)5EE;*$DjXHpwDf z+B>rK9jC1zCQ1Bc10wytMU7r7OkgF~_?uGdw*u+T705iMs*&&Kw3bSnqm-`FrA}vr z!W%guPH=rNWM0$5a=0G^P$m1Q?MNLmXp%Z3rbRtARBplpqpfO+n%Hn7vqA5C%b-Qp z+eQD1+DQj-rcg*QeYitDz0(!Y!KC7r^cItL6*ZnfuNh6R}}T(~1u5O?VNB zazm$B2ZzJRrqkk@@!TD{k*wqsa-1eO`MW5waLvX58*vi*Apt}OUQ@w(Q1@!D(UW>e zcO0zH`fRacvP`=RNHEB@r>%OdxQEbG=|2&qN@3-lQ4o9cuW<6K2YgR3sl()d2)fvc z^ksPGL6UJVNL3_`?cQoV;vZTJcT;DI>_PSo?%u7+8!E%x9~O@p)qhSD8#35D$v7(K zI6H7FIw1XofP_Jo4t<=rHzC9K+?pUdAhr){`9xQE^SUL8+nAY5f+8iU;k}(35!A}5 zm!^M^MqQWaj~5xVnv+C0ya7h81TgadkGbxzefOD);{eG3q$gwNrNF|#Fj-_Od}ULz z8YDP=@sNU0v3OxgT0-}CLj^Eu&V#2(x0Rm<)4@G1UWXF*)%qk{j5g%S*Y$OeJ? zrF-59F#A3AL1aYzc$qfI_b6}LRCM2~8=I9THdQ0E{)ZU}7FdO>e;(H)(3iSoVHkG|S#aj2Tq z13192TLHUM^uIHq{rjM;u=Z28^GTWv3EBa)vBW`cSytEb%bhW8nkXY3-V(wH_O-Kb zkP}(sZUe(T&)sG?G50O_tqA(K)qYg?c>VH6H#`}x6q z^DW3M^$!}RaP~A_2mO^0sqR|=y3Sp>BC03%Qygt*H(XbIm%!HvtsA@`B>Z=aS*)YC zBhe6n2D$h$SNia^wYS>hGET4Ig|KlNT5>U(35bGx_ujl-I|9FIiUn z%A!qX4=Gi_*^Yx@ek2!es9RP$&WoWkyKoO_s3fM*-ZWPXC|6kr#%W@9iJ6;+K=B8_ zgLBgb&2+wc=YH{yfsSfL79Qm*NZAv+`Eg?!%5~Vh$RK}sRimWG^2(=ISXblie3Gsm zkK2$-;pwf)lq+C2v?v$rk~-@{_#m}iJ}PhSt9AF`&k?MvcWSmHaa$jN`&g7=<{wAR zNZ3fLv?YO6KfWer;3IoQUMtDBm|b|oLr4eVAU1OGL+}d=m5|f}Yjo!b6}I*bgVH1ubk21&MUkV)QN7<&uymkUFE>r< zRJC!XLc#MB*=_8uo-W;Fba(JOkRc)8K>If?}tg%gm)QkX(fIQa|paNyJ8fcJnWvT2Uz|@W^8=TE8K%hO4V={C$dIW zk<_T%6h2)427`Bs0W+9r@(4Pvw#;mAk!7(6hSdultQxeDKf*0j9hHq63p&l*E(FHq zl~K*c=h162i{3RX9UFFpLROYIRdmX|o1R3iy^YjVKc=N{?5{iTVIC(6EOWfq@NLSw zX(u)6dvXRcHYKWnVf9zj!?PJ-8WU%! zdEZM6*bp}($=xSOM%u!x2^BAKOZfSc!}MT;t8+GqQSzI5X>Z1-J85T-mVmxY<0e^& z7~XF%qlW1*u9!0frNO=uAfZ7yv-Y6Y*;5X@{vO#^|7xb1f=&>p>&?AtPz(}mu9AG+ zz|9w;ukfOIUX0b>>nJ9vB|CHsz+>vFxdQ5rvAY&;vA40ZJ@E0nI_}!cuNc>j zSfe|EQlVpN8lnf%3D(b?beq9Cc!v}_9kvVOKl6CnmZr&i#72Zag{PpMy*G}v??HyN zO8&AaWQrqa{}nGEUv*xlXQ8qs4naxzP?UxmT=QK4?m>78a}pL0&=Q;c3^)#t!f1&S za(5yxVC4v$X(0N*9uQ{#cWj(`#rCG-Fy;-80sV-kOj z2GWhcO2{(!nHJH6m|ycyyR3e(1*Lpu%Di-DmI<$Ds$;f-TjN3dA?wU(@|vonx3EIX zvO;F{Y?*^0Rg9YWI(pgRlx^)M)8_linWXm9eri4t%5Z%1yno}DEvqY6k$yKOSQ2ZhtlABUwteQ;g#Dy+(+fYbu;gkjV3cE;=xrY2}c4kOd}3t7r&sENjgXy znUD)|0haHPGcN6??4{G-@)Q3IDSjGyXcsp%y_+6S;$Vc0b1NIKkL6@vL;TH&G9EN7 z!BoD~ATT2@UmJydh+b;QsXQ08fM3Lau_Rtxs?@Q(n71U!?Nv#xN`dkTB@}L{v|2f~ zgd>}hv_frR+Ls-@{0!_EqclpDX?LgXu=nMP?v+pj=2soU@eGc2WSy|LF$`+MaHO@1 zhDpSL?PBePnGXhy870Ohpxc%^nZ#OSu?|iPxTCMka)~2?Ex#DWTfP}^Gp|*Or+N($ zQ6$-*5s=d@(4Fi4GY2wjvX^gYIPH`g;WZpM7$N}#q!p%7H-OJ%`!2m`J3J?&cy|* z5T_-Ly24xvz21zOCgLSfhT}vAfoj*h`pQiA69$4zq^jA&u)cD-qqJjDjvT#D=(ROt zD`W%1>hrz84DCcI9d^@6MUhmk8W?HsTx`teYYH#gQ21=SvA-eIHqgLB&GnUAAMu_5 zhMo$13J`_-s2Yn01^OamS(fznfc$a!R1(H;*&bty{za2&E=b0lC_ z%Vjwk`jnU}N?NVHPDWvp(0-JcnKYG6Qh#}3(WtM1l$&EKP}dD(!(@PWm8E$}?9QLS z`NQCgQ-+k0SGzeeYrAE?tH*G^c+~!3-FUc{y4k0MjiyZnpTtjL z381SjY6g#q`z-qOVTxHSg;*tz&@|R@ zbd<#4L`k4$XfR3evmym5l>K0ejVsGDFsJt0>nQEKmyeC%{8MAi_D_t0IFy7QY4g-n z*$FU?>hw$S?UfVN+v&=N-w2r(;tEv2<~B`zshv9{vDDNLdT{+P9!98t*glCKUPD*c zqphqt*%2Vls{*U$`>20h>&v0hlUialwQWKswd1Mh?w@ax?Z#WBTMn)@-DnuW*N>;M zVH~ss-kIoe(1U}Z!hM!y8iL+XL+S6M#faI!ejL(TSO=|o7xF|tkSf|x?e#X0bh(yg z>p(Vw%Re_n;~=SfZFO#@P@mpona|<`%Ski&e!|2jR0Q;6xol8{U8AU#^wb9#&B+7# zFQZX!D6nbNT1;be>MZr)NcW1__de&zjTwb~`!Z-7WkDm4pF{!gn`r3Jap-PQM>E@r zEtY#WVi#wgfC=2Vi2}^BNerB=P)oDU%s;gcZ<2n2jh#PeEkKPh&SCM{xw7IxXc4{r<4&%*uV_Gv8Q+3Qhh%eVQI1h(0MS(iKGBXp@ z6JVyswUL`@^?^OSq*zJitjTufqqxBRw!Q#$?Drtd7;gdU#Nm*4Mi!epVqr>5$U&Oa zDx`Tb==O!0LY8$mGYyNqdv?$sY1`^oAJd?WeZb5M-Rt{QDKQwf%?mHfFM8pjTuNKu z7o8$CEe4$I+wroMqnh}r8MYbh^YK^)m4ZA`8qw`*J*DF{V49W0-o5*5CuTLUw*!4# zr>QGXH0V%>g7BeW@*(i+snwxfE1t_hCK*TkJoJ(gf>UXGAraOGZ{L=Z)JR8}tY#%UPMNjFrCF~oCZ!m7FJr`mg`l^aM7h@ij z`rIV83S-NA9C9XNDn-Ar-F~HH!LY(76AzC39mvBsLOCR7 z)+%U0;re8Yg>L1nrq@oAMq3p_M-?*+HGLz+$oU%8<*UZKYIchR6de_7?}31DT)og`sIzEIud*k%-vx2vN1K0@Qi6W~ z;UFffX2pQKL3I%%fMh_*&1>f}4%qGC$Lhu6icketpd5QtG+F3A4P?SeuaZ7zx=X@~ zCKHk-Uuxd{n%SPr6hL+phIOEJb*hED6U0d^Gf{%Li{Nq2Kunl+&fV_G58vOaEOL3k50-xR_JxGz3#Y-H5vu<;srb1&&Y@gH4W^p5(6H zYqP+udfjjY@l`EIZ?#>cWi#mhN(45K5!Y}hT)iK^XQYGtXo??=q#HAZ5cqwZ{YJyvsQjT;hwxjKG~P+9F4rG?~i9wQJmdgjF*-( zOV#UgMn!x|viNZH7UgcRJ0boAhZ;p{Q=4=5sWK2hbM}=J-}O`hG4d9%%e3P=!DD-b zawq6f5-tv!JEhR=BN=H*?t z_If)wCJljVi(fKcWW$QUpZy|b)mI5IbrJgh@AU!gcp?`)tZ4}QT4zrM1D zE^&Zn$mLu4uCz*((eyPQogGX~UWdVBe7qZ@Ya`khCn;Roe~M+_OpWRE5g|4^@_m%R zoW@0zD(O|NN@dG1jl;ztVf*%)#nsa3AkK;U9}=gw4u*gIDpO$LEZ>?(An6fYs<8;*w~0zLKZkzj`%#s4Dw@oz-@WA&41ie9!O%NmtJ!8VqLle z{mt9ct`*G6U7`ovlEgM8Ob6CoWkqaX=8(?@W_;f1C6g$$(|F=gvb6$D!4Eo{%flDi zPZzsm`D9-lP)A4d(as?3mxOZ~l{f=4^tK^`bYb+wzd?LmA}=+BP|zR`miv6<$Fh&r z$Joi|CNv5Ky4HK?uH!Vp5`qrCGnrFaWeUgeHcuC%b`k05IO$b$@^B|#hAkXP4E;XA zMW{b($tup}Tm3hX)Fhpn={dyv6sk-iZcg68H6cj7Vam|vd>w8yHEuG*(`trkHVm1T z)9zkk@?o&|k7g}yGP<33NU<#eUxH&;{N#hS63$`*1+Tn~oF{l90@*HaB#DNzIVWe| z@JJ1PoU;_C5_5C9f*2zG&{m}nml)P$52s|#S;7qm1Cw`;3+3;d(5wi`QnHhVqN8Ok z_t9SMM2|9G$y31@dG2Td|EfTgi>jt*r$rN;^?Dg-Ru*+ok)@gE{Z#0sykHAfjSv+u z4pk|3&n9`I3^qr07B6ykI$e5T6;OrgXOs;8Z+FX3h)Y$ds5v-RO$bYBZ#Yt1I4*#k zH^?+YK6P6^qM>e}7I*@mxZ+^321%#BmN3qh*v-)hnXoyI&rBxJASagLZ9XcZpD)C$~!S=cnRMT(r0mO1)9 zVyyKv?tkl-542I>%2KL$v(MRi7k^m^OeN8rN3LCV&J8QmOA5E|e6hw)WIf7@NL3PG zJEIg3foR7ew7h}8Y0fD{vxMIxG0ODuM6ro3fM_(4YDVO!EsI?zwsOEDg-C5%L;kE% zd}g+U4Xw|NZQeOE`tHGfhBgUGy%dYKv;2@S=?hsv2}aKWaQ|vK+UVfjCG&nVkQaUO zZGDIVmO)i2-D+Qol?hB@2M2m(^9V2rIXi<}$n759e9{KQL0d|YeBT}|)v{!m9%pyG zQi?(Uh=GKt-kx;C{5-nuuFt#iDTWeJHVP3d67OK~CF~2!0?xdWM_Z8LMe^XPjB_;^ zRjo;3Bu%yeC8`-SPpm%k7JU$l{T7D9_L&Bj!%#gjpSC<>vEW-QI#}@$^|0#L801gX zM21{}j5Re(BI4GxEM!JyX+(JHD!B4T?Kt23U$I1>_oX5+zjw=D6548v=0bx(%5nlR z`G!Su*&opq)w)5Qx>|rd^P9p0B!#I!d)O0^bsXy4MT-h^B&an zT&hJ+4N@_Uy1qvoTuBrSrAubJG<|(Fy+hzB|R5B8)Q{XHddbNgL0yaQ%e3oTLY#+!pzjN}(n7xHrUFzGr0dTGZJVThU%RY3H|s z;hhqPbHCB*&=#2U@o0BexSg$qAXx9Tk^13HJ$?fgy+@(P_ZI17liCVmndH!8+I?#b zI}ST+ZGJd45Pn~gyai!7Rq=1umAa~vlei?>l~POc*dp`u_jn4f9!3009cE>kb_ZC~ zk}edI3O{;BN?r4O+7#uo9fMdz8#x(Wok^tW(s3ON3e!6tu#}Wdvy?paa(IK+80Nd$ zTp{jt>|By+a`m}-4s8Kiq_a>sk*XfzTrrbmcZ;d3XB+~Xhh*Z>kM|q<*!rF&RlR9X z<%wx|5wntIqjvYFi3Z#~v5CFnuR4R!9@h@{%ALLH;&((;6J&c%_>N%vOP4mbjyX>% zAPcXuHr`vl<;pMTR$tI`a;z^N)7Z{*Kzk?)Ym+$iVy?N5YZtWzX5GSkBD@^_m%|l?>l8;#$nbby= z70Hd{fj~Bjk>1*e^F+WldSI)>1)sXdZdfiyZ5CwPf~g;|lO4`59z(I+vlFjPW`F3Y za^V!@dV#rHn%>B*DlymX*?I@Uo?zeK$-i4{-_F$Et4|)a7Q2$+pK>@8`Y|q96rD>#oIDVK*+lpFDe%FLJ{&`C*WK`Dwpi&zd~f zGP*()xIf$tKFlt{L9>&tvpRZy`brL)(|KE&8Zr2QQR<3Rds1t;FT=Jy+!Z zGB)k4(aw6zN`miKm^@M~k+%feU-zDP{<>kR;cA_d0Pu_U13Wyx@b3J}!EX4cAm@MY zk*X~Cyi-Ab5?&gZ60BD0k6IyCnr2NhVhbXia4iYnB9_8jBC`{-Rfj^fz?X?JNthf6 z)ex7+od_%}1WilwVhHywV1y**Nn*LZ7<*^acCG@~!NGtbG228(1K2rbyW!aLG-;mV zd3xyQ0luYOmB~R2f?@E5i$K|yOR^*L{m@#~laJpmozuHgLR=j%ET-96NT@5rt#miKK(YEQbW#J;BlX9pFw&ERcRz=`p~tW>_eq1$YOWBx#9 zN%&zLyK4Q_)OwvdcI*Uw87l0|NAOjTLq}`!a$2-^3JBrAerFf{UA} zSV~|uhRq0VI^@^CF%hqX*l&N=z}y)Xc^G6JEw(>0OO{c^B*CRKC44_78X}njD&;zU zZd@9^$8-dFA;s@Ll%XPFq9}oCVN=_?lR+H7A1?)o=T#YS&3=Yy&|r3vF7JHn2%H$R zLcS8weK~f#;7TmYp-;1)2(&`%c{pSod3}u=MCiykRi*h+&W@GW=koM4v@Qa~$UwqG zsBg1DjpFv&Qb!gcK|%?jofFwrPy(IjACKcmuY3_>r1Amcw9L8LTw>px-L{}K87fV* zqFg2FKsiu-iY;~_=lnH=qvLRk?^6TiheUO*lL2On%gOXv(3!I4Y3t%xT%mg5aUdGdG4GpU1!wY>+`;RSnI86o zn&Uny$$U3ln5%0R16umR-^s_BpH#X?d|9iRFL8QZ zY!)PEdakEjt$w%OpvCk&ium?>ml|dx9vGao6TEN)&O9H zQ?(!L)@p|}xT>8Z=W^&O$Zh^EMxH92H|JiUJfGhZ8J_O4Ff=eJBRxX!BwZjf_XwXF zJt}sNpF2Q;x7)F19F%M`M54yF&bexYwu60E*rTb5K^|F8@I!v|QyC{#@OKg7&R7QGaU(D2C`GEb(UO4cZ*AXwIW7Z(dm!` z%bC5Z{ryOc26$!#7F~wW7OhJtp`c&p(Rfw^n84|Hgca;NSPNyMNY?2G+XnPDHnS%aNeG)n3MPjio~E`y@mAG3_QpCxUm0pk2@F4T>kS0 zkMNE=0&l4MJ>z>?!_&67R!}mRce%|P5No^v`U(2SVB1b~($#_bn_zL@Eo2EL_vWgk zx|A{sV&cwKEVG*c3U^oZZIq!^p zQa){S$s7xy>)Lxo>gmj|jrCZu##a*0GwMRW?Lim%KpU=ARsD`;)4MGIMw?hHpVKbm z)q?1TUIboH@npEjIo(r#3ehHO6r4@mEuw3JGj>;hW+fiqtEf%1bep)SZFsI}9v z0+~%Q@eEAQIDSt*?pOyI{Aydc2;H6`-Y9X!Xn%!D^ype2xdR~GH?f?)yNIn24Thn(7Y?{F`=H!D(JNs=g!Wd zR0k-q7s!&r9NtR(8?)@eY6k4KFjGS(z(eRR^M+y<&HGSnEngi>cwAW7eyN%=249!{ z2GT#zh{1d1`tI~{L!tcUz6F^h``YX~43W08_9Jp$Kwy-q0DCKo;GTN%H=ph?fLBxE zESz;_nFi__#r;Q|PUT`9qMol*kz5Ba2`VND1GR3Z05uO;L%C@?+|IX@n-mPk6yUr( zG3Exrl8;1r*g5Znd}ShqS4gq1YCb@~3C9{;X|Bb5rk8k-*Lsb-#s@0Y&qoWiBEZ-N za%#P9B%GkNnriCBNLO`gGX$wFnL%DW6_-tgf9vebF)eCe0NKBXq>d%tvk-n;Zt?&- zel6=`<$Qk?Ur~nBLSGf68L~ts*Qj|J+ynA`&wbyTj;kB*j&j8o>xPUVvlz-o~`P;bu$04{sM)ybs zjei{pX=tQ6!7tQA;v+@Pr5XxDZIdknp~ExlDFE}g5#Ue@vUEvbp@R2;8Yk|!%?TBc z5%jtSY@{Dk7b1yyre?A|WS)7hu`zu5;rZj0E<6R9p{%T&B%UAt+k4vVyq%!1bTP_; znD<$IRFuSa8s29gnkYWqY}XWQc7%aLA$W{f+Ntmr)eK*!tbPqBQ3*JrqS!Bi>ekmD z-heW0@lN)u9i$YfbdRcv*r6{Z6z@XNR^wyTnOB6 zXEL^?7a4Fsi*V!cOW3ApFxU_3J|v#AD4Nir@87vnYMsWKZ z*`{%!koSx#jm_z`mNbps*RD}&4{Sf^DF^r!$g#~`LE<{cK%z5dbX7Gz}Lkv#VyIC(58=rn|46|`NWI5CJqqK-HiEk8*PI{qzwF_3*TLEM{Bh?mN9h+_K{Bp;)37iNA|PO;G)#!-5QEhjvSUQ0#}s3`f@CaW>Zkz z=8*Zn545hcPzWM0uy>MFy}C6q^_-sL4+@AhuekawJaVnJzkpRCxSzT|7QIh2CwaR} zlz=!37KLyT6&Qs{9;_4kVW*wvYBq$O6hD~LcQHWUM|>vo8WI)jW5s-!<5%M&ZE}g5 zrWq`#wfZ7hRi)K)4CQvLi2P+UT5LL>0Snl!PMsyvPCfp;4AbSxnv@ihOcxQZV%&gWnR5;M3Gz8 z3PeJg682V6)pam0?CMj3u^^~o4v^660+Afd9@%~sB;T!9;#MC`y=yA^a2VP6PRv~^ z>L;sUE2bT~O|M5_O}?b&S;MhD_A`|%Y2{E0`yzdb`{Yms&UUpfH~czuEN`<0Bb6L6 z(cyuHH%rL`Qk;C(p!$swGKGWx5CvTa)C|Zep>0veW!-z`Pr0cyj#QwdlzAK_rhtE` z^VFeAxh;;>e}MdT5&HH=w+a&AQ6d1YpUIj3Erkv^vHQ<5=sPdP&mkZn0M+>b*Khi*7y%G;Dp?tN(SKG#@^&_oIn5MKQ#cVF@Gwb0rx*^{96+KpQwKJ z!E-qR-2SQJzvb%x#(d_ko_q#qSt)255SuNTm;X!fIC${Aj~hI1px{HmNt5Z|B<142{>fK?(i1SO}v2iGX4dS z6W|&7CqTf+;p)cc;Fjizl8S=p@r85bmb1fWPTo^e=bXa zm+2R+1xOoPIynI3L4?gLjra@<01Q%k)_VV!P5mVSNQwK3CZNOR03H5U;|K%1{=Xm) zvDX7+a8v?F35wcS8A;mMSUB1Kx@(Tg&Etyz!tsoNmXbd=9B@a6{}0grPCNC}_I{1K zcdY7A3P4!`TmYay6&%1X_(hY&{$q8&#>*^2yZr*_V`e~ZhQH!LQvVvy+QCuJ((=FA za3*v!FCpMfy#{k8dyTa*D02neux`1wJ8E{|4=U%3tyl@F&1eEBje~ z<|uhCwgA9Cy;MJAcV1S0nX%-#a`xXV|0ik0f1eG$gnyZZ;u)UY^lxqZ5B%?}BwiA| zRFZ!t8n^r#(VyD?Uv%YP!oQS6e}*@*{wMesljWDNFO|TbVS8=<3HHx^hL@NxWo4f+ zN1Xl%^N%Qi|Mq2kDd75y+T{EjsQ+Eg^=0#4ic&rkNxALt}nsf=eTz3|_l`Ul~R zmrO5Z37(mBqJD$v4|CxArAWa`s+ZB=&r}MrzfA@BzS#a*+3h9C%i!8)60?NgCi&xi z{gd3tOO}^WoX;%ANx#kV=a|ly1TQ1#o(UvU|33--SC74nX?mt21gzR#jB$VZy#M>7 z_CNdTWpK+gzDL$?;Qw=|%gcUy84K`C)(lvW{I4JL>q*wj9q4DwzPOF^WS)0PCNf(M*m|Nf9ZL7 zrors`zbV~+^TYh7&HwSb{Ml*p)9dnFtN>vD%?BeZ0SZ_L{S5e{2hstYLKp!2EfCQE E17(ftEC2ui diff --git a/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties b/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 568c50bf..00000000 --- a/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip diff --git a/internal/wrappers/build/java/gradlew b/internal/wrappers/build/java/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/internal/wrappers/build/java/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/internal/wrappers/build/java/gradlew.bat b/internal/wrappers/build/java/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/internal/wrappers/build/java/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/internal/wrappers/build/java/settings.gradle b/internal/wrappers/build/java/settings.gradle deleted file mode 100644 index 25da16a3..00000000 --- a/internal/wrappers/build/java/settings.gradle +++ /dev/null @@ -1,10 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user guide at https://docs.gradle.org/4.5.1/userguide/multi_project_builds.html - */ - -rootProject.name = 'kuzzlesdk' diff --git a/internal/wrappers/templates/csharp/core.i b/internal/wrappers/templates/csharp/core.i index 8cd4e630..07ca29ed 100644 --- a/internal/wrappers/templates/csharp/core.i +++ b/internal/wrappers/templates/csharp/core.i @@ -28,11 +28,11 @@ %rename(Mapping, match="class") mapping; %rename(_auth, match="class") auth; -%rename(_kuzzle, match="class) kuzzle; -%rename(_realtime, match="class) realtime; -%rename(_collection, match="class) collection; -%rename(_document, match="class) document; -%rename(_server, match="class) server; +%rename(_kuzzle, match="class") kuzzle; +%rename(_realtime, match="class") realtime; +%rename(_collection, match="class") collection; +%rename(_document, match="class") document; +%rename(_server, match="class") server; %ignore *::error; %ignore *::status; From f00f3e332b1807abf6ce6d8cf86637ac5f3f52db Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 5 Jun 2018 14:08:58 +0200 Subject: [PATCH 206/363] added gradlew scripts --- .gitignore | 3 +- internal/wrappers/build/java/build.gradle | 101 ++++++++++ .../java/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54333 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + internal/wrappers/build/java/gradlew | 172 ++++++++++++++++++ internal/wrappers/build/java/gradlew.bat | 84 +++++++++ internal/wrappers/build/java/settings.gradle | 10 + 7 files changed, 373 insertions(+), 2 deletions(-) create mode 100644 internal/wrappers/build/java/build.gradle create mode 100644 internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.jar create mode 100644 internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties create mode 100755 internal/wrappers/build/java/gradlew create mode 100644 internal/wrappers/build/java/gradlew.bat create mode 100644 internal/wrappers/build/java/settings.gradle diff --git a/.gitignore b/.gitignore index 6d944e3d..70027388 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ main.go # Custom test file test.go -_build*/ -build/ \ No newline at end of file +_build*/ \ No newline at end of file diff --git a/internal/wrappers/build/java/build.gradle b/internal/wrappers/build/java/build.gradle new file mode 100644 index 00000000..6848fca3 --- /dev/null +++ b/internal/wrappers/build/java/build.gradle @@ -0,0 +1,101 @@ +buildscript { + repositories { + jcenter() + } +} + +plugins { + id "com.jfrog.bintray" version "1.7.3" +} + +group = 'io.kuzzle' +version = '1.0.0' + +allprojects { + repositories { + jcenter() + } + apply plugin: 'maven-publish' + apply plugin: 'java' + apply plugin: 'java-library' +} + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +javadoc.failOnError = false +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +bintray { + user = System.getenv('BINTRAY_USER') + key = System.getenv('BINTRAY_KEY') + publications = ['MyPublication'] + + pkg { + repo = 'maven' + name = 'kuzzle-sdk-' + System.getenv('ARCH') + userOrg = 'kuzzle' + licenses = ['Apache-2.0'] + desc = 'Kuzzle JAVA SDK' + vcsUrl = 'https://github.com/kuzzleio/sdk-go.git' + websiteUrl = 'https://kuzzle.io' + issueTrackerUrl = 'https://github.com/kuzzleio/sdk-go/issues' + publicDownloadNumbers = true + publish = true + } +} + +def pomConfig = { + licenses { + license { + name "The Apache Software License, Version 2.0" + url "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution "repo" + } + } + developers { + developer { + id "kuzzle" + name "kuzzle" + email "support@kuzzle.io" + } + } + + scm { + url "https://github.com/kuzzleio/sdk-go" + } +} + +publishing { + publications { + MyPublication(MavenPublication) { + from components.java + artifact sourcesJar + artifact javadocJar + groupId 'io.kuzzle' + artifactId 'kuzzle-sdk-' + System.getenv('ARCH') + version version + pom.withXml { + def root = asNode() + root.appendNode('description', 'Kuzzle JAVA SDK') + root.appendNode('name', 'kuzzle-sdk') + root.appendNode('url', 'https://github.com/kuzzleio/sdk-go') + root.children().last() + pomConfig + } + } + } +} + +dependencies { + compile fileTree(dir: 'src/main/java', include: ['*.so']) +} + +artifacts { + archives sourcesJar + archives javadocJar +} \ No newline at end of file diff --git a/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.jar b/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..c44b679acd3f794ddbb3aa5e919244914911014a GIT binary patch literal 54333 zcmagFV|ZrKvM!pAZQHhO+qP}9lTNfnHSl14(}!ze#uNJ zOwq~Ee}g>(n5P|-=+d-fQIs8&nEo1Q%{s|E!?|<4b^Z2lL;fA*|Ct;3-)|>ZtN&|S z|6d)r|I)E?H8Hoh_#ai#{#Dh>)x_D^!u9_$x%Smfzy3S)@4vr>;Xj**Iyt$!x&O6S zFtKq|b2o8yw{T@Nvo~>bi`CTeTF^xPLZ3(@6UVgr1|-kXM%ou=mdwiYxeB+94NgzDs+mE)Ga+Ly^k_UH5C z*$Tw4Ux`)JTW`clSj;wSpTkMxf3h5LYZ1X_d)yXW39j4pj@5OViiw2LqS+g3&3DWCnmgtrSQI?dL z?736Cw-uVf{12@tn8aO-Oj#09rPV4r!sQb^CA#PVOYHVQ3o4IRb=geYI24u(TkJ_i zeIuFQjqR?9MV`{2zUTgY&5dir>e+r^4-|bz zj74-^qyKBQV;#1R!8px8%^jiw!A6YsZkWLPO;$jv-(VxTfR1_~!I*Ys2nv?I7ysM0 z7K{`Zqkb@Z6lPyZmo{6M9sqY>f5*Kxy8XUbR9<~DHaC-1vv_JhtwqML&;rnKLSx&ip0h7nfzl)zBI70rUw7GZa>0*W8ARZjPnUuaPO!C08To znN$lYRGtyx)d$qTbYC^yIq&}hvN86-JEfSOr=Yk3K+pnGXWh^}0W_iMI@ z#=E=vL~t~qMd}^8FwgE_Mh}SWQp}xh?Ptbx$dzRPv77DIaRJ6o>qaYHSfE+_iS}ln z;@I!?iQl?8_2qITV{flaG_57C@=ALS|2|j7vjAC>jO<&MGec#;zQk%z4%%092eYXS z$fem@kSEJ6vQ-mH7!LNN>6H<_FOv{e5MDoMMwlg-afq#-w|Zp`$bZd80?qenAuQDk z@eKC-BaSg(#_Mhzv-DkTBi^iqwhm+jr8Jk2l~Ov2PKb&p^66tp9fM#(X?G$bNO0Qi#d^7jA2|Yb{Dty# z%ZrTuE9^^3|C$RP+WP{0rkD?)s2l$4{Trw&a`MBWP^5|ePiRe)eh1Krh{58%6G`pp zynITQL*j8WTo+N)p9HdEIrj0Sk^2vNlH_(&Cx0|VryTNz?8rT;(%{mcd2hFfqoh+7 z%)@$#TT?X0%)UQOD6wQ@!e3UK20`qWR$96Bs_lLEKCz0CM~I;EhNQ)YC8*fhAp;-y zG9ro^VEXfQj~>oiXu^b~#H=cDFq1m~pQM-f9r{}qrS#~je-yDxh1&sV2w@HhbD%rQ zvqF(aK|1^PfDY)2QmT*?RbqHsa?*q%=?fqC^^43G)W3!c>kxCx;=d>6@4rI!pHEJ4 zCoe~PClhmWmVca=0Wk`&1I)-_+twVqbe>EhaLa(aej;ZQMt%`{F?$#pnW~;_IHaAz zA#|5>{v!dxN&ouieHdb~fuGo>qW(ax^of8<3X{&(+Br@1bJ-0D6Chg$u$TReI=h+y zn=&-aBZ`g+mci#-+(2$LD5yFHMAVg8vNINQOHN6e4|jQhIb$~sO;+G?IYshZf)V{ZewQR z?(|^o>0Xre^gj!6e}> zTHb#iYu$Pe=|&3Y8bm`B=667b-*KMXwSbr9({a6%5J<}HiX`8&@sTKOHJuGG}oFsx9y^}APB2zP0xIzxS_Hyg5{(XFBs z^>x@qc<{m0R5JuE`~*Xx7j+Mlh8yU;#jl1$rp4`hqz$;RC(C47%q!OKCIUijULB^8 z@%X9OuE)qY7Y3_p2)FZG`{jy-MTvXFVG>m?arA&;;8L#XXv_zYE+xzlG3w?7{|{(+ z2PBOSHD7x?RN0^yTs(HvAFmAfOrff>@4q|H*h<19zai;uT@_RhlZef4L?;a`f&ps% z144>YiGZ|W%_IOSwunC&S$T1Z&LDI1EpAN4{D|F_9c^cK8`g zQ4t*yzU*=>_rK=h1_qv3NR56)5-ZsGV}C?MxA2mI>g$u>i9xQqxTY3CP6SFlmqT*kJm+Vp&6|Rd&HVjVV2iE;dO7g%DBvpKxz}%|=eqatxbO9J z26Tmn5nFnvGuWhCeQ?Xl{9b3Zn?76X;Ed_yB`4Tuh{@)~0u0g-+Z&_LbVuvfXZ0hi z<)Dcp(7mi{4J2=wr$jn!SYp3yKg*nj)GwiiYeB6=Jz5 ze_>nw@IjCW&>1ztev$h~1=OFs*n#QYa*6y3!u>`NWVdsD^W6FZ)$O=LbgMzY=6aNW zplFoLX0&iKqna6%IMp|Pv~7NW-SmpI>TkgLhX&(~iQtdJ4)~YUD3|+3J-`WfB|P2T zKia5&pE5L|hjvX`9gmw7v=bVal$_n*B&#A(4ZvvYVPfl@PI(5e!i4KS_sd`yS0R*R zt|Yp((|SofnsEsS8|&NyWo{U<<66>|)Ny{8(!hRcc&anv%ru(Oac)?%qn}g3etD=i zt6c#E^r&Ee#V}}Gw*0b1*n829iQ&QWLudUqSuO3_7xb~%Y!oRTVaOEei3o>?hmsf) z;_S_U>QXOG$fT6jv$dsI*kSvnPz=lrX#`RUNgb><2ex!06DPaN9^bVm^9pB1w&da} zI*&uh$!}B4)}{XY$ZZ6Nm0DP#+Y&@Ip9K%wCd;-QFPlDRJHLtFX~{V>`?TLxj8*x9 z*jS4bpX>d!Y&MZQ6EDrOY)o3BTi4E%6^Mp#l zq~RuQGD*{Kt9jrupV_gAjFggPSviGh)%1f35fvMk zrQGJZx2EnWQBy8XP+BjYan<&eGzs{tifUr7v1YdZH&>PQ$B7|UWPCr_Dp`oC%^0Rx zRsQMQ7@_=I8}s$7eOHa7i>cw?BIWKXa(W9-?dj+%`j)E%hfDjn$ywH=Zkko}o96NuqwWpty9I2QtUU6%Hh#}_->hVJ-f711&8$r7V~O^7sth1qdm+?fD?&gIjAc zyqFI*LNCe9r)#GW?r@x@=2cx756awNnnx7U6`y?7hMG~_*tSv_iX)jBjoam}%=SnL zQ>U^OCihLy24_3n!SV-gS zOc&9qhB7Ek%eZMq6j(?A@-DKtoAhCsG+Uuq3MlDQHgk4SY)xK$_R~$fy+|1^I3G2_ z%5Ss|QBcETpy^7Fak21m_;GRNFx4lC$y8Fsv?Ai^RuL6`{ZB<{Vh#&W=x%}TG%(@; zT)NU7Dy$MnbU{*R-74J&=92U75>jfM3qQ=|sBrk_gUpJ|3@m-(S} zqrmISaynDD_ioO6)*i^7o0;!bDMmWp0YMpaG8btAu^OJ)=_<07isXtT+3lF76nBJ{ z`;coD)dJ6*+R@2)aG#M$ba<~O=E&W~Ufgk7r@zL&qQ~h_DGzk<>-6*EUF#I+(fVvF zF0q3(GM8?WRWvoMY~XEg>9%PN1tw>wLt5DP-`2`e)KL%jgPt=`R_Tf+MJBwzz@6P` zYkcqgt{25RF6%_*@D6opLzleQ)7W@Gs4H3i#4LADwy$Js;!`pfiwBoJts0Aw#g{Mb zYooE6OW7NcUMd1}sH)Ri=3(K0WmBtvK!2KaY?U&Htr#Q|+gK<+)P!19dIyUlV-~ZD zWTnl`xcUr)m5@2S1Lk4U(6nbH$;vl%qb5Vh|G5KA{_*04p!LOkPsWhxMRz}sl&mDWMOvz5;Kq0`+&T6$VoLdpvEBn-UN`Yb8ZZ0wMcv3XC z&vdicA-t=}LW3(&B6Kj(>TT!YHdrG%6Mp}$B2)7 z+;)t8QsBkfxDOo?z_{=$3mKym5Go;g$Mk=-laVV$8~3tYKU*>B?!wZzsj%|0`(rDZ zQlak~9a?7KG<`P_r`)fK5tmRtfJx2_{|%4C{wGh4l@LS$tQ$Tbg&CH~tGKZcy%EgW z`Ej2=-Hlzs6Deb(!HzY)2>45_jU5(2ZZtAeg#)2VsD^#*$8x<;w5s&*^tt+nA0nto#6hJ&M?xQ5=lhI*Tap+o@#YI~Hi-l#@sdjZ4PCVcFr zrtJF2C$N~X&6L4W47_$Flt4D!po1W~)1L9HNr#|W_L09d`a-4_H0Mx`rv5icDMbTk zjgibis*{cth+j!U;jr1ejW?${hBE1{p6EKm8=(ABt9m z73d7-{oHvvZQ4|t%Yl|k2ISat%`52J25OJ=M|CD{m|Q`~Q%t0|TS>zV%Z(g_Tfm4* zrnW_nWqsh&V(Vg+lY`u)?gp>c{g&12){~5SxL)&$i>$($pDhnsXK=$u3m0Cx-kD$+ z5Sf?E*TYQ#^KvHWJU1%*={yG9NjM(7`Q)rS7&uMenLoOe2N*xk(vN5F{sf(%CH8#I;sdqf1dw%kBI&pS`K)){>EF18AT6CAYZz0_Bc|Ws1Nh3 z%twB`i+Lm2(%hoXJP|J5lGpD^-5BDO7S(}JJ>5B*GC`HoszjIH2&%(H9^gwUpLh!i z3Qy1nE2J}h@;Ak+bcPP0N_i9XP zGP%F-_xo6mx<}RTyu}Gtjo&rvdJ)cjDjdsF2#cIzUZPQ4jw3ooBicqI*=>s6PhTHP zUbqtt70zm3RGvU{bmEBy@7>pUvN*V&xd}e^Utpe0V;b_!mCArr(MJKQnMqizhhON$ z0PU2%@B_9xKJKKe6`VjcwmWC;Y0r{P@{$)pR~JK z7W*a7V+;ltQ(0F8#ai=9MTrhuKUuc?XHbAd#{@4h9w}rzVRuq6yXejFE!8sdL8=54 zlMy{taj5+w=D#noC@!#8;au}K+eZu|Qu0-kgkp6xNYzcURuN-6Kl%)%2VR8!wVGU1 zWZEqJTSbol6_)?Gn*57aSh-rbxyjqOxm!5?6VUdE?S~B!MwhszTd>6tpLmj(o$a(h zAs07xg*#7|8#vhWTd4=LC(iu_{`BjJsuC)6y+j zVt~bjACA>0y~vnuy8LtP`50?}Sv@t*JN-yL!!hVgrCPk1MZ}gKt0uixMw>b}LVSYT zO2tkmt!7v#jQQ>8j*U6`G)hEPOU>LGS_Bb0_fM;F-V(W)wq65Rk*aya3yO z_E*B&%-+Mz#?wO5#@<52%(}O6W4o%BNVbB8s4!4(PR*gSb z$j7Eencvf9?_))K7b19T597Ql)q~!PlMm$u$j3)NoBF(=YuwSFa=2J3EM=@!qJ=bK z2UY^`gcpl_0a{Nbh&mL-S}|dXDc@FYTzkR9u>DlO|r9zMbY9 zcvi~*Sn!-XdibS9>V|VmH54$J!N;-k>U|!e$!EePWpr0wZn4~|?w4vo%-Ffcx{+}N z74+Dx>^&$SsYtq~oLkztY&j;cG5S5NN)rYFS~F@`)MVA%911fMO^vLB+%;E2kGcx|C?bj%K*Y#Btv7K6inqIt~eN9{d@I&&(VF z1}bT14cQy!1jpa|7DiCJuBh_{+56)f_l3}qLWwox4&D>1NwX@~lG&(9Cp!ZS@vbCbV>$9jV0PWrUoc zGQm`Y5){E1K~q2RUK#=U*e^6&?8-y!fP9=6o+W+4nm+mSQeDNJD5!E8CaU;I#+HM)Gt`;3%$yq7H_kqm0#(U8c<8HUpZ5@8zRzEG5L^AX4{< zwDEN(lUW!^k%H!t&T_;T6To1i4r0S|tu+lWr|`3wjbo+~>MjOj62{&D3H$OiWs=Dw z`m6MW^8|~J3*ER5G^h~UbH*UPW$7ZHfg&@9%r2u(d@8YN94k?}pzw`3tuCNVl%MV&<#4ESfo@VX7dX=)C-e#!(E` z#+;b>rvW^#ug1(yr&cS%w96I($;2(O*FuVoTK-KiA2Qgwkhs0^Xt=eXkh&mx)iBSK z+r|&Xi($%(!3BO6G7f)2qliGTP)G50)i_iAAQYn_^v$7h=>j<98G2H|p1$BA(xe5i z0+-b-VX6A*!r*B>W<`WMPAsKiypzr_G25*NMBd*U0dSwuCz+0CPmX1%rGDw|L|sg- zFo|-kDGXpl#GVVhHIe#KRr^fX8dd>odTlP=D0<~ke(zU1xB8^1);p2#8t_>~o&?jKIG49W)EmhTo5fZ|aP=E2~}6=bv=O`0e4FpgaP@U~KHt>V*oR z{wKtxe`uCFdgYHlbLL2`H>|$?L@G&exvem8R^wQppk+Gu8BI;LR4v=pU`U4vlmwFw zxYbNZXbzdqO{7#b`Eo2>XlNcQEFC-Gk2v__^hqHG{bb%6gvMRe9ikQ>94zOK3o85` z)Ew{!is}|b0%g#qa2H+$A1i=5;*y)hv$5m)&;Z~CTv zpdZz#9k)yhrLH%G>|ly;%|Fe`K{}d{6vyNO^Gk$ZYOIL$3&5XuJTqse&XvY7TH(_z zb3L0aT`$6i&c(dBQVcLsV?yM^@BTj>C_2=Ih6Yxsk zP5r-Yg34bu;lJUUrT!1Gt>I?jD(&Q8A@Ag5=i&TcT(g><60QjPmt>;B(xYk(bt}+T z4_t3m_flhFXrd}o9hw+M$vh0Ej(*GdO21EJaL-eD*b$UHHZnUN|OJ z0Jp^;Ep{EvhbQw6K_&t~eB7m4_csSE=CWXyWY4sLL-`>gdwbXUqW8FqVwQ((K>Hes z6?QDu2SZjI&_Oqc`A&D$)~oa&r%dn2G?-*9nvEt&L!4PeU(lyXCgK1^guGj|F$M$j z(GuZXkiyMXV}lhNuz5oi;9>+0nCgNO|gp>9FS%CFa9W(t_WRn1h zi*Vk4IQG@3-{J`U=9`Ky!DmF2O%ld1w#`8Drc@C6KGz2^NhY^gQZo9SG}}BF9G0<> zUIO))F&%dt6uAb`cN%_jf&q5I)?_7J^9T09fb~#ll%%T{?}PznT^_22(*OROJ`X;tg`78+=eW z{nLQs1%;?R)4yhs=QXy;Ww3ta7dfE~<&UNFZ#6bKVY=m1@p+4G(=Yx{7vDsa`}d$v2%*jQt+wTN!@Q4~!T4`0#GI8YfG!RD zA-RJ))sAlYej5x5RQ-^2I`1%|`iFfD*JoRd`hJ1Hjq_1EjBZ7V)S;?@^TS;{^==d= z)f-C;4#XD*THtvXh>{A80hZC?O(tJ)M}tK1Z4n%Y}= z7G#ciWgC-qm?9fE0?893;j3|Em(+qaH${U|Z^A^QleR%Z7 z1tb3_8mwUDjv6g+M+PH*#OmXvrsOq;C|~Oa;`LR+=Ou;zBgy?^)d&PxR|BoHj6&sQLvauxiJO7V_3Dc#Yum zGB>eK>>aZ64e9dY{FHaG&8nfRUW*u+r;2EK&_#d;m#{&#@xVG;SRy=AUe9+PcYYs7 zj96WKYn5YVi{SKZ^0v}b<>~7D3U^W@eJTVKCDk#O!fc5%`1KJ%473-~Ep)z$w6SC^ zTLzy~^~c+8J4q^gv9G_h((u6+#9K|Hwyv?kkbEpaO6^U013F*&bbnuxwtH~v%F9#0 zmtLmWALa{|zD`KnzKOv=DK^Qdb+qyOnd??*IXEprOa{&tVKg3pExuAFe~YQ4t|)j) zij8hA%U)XCd1Xs~{O?y^$^Ay>@J#8GF%+8%LcH*p@gmDRZXB5qIXD z8>)QYQpTPLtK)oS#azTHeBGCqsnlj9NCIGNEpJb;iSSJPZ2?lGVE8nj#y*wRnoLNP zUDvlQvp`STbAjrwgsMtnowuaK;8{D_vB36%w zJv*S667QTThf?Cmh=Z!={xFo+ID2<-Vy`H~ArX{AKl+?KW=|8LZO0Np%7v|KE(}&? zkm-iqK;uMF5)cH3KYs+zl0BM%jvE+hMDx-L*xqRy;-OS_rAK2sX;%0n1!Ma{5Lmy9 z^imumWb?xIHBgd8Q<3ZITO&oZe53WDFt~k-gkZB#xr?4x**{ecHCK=){(+%{U)emp7C}WTX-ec@8h(}WY4jqVq71BVnXwP*x&;{_d zN*3_vi&qrs&)e8zxt-odRm_T)R;UhvD$t{UlTf!SlB8E1GF4cNqHtgHu}%8Q8%zI^ zpO2!5*(g*etB5GgYL`Ac=M!b)Xq2bNT3ITjN-o2|WjTohM*|Zlubs@v$LuHc` zZ9L$4X`?POL_=tgyId{qVRj|31h_W~uwSBS8Ah`MRZtYNw3)JW;zH~Pv)aMi=uCgq z#Os}gx^be(^r#pj-M0If8r_YMPZT)4&1&7mrz) zh!z$uE9c|~q;;`W8Ai3H!KF-#GtuGf98}gBI3*2zD4rHswCwmtL-<*{PH$;(Ich%i zT*e+^HTbEiukgv7AMqKZ_!%!^91tMZXJ&a+eBiBB>)uZd6=!3wJGNOlZBqfyTo_(Jq z52h7Y#wYwKScBP<{-&F}%`x@JiQDol9`9Y82JRmh8^6_R_^6I7I(oY45vsM)2Mg0! zNA^4MWmRnm?JM)uuzN;;ogInuA5}Qk;oaQ$cs9Ai)!zvU7TmWOs>`bxrdCQ#mnxk} z5Qpoyg#i0duj8%&Cc)XL_UW9Y?IgF{#`HuraxSoAO7mma*cOEu@T)wAF;<^bOp|dR zADP}}$WhfJnAd^kp5&R5b(nQw_sNEB!jZ-p!ty@M!(=`!YrVm5qzwmXy!+l^Qp||H zv)&M{iBPo$VxFKnW{T}^(SSQhrcO8bGeIkBJ=JR;#?sW8mMt~^yS(gY`@?F17Z%jH zb{eMek^AG53t{vvM+t+R{@qK?fCZn7^EkTA!lZMl?}J59=&K`ZSgNCVJpfBBkb%)0eYGJXVS%p1UU)y*F6#Od-P`RT#1*&Ua*G-rTNAwiZ_43phR z$Tt_#Lfj(r=Zu@nx5yBV zF=8b~y8XrjculznaTL$d_A?<3CJzV%`@=R?nu3qGhpnniU7b64jQx=U%#3e_@5n7P z9CZn~<+hnXIoahha&pWlKH!M&^LRKwKLg-_J)&7>fN$!Zhh*IevmsWNm%}J!& zx5esSGz=)HgFY>*tW#_Bh8hH?clu~3dMZr!u|cf<&P_Ks1R4orwjF4Qmy<{9I7j2^-P1Qe-E$ZHv^Y2|8)>4abo8@^ExNA7B+Oy;0NIqz z!#d;E2rU+kkB0P#KYyn7N;Nuo2k!qQugm($Hr+YiqO^0y2CRX2m^!SZq@xDICbo~5 z6K1##iSi zz-lajV(rBC^a}AEt3AqMcJSKZsorc=(iiiCwip4!9->vgGF5(@L;ix&mq$LxsQ;yn zCD@C_!;8(Kv^6$mb||Lfhhf5I6~WBlJ&cje30%f>NXFsAPq<6#QkQbOXF|Tn)4360 z9ZbI~k=SJ5#>G^Tk#7(x7#q*dL8Sx?4!s4*FGxDT3=jA- zd3uD7(hY0)XnNaS4GSis{9xF|$|=it<}R2GMf5Wql`jRfCIlWupKy@#xLkR# zzy28n_OG7iR%5>`{zXeUk^Xy69o^hb?Ct;Aua~R!?uV|06R7mWI$`-8S=U+5dQNhM z9s#aU873GO#z8Dy7*7=3%%h3V9+Hyn{DMBc>JiWew5`@Gwe3-l_Nq*xKzBH=U3-iE z^S$p)>!sqFt2ukqJ`MWF=P8G0+duu;f17Wc$LD>!z8BIM?+Xa8che3}l(H+vip?rN zmY_r$9RkS~39e{MO_?Yzg1K;KPT?$jv_RTuk&)P+*soxUT1qYm&lKDw?VqTQ%1uUT zmCPM}PwG>IM$|7Qv1``k--JdqO2vCC<1Y(PqH-1)%9q(|e$hwGPd83}5d~GExM|@R zBpbvU{*sds{b~YOaqyS#(!m;7!FP>%-U9*#Xa%fS%Lbx0X!c_gTQ_QIyy)Dc6#Hr4 z2h++MI(zSGDx;h_rrWJ%@OaAd34-iHC9B05u6e0yO^4aUl?u6zeTVJm*kFN~0_QlT zNv9T613ncxsZW(l%w`Lcf8uh@QgOnrm@^!>hcB=(a!3*OzFIV{R;wE73{p_aFYtg2 zzCY5;Ui~l_OVU;KGeSM9-wd66)uL6N3DqJHJ0L6rET&y2=f)>fP6;^5N)R`BXeL+& zo6QZ-BrVcmm1m{!!%^&u^*L!e>>{Tg?Du<%-A6<{O8xZCvmdNv?|;Xmm;55oj300) zByD!GlJZaPau!g@XX#!j!>VHPl5bWf^qk=Z+M%N_!myUu=dg$C;S{|)(pcrOI5b6g zcV*=qSI|KVEI(o_(QiDzss>!+>B>W5IhxlS^Eop*rIB0e3~F_Ry*d7(0zb2SYv%Kb z_K~7;{#bI4uy<>P8(6oG^->yVwA%#Ga{s{Xn{$C^=B;Y4GEp4m=&suBjN6XN-ws|h z6tG__V^Wl+rCfTPUf8trHW>GCue? z58?dkGg|8!;YQ(dl}+2_Im{K0{l$)Ec5rW*Y2Z!w?tGQ@ZkO%A?&@KMXBFF9EHi`i zOwT#+Fz~do?#nt1Hz3;_?3rEQU^K$J2BgxOX2AT>!bmMv8&0nQSVYKW83j(9ZEV#w zjN&G|L)`7uiV;>?**_x)mP$&Zg}sh;>8W-$u!qozJS8IH9zQ1|+90mWT-zni7m2b0$Anx2<6 zpgF=^bxuc|t#XClG*jIl^LA3hx?Z^%49PiWfiUKeVVv(xH_AIRe8-Pl=_1S?FaEF$ zZ!IPxsXgx_Sl%jaPlB<1tvQ^!2ii2R`W@xr@#^kRW!y^B-x4+3`V!9)HHE^F%>IqO zh;0Ul3|&UwF?&L-&5@Spcs2w(uSgY{aIB{MbAqjDb%)nrZUw`=7S+4d)K9AS5NS1B ztX^Dm+m$5hO#;9xtxqoNB6(|gHUyBn4`2C_<%a8abEB~01nwRf!?+T#Big__!bMbF zt|-LS;8LPy3a$3$gAD6^;xulrXsZXjKW-1pFu829!mWo?yqwx&THb1Th-c*q*u2^k zeefe7T+G~7CiS=Z5~B?}bW-J>-WuqL13Xx~@Q^)QhHxDgk+x*nyVFjnX8tR1^Sdl-R(PR#|j?hx!oryI`_wmmB4z4{7wrEBF>sclHoe z2JB6c#_$aL%lp4!UAb@_!sLIi3O&()fDr#T(f=PY@t^ItF#Z^atwL1KN7GYN4G^O3 zHDst`gr4lwxJkr~B*Z2x#CzmkNiiD~)46h}=bA*Cx|c;BZ5Un^r5fs}?6g3Svj=j;fV|OR^i@=cCh)VMW_5+L*;k;r!;9t>|w{@)`;;)E->kUinNJ?X8kN! z8`}GhsA>#DPeGkd8dg4r`L zyS19T8YH@ihS=4~WrkUhg$=sYId}&g^9vO>KCnTIzZ66a=?JDsc*B=vngxfB?;*qV zL|Xu(P(H={Trz4ndsE#KyKv}^sWN(EEpcsO6`4%x-hL6fp-yZ@=m!LME{*J|u;(PU zhn!*SVlA=jA^0#&C;}}4DRC|Tk)2eG1v`?uIH(hb7|mL7IBeI~W6fP_36}|0t9q!} z@!h`tf|zFCFY8G0K$!&iwF*jOb@C9E-u5s?^Rlaad%bCX{YDpPTBm z829R2aPrE$*^pP7-pjT|pATPS5NnI|WwT++-L34$e1-}4%*dsYYnu}Hm#92MgFE{o~NjJ{EMM1=Mai)NW%TmhhCo7lUYkk_3rXFLXs;*u? zgRA~x>&_K>WvT0`Pd9_t44Z?otM8lH}ukI$yM3RtOb}S@I`i-+*_MWx=B>k@KtGEN8>e7{~g_4w!LHb-T8%?i{F01C+zU_~n>ZWyA#$r92il-{03qE7w z=Cpz1(vmmZVhNpscjG0M0K4$Tenmdqi6Sa_1=KMJKbaxz-TB2#j| z6%G1&3`Cs*FXeBf5(kCLyAWQvCo0ZsL(P{pXxPqF2l6D7M->xL%)qCYEkc|mAi<}j zM!2f7X2*gpVHIkatPI>>9cVyXLNiS%vFL9?smnYBm z(8k{xAaDSFG3*O+n{p-<+h z7l32L?Kv`Udr$(2lSmFBW$yYNd>T2?L+3N;I5dSOJ3s}q5#UX0X^z@DgEB$HV&10A zh$rhWVb)Pj!doaXx0#;$Bcn=|-z~XKopH&SA^!)ZkvcurJVErdUW4&BwdCV8j+VY$ zciQn&1L7%B8%%^|UFw={uTc`symy1L3LMfFY3N*^yU?cSJQCgLc%}394vUB-)Itp( z))pWllOb*Nj8O0}RkoI!FBX!U4yC?kPD@vFu|>qeg`S&VXlPQMy2}GEa<|}5e#^L&lXX^D1U!rce9c0+G>TC7~L+bTW5AF8gv#eYG z_;WNQQpE>x&kqA*?^}TS2B(=Mr5>Ase_e4xngO--eRT4DtMq`h?QLjn;YW)HTixlc zpnP+~DkXWgh7H1Lu2wUeE>u&y<%4N*+>;F)+x=UWvKjon(XuB@r$%7Jb7cQh^@qdO zM9XJ}Xo(M1KWX8xU^Y0d(B!s?4bx`v-M6p0@$DZP?GrT3lb%%H>>?4TX%etz)cC`dOmZ__G2X+AGcJoGFy@wtQ zeakz$cBhhehjg_(SuL#qVk-xYE(aUTzIG8AK3XD0mZM0EJ13YVzUS$oZg^^hO{b+^ zWy#6}LqU}|3q#lZqO#g=>*2Az7iHbW68sdBHa@f4CwB*}eQsFu7Tt1TJhp;6vXBue z4Z&aWG#~BbN)h`=E<(Vw-4-1?9pAqoG$@yitG#M$ z{V)~zAZdJ9n{7$_oi$!R(XyIv*uawdn?iLi0_|*UpE{z}H(+r#IfP9?u^% z!kKxcc+??s1pNs5YaXS!5+zbthP-;O;!^z!rLXWNUgHa3&8% zFnn7A;Y{bf;(_n0W1vs@RX}8v>GhLDF1~V3{R_i?vJdlO68|#BgDk4eW|fA=Px|8~ zxE(@omgp2MOi2Be%RhF!?{Ga)FTRJW;ECWYF+u9F?c_jdOf1i1BmIzVaa^@Hjh%Dc z?F+^by1;e_#f|(klA^TO3A`*eE5&0ZPj%0yYALQ9XCW@RI&St+OHRvu1>@Onb5fQeP=E$YVLhC zMpkEIz*}74t>;PK?7p#~Z%%f?7~v`0DRg{|bgVzLd*4!|S_D~Bs^i}}-~bm7W%PuM#$_t2fExWw_|WAamWxY6S=i?9Vv z%r%BcXG@HRZ58<(=pqR3&TX^GGZa(U>rmsz|48$YB!5Mbd}P5~h{T9z78BD2Hc~3x zKc=D%SQ$%P6OieeGg?oR7gqz4+_JkSUx-yl&y1FKX^s)nU<6PVuXc@ z5Q^F76 z{SeBk&t7-TvH9etn33qag}(s;Y#{$}DuS}%Dsh-D+#S{21Xu}Sk&DG)xHL^Qw|H>V zxET9a!QifM%L2`JPex5!_AtdT_*%k`VeIDQ?HT<-M)oaKV}&lR%R{pCedOz43WD^xnWfcqCkBF@ z9VL7YK`@>c7LO}V=2TqML`PYb>%P~dvj3iOGBECvD{|;Qxf^$-ay$lo8O#nsR?je@BD*SU*98?E={03WiP!k{}RCQ9m z$}#Jzcn)I25#^-Qz>JN^??=RtAucr-Jg~DzhqOS$;j`Nvn04M4em6Ki1o7#9mexRO za1Xpdyz4D?3QY~9CFGp2%?f=2jo6e$v!*L(L}2VrIGXj$Qo`z2<~wn>{lP=(&WO_z z%zI*bMxNYxqS^^Q%LdYtVK#tB?aiXO4M+CB82bvCy5B5q+}+)^xE3hx?(XjHPO%Hc zp}4!dLve~*ad&rj`|j+_?#}#o_RA)akU$`p-?{HO?{gm6pZ01@yeN33rIEH6_h#S& zAtyDiJrVMTQI^fsYm9y9uY^o2bTA1eX3xK4_JcOpgRO?X!s>CM^h@c2{%VH*gzC+X zm|DU@rf9<$tml$Jms2>4!=KJ6d8-32{Whg&RZ)|_&kVZ0FTt!Gs9OJ(PnX+!>5)Qh zUlC8RiylPF@@L#Kl%)qKKc6ZzJ_2|rcY##{ID-2IQXd(&W*dO0U`Xf^_O3hzv+xkb zyWZ`jB(PC_st2sEDep$CoUQ^V_XIDXDA&I?s}bkBW^0jQ{7$(3#>|Pt&`$Eg+Gz5E z;1W~$+#bKU41|KrdzjU-}M$(v|Z_GtP$3uCNzu7r6tT zbL<-Yzs4_hl6Ar@TVoqX`_{xb0v&U6)YpWp#kj60veHC!+z-J61{@B5su999=xpMx-gS$e@eFvqMEK%gabP9K}#r0IvW%eC!?X4N_8L|4?qdX5#mx^1+!K`l5>-B!e?Zi&>J~yXe z^EiDXWNlAa=vKuV@D7qCAc#+)(rDN_h$lAQQr1NEM1~of6g0s&*Wa7$zfuqBC5F}q zIq_;)KITrRf4ja2p8@)7#`a)Uf-R*tDDuh~r5&3r|B*a)_||C;726hD33bKC@ZHC# z?zQfi_d71~w6Ulk;z5n@cnfKt56Ynic~^~u?4{Um-f)^FWFF-Hjo6)cC(RcWV-pld zUNDj_5A{hC~NfI(fVO2HkQ=y;Tzvm zhzHk*XBGZ<414*^20jeoP6fycxbX_4ZS-C0#Q+>;R*@QA_E_mUo$Lovdi=e6WBOgM zO$r}XbX2^Ad<4XtiE?#6K{o?sk1)A-V?YF^rd4z8@D$1MWZh^By(-wVH{ANZNZ60f z`VxgC22Jem%k!#k8&%#{WvT_rZ6&fo>ti-xff|7Cr6BIfkKPk5o&VJAoeS+3ZoU3Q zL%3tr>%#lX%>{;tPj-YL-?vb2jzl<>z-(*JU z#NgY(Xne)TUG*ZAJQ~DTMCGtEk1WReb_%|XglxGE-9F|)dF+enZ>5s#WpS}MuE!-@ ziZ2T!lpxm^3#caGuE!u+G$4Kc$I<|Ba8vj-l~>D5_%~He?)uB4i9Xj9SE#HO$E#r> z%SJ-{)O`xKRWCpsauH)Y634V#LG!Q&%L|cQ$cB+6KQfQH;8??vi0OE&;IYY{7e2}( zPBTv-c$2rgimyl;^vpeKO)1 zC>_sX@V&--z}6m#@s^0ExO@gZZ00=}D9*iM!~N(*W$uoP@(KSg!J}Dzov788kl!IyaRHISj`d0HO8AS*(KzxG4!kYWX6Be=3xjN< zV%-thv=OdVJ8<&z&!_kFH8GbI&!(@bU42xP_wdQ*z53EX9#7aJ7_5DVSbVFZ`SET9PA)Q2Zam@YoV458Nf#{uQ=< z*0n=~x)Z7MRDC<29^87p{+*hVetwUQGQXeloWGij(}&7UV7_rhwUrEpP-{6 z89MJ56vT+HDYZ9OyOa!|aM)$#DV}GS5vvZUGUy$*#TXqk#4F<6jEK&6BG4hJ=6u%z z2MikfzN)%;`||E559&09Mq+2T(8yCPP?-RXH3>x65|@udly}iJ+A$ zo8$4>0ZgZ|dGG{Se=jM2*dmF_;^7h$#|vu~>g%)#8*9+)-wK|3kY=^6^>_YV6f_jnm&w=h6F^A2G_%6x=JIK*F2`2&_J#h>IR zsS<`$vYK4_hShk9N*a}W>ZapIGBmH8qE*(CFsWe|LaNsDH?o}gH-M!dV2QOA0@iG% zhVgrYi(|5UGoK^sH_#_Fkjdw*MC6$6ly3Swx{xk;(pUJSHG-^uOzDe)F;MLSMw7eA z*P|%G6b}ncolp%}eR9e5;4%Ltf^6h1;nkuIvg~FF?Kv4whK`gOgc)m|&>0SzLfjdd zP#(f97vZEs-ga$#{7>Y&gOCy^=D&M}0 z_){+OQ@U62Do>z?SdEtrFjI=+yOieg%ILB*){Pwi(lJoMJ#JV9gRCHTH%>6+*Kwyr z^<>8}9IKkcym=InL#D3PQG@pEzgA8scXeaJQF?~LiI;Zqn~-7UM^u2-^rZ}80P6Gg zh9Qa1gsAnP7qM#jO>9W#$=$Wo^oZ?k+}1*UGX*`n>K6e-AGxw_SSYkU@ddPzyg#FR zyZJUzXjpbNlMhYSNG?f5AzLJJMb(r+MP8;Jzp|CxZVxUZc!zX2 zaH$O%^6W=WDKb%(Ia@)*cwtZs`FaSx4W#0%FewwWUN?eh7U1RiA_or`9lf z!_HZGo3ni_pdx6=>xh9TB3Nchzk=j|hWwm)c=nB;)t5;^hg|UvU;fTJMEK4e;xXzJ z35z}~O=*12Yz~>8ROkntnYjr))^l)lRI&+qfqf&9ky$0?t(@dyxFi>RNBlG<98cJwCS3?L< zwfHWqfkm?qag5EV9UT^5{7uwDCW-5Hnl5T;1NCb^OaVnl+xEt4Y-+iorirEqn`C-O z?S*;-pZwBqG21j;ZeISj&feB;Rz}wT_oKGoXIvRO>J!c&WIt^vhA^V*$@1CV&>h$a6Jih&0ef@ghZ?jshYO&hn z1PN!tTQ_tvx6rPH^z?%(8=h)`lT+qvbQ!~9EkW!-+Y?E6RXvZZQ(B-&^&d{IQF{V)}sp8;a@Ff3w$ zr)od6lhObk9u;uUy?E6KC}FN3jkMC=>rCc&gYjVJh0fAw#~tt-pg%y=>5mmVq<*5s z9kF~$s}#R>LF`63PH8RJdiz%6Sa(f_*}cFVthI5nwnzTOzhJxNDJx>r<_Y|xbX(!6 zA&3!qiE6@Za6)*&IXWo!C6Xp;rzXf!qW2mrP5sa8QdW&-b(_`MbAv~|D(wNf`iPuu zEi-ztT6HUIH@o=nhl;4wzRfESL=T`vOu4A9#+n=FS3yLMHItj*$-zhsBR2ezjOK^{ zOHVyC<_NuoY|{_pprRz^EYSh)jW6qDslRoUBy*w-%@^%)PCHPMyC=p*`bT;Xta&%) z<_A0RPNkbGPt5nZYZAzJMn~yz{B=BdXlRcW?X5^#gDo=f?BPYmKC+BrZ&;wfO6-vSrP6UXzH3F#y-XVoW@84{!B^gdOcUL3TqNoPPR;XJ`$F_QW8jxE4=puGt2L z=SPF&tssz>hvkS;)dIB^Sv#?Qan6Z8wvhzHyCD@bdJnSE76@`;)mW#cFHRPbdQbx!K`kJr}j1`2ZH@+vcv z;73k-7__tN5+9qW1K%&MPBgOo4ZIf~=yFd->Xyjg(r*ZC^Pd2VX9SgxYQME;Cjtp* zlMB;&pd^{z55DV>B`o$z6#6-B2&^u%s3V+`DLtO&1(n|CXmyVgIgVe(j<%)R z_01L&JobJ=h^zCb{bkk8I->rLKDz>|%4}mM`EEn@XGlQvMIJoyJ#XopX0KY!@bfXs zQ+*kOyZ7*rNE@kCZ%+|F55WrV2|S<1KtEzEH7+iWOsbP*RN>F1-Nub!X@zwgFOrrzV52|(o%AJ8e2`QP_S6)&Ke*bXQy20CrJTA8^>8rcJFI{(WoQ%6Nd4da7T zii?zBw3A&@r?4qRN0~{IvhfQB1tu6JOp*QxX(m+|z-4Dd3e@5LMcaVD;w0DsX_9Ml zE`@nG%I{I4Y*U_WZ(-E5{$a(&&*!|UyJ=DW4;g!#DNO_nb8 zx|clK;W^h(U7k$&SKgK#qzl}EpJiVmwh}j^WF5_b9I-0BlxHRCm}dzpoo3Qb^4eZ8 zwhjN<;4kG4>Va3Z7a{VCEfL7{Ah*EgC2dwKqhvyJ++l71mKYV8>;luinuhg-KsWE)oR|7{or&9mR%(J&>yyjbg7mJj1}~D zm19gUVwyr5%{*N4qA+N<*-Dc_;alzW(+Jq|!)?=6TSr1&v2J~fyb=OgDZOzTOT_h#9L9xJ?gm>~7dz%=_p8`qzqgwWIB3>(C z(PFj%jv%zP=M57VLvk17+TJZG+ztS;&p7`j7?M&n1sRH>?d&mX=vLo2PZhmDO;5*M;4-=0lOB>pJ$Gp7$b&~* zWsN1k<{yo7M^z~}bOV{1R~xSMhrXnGegm5qB!jXsRW#O;Us-5A%kcfUKl@0%7~W0U z@J!$9*EEl-k*hmijx@VU7|N|$`I1Y~B&)h<1k;j6JgOq#ZKnMN-9q5ntT}7Ee4FAK zFi)1!RH1NeE)1qQ3iHbIQ*R1m(F2N%L(7?R?+4>M@~cD|M^Y!0?xYQgW6|IZI^^$L zt|?;H?HyFe;0~D#OY&J z(xvYT&XC+{5t*wx@8|fM8vH8Z2_Pcw6A^iTBTeKGe-ICoaJJl9Y=L%LW5Dcw9U<~A z2vb}{nijn)Yd#>*#>wXhYmWD86u_O#+Xcx2n~n$1#PSR|Rc(hDT=(}tvRHZJb`|Km zn%-+8@E+vzM{dgb!@c*or)P1@*Tapi{`kR-Oe}@ zxRKu#4Rept=nlmrZAHWteObcWt|KDlij{WWF_=!`n6jxc#_4XyLbun3K9qRVWszBi zS&3f0*CT1A$rse1q{g^d9j%yVwGM4L5 z;vQtP%ub!$%GKXr*&5hxbKcK&Utg!D3_uR9Xu@PtM+`Y538D}#oCJm@c)vcjdG$;P z<3(EWn*MpP6Sz84|5~dTW>o8B>CcKd1Q%5`abJQEy73ZmtbHQ?Je{b>4Mh4ar4H)3aYnb{VV7&MMNw%0C~<#U*|vScop8mbF-HllyNf z$EXs^3rI{}@`)x{ww8vA%$|GuEWl@6`l~i=X?@@!Vj@iI8`v|}aGdX!4r
K7|BUm`^7>V&Zk%^_d-%A~k@lFe zJ29@)d6R=}098x)iL_mZLWI0K!FqBf3ZpOzvy+Jct8hK3BkXB|;{d;X&YC^=&6Ir$ z7dO(0F~nn3Gr|Rt;+c_XW1`>ZY0JmUlh|dGco5o?f9f0Y-h5b}XYwKP?NvN;_U?Fa}eW-)d@m zG(?{8rVK0|*ho7_Opp&!{iFuJUdcgq((l3@m?b)KL^()Va<63&5uKdl;a(6D;1J`U z;42^^7JCB#5|pAZ^5rG-lbPu`C$c)l**QEUMp7;DOxo5PJjDmn=^+bWzE_JJ6Cn$8 zu(?@2m4>yoN2Kw4Tlx-N@a-PQ`@>cYdaLXnZ};Y9Yl|Y6K*=+viVLwZ=+Q}QT4m_h z-|1S6u2bLQ(SKvVIDwGu(ezr)jS5pX;6-V$ z69nqiOAC@Y@k%a3swx&M%ck9gofsP2yXq=0h`^4o8Llly(mCHXN z_$=78d#||+)1kiO`H(mp6tWZ;8C)v zw57vIxFga4uE_TD%gVGst)f!7dE(gSY)5}W8SyFns3>ErCf;*(=u)gdI|nDFSIjM8 zAG5*H68om6K~IYM8gN5e2)jA*1HBHtB{`m0nJGn$@o?;v6(RCW1^)euPhonpc?3RO z=>f*`@?Jr3)E_%ZSUV488l!;_1?;w$b&LA6?1_X;PSw==cO zl}tiKT(g>~wqIhS)<3OjJsKp=f6*1P7?jqQWqnbSvM3`Mq<~OZjhjfE0$AOj4v>wg zWhTv%d7UTdD5=2c;2QM3eCo081+|D%{OgNFV~$963&5P8R6e#XN-r}+ly?+?+x`aE z6?s|Lcd4@4Hg=+Ph1a3pi`t>xt919pGj)P+AT@}1E3Ax=7B#21RIh@Ttd}ZN;V~JzPXAQu>+Kf+;v2mA zTLP{ezh6Sol3k*+7AlRs{4^Us3r93A>TDH3nE@@1g#pk>q`TJv^DRcB8=7)+##Zfh zysozdV|-_B!q>^W$ncNJ@dT;DstI3!;+4c3ZHNHf6FjvTmI>*bTJPr7Bg#kKR?bsO zhzPj2DuwS|l)an;@wEB*7!y`w6n~k`a%uLX+p&4NqJHHyUUK$?&WVzJLd&vVqLkmS4BiD*$uoMxW|#zjBghEf zY->VN$QZ=^kVjRrBuRBO*WSJ83fY8tAsg0l4|WlN_+nr@QSG@h*@8frYlEN-HPD1+ z`FI;aELzQa!+P+#7Fls+gknx*QCm{g5+etHEy7SQ-sm`bL zwSRn%Ds>`0Jvt3wc^|bBgeU3=7VV5E<*_Ayi3`&gb4>};7jbO~>k2#SC-UZ-<|FbZ zCtJ(4BHSioFh5ygXChtqJE9%|&2LvypvyG_ojC$K5#Nm$GlRfFAz&!ziu#lJ9lvlI zYb^vLI>Ha82K^5rjx#8+u;f+3wO2^a&)NI6*69k5C21dTc} z|1>T$_9>GhO>y;W_Sku|#_@vr4IPuqrXQV64;y?B8=V-bN4yKm8K>tHh{Cn&8>^O= zc4$5sO!;ntp4|fv{Jk3R{JpN$NHuA`e*io@_d4j68wf-i^V=#Q6X~%&DSu77!sv8bj+L-tmN`f&~!4M zn zNlj=wAdNpZP58T$EAVUF#aA@U+-K6A*kA3l#>ix~@x#qtw%wrIM9b=fF}v_f++UJ^ zjV|eBP`wwrg2)xtCs3Ud6k)2d24r)UXXm=u-mE~L;ZkZ`o+?lr)}?$r>V@$3xInMV z6Pme_r%TnQ`C7TpH!CB4@4=&Kk1nJVMzt+&i}p1_&+n^jvM;X2j4!U1ek?N%QnXJ` z$_wzG%1U1rV#6nHzO@Ljo8UWhVm{-d5$Z2=>6+yx-n(rIE8z_bzSyRf{l+p9KP}WX zURd?s^C2jaA6osgRg~^2AY3p+guC8LBb-c>||BvcYtTmjhlS=k&c39kJgP}vh<5m z#DK|O@2;kt))IjF$7dpS%y~7#-#%g(I(VYl$YQEOo^rz%D)BopnuLe$N>WIu>DPRy?#93>CyCkM<1{ADA#8~Vq92si`*Ew}%}xc={9A`JgX2x0h- zWDiH+{)f@=zkm!nn$am~IY!!MIVNe@5vh5($&tM;Unb~A#^stI|ALbMf9ro`ngEq{ z|B-3(_dmg8Vr%t30!ZS9?~-|e*A5lne)KP%ZGZc5A>+SAkC?cMIM~?%(G*!Ldo$qm z!ySmP{3ouGr1}qkdH6`W=5V{J%|FQd1+J_7X~L2))0V>Js58HZ%y1X&3{wz93Ih5z z^O@MEe-m%TvTkU_DJD1G869qL`&_oU9Bix$1O$9QIfj#i!=4>2aiH|ZfD%q6Jqmkq z6M7Ls5{dyl2kv#X%)$?DN)WWyFC78%fYa-rMl};+W7Zz9QeS;nPqMZ9)LvmrN2V^m z=gnP(n(*|UxVBk&=rt@5Ng6HJUp#szFDjY3ZGJlxc2+W9Y8}6C`pmgJq7qF~uh6CB zTqhz&7-}0#bF)v=8*>?N!N}JfV_W+5fZJlmO$?BXq$HTBZw?QtmYT6)oadt-j(%id z*$OhU(eD}W-GpYr=sZeH!mXqYJ>?E;rm-?**7vLPGHCDm`loKlvErB~n=&k@`pnRZ zGk+A?mH125Zf%4$PP?#dDUg3n442XEu14ITac^fZFV)v$2N-u-OcI5Cl}hE3+#y23 zjrf|10+{Qd0-RHdhK`Mk&WEs_IVs3z2qWg9zU}b{iMYEgPJMrwG435_?$G6GeD+Ep zXc>j8rl$#u90d8 zR8uVCY+Xh&oxWhQN+~=4Ra~9?*E4*4EOvM{hBUclsIpVY(gw`+ zsVdH){1;k>tc}{9UkVB#`6`~@!xAed<6*ftsSk061kwiuil3x!c z>V_?U-HUE}4Km9D5xzs9`OCNeS-JmNivNx8{qIFtrLLoa4+Q(GF{6_x!M7ahWFY`Eia6a#=vSjmD34{Uan&@^(KaL~Sjp7T}ZlmY8!PGYq_P z=a7Gka6k=*Pwy(7JtMU zTx*@E3Ye}euE4*y7UCeL359bC(kdubZN^mDb&aH5dQBg21p0~Xi!Q55V{#}}TK;hD zt(PmZbVw7IqqzuvIPLpJt3%GF@I&aE`}u z=0|I<1WxVh$pm{ca;v%}S3rkL> zo0ZEdY@*Z4w3Fd!m*_J1?Xp?djlPILD%l1@lXC{wd5i9f4Ux>Rs2yM*vbRUBV;`2f zJ9|}oL>6~216K(b4pmC388BkJ#U}@i_0>!EZULU>z7NNo-tx7NuTXo|_E<=B`B_ok zS_nm-C-wTBNj%v4Ux9o%d#rgMyc(s-Zh8H^X48%zQh>Tycc76iE^b3A>UDIKM?Cg* zRTMQzH1|j0_xy0Qfc%K1pGt#WFmi*S*%76~rNSvjx#Avg%~6+va&!pA(Y!b6)GJe_-2G1@o=K0G zrw~{iXTF6@{p5x794aZ~pXj0r0?dUkb?4JIKCLS`6mm%3cCEV!Hz-lA&7SHFo@3Fj zE;vw43#o-|3q^le_=EKsCsao_0V}oZk7pv@E+>rB@6|Rf?WI6`sjh7ZNrA?Mjm zxf}P|`jJ}>P|4FhXBr!pFmmU62q5cx>ZA7))CK!Q@AX`qeZf+KT`BvDs`&(Y#!cv( zn(x+Q24F_qXsHHa+=U~7@nvs)wYACF{Wj7O{G2?EC-rL8jR*gRv{@a{8z|61_lIha z0AgVm32I?iGy)0AL*E-wIM*%WyZr1WYu{cxd8(DR4Vj~Y(TfGeS7~$_;gu+4 zTXFbJ7#LE}PhlDoUZ*SZ(`kY3!JK&L?#LIoB8;2X1{bQFK@UN#{_06K!dJc<$F3CS!f+xY8?03k& z2DA*$?9oY4X9rW(58Fw@*FC|@a>4L@D`-|8yOqi4N}k8C|MfcB{jX5Q5jom;QTlDIRR~(-v%F1?P)AptH3e=Z|MM?&fAxLX&FMI8E9sTCx`UPqWVFC?qiPdOT zY+Wq4hx;(7gfHkNFF=8~49F(*ephuub&mx=gvxN6L#XAzyJrlL7el#XSQQLo7|IGxw|yk_`!be_nV0k;E*cX( zHiQaRi}fR1ug+iRlh+t+IkkN2jSfc84fT-YS^eW>5r{TUv+j%hf0?PMAtVuSfltK( z_*8&W%D)ah|MXP;GQC7A$;tE!qWH}&49?Y*Q%{kx!-?0((Ml>|fWg6Tv>dnFN`0+g zPyFCS{s0L`Y?aG{_$iE?oaNPU3CsdJd_2YP;hQ9MCCo(2q)>scM$FrUFR|@?OQhZI z#;IQB+82WLAyn`(2CIQX<%t~&3BXG$YYS!z!k5ZR9pRu}n}ffwk!co3d@%8&-F-S~Fzqd@`dZac6XMtZNmTjU zl=x5oUxj}v^(=KA4|HG`rb0|($6Z0QoOQ;AD}=S1(-zbgqG_>alC+@{3$bD?4xW`w zm2C}=csym=8u+?D0PP4{IjYT=<9lWCBrV8hH^$QsRs;yzID_qcp$&DBWvg zB{NpqD0N`(E~5NQqKPmb!Vr-{SPX5U1k@wwh>Hc;CflylCsVr0>#I1FE=N@1FKbN@ zCH>*Az>X-_t7C`tIrSJSR}o>rs&8m6!iFyxI?5|m&#TYJJa1d2uC zUL9Q&YQbBR4pVgmMakovWd~u;<#i z4VhX{@xQ|4f6j;)zNBb9YQ=|X3N=_Pgf!4{pu|mf4K`sJ?T%SLhg9Igl9zoqgj)ES zLJlfGTJF~NP_p1Adwso^^v&~A#lP2H>z6~PDS5JbHBN_?f#IX6*w>qMAYrIUbtdAO zwn|qWzEYcW{^rVx`kFHlRMHILO;H1*aaHdu(fdFp2-yHPlBrymL$NxJqDArL!Si^+H z)VFdA-FI|mK9~BQb>OEhDKzA3twArhZ!t+Q#!v6EhipA{M<@$Sf>Qgr4S9Rt7$-=B zEt&1tq@bGXXrP$!XnjgrmGC;P$VPk8{Wo*B`08@%S2uNDUXSZHt7Mv|YRT}E3;1E) z#iWf#R;r*1RW3Kas&(Tz$LZ%e5B;PB%W@vbxPo-*q6^ilN|YPJ*#pboi;UuJukPBfA zD2pP(`WqcN0jfbJ4Qp>yAvYcG?4PWY-q?#s#&Nf#ll~I;eQ#aK{$RB47*dh~cKE3+F-?Q%V{b>dz(36dJ*lD1p;Wv;FZ zqRF#EE-xXNE^RL&>`@Hr#eJ&`c6p%X(Y%|KGOsyBrop`i=D)#P8BwBT-+AhG@r_H1ajPoqlC0pc1&p%uBN0#b) z^pDjnws|zUV=#q+j1SXqB~k|sfkCH`4~NKU(6=^`(}1`>nK=ZYEpP+%2b$pJrIFF;P~hEhPn5D!-QzJ#Rd4{)Y8QP&0= z_BelO1Byn@ zKoi;jH1Y|J68c;4p4g{llQz8jetWo$$dn=mgjg^7Z}(CLD=?{hM@HW7VQ4D4?T-An z0>tJUr|+I%!zf`eBBCKjw)V|ic2%jh!*Z+AdKWem)K-M6ZseB2bWUl-`fsqV0V0!cR%56K-%{izCQQ zuqaDQxRtYutBRZP zKfe8U!sdYbsXV$8%Ex4LZ7qW$%9jmPx}yP4 zkWFxO#4kUtbAH6`h~ONaVbNo?hsHe}j%TKEZ>FVXrSSoAl6NSQKr`5?xD2ZwGM2&g z@wUTZMr-ISWIOzeQBo)@j5~qhu(15H(s5UkzfDkS0ph1k>TmWhu%EB@JQ` z>TSi$t~Y}*bY&GnSdqxQL;8WndSE*15m_pH z$9^fcKRcmL6nwP$B2c}}<6#?by?7rKsryCsqwLJ ze=T;$RN*6lBjB0F+8uT0C1Rq}BB<$lc;$=FJ<0JfQHm30EqA&sg-NSW3wP<|Gz8PM>Jxd$)RlO5u27E$yScHz zA14qe4&n4-=2eN?4bVb0dk>IJYYJ(yfHTGAdXGJ6XlT<&OAB1rI(lK-Wq0Z`UDrK% zxRz-dd&dhTCoo7t2^f!USjWVV`baIf=p2mm)aA`o{AVLh6;MW^z(^btE^`;7Z`PAy zC`}D`4J=Sjp+^{Ixk>uE>lAHLcgY&U#7Yq9N1|W_TMAVW35AcSelQ=BGKQmchJltV zbnkze^F3crR|@|&<3sk|?^scj8e`dkqOQ9k@aEW4^;R zmw>}epDDY5kCz8pc(ld;$YKU^?M+ zems4sBF0ReVAXfD6QHKYeWztCxn37~zG;S&6XlWfg^faE?MtuAOl`ByW^;#y?<(n- z;YgKZ$vB_RNgm7b3`OWN2194mWa#V|)BYzGfV1x%a0D;A8QPMy8 z=WFK!*GScUQSEHoKJ8Nj1~F}_pH$=yY7mmY&0`TW;Ykg+K`~bn?WXRI4CG=ac5**| zVT~fRfDLZGxbVh2&129pX`Qf8$4V1}(t2)>7h___ghz<1yFJm zb)t(DTQg7PRzhZ#%`tt&Jy6&nbPeA1NHWSl7yXr`K{^?`EmETYiHwMDHxMA#!oaw0 zs9(jubjzoIFj+mnPp&8)*p+HE{6L(@C#H;yv20;_On#1P1s9E*MJPBO%_MpDvphFv z<6ZL4=;4u3#-AlDXH$IpcJf#iK@utYfO#hk|{z)s`~j2Yqm|6XqY z(TRl3%pIJ8i6j5E71^nvYhd`>*E>2jSV|%$HCq-6kuZgTe34RwpKC$;VVB5RYWLMh zPUEMZMMD`dUO40f{@W~)_F(fS&n(kB@jGf(_Ah)9=0L<4ws&WPNxuv3DZhuchQ}IU zQ$iHP1Cok<&#+jtvi52243EUs(vwHZfa(rn#wh$Y4K-2g;ZGvn{W8=mNQ!h!c2Nw6-y=xAlkgMQp;n`IhsDNLrcjfqr526Ym5fA z9bsGTJkQE%(Y3+|J7Ygt0cyY4$Z|nj&W@cuh`}o%>cLf%8d3Ejm+$v6KYV|!6^7k> zJ-mYLIy+aFA&%3KJ-v40$l`+QNBm1?dU=^Rhgu`Udg(zs1KY;jFJE-%ZfmtrSG|v; z)ik7RQD^82Fgf_w;xd2m7Q$FpNj1v>F8T~z*_eW15WvtSMN)@WNtWv^Uk19IHv28Y zwEqLkuvmkY8jYMNQjEKidFUFPype1#&BkGCe;jW@l<}<|WX4m%E*&JLEsJOeg{mX+ zBQ9%p`~_Yt;%(V9Ij#a>W8oG(6-0#t&JHxRW?lJ2yZMqvj#}eFiNLBeu2qp(y?ASQ zhD&_e$lx5kh$E8#{JwJxU_^bmrcvvWSK&Q468nme&{NTi<9G!xi z%&NjsZs>D?fn&SI#<92MPAduEzAHkpJ4ITZ4zp@HoN;1$U;Aj6f2y@Ey;)yoT{$Ow zr)^3ww6c5|;gH9wJ?+NZp~NayNSrzKEUXs``WSbq8KI&yo3r#;!H`HZ7&nKn*4vju)9<*BOh7mmu#(tK#|C4A_ zN%tZ&`!69EfqQBC4|v}?Ph;qh9LtOTusI@Z8(UCtTU1bYBI0{-Qrl$C&boZzDVK5FX4ouZ+T!b>!Sso#I`O9deKCT+uHEPPCCB$vqh7b}m1?EaDwv?70Hw5fgiox3mc zO0iogzg@f#cUUq982UoXK6P)lLGKM@ZUX)lw(M?(E$0I^&IRCpMg0GAhKLxsm`T~Y znAy8nxdP*hRDjwudkf%H>u3bz9sXywbdk!c{j4Ag->L2zR2ZNUQBhS}I=4;ftDg{! z5`?I51O}*bd6z>%^zvvO-D=qr<_9TL2gVQR-)sRPt&=P2C~_o{G^3MePvdFayVoU` zmjWQAyENd00|@GK@qK)5Ym0R?eUyZlgldEw09O?rR!bHN>3wv7=_(-{psCvR_w7h4 zQ-{e$3vI$>JGgz0qe8h4fh<%_;Z*JHLDvyim!mK4u*)<&@3E$xhwmUCQ7cjKv=hO0 zlikH@5L&jo-V`fCEV7*ulC2e*`*>Df`AdRN*HwfJ4L-sPNrw{tYtaR*z+v$O;aF5$ z^s{7}2=|2+iC#(d-8iUuY^>z6VvIOKrOS_Zu}@Wmph4flwdw2cprrm~?cO4YIzE2G zif`EL{niTFNXS&u4z~)3a$r^&-GI5w#U-+G*{Li~@N3y}4b4(8$7%_VXn1pG)0mNSMNtbXqfydnD`XI+KT7laJ>1yP296NHJ{ zUs2h`d9xB?T6bxbd1c(w6S)~u$($f%qu(qYMyBJ6*s6lg*s2p8L_sP^k(=n)`?$PB zk0_RXo7@9MZC(+TS5@|@OW2A#glm~38)}AY9hjG5F1?!Ny-?wmIF8 zyuf~uejq&v`(Q8jWpm&;rIp)mV`=TF`~O7>=b+2oy$J;ZQi}?t`2SxDRK^~d?*8}5 z?(c0+#ns5w?C&$)y5{lUfXB~H&hrr09yA(F#i*GX&UN@87|`JpgIftcfdI>sMCs$C>8fy!80c8 zkg}s^mFea|M$8lU7iC9ZevP!JT;C~J{j`k@V8bdSohapsN{KV7;7`5WqFMt-o@TN& z>|6`Jc?ZA!m%0#bVmZtEDshF_{Gk;Nz4g-6Wb5SU6az}dBW;w{1G4;T1Sf2

Qox z0`xkkAPQweAlfOtBr;PCpCyY@I(B}_q2#9zd3W%J|3eWKpVLA(TO z5%Zf>!cM)^YQ?&n@bvEeMq7qf)_Rqe86vho+bO6^&4TNMJrCK9V`zKRuXfd8M5%~s`9IYm95q_DwQl# zw{#U3?nojDov=wtw2sQ^BnoussoxlxR&D21ZG+h=hHHPRxddwfoNLfm=2*#>S;;QV z!b3X2P@Y~tG@ zEsv?a$avqb z!A;+xKmVyOCP2?u_M?6ro!|6p3hE1XWYaW#CmFc3%s^$13Jd-mV|FHKD;5_gD8=oL zv9{Lt);bu_WV&2XT749?b+HvE@zDP45=p1BaTTD|Ujs_}Pptcu-!Z)p9f!fEsGcW0 zNI*A-;X6d73JsXdwnqOVLo}*B?BqJxV>?b(wQd&e?en)d{)G}U1e&OCD|aImZ`3H6ub*NDlQpCW z7Fvb22s61l4U30fGmyZE_9%KpbX?j2jtpKREvCcg;qd6)+bMk%rMajuBY7%4@T_MqDUPcc-On;3{h}TDaHHiD8llM)Y zenv30d7+wIdgsx!>bknt{ArjL-`i3>%>zm7b1aEWPdW0}Dn`+tNiz|#nDU#_Mw2GC zF??~VSmm`iB5JmNJnfW{;S|zFTxex&mW5Oa^r*W%uJM>*pmo=TO24r~ap-AG@Z^z& z@ag%!NpczPaLM}v-G7twO{k8Y@*^M&%;gdP$@biw`0`qQ$SNmi*8mkopTL?V(*&}c zBLjqsFZ6T@g5&L+aa)+Qr61|;9SRLU@j)Cb*v4VnqP&h-Cqz$)nB3x)s@C4u!g%pM zEyb*^R3|r3{4MKBUPH?(D8W81Y2Wi>?d83MZ{MQ=!DaVyWJQG-->ZYzQh6mm-2RAr zwJeG0GKJdfJyLuoeXc_f?Ancb`$9pUO=9Ebr%&VtFna#h@=(gm!2vLt`(x|`>{9<} z;LQAwbHwG{$}BQEX-KrBUk$h+Oe|hb=vXisNt!NgrwZ!qNZKii4fNz~AIrU&Cthe& z52`m1Pr}7=!w75=OcL=4TjSp2n8D(|{FJg?rBNVX+2cqF#nR*srLf3GN^A4tb~jU^ zw^00dk6n`pHdS@eyf=nvnjNK@PwmDHX|tg8hQda*<{Z&cN~6kAkK*PmYn!Yzdc&qo zZRN_;yI>xRqWF|ahf0Yk&#(p9mfqqvcEXjhG7XuCqJKPLZjihSvsrMYmv?GtZtpBC zygaAfZLcR?ncPb{QqRN2JsWmcosmDIY;l(-I{^F9WE4l-zK$g{sJwQ;rCrzj0d1cdA`jz{$1?pXrG=acA{?JbGvy(oh&ivO9cX;@g)xX}$b5Kq948PdDBiJbiYt zR0vER&T`jt{Dj;JtKbTgsy#L^0Zs{7FHT^NL1-580djJX)=Wk;e1aj-1UzILng@P` zgo%F__Zz9(sqT9~vJ}FxsRdQtC%d@`Y#?J>qrJisrL;3PxBXf$=g6%%F_Kn$wT!uy>CK@uaU z0F>zhy{(7o7W{}c*oBRdoE}3X9G68iyzT}{29wew58xymHl3&f zuKG?e$hb&uX*2Ki=|a54*X&bX`B`dyny*-oDJu~g-4!B*9?~JIa+lH+$w8>&CeB|M zHvac;C8+@GF9lftZ_OM3ZT2pD_C|l3H&!SuSWnBsak1EK_1KA#TB#1nPbCna#xZ|L zpr$O$`yj6vKXAO9!cL#;+Jqw2C99vUJ7z+5)ek$x)ON(BhmLXEvqt zE!l_#8jiyN2{>H4nZuoy$hkMW7~ZA(&|1LI{Yc%}K>^G0u+8Mhn>+&O@;9PmZ+CBO zd<`V`uQ_1;u#fK2XLP6rV;~bO>TAn7O zQMZ>EM(ELT)0mClcC7IkY##L4t!cV?uT^+Uv(ezz;AQS!p56^|2ln2^-NffhZ58{8k5t*V zK`^yH?32h(0seh<&w7XO%$Z1y)w53NfD`s^S{ugGPuHN8_N`V=MyaLW6}=7_9keUc zvywH`bHX{CBFadUFYkPsYx=p;Pq^#j9gMo|hCtf!oZMZ6X~|VEMT>W)6bPXLuT2Ap zJ%ZZk@$w9(`$o7^Iy-RnM@|Xu={|tY$Y&YlR*My=zA-==mW?tW$O31Vktg8KK&8c| zt&F3QqchlLNVw7JK-*T|@o?4G%0i>wMA$*6Ho#wB=#~XnqUXjFR}?T@Q0ZC4cK~uy zai|eukdf#KcZjRHEmS(8y5K?=Gy&|vDh_o+kTdxq`%T@zMMso0AuN*p|hGHue ztCRZL7%~=DgK+i8FgEJPi?!01K5?H;fX!C`Y@X$J)=Gca{L9sQqSC)S;ohgSlXA>x zl|!Cx$o0kf70i=VQyK_; z&K^)rtR@yP*;m_RzF|SzbaP7PBWHUc?&b|#+I6n2Hfgbm;0k9HKrS{`Z4Dakb4dY*Nn57C#) z=ECn}*Y1u~%pvL}>{5-!9ou<#23Q+=AWl%|Fh%D`@94AW$~9{*_^6gdOv_vO&i4#0 zi>d7wf0OY^@!GR6z5U_yf%%@H zb_*}SllSF=(a5w$dA9WgP&+VDPtU-lb%--Yg=2F}3b)WP0VEyFbgc;K0!u_p1{4rl zuT+SIC>2yD51g9c>`p3T&p2+oQL(5e|2W(B$-NV`5TnJLPXMj)X95zlFc(T zV;*6TyX^>C`K+kBi4bGJ>i#^BW(A^ z2R?pZE|5he!8_?UlcB|w%_0M@^j3}-P=KiErPlGVW3{%4&fPv#IAO4uW)`Fs%HdX0 z4uXay5=!}E#1_g(zlx6i4*S=UAd|qct{89ztmyBuO26J4`s1zm+aQoAuk}+_iK|wv z)>%rbE^X5#f=rmq8cBx`-;@{04=R@PmRT(5WWZS2n1skDm#0`Jkoy++K0nNb`4v30 znKSlSX6s(oFqg~Iu@@rhE)gMy+y%s!B#=XC5lrSbcUrKR$z_rHy{EXWQk4a zmmK_S-=qaodySWOuo0Yn0BnhzJa^IL{EV%fVr%SpfN3d4*xzu`(i-(9^dQMw_P_=J3AAf)c! zAse)jx9GXO<_2en3`Uh-2z8`DF&5mVd9kgOIN~Y#PHsnmFyg$b8z^Yy(D02 zoKEp6SSnKeg4dW0^j?V;Nn5Msgfom9_Ra|-8Eq(DM2}Po zznRFri~2Y@(7*&=g{uWLz>v=P+NbkQ%-4S*!O-i6?^~ojVUXKfh^9Jb%7Ug488T`; zw%)u^R7wXUN^k!Ch~9-yz2O91qMVV+)k#Se#gDM&Z-nT)& z`UYdx9f?)jAU1d0MkwkmwszZ9x^9G4YoBv2mCTx!u*`eK7){fT)5EE;*$DjXHpwDf z+B>rK9jC1zCQ1Bc10wytMU7r7OkgF~_?uGdw*u+T705iMs*&&Kw3bSnqm-`FrA}vr z!W%guPH=rNWM0$5a=0G^P$m1Q?MNLmXp%Z3rbRtARBplpqpfO+n%Hn7vqA5C%b-Qp z+eQD1+DQj-rcg*QeYitDz0(!Y!KC7r^cItL6*ZnfuNh6R}}T(~1u5O?VNB zazm$B2ZzJRrqkk@@!TD{k*wqsa-1eO`MW5waLvX58*vi*Apt}OUQ@w(Q1@!D(UW>e zcO0zH`fRacvP`=RNHEB@r>%OdxQEbG=|2&qN@3-lQ4o9cuW<6K2YgR3sl()d2)fvc z^ksPGL6UJVNL3_`?cQoV;vZTJcT;DI>_PSo?%u7+8!E%x9~O@p)qhSD8#35D$v7(K zI6H7FIw1XofP_Jo4t<=rHzC9K+?pUdAhr){`9xQE^SUL8+nAY5f+8iU;k}(35!A}5 zm!^M^MqQWaj~5xVnv+C0ya7h81TgadkGbxzefOD);{eG3q$gwNrNF|#Fj-_Od}ULz z8YDP=@sNU0v3OxgT0-}CLj^Eu&V#2(x0Rm<)4@G1UWXF*)%qk{j5g%S*Y$OeJ? zrF-59F#A3AL1aYzc$qfI_b6}LRCM2~8=I9THdQ0E{)ZU}7FdO>e;(H)(3iSoVHkG|S#aj2Tq z13192TLHUM^uIHq{rjM;u=Z28^GTWv3EBa)vBW`cSytEb%bhW8nkXY3-V(wH_O-Kb zkP}(sZUe(T&)sG?G50O_tqA(K)qYg?c>VH6H#`}x6q z^DW3M^$!}RaP~A_2mO^0sqR|=y3Sp>BC03%Qygt*H(XbIm%!HvtsA@`B>Z=aS*)YC zBhe6n2D$h$SNia^wYS>hGET4Ig|KlNT5>U(35bGx_ujl-I|9FIiUn z%A!qX4=Gi_*^Yx@ek2!es9RP$&WoWkyKoO_s3fM*-ZWPXC|6kr#%W@9iJ6;+K=B8_ zgLBgb&2+wc=YH{yfsSfL79Qm*NZAv+`Eg?!%5~Vh$RK}sRimWG^2(=ISXblie3Gsm zkK2$-;pwf)lq+C2v?v$rk~-@{_#m}iJ}PhSt9AF`&k?MvcWSmHaa$jN`&g7=<{wAR zNZ3fLv?YO6KfWer;3IoQUMtDBm|b|oLr4eVAU1OGL+}d=m5|f}Yjo!b6}I*bgVH1ubk21&MUkV)QN7<&uymkUFE>r< zRJC!XLc#MB*=_8uo-W;Fba(JOkRc)8K>If?}tg%gm)QkX(fIQa|paNyJ8fcJnWvT2Uz|@W^8=TE8K%hO4V={C$dIW zk<_T%6h2)427`Bs0W+9r@(4Pvw#;mAk!7(6hSdultQxeDKf*0j9hHq63p&l*E(FHq zl~K*c=h162i{3RX9UFFpLROYIRdmX|o1R3iy^YjVKc=N{?5{iTVIC(6EOWfq@NLSw zX(u)6dvXRcHYKWnVf9zj!?PJ-8WU%! zdEZM6*bp}($=xSOM%u!x2^BAKOZfSc!}MT;t8+GqQSzI5X>Z1-J85T-mVmxY<0e^& z7~XF%qlW1*u9!0frNO=uAfZ7yv-Y6Y*;5X@{vO#^|7xb1f=&>p>&?AtPz(}mu9AG+ zz|9w;ukfOIUX0b>>nJ9vB|CHsz+>vFxdQ5rvAY&;vA40ZJ@E0nI_}!cuNc>j zSfe|EQlVpN8lnf%3D(b?beq9Cc!v}_9kvVOKl6CnmZr&i#72Zag{PpMy*G}v??HyN zO8&AaWQrqa{}nGEUv*xlXQ8qs4naxzP?UxmT=QK4?m>78a}pL0&=Q;c3^)#t!f1&S za(5yxVC4v$X(0N*9uQ{#cWj(`#rCG-Fy;-80sV-kOj z2GWhcO2{(!nHJH6m|ycyyR3e(1*Lpu%Di-DmI<$Ds$;f-TjN3dA?wU(@|vonx3EIX zvO;F{Y?*^0Rg9YWI(pgRlx^)M)8_linWXm9eri4t%5Z%1yno}DEvqY6k$yKOSQ2ZhtlABUwteQ;g#Dy+(+fYbu;gkjV3cE;=xrY2}c4kOd}3t7r&sENjgXy znUD)|0haHPGcN6??4{G-@)Q3IDSjGyXcsp%y_+6S;$Vc0b1NIKkL6@vL;TH&G9EN7 z!BoD~ATT2@UmJydh+b;QsXQ08fM3Lau_Rtxs?@Q(n71U!?Nv#xN`dkTB@}L{v|2f~ zgd>}hv_frR+Ls-@{0!_EqclpDX?LgXu=nMP?v+pj=2soU@eGc2WSy|LF$`+MaHO@1 zhDpSL?PBePnGXhy870Ohpxc%^nZ#OSu?|iPxTCMka)~2?Ex#DWTfP}^Gp|*Or+N($ zQ6$-*5s=d@(4Fi4GY2wjvX^gYIPH`g;WZpM7$N}#q!p%7H-OJ%`!2m`J3J?&cy|* z5T_-Ly24xvz21zOCgLSfhT}vAfoj*h`pQiA69$4zq^jA&u)cD-qqJjDjvT#D=(ROt zD`W%1>hrz84DCcI9d^@6MUhmk8W?HsTx`teYYH#gQ21=SvA-eIHqgLB&GnUAAMu_5 zhMo$13J`_-s2Yn01^OamS(fznfc$a!R1(H;*&bty{za2&E=b0lC_ z%Vjwk`jnU}N?NVHPDWvp(0-JcnKYG6Qh#}3(WtM1l$&EKP}dD(!(@PWm8E$}?9QLS z`NQCgQ-+k0SGzeeYrAE?tH*G^c+~!3-FUc{y4k0MjiyZnpTtjL z381SjY6g#q`z-qOVTxHSg;*tz&@|R@ zbd<#4L`k4$XfR3evmym5l>K0ejVsGDFsJt0>nQEKmyeC%{8MAi_D_t0IFy7QY4g-n z*$FU?>hw$S?UfVN+v&=N-w2r(;tEv2<~B`zshv9{vDDNLdT{+P9!98t*glCKUPD*c zqphqt*%2Vls{*U$`>20h>&v0hlUialwQWKswd1Mh?w@ax?Z#WBTMn)@-DnuW*N>;M zVH~ss-kIoe(1U}Z!hM!y8iL+XL+S6M#faI!ejL(TSO=|o7xF|tkSf|x?e#X0bh(yg z>p(Vw%Re_n;~=SfZFO#@P@mpona|<`%Ski&e!|2jR0Q;6xol8{U8AU#^wb9#&B+7# zFQZX!D6nbNT1;be>MZr)NcW1__de&zjTwb~`!Z-7WkDm4pF{!gn`r3Jap-PQM>E@r zEtY#WVi#wgfC=2Vi2}^BNerB=P)oDU%s;gcZ<2n2jh#PeEkKPh&SCM{xw7IxXc4{r<4&%*uV_Gv8Q+3Qhh%eVQI1h(0MS(iKGBXp@ z6JVyswUL`@^?^OSq*zJitjTufqqxBRw!Q#$?Drtd7;gdU#Nm*4Mi!epVqr>5$U&Oa zDx`Tb==O!0LY8$mGYyNqdv?$sY1`^oAJd?WeZb5M-Rt{QDKQwf%?mHfFM8pjTuNKu z7o8$CEe4$I+wroMqnh}r8MYbh^YK^)m4ZA`8qw`*J*DF{V49W0-o5*5CuTLUw*!4# zr>QGXH0V%>g7BeW@*(i+snwxfE1t_hCK*TkJoJ(gf>UXGAraOGZ{L=Z)JR8}tY#%UPMNjFrCF~oCZ!m7FJr`mg`l^aM7h@ij z`rIV83S-NA9C9XNDn-Ar-F~HH!LY(76AzC39mvBsLOCR7 z)+%U0;re8Yg>L1nrq@oAMq3p_M-?*+HGLz+$oU%8<*UZKYIchR6de_7?}31DT)og`sIzEIud*k%-vx2vN1K0@Qi6W~ z;UFffX2pQKL3I%%fMh_*&1>f}4%qGC$Lhu6icketpd5QtG+F3A4P?SeuaZ7zx=X@~ zCKHk-Uuxd{n%SPr6hL+phIOEJb*hED6U0d^Gf{%Li{Nq2Kunl+&fV_G58vOaEOL3k50-xR_JxGz3#Y-H5vu<;srb1&&Y@gH4W^p5(6H zYqP+udfjjY@l`EIZ?#>cWi#mhN(45K5!Y}hT)iK^XQYGtXo??=q#HAZ5cqwZ{YJyvsQjT;hwxjKG~P+9F4rG?~i9wQJmdgjF*-( zOV#UgMn!x|viNZH7UgcRJ0boAhZ;p{Q=4=5sWK2hbM}=J-}O`hG4d9%%e3P=!DD-b zawq6f5-tv!JEhR=BN=H*?t z_If)wCJljVi(fKcWW$QUpZy|b)mI5IbrJgh@AU!gcp?`)tZ4}QT4zrM1D zE^&Zn$mLu4uCz*((eyPQogGX~UWdVBe7qZ@Ya`khCn;Roe~M+_OpWRE5g|4^@_m%R zoW@0zD(O|NN@dG1jl;ztVf*%)#nsa3AkK;U9}=gw4u*gIDpO$LEZ>?(An6fYs<8;*w~0zLKZkzj`%#s4Dw@oz-@WA&41ie9!O%NmtJ!8VqLle z{mt9ct`*G6U7`ovlEgM8Ob6CoWkqaX=8(?@W_;f1C6g$$(|F=gvb6$D!4Eo{%flDi zPZzsm`D9-lP)A4d(as?3mxOZ~l{f=4^tK^`bYb+wzd?LmA}=+BP|zR`miv6<$Fh&r z$Joi|CNv5Ky4HK?uH!Vp5`qrCGnrFaWeUgeHcuC%b`k05IO$b$@^B|#hAkXP4E;XA zMW{b($tup}Tm3hX)Fhpn={dyv6sk-iZcg68H6cj7Vam|vd>w8yHEuG*(`trkHVm1T z)9zkk@?o&|k7g}yGP<33NU<#eUxH&;{N#hS63$`*1+Tn~oF{l90@*HaB#DNzIVWe| z@JJ1PoU;_C5_5C9f*2zG&{m}nml)P$52s|#S;7qm1Cw`;3+3;d(5wi`QnHhVqN8Ok z_t9SMM2|9G$y31@dG2Td|EfTgi>jt*r$rN;^?Dg-Ru*+ok)@gE{Z#0sykHAfjSv+u z4pk|3&n9`I3^qr07B6ykI$e5T6;OrgXOs;8Z+FX3h)Y$ds5v-RO$bYBZ#Yt1I4*#k zH^?+YK6P6^qM>e}7I*@mxZ+^321%#BmN3qh*v-)hnXoyI&rBxJASagLZ9XcZpD)C$~!S=cnRMT(r0mO1)9 zVyyKv?tkl-542I>%2KL$v(MRi7k^m^OeN8rN3LCV&J8QmOA5E|e6hw)WIf7@NL3PG zJEIg3foR7ew7h}8Y0fD{vxMIxG0ODuM6ro3fM_(4YDVO!EsI?zwsOEDg-C5%L;kE% zd}g+U4Xw|NZQeOE`tHGfhBgUGy%dYKv;2@S=?hsv2}aKWaQ|vK+UVfjCG&nVkQaUO zZGDIVmO)i2-D+Qol?hB@2M2m(^9V2rIXi<}$n759e9{KQL0d|YeBT}|)v{!m9%pyG zQi?(Uh=GKt-kx;C{5-nuuFt#iDTWeJHVP3d67OK~CF~2!0?xdWM_Z8LMe^XPjB_;^ zRjo;3Bu%yeC8`-SPpm%k7JU$l{T7D9_L&Bj!%#gjpSC<>vEW-QI#}@$^|0#L801gX zM21{}j5Re(BI4GxEM!JyX+(JHD!B4T?Kt23U$I1>_oX5+zjw=D6548v=0bx(%5nlR z`G!Su*&opq)w)5Qx>|rd^P9p0B!#I!d)O0^bsXy4MT-h^B&an zT&hJ+4N@_Uy1qvoTuBrSrAubJG<|(Fy+hzB|R5B8)Q{XHddbNgL0yaQ%e3oTLY#+!pzjN}(n7xHrUFzGr0dTGZJVThU%RY3H|s z;hhqPbHCB*&=#2U@o0BexSg$qAXx9Tk^13HJ$?fgy+@(P_ZI17liCVmndH!8+I?#b zI}ST+ZGJd45Pn~gyai!7Rq=1umAa~vlei?>l~POc*dp`u_jn4f9!3009cE>kb_ZC~ zk}edI3O{;BN?r4O+7#uo9fMdz8#x(Wok^tW(s3ON3e!6tu#}Wdvy?paa(IK+80Nd$ zTp{jt>|By+a`m}-4s8Kiq_a>sk*XfzTrrbmcZ;d3XB+~Xhh*Z>kM|q<*!rF&RlR9X z<%wx|5wntIqjvYFi3Z#~v5CFnuR4R!9@h@{%ALLH;&((;6J&c%_>N%vOP4mbjyX>% zAPcXuHr`vl<;pMTR$tI`a;z^N)7Z{*Kzk?)Ym+$iVy?N5YZtWzX5GSkBD@^_m%|l?>l8;#$nbby= z70Hd{fj~Bjk>1*e^F+WldSI)>1)sXdZdfiyZ5CwPf~g;|lO4`59z(I+vlFjPW`F3Y za^V!@dV#rHn%>B*DlymX*?I@Uo?zeK$-i4{-_F$Et4|)a7Q2$+pK>@8`Y|q96rD>#oIDVK*+lpFDe%FLJ{&`C*WK`Dwpi&zd~f zGP*()xIf$tKFlt{L9>&tvpRZy`brL)(|KE&8Zr2QQR<3Rds1t;FT=Jy+!Z zGB)k4(aw6zN`miKm^@M~k+%feU-zDP{<>kR;cA_d0Pu_U13Wyx@b3J}!EX4cAm@MY zk*X~Cyi-Ab5?&gZ60BD0k6IyCnr2NhVhbXia4iYnB9_8jBC`{-Rfj^fz?X?JNthf6 z)ex7+od_%}1WilwVhHywV1y**Nn*LZ7<*^acCG@~!NGtbG228(1K2rbyW!aLG-;mV zd3xyQ0luYOmB~R2f?@E5i$K|yOR^*L{m@#~laJpmozuHgLR=j%ET-96NT@5rt#miKK(YEQbW#J;BlX9pFw&ERcRz=`p~tW>_eq1$YOWBx#9 zN%&zLyK4Q_)OwvdcI*Uw87l0|NAOjTLq}`!a$2-^3JBrAerFf{UA} zSV~|uhRq0VI^@^CF%hqX*l&N=z}y)Xc^G6JEw(>0OO{c^B*CRKC44_78X}njD&;zU zZd@9^$8-dFA;s@Ll%XPFq9}oCVN=_?lR+H7A1?)o=T#YS&3=Yy&|r3vF7JHn2%H$R zLcS8weK~f#;7TmYp-;1)2(&`%c{pSod3}u=MCiykRi*h+&W@GW=koM4v@Qa~$UwqG zsBg1DjpFv&Qb!gcK|%?jofFwrPy(IjACKcmuY3_>r1Amcw9L8LTw>px-L{}K87fV* zqFg2FKsiu-iY;~_=lnH=qvLRk?^6TiheUO*lL2On%gOXv(3!I4Y3t%xT%mg5aUdGdG4GpU1!wY>+`;RSnI86o zn&Uny$$U3ln5%0R16umR-^s_BpH#X?d|9iRFL8QZ zY!)PEdakEjt$w%OpvCk&ium?>ml|dx9vGao6TEN)&O9H zQ?(!L)@p|}xT>8Z=W^&O$Zh^EMxH92H|JiUJfGhZ8J_O4Ff=eJBRxX!BwZjf_XwXF zJt}sNpF2Q;x7)F19F%M`M54yF&bexYwu60E*rTb5K^|F8@I!v|QyC{#@OKg7&R7QGaU(D2C`GEb(UO4cZ*AXwIW7Z(dm!` z%bC5Z{ryOc26$!#7F~wW7OhJtp`c&p(Rfw^n84|Hgca;NSPNyMNY?2G+XnPDHnS%aNeG)n3MPjio~E`y@mAG3_QpCxUm0pk2@F4T>kS0 zkMNE=0&l4MJ>z>?!_&67R!}mRce%|P5No^v`U(2SVB1b~($#_bn_zL@Eo2EL_vWgk zx|A{sV&cwKEVG*c3U^oZZIq!^p zQa){S$s7xy>)Lxo>gmj|jrCZu##a*0GwMRW?Lim%KpU=ARsD`;)4MGIMw?hHpVKbm z)q?1TUIboH@npEjIo(r#3ehHO6r4@mEuw3JGj>;hW+fiqtEf%1bep)SZFsI}9v z0+~%Q@eEAQIDSt*?pOyI{Aydc2;H6`-Y9X!Xn%!D^ype2xdR~GH?f?)yNIn24Thn(7Y?{F`=H!D(JNs=g!Wd zR0k-q7s!&r9NtR(8?)@eY6k4KFjGS(z(eRR^M+y<&HGSnEngi>cwAW7eyN%=249!{ z2GT#zh{1d1`tI~{L!tcUz6F^h``YX~43W08_9Jp$Kwy-q0DCKo;GTN%H=ph?fLBxE zESz;_nFi__#r;Q|PUT`9qMol*kz5Ba2`VND1GR3Z05uO;L%C@?+|IX@n-mPk6yUr( zG3Exrl8;1r*g5Znd}ShqS4gq1YCb@~3C9{;X|Bb5rk8k-*Lsb-#s@0Y&qoWiBEZ-N za%#P9B%GkNnriCBNLO`gGX$wFnL%DW6_-tgf9vebF)eCe0NKBXq>d%tvk-n;Zt?&- zel6=`<$Qk?Ur~nBLSGf68L~ts*Qj|J+ynA`&wbyTj;kB*j&j8o>xPUVvlz-o~`P;bu$04{sM)ybs zjei{pX=tQ6!7tQA;v+@Pr5XxDZIdknp~ExlDFE}g5#Ue@vUEvbp@R2;8Yk|!%?TBc z5%jtSY@{Dk7b1yyre?A|WS)7hu`zu5;rZj0E<6R9p{%T&B%UAt+k4vVyq%!1bTP_; znD<$IRFuSa8s29gnkYWqY}XWQc7%aLA$W{f+Ntmr)eK*!tbPqBQ3*JrqS!Bi>ekmD z-heW0@lN)u9i$YfbdRcv*r6{Z6z@XNR^wyTnOB6 zXEL^?7a4Fsi*V!cOW3ApFxU_3J|v#AD4Nir@87vnYMsWKZ z*`{%!koSx#jm_z`mNbps*RD}&4{Sf^DF^r!$g#~`LE<{cK%z5dbX7Gz}Lkv#VyIC(58=rn|46|`NWI5CJqqK-HiEk8*PI{qzwF_3*TLEM{Bh?mN9h+_K{Bp;)37iNA|PO;G)#!-5QEhjvSUQ0#}s3`f@CaW>Zkz z=8*Zn545hcPzWM0uy>MFy}C6q^_-sL4+@AhuekawJaVnJzkpRCxSzT|7QIh2CwaR} zlz=!37KLyT6&Qs{9;_4kVW*wvYBq$O6hD~LcQHWUM|>vo8WI)jW5s-!<5%M&ZE}g5 zrWq`#wfZ7hRi)K)4CQvLi2P+UT5LL>0Snl!PMsyvPCfp;4AbSxnv@ihOcxQZV%&gWnR5;M3Gz8 z3PeJg682V6)pam0?CMj3u^^~o4v^660+Afd9@%~sB;T!9;#MC`y=yA^a2VP6PRv~^ z>L;sUE2bT~O|M5_O}?b&S;MhD_A`|%Y2{E0`yzdb`{Yms&UUpfH~czuEN`<0Bb6L6 z(cyuHH%rL`Qk;C(p!$swGKGWx5CvTa)C|Zep>0veW!-z`Pr0cyj#QwdlzAK_rhtE` z^VFeAxh;;>e}MdT5&HH=w+a&AQ6d1YpUIj3Erkv^vHQ<5=sPdP&mkZn0M+>b*Khi*7y%G;Dp?tN(SKG#@^&_oIn5MKQ#cVF@Gwb0rx*^{96+KpQwKJ z!E-qR-2SQJzvb%x#(d_ko_q#qSt)255SuNTm;X!fIC${Aj~hI1px{HmNt5Z|B<142{>fK?(i1SO}v2iGX4dS z6W|&7CqTf+;p)cc;Fjizl8S=p@r85bmb1fWPTo^e=bXa zm+2R+1xOoPIynI3L4?gLjra@<01Q%k)_VV!P5mVSNQwK3CZNOR03H5U;|K%1{=Xm) zvDX7+a8v?F35wcS8A;mMSUB1Kx@(Tg&Etyz!tsoNmXbd=9B@a6{}0grPCNC}_I{1K zcdY7A3P4!`TmYay6&%1X_(hY&{$q8&#>*^2yZr*_V`e~ZhQH!LQvVvy+QCuJ((=FA za3*v!FCpMfy#{k8dyTa*D02neux`1wJ8E{|4=U%3tyl@F&1eEBje~ z<|uhCwgA9Cy;MJAcV1S0nX%-#a`xXV|0ik0f1eG$gnyZZ;u)UY^lxqZ5B%?}BwiA| zRFZ!t8n^r#(VyD?Uv%YP!oQS6e}*@*{wMesljWDNFO|TbVS8=<3HHx^hL@NxWo4f+ zN1Xl%^N%Qi|Mq2kDd75y+T{EjsQ+Eg^=0#4ic&rkNxALt}nsf=eTz3|_l`Ul~R zmrO5Z37(mBqJD$v4|CxArAWa`s+ZB=&r}MrzfA@BzS#a*+3h9C%i!8)60?NgCi&xi z{gd3tOO}^WoX;%ANx#kV=a|ly1TQ1#o(UvU|33--SC74nX?mt21gzR#jB$VZy#M>7 z_CNdTWpK+gzDL$?;Qw=|%gcUy84K`C)(lvW{I4JL>q*wj9q4DwzPOF^WS)0PCNf(M*m|Nf9ZL7 zrors`zbV~+^TYh7&HwSb{Ml*p)9dnFtN>vD%?BeZ0SZ_L{S5e{2hstYLKp!2EfCQE E17(ftEC2ui literal 0 HcmV?d00001 diff --git a/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties b/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..568c50bf --- /dev/null +++ b/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip diff --git a/internal/wrappers/build/java/gradlew b/internal/wrappers/build/java/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/internal/wrappers/build/java/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/internal/wrappers/build/java/gradlew.bat b/internal/wrappers/build/java/gradlew.bat new file mode 100644 index 00000000..e95643d6 --- /dev/null +++ b/internal/wrappers/build/java/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/internal/wrappers/build/java/settings.gradle b/internal/wrappers/build/java/settings.gradle new file mode 100644 index 00000000..25da16a3 --- /dev/null +++ b/internal/wrappers/build/java/settings.gradle @@ -0,0 +1,10 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user guide at https://docs.gradle.org/4.5.1/userguide/multi_project_builds.html + */ + +rootProject.name = 'kuzzlesdk' From 1fe246cde1460e9f2d5cf8d58eefc0b94e89015c Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 5 Jun 2018 14:36:55 +0200 Subject: [PATCH 207/363] fix Makefile --- internal/wrappers/Makefile | 53 +++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index ebf6918a..07dd37a9 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -115,30 +115,32 @@ swig: $(SWIG) -Wall -c++ -$(LANGUAGE) $(SWIGOPTS) -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(LANGINCLUDE) templates/$(LANGUAGE)/core.i swig_java: +ifeq ($(OS),Windows_NT) + @if not exist $(OUTDIR) mkdir $(OUTDIR) +else + mkdir -p $(OUTDIR) +endif $(SWIG) -Wall -c++ -java -package io.kuzzle.sdk -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(JAVAINCLUDE) templates/java/core.i swig_python: +ifeq ($(OS),Windows_NT) + @if not exist $(OUTDIR) mkdir $(OUTDIR) +else + mkdir -p $(OUTDIR) +endif $(SWIG) -Wall -c++ -python -py3 -outdir $(OUTDIR) -o $(SRCS) $(INCS) $(PYTHONINCLUDE) templates/python/core.i swig_csharp: - $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i - - -makedir: ifeq ($(OS),Windows_NT) - @if not exist $(subst /,\,$(OUTDIR)) mkdir $(subst /,\,$(OUTDIR)) - @if not exist $(ROOT_DIR_CLEAN) mkdir $(ROOT_DIR_CLEAN) - @if not exist $(GOTARGETDIR) mkdir $(GOTARGETDIR) + @if not exist $(OUTDIR) mkdir $(OUTDIR) else - mkdir -p $(ROOT_DIR_CLEAN) mkdir -p $(OUTDIR) - mkdir -p $(GOTARGETDIR) endif - + $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i java: LANGINCLUDE = $(JAVAINCLUDE) java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk -java: makedir core_java swig_java wrapper_java java_object +java: core_java swig_java wrapper_java java_object #rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources @@ -151,7 +153,7 @@ java: makedir core_java swig_java wrapper_java java_object cp -p $(GOTARGETSO) $(OUTDIR) csharp: OUTDIR = $(ROOTOUTDIR)/csharp -csharp: makedir core_csharp swig_csharp wrapper_csharp csharp_object +csharp: core_csharp swig_csharp wrapper_csharp csharp_object mcs -t:library $(OUTDIR)/*.cs -sdk:2 -out:$(OUTDIR)/$(LIB_PREFIX)kuzzle-csharp$(DYNLIB) ifeq ($(OS),Windows_NT) $(RM) "$(subst /,\,$(OUTDIR))$(PATHSEP)*.cs" @@ -163,7 +165,7 @@ python: LANGINCLUDE = $(PYTHONINCLUDE) python: OUTDIR = $(ROOTOUTDIR)/python python: CC = g++ python: CFLAGS = -fPIC -python: makedir core_python swig_python wrapper_python python_object +python: core_python swig_python wrapper_python python_object cp $(ROOT_DIR)templates/python/*.py $(OUTDIR) cp $(ROOT_DIR)$(SRCS) $(OUTDIR)/ cp $(ROOT_DIR)kcore_wrap.h $(OUTDIR)/ @@ -179,11 +181,26 @@ cpp: core g++ -shared -fPIC -o $(OUTDIR)/libcpp$(DYNLIB) -Wl,--whole-archive $(OUTDIR)/libcpp$(STATICLIB) build/c/$(LIB_PREFIX)kuzzlesdk$(STATICLIB) -Wl,--no-whole-archive clean: - $(RM) kcore_wrap.cxx - $(RM) kcore_wrap.h - $(RRM) build$(PATHSEP)c build$(PATHSEP)java$(PATHSEP)src build$(PATHSEP)java$(PATHSEP)io build$(PATHSEP)java$(PATHSEP)build build$(PATHSEP)csharp build$(PATHSEP)python - $(RRM) build$(PATHSEP)java - +ifeq ($(OS),Windows_NT) + if exist kcore_wrap.cxx $(RM) kcore_wrap.cxx + if exist kcore_wrap.h $(RM) kcore_wrap.h + if exist kcore_wrap.o $(RM) kcore_wrap.o + if exist build$(PATHSEP)c $(RRM) build$(PATHSEP)c + if exist build$(PATHSEP)java$(PATHSEP)src $(RRM) build$(PATHSEP)java$(PATHSEP)src + if exist build$(PATHSEP)java$(PATHSEP)io $(RRM) build$(PATHSEP)java$(PATHSEP)io + if exist build$(PATHSEP)java$(PATHSEP)build $(RRM) build$(PATHSEP)java$(PATHSEP)build + if exist build$(PATHSEP)python $(RRM) build$(PATHSEP)python + if exist build$(PATHSEP)csharp $(RRM) build$(PATHSEP)csharp + if exist build$(PATHSEP)io $(RRM) build$(PATHSEP)io +else + $(RRM) build/c + $(RRM) build/java/src build/java/io build/java/build + $(RRM) build/python + $(RRM) build/csharp + $(RRM) build/cpp + $(RRM) kcore_wrap.cxx kcore_wrap.h kcore_wrap.o + $(RRM) build/io +endif .PHONY: all java csharp python wrapper swig clean object core From d19a5515bb7842678f2eec22ab61bee3b7c77415 Mon Sep 17 00:00:00 2001 From: jenow Date: Tue, 5 Jun 2018 14:50:42 +0200 Subject: [PATCH 208/363] fix Makefile --- internal/wrappers/Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 07dd37a9..517d4772 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -1,7 +1,7 @@ -ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +ROOT_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) ifeq ($(OS),Windows_NT) - STATICLIB := .lib - DYNLIB := .dll + STATICLIB = .lib + DYNLIB = .dll GOROOT ?= C:/Go GOCC ?= $(GOROOT)bin\go SEP = \\ @@ -12,8 +12,8 @@ ifeq ($(OS),Windows_NT) ROOT_DIR_CLEAN = $(subst /,\,$(ROOT_DIR)) LIB_PREFIX = else - STATICLIB := .a - DYNLIB := .so + STATICLIB = .a + DYNLIB = .so GOROOT ?= /usr/local/go GOCC ?= $(GOROOT)/bin/go SEP = / @@ -25,7 +25,6 @@ else LIB_PREFIX = lib endif - PATHSEP = $(strip $(SEP)) ROOTOUTDIR = $(ROOT_DIR)build JAVA_HOME ?= /usr/local @@ -73,8 +72,10 @@ kcore_wrap.o: kcore_wrap.cxx $(CPP) -fPIC -c $< -o $(OUTDIR)/$@ $(CPPFLAGS) -I./headers -I./build/c/ -L./build/c -lkuzzlesdk core_java: +ifneq ($(OS),Windows_NT) ifeq ($(wildcard $(GOCC)),) $(error "Unable to find go compiler") +endif endif cd ..$(PATHSEP)..$(PATHSEP) && go get .$(PATHSEP)... $(CMDSEP) cd internal$(PATHSEP)wrappers $(GOCC) build -o $(GOTARGET) $(GOFLAGS) $(GOSRC) @@ -132,7 +133,7 @@ endif swig_csharp: ifeq ($(OS),Windows_NT) - @if not exist $(OUTDIR) mkdir $(OUTDIR) + @if not exist $(subst /,\,$(OUTDIR)) mkdir $(subst /,\,$(OUTDIR)) else mkdir -p $(OUTDIR) endif From 011cbd92283a618c885d07788bb62199db3afc93 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 6 Jun 2018 10:10:37 +0200 Subject: [PATCH 209/363] wip --- document/search.go | 3 +- internal/wrappers/cgo/kuzzle/c_to_go.go | 18 ++---------- internal/wrappers/cgo/kuzzle/destructors.go | 13 +-------- internal/wrappers/cgo/kuzzle/document.go | 3 +- internal/wrappers/cgo/kuzzle/go_to_c.go | 29 +++++++++---------- internal/wrappers/features/documents.feature | 12 ++++++-- .../java/gradle/cucumber/Documentdefs.java | 14 +++++++-- internal/wrappers/headers/kuzzlesdk.h | 9 +----- types/search_result.go | 6 ++-- 9 files changed, 45 insertions(+), 62 deletions(-) diff --git a/document/search.go b/document/search.go index 827c60ac..c42a78b8 100644 --- a/document/search.go +++ b/document/search.go @@ -52,8 +52,7 @@ func (d *Document) Search(index string, collection string, body json.RawMessage, return nil, res.Error } - sr := &types.SearchResult{} - json.Unmarshal(res.Result, &sr) + sr := types.NewSearchResult(collection, body, options, res) return sr, nil } diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 0a3ba131..1cac66d5 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -30,18 +30,6 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -func cToGoSearchFilters(searchFilters *C.search_filters) *types.SearchFilters { - if searchFilters == nil { - return nil - } - return &types.SearchFilters{ - Query: json.RawMessage(C.GoString(searchFilters.query)), - Sort: json.RawMessage(C.GoString(searchFilters.sort)), - Aggregations: json.RawMessage(C.GoString(searchFilters.aggregations)), - SearchAfter: json.RawMessage(C.GoString(searchFilters.search_after)), - } -} - // convert a C char** to a go array of string func cToGoStrings(arr **C.char, len C.size_t) []string { if len == 0 { @@ -159,21 +147,19 @@ func cToGoSearchResult(s *C.search_result) *types.SearchResult { opts.SetFrom(int(s.options.from)) opts.SetScrollId(C.GoString(s.options.scroll_id)) - var collections json.RawMessage c, _ := json.Marshal(s.collection) - collections = c var documents json.RawMessage d, _ := json.Marshal(s.documents) documents = d return &types.SearchResult{ - Collection: collections, + Collection: string(c), Documents: documents, Total: int(s.total), Fetched: int(s.fetched), Options: opts, - Filters: cToGoSearchFilters(s.filters), + Filters: json.RawMessage(C.GoString(s.filters)), } } diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go index 7492c868..15f28e6c 100644 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ b/internal/wrappers/cgo/kuzzle/destructors.go @@ -544,17 +544,6 @@ func kuzzle_free_string_array_result(st *C.string_array_result) { } } -//export kuzzle_free_search_filters -func kuzzle_free_search_filters(st *C.search_filters) { - if st != nil { - C.free(unsafe.Pointer(st.query)) - C.free(unsafe.Pointer(st.sort)) - C.free(unsafe.Pointer(st.aggregations)) - C.free(unsafe.Pointer(st.search_after)) - C.free(unsafe.Pointer(st)) - } -} - //export kuzzle_free_profile_search func kuzzle_free_profile_search(st *C.profile_search) { if st != nil { @@ -649,7 +638,7 @@ func kuzzle_free_search_result(st *C.search_result) { if st != nil { kuzzle_free_query_options(st.options) C.free(unsafe.Pointer(st.aggregations)) - kuzzle_free_search_filters(st.filters) + C.free(unsafe.Pointer(st.filters)) C.free(unsafe.Pointer(st.error)) C.free(unsafe.Pointer(st.stack)) diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index 6ae28aae..6751e3c1 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -117,7 +117,8 @@ func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, //export kuzzle_document_search func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.search_result { res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - return goToCSearchResult(res, err) + r := goToCSearchResult(res, err) + return r } //export kuzzle_document_mcreate diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go index 7791a51e..1d5c1495 100644 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ b/internal/wrappers/cgo/kuzzle/go_to_c.go @@ -371,20 +371,15 @@ func goToCBoolResult(goRes bool, err error) *C.bool_result { return result } -func goToCSearchFilters(filters *types.SearchFilters) *C.search_filters { - result := (*C.search_filters)(C.calloc(1, C.sizeof_search_filters)) - - result.query = C.CString(string(filters.Query)) - result.sort = C.CString(string(filters.Sort)) - result.aggregations = C.CString(string(filters.Aggregations)) - result.search_after = C.CString(string(filters.SearchAfter)) - - return result -} - // Allocates memory func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { result := (*C.search_result)(C.calloc(1, C.sizeof_search_result)) + + if err != nil { + Set_search_result_error(result, err) + return result + } + result.collection = C.CString(string(goRes.Collection)) result.documents = C.CString(string(goRes.Documents)) @@ -392,15 +387,17 @@ func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { result.total = C.uint(goRes.Total) if goRes.Filters != nil { - result.filters = goToCSearchFilters(goRes.Filters) + result.filters = C.CString(string(goRes.Filters)) } result.options = (*C.query_options)(C.calloc(1, C.sizeof_query_options)) - result.options.from = C.long(goRes.Options.From()) - result.options.size = C.long(goRes.Options.Size()) + if goRes.Options != nil { + result.options.from = C.long(goRes.Options.From()) + result.options.size = C.long(goRes.Options.Size()) - if goRes.Options.ScrollId() != "" { - result.options.scroll_id = C.CString(goRes.Options.ScrollId()) + if goRes.Options.ScrollId() != "" { + result.options.scroll_id = C.CString(goRes.Options.ScrollId()) + } } if len(goRes.Aggregations) > 0 { diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index 9d8712db..95668bef 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -55,10 +55,18 @@ Feature: Document management When I update a document with id 'update-my-document-id' Then the document is successfully updated - Scenario: Search a document by id + Scenario: Search a document by id and find it Given Kuzzle Server is running And there is an index 'test-index' And it has a collection 'test-collection' And the collection has a document with id 'search-my-document-id' When I search a document with id 'search-my-document-id' - Then the document is successfully found \ No newline at end of file + Then the document is successfully found + + Scenario: Search a document by id and don't find it + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'search-my-document-id' + When I search a document with id 'fake-id' + Then the document is not found \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index bef1558d..962243f2 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -166,11 +166,21 @@ public void the_document_is_successfully_updated() throws Exception { @When("^I search a document with id \'([^\"]*)\'$") public void i_search_a_document_with_id(String id) throws Exception { this.errorMessage = null; + try { - String document = k.getDocument().search(world.index, world.collection, id, "{\"foo\": \"barz\"}"); - this.document = id; + QueryOptions options = new QueryOptions(); + options.setSize(42); + this.documents = k.getDocument().search(world.index, world.collection, "{\"query\": {\"bool\": {\"should\":[{\"match\":{\"_id\": \""+id+"\"}}]}}}"); } catch (BadRequestException e) { this.errorMessage = e.getMessage(); } } + + @Then("^the document is successfully found$") + public void the_document_is_successfully_found() throws Exception { + Assert.assertNotNull(this.documents); + Assert.assertNotNull(this.documents.getDocuments()); + //System.out.println("########### " + this.documents.getDocuments()); + //Assert.assertEquals("foo", this.documents.getDocuments()); + } } diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h index 40615298..676c72ac 100644 --- a/internal/wrappers/headers/kuzzlesdk.h +++ b/internal/wrappers/headers/kuzzlesdk.h @@ -538,13 +538,6 @@ typedef struct string_array_result { char *stack; } string_array_result; -typedef struct { - char* query; - char* sort; - char* aggregations; - char* search_after; -} search_filters; - typedef struct { profile *hits; size_t hits_length; @@ -605,7 +598,7 @@ typedef struct search_result { unsigned fetched; unsigned total; char *aggregations; - search_filters *filters; + char *filters; query_options *options; char *collection; int status; diff --git a/types/search_result.go b/types/search_result.go index 7142bdd7..30561bc8 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -20,17 +20,17 @@ import ( // SearchResult is a search result representation type SearchResult struct { - Collection json.RawMessage + Collection string Documents json.RawMessage Total int Fetched int Aggregations json.RawMessage Options QueryOptions - Filters *SearchFilters + Filters json.RawMessage } // NewSearchResult Search Result constructor -func NewSearchResult(collection json.RawMessage, filters *SearchFilters, options QueryOptions, raw *KuzzleResponse) *SearchResult { +func NewSearchResult(collection string, filters json.RawMessage, options QueryOptions, raw *KuzzleResponse) *SearchResult { type ParseSearchResult struct { Documents json.RawMessage `json:"hits"` Total int `json:"total"` From 7161484b3f6674f6aa9e91638449aba590726200 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 6 Jun 2018 10:19:16 +0200 Subject: [PATCH 210/363] fixes from PR comments --- README.md | 4 ++-- internal/wrappers/features/auth.feature | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 45326a6f..865a99b8 100644 --- a/README.md +++ b/README.md @@ -75,8 +75,8 @@ gradle cucumber ```sh cd internal/wrappers ./build_cpp_tests.sh̀ -./_build_cpp_tests/KuzzleSDKStepDefs & -cucumber features/*.features +./_build_cpp_tests/KuzzleSDKStepDefs > /dev/null & +cucumber ``` ## Wrappers diff --git a/internal/wrappers/features/auth.feature b/internal/wrappers/features/auth.feature index ecae1dbb..3f046eea 100644 --- a/internal/wrappers/features/auth.feature +++ b/internal/wrappers/features/auth.feature @@ -31,7 +31,6 @@ Feature: User management And there is an user with id 'my-user-id' And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' And I log in as 'my-user-name':'my-user-pwd' - Then the JWT is valid + And the JWT is valid When I logout Then the JWT is invalid - From b24649dd24bdfe2a0b133fcef79868e74aa68f66 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 13 Jun 2018 12:38:42 +0200 Subject: [PATCH 211/363] java e2e tests with fixes --- document/count.go | 7 +- document/mDelete.go | 6 +- internal/wrappers/cgo/kuzzle/auth.go | 9 +- internal/wrappers/cgo/kuzzle/c_to_go.go | 7 +- internal/wrappers/cgo/kuzzle/collection.go | 9 +- internal/wrappers/cgo/kuzzle/document.go | 10 +- internal/wrappers/cgo/kuzzle/index.go | 9 +- internal/wrappers/cgo/kuzzle/kuzzle.go | 11 +- internal/wrappers/cgo/kuzzle/realtime.go | 9 +- internal/wrappers/cgo/kuzzle/server.go | 9 +- internal/wrappers/cpp/collection.cpp | 2 +- internal/wrappers/cpp/document.cpp | 8 +- internal/wrappers/cpp/index.cpp | 2 +- internal/wrappers/cpp/realtime.cpp | 4 +- internal/wrappers/features/documents.feature | 140 ++++++++++++- .../java/gradle/cucumber/Documentdefs.java | 194 +++++++++++++++++- .../java/gradle/cucumber/Geofencedefs.java | 8 +- .../java/gradle/cucumber/Subscribedefs.java | 17 +- .../gradle/cucumber/UserManagementdefs.java | 5 +- internal/wrappers/features/realtime.feature | 3 +- types/search_result.go | 2 - 21 files changed, 413 insertions(+), 58 deletions(-) diff --git a/document/count.go b/document/count.go index 4f799a1c..3e4633fa 100644 --- a/document/count.go +++ b/document/count.go @@ -55,12 +55,15 @@ func (d *Document) Count(index string, collection string, body json.RawMessage, return 0, res.Error } - var count int + type countResult struct { + Count int `json:"count"` + } + var count countResult err := json.Unmarshal(res.Result, &count) if err != nil { return 0, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) } - return count, nil + return count.Count, nil } diff --git a/document/mDelete.go b/document/mDelete.go index bc8fdeac..77033f33 100644 --- a/document/mDelete.go +++ b/document/mDelete.go @@ -36,12 +36,16 @@ func (d *Document) MDelete(index string, collection string, ids []string, option ch := make(chan *types.KuzzleResponse) + type body struct { + Ids []string `json:"ids"` + } + query := &types.KuzzleRequest{ Index: index, Collection: collection, Controller: "document", Action: "mDelete", - Body: ids, + Body: &body{ids}, } go d.Kuzzle.Query(query, options, ch) diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go index c649e1ad..d3c3719e 100644 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ b/internal/wrappers/cgo/kuzzle/auth.go @@ -36,8 +36,8 @@ import ( var authInstances sync.Map //register new instance of server -func registerAuth(instance interface{}) { - authInstances.Store(instance, true) +func registerAuth(instance interface{}, ptr unsafe.Pointer) { + authInstances.Store(instance, ptr) } // unregister an instance from the instances map @@ -52,10 +52,11 @@ func kuzzle_new_auth(a *C.auth, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) auth := auth.NewAuth(kuz) - a.instance = unsafe.Pointer(auth) + ptr := unsafe.Pointer(auth) + a.instance = ptr a.kuzzle = k - registerAuth(a) + registerAuth(a, ptr) } //export kuzzle_check_token diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 1cac66d5..55dea422 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -37,9 +37,10 @@ func cToGoStrings(arr **C.char, len C.size_t) []string { } tmpslice := (*[1 << 27]*C.char)(unsafe.Pointer(arr))[:len:len] - goStrings := make([]string, len) - for i, s := range tmpslice { - goStrings[i] = C.GoString(s) + goStrings := make([]string, 0) + + for _, s := range tmpslice { + goStrings = append(goStrings, C.GoString(s)) } return goStrings diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 8d5aefba..3e94d2e7 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -33,8 +33,8 @@ import ( var collectionInstances sync.Map // register new instance to the instances map -func registerCollection(instance interface{}) { - collectionInstances.Store(instance, true) +func registerCollection(instance interface{}, ptr unsafe.Pointer) { + collectionInstances.Store(instance, ptr) } // unregister an instance from the instances map @@ -49,10 +49,11 @@ func kuzzle_new_collection(c *C.collection, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) col := collection.NewCollection(kuz) - c.instance = unsafe.Pointer(col) + ptr := unsafe.Pointer(col) + c.instance = ptr c.kuzzle = k - registerCollection(c) + registerCollection(c, ptr) } //export kuzzle_collection_create diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index 6751e3c1..348345c3 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -33,8 +33,8 @@ import ( var documentInstances sync.Map // register new instance to the instances map -func registerDocument(instance interface{}) { - documentInstances.Store(instance, true) +func registerDocument(instance interface{}, ptr unsafe.Pointer) { + documentInstances.Store(instance, ptr) } // unregister an instance from the instances map @@ -48,9 +48,10 @@ func kuzzle_new_document(d *C.document, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) doc := document.NewDocument(kuz) - d.instance = unsafe.Pointer(doc) + ptr := unsafe.Pointer(doc) + d.instance = ptr d.kuzzle = k - registerDocument(doc) + registerDocument(doc, ptr) } //export kuzzle_document_count @@ -118,6 +119,7 @@ func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.search_result { res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) r := goToCSearchResult(res, err) + return r } diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go index b5e4737f..f4960edc 100644 --- a/internal/wrappers/cgo/kuzzle/index.go +++ b/internal/wrappers/cgo/kuzzle/index.go @@ -34,8 +34,8 @@ import ( var indexInstances sync.Map //register new instance of index -func registerIndex(instance interface{}) { - indexInstances.Store(instance, true) +func registerIndex(instance interface{}, ptr unsafe.Pointer) { + indexInstances.Store(instance, ptr) } // unregister an instance from the instances map @@ -50,10 +50,11 @@ func kuzzle_new_index(i *C.kuzzle_index, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) index := indexPkg.NewIndex(kuz) - i.instance = unsafe.Pointer(index) + ptr := unsafe.Pointer(index) + i.instance = ptr i.kuzzle = k - registerIndex(i) + registerIndex(i, ptr) } //export kuzzle_index_create diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go index ec6f9f01..220f3cc2 100644 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ b/internal/wrappers/cgo/kuzzle/kuzzle.go @@ -41,8 +41,8 @@ var instances sync.Map var listeners_list map[uintptr]chan<- interface{} // register new instance to the instances map -func registerKuzzle(instance interface{}) { - instances.Store(instance, true) +func registerKuzzle(instance interface{}, ptr unsafe.Pointer) { + instances.Store(instance, ptr) } // unregister an instance from the instances map @@ -71,10 +71,11 @@ func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) panic(err.Error()) } - registerKuzzle(inst) - - k.instance = unsafe.Pointer(inst) + ptr := unsafe.Pointer(inst) + k.instance = ptr k.loader = nil + + registerKuzzle(inst, ptr) } //export kuzzle_get_document_controller diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go index 60ee7810..9df386f8 100644 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ b/internal/wrappers/cgo/kuzzle/realtime.go @@ -21,8 +21,8 @@ import ( var realtimeInstances sync.Map // register new instance to the instances map -func registerRealtime(instance interface{}) { - realtimeInstances.Store(instance, true) +func registerRealtime(instance interface{}, ptr unsafe.Pointer) { + realtimeInstances.Store(instance, ptr) } // unregister an instance from the instances map @@ -37,10 +37,11 @@ func kuzzle_new_realtime(rt *C.realtime, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) gort := realtime.NewRealtime(kuz) - rt.instance = unsafe.Pointer(gort) + ptr := unsafe.Pointer(gort) + rt.instance = ptr rt.kuzzle = k - registerRealtime(rt) + registerRealtime(rt, ptr) } //export kuzzle_realtime_count diff --git a/internal/wrappers/cgo/kuzzle/server.go b/internal/wrappers/cgo/kuzzle/server.go index 030da65b..baf1ff64 100644 --- a/internal/wrappers/cgo/kuzzle/server.go +++ b/internal/wrappers/cgo/kuzzle/server.go @@ -36,8 +36,8 @@ import ( var serverInstances sync.Map //register new instance of server -func registerServer(instance interface{}) { - serverInstances.Store(instance, true) +func registerServer(instance interface{}, ptr unsafe.Pointer) { + serverInstances.Store(instance, ptr) } // unregister an instance from the instances map @@ -52,10 +52,11 @@ func kuzzle_new_server(s *C.server, k *C.kuzzle) { kuz := (*kuzzle.Kuzzle)(k.instance) server := server.NewServer(kuz) - s.instance = unsafe.Pointer(server) + ptr := unsafe.Pointer(server) + s.instance = ptr s.kuzzle = k - registerServer(s) + registerServer(s, ptr) } //export kuzzle_admin_exists diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp index 40749cb3..763fcf5a 100644 --- a/internal/wrappers/cpp/collection.cpp +++ b/internal/wrappers/cpp/collection.cpp @@ -23,7 +23,7 @@ namespace kuzzleio { Collection::Collection(Kuzzle* kuzzle, collection *collection) { _collection = collection; - kuzzle_new_collection(_collection, kuzzle->_kuzzle); + kuzzle_new_collection(collection, kuzzle->_kuzzle); } Collection::~Collection() { diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp index 1853f35e..2d7686f0 100644 --- a/internal/wrappers/cpp/document.cpp +++ b/internal/wrappers/cpp/document.cpp @@ -139,9 +139,7 @@ namespace kuzzleio { if (r->error != NULL) throwExceptionFromStatus(r); - search_result *ret = r; - kuzzle_free_search_result(r); - return ret; + return r; } std::string Document::mCreate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) Kuz_Throw_KuzzleException { @@ -166,9 +164,8 @@ namespace kuzzleio { std::vector Document::mDelete(const std::string& index, const std::string& collection, const std::vector& ids, query_options *options) Kuz_Throw_KuzzleException { char **idsArray = new char *[ids.size()]; - for (int i = 0; i < ids.size(); i++) { + for (int i= 0; i < ids.size(); i++) { idsArray[i] = const_cast(ids[i].c_str()); - i++; } string_array_result *r = kuzzle_document_mdelete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), options); @@ -188,7 +185,6 @@ namespace kuzzleio { char **idsArray = new char *[ids.size()]; for (int i = 0; i < ids.size(); i++) { idsArray[i] = const_cast(ids[i].c_str()); - i++; } string_result *r = kuzzle_document_mget(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), includeTrash, options); diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp index 42891319..88a8ba4d 100644 --- a/internal/wrappers/cpp/index.cpp +++ b/internal/wrappers/cpp/index.cpp @@ -25,7 +25,7 @@ namespace kuzzleio { Index::Index(Kuzzle* kuzzle, kuzzle_index *index) { _index = index; - kuzzle_new_index(_index, kuzzle->_kuzzle); + kuzzle_new_index(index, kuzzle->_kuzzle); } Index::~Index() { diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index d2500eb1..909ebb22 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -26,7 +26,7 @@ namespace kuzzleio { } NotificationListener* Realtime::getListener(const std::string& roomId) { - return _listener_instances[roomId]; + return _listener_instances[roomId]; } void call_subscribe_cb(notification_result* res, void* data) { @@ -67,7 +67,7 @@ namespace kuzzleio { subscribe_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), &call_subscribe_cb, this, options); if (r->error != NULL) throwExceptionFromStatus(r); - + std::string roomId = r->room; std::string channel = r->channel; diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index 95668bef..9bd16b61 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -69,4 +69,142 @@ Feature: Document management And it has a collection 'test-collection' And the collection has a document with id 'search-my-document-id' When I search a document with id 'fake-id' - Then the document is not found \ No newline at end of file + Then the document is not found + + Scenario: Count documents in a collection + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'count-test-collection' + And the collection has a document with id 'count-my-document-id' + And the collection has a document with id 'count-my-document-id2' + And the collection has a document with id 'count-my-document-id3' + When I count how many documents there is in the collection + Then I shall receive 3 + + Scenario: Delete multiple documents with no error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'delete-test-collection' + And the collection has a document with id 'mdelete-my-document-id' + And the collection has a document with id 'mdelete-my-document-id2' + When I delete the documents 'mdelete-my-document-id' and 'mdelete-my-document-id2' + And I count how many documents there is in the collection + Then I shall receive 0 + + Scenario: Delete multiple documents with partial error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mdelete-test-collection' + And the collection has a document with id 'mdelete-my-document-id' + And the collection has a document with id 'mdelete-my-document-id2' + When I delete the documents 'mdelete-my-document-id' and 'mdelete-my-document-id42' + Then I count how many documents there is in the collection + And I shall receive 1 + And I get a partial error + + Scenario: Create multiple documents with no error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mcreate-test-collection' + And the collection doesn't have a document with id 'mcreate-my-document-id' + And the collection doesn't have a document with id 'mcreate-my-document-id2' + When I create the documents 'mcreate-my-document-id' and 'mcreate-my-document-id2' + And I count how many documents there is in the collection + Then I should have no partial error + And I shall receive 2 + + Scenario: Create multiple documents with partial error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mcreate-test-collection' + When I create the documents 'mcreate-my-document-id' and 'mcreate-my-document-id2' + And I count how many documents there is in the collection + Then I shall receive 2 + And I get a partial error + + Scenario: Replace multiple documents with no error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mreplace-test-collection' + And the collection has a document with id 'mreplace-my-document-id' + And the collection has a document with id 'mreplace-my-document-id2' + When I replace the documents 'mreplace-my-document-id' and 'mreplace-my-document-id2' + Then I should have no partial error + And the document 'mreplace-my-document-id' should be replaced + And the document 'mreplace-my-document-id2' should be replaced + + Scenario: Replace multiple documents with partial error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mreplace-test-collection' + And the collection has a document with id 'mreplace-my-document-id' + And the collection has a document with id 'mreplace-my-document-id2' + When I replace the documents 'unknown' and 'mreplace-my-document-id2' + And the document 'mreplace-my-document-id2' should be replaced + And I get a partial error + + Scenario: Update multiple documents with no error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mreplace-test-collection' + And the collection has a document with id 'mreplace-my-document-id' + And the collection has a document with id 'mreplace-my-document-id2' + When I update the documents 'mreplace-my-document-id' and 'mreplace-my-document-id2' + Then I should have no partial error + And the document 'mreplace-my-document-id' should be replaced + And the document 'mreplace-my-document-id2' should be replaced + + Scenario: Update multiple documents with partial error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mupdate-test-collection' + And the collection has a document with id 'mupdate-my-document-id' + And the collection has a document with id 'mupdate-my-document-id2' + When I update the documents 'unknown' and 'mupdate-my-document-id2' + And the document 'mupdate-my-document-id2' should be updated + And I get a partial error + + Scenario: CreateOrReplace (create) multiple documents with no error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mcreateorreplace-test-collection' + When I createOrReplace the documents 'mcreateorreplace-my-document-id' and 'mcreateorreplace-my-document-id2' + Then I should have no partial error + And the document 'mcreateorreplace-my-document-id' should be created + And the document 'mcreateorreplace-my-document-id2' should be created + + Scenario: CreateOrReplace (replace) multiple documents with no error + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mcreateorreplace-test-collection' + And the collection has a document with id 'mcreateorreplace-my-document-id' + And the collection has a document with id 'mcreateorreplace-my-document-id2' + When I createOrReplace the documents 'mcreateorreplace-my-document-id' and 'mcreateorreplace-my-document-id2' + Then I should have no partial error + And the document 'mcreateorreplace-my-document-id' should be replaced + And the document 'mcreateorreplace-my-document-id2' should be replaced + + Scenario: Check if a document exists + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'exist-test-collection' + And the collection has a document with id 'exist-my-document-id' + When I check if 'exist-my-document-id' exists + Then the document should exists + + Scenario: Check if a document does not exists + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'exist-test-collection' + And the collection has a document with id 'exist-my-document-id' + When I check if 'exist-my-document-unknown' exists + Then the document should not exists + + Scenario: Get multiple document + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'mget-test-collection' + And the collection has a document with id 'mget-my-document-id' + And the collection has a document with id 'mget-my-document-id2' + When I get document 'mget-my-document-id' and 'mget-my-document-id2' + Then the documents should be retrieved \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index 962243f2..5e3f90bb 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -1,6 +1,6 @@ package gradle.cucumber; -import cucumber.api.java.After; +import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; @@ -15,6 +15,10 @@ public class Documentdefs { private World world; private String documentId; private SearchResult documents; + private int nbDocuments; + private boolean partialException = false; + private boolean documentExists = false; + private String jsonDocuments; class Source { JsonObject _source; @@ -113,7 +117,9 @@ public void the_collection_doesn_t_have_a_document_with_id(String id) throws Exc QueryOptions options = new QueryOptions(); options.setRefresh("wait_for"); - k.getDocument().delete_(world.index, world.collection, id, options); + try { + k.getDocument().delete_(world.index, world.collection, id, options); + } catch (KuzzleException e) {} } @When("^I replace a document with id \'([^\"]*)\'$") @@ -180,7 +186,187 @@ public void i_search_a_document_with_id(String id) throws Exception { public void the_document_is_successfully_found() throws Exception { Assert.assertNotNull(this.documents); Assert.assertNotNull(this.documents.getDocuments()); - //System.out.println("########### " + this.documents.getDocuments()); - //Assert.assertEquals("foo", this.documents.getDocuments()); + Assert.assertNotEquals("[]", this.documents.getDocuments()); + } + + @Then("^the document is not found$") + public void the_document_is_not_found() throws Exception { + Assert.assertNotNull(this.documents.getDocuments()); + Assert.assertEquals("[]", this.documents.getDocuments()); + } + + @When("^I count how many documents there is in the collection$") + public void i_count_how_many_documents_there_is_in_the_collection() throws Exception { + nbDocuments = k.getDocument().count_(world.index, world.collection, "{}"); + } + + @Then("^I shall receive (\\d+)$") + public void i_shall_receive(int nbDocuments) throws Exception { + Assert.assertEquals(nbDocuments, this.nbDocuments); + this.nbDocuments = 0; + } + + @When("^I delete the documents \'([^\"]*)\' and \'([^\"]*)\'$") + public void i_delete_the_documents(String doc1, String doc2) throws Exception { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + StringVector v = new StringVector(); + v.add(doc1); + v.add(doc2); + try { + k.getDocument().mDelete(world.index, world.collection, v, o); + this.partialException = false; + } catch (PartialException e) { + this.partialException = true; + } + } + + @Then("^the collection must be empty$") + public void the_collection_must_be_empty() { + Assert.assertEquals(0, k.getDocument().count_(world.index, world.collection, "{}")); + } + + @And("^I get a partial error$") + public void i_get_a_partial_error() { + Assert.assertTrue(this.partialException); + this.partialException = false; + } + + @When("^I create the documents \'([^\"]*)\' and \'([^\"]*)\'$") + public void i_create_the_documents(String doc1, String doc2) throws Exception { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + String docs = "{\"documents\":[{\"_id\":\""+doc1+"\", \"body\":{}}, {\"_id\":\""+doc2+"\", \"body\":{}}]}"; + try { + k.getDocument().mCreate(world.index, world.collection, docs, o); + this.partialException = false; + } catch (PartialException e) { + this.partialException = true; + } + } + + @Then("^I should have no partial error$") + public void i_should_have_no_partial_error() { + Assert.assertFalse(this.partialException); + } + + @When("^I replace the documents \'([^\"]*)\' and \'([^\"]*)\'$") + public void i_replace_the_documents(String doc1, String doc2) throws Exception { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + String docs = "{\"documents\":[{\"_id\":\""+doc1+"\", \"body\":{\"foo\":\"barz\"}}, {\"_id\":\""+doc2+"\", \"body\":{\"foo\":\"barz\"}}]}"; + try { + k.getDocument().mReplace(world.index, world.collection, docs, o); + this.partialException = false; + } catch (PartialException e) { + this.partialException = true; + } + } + + @Then("^the document \'([^\"]*)\' should be replaced") + public void the_documents_should_be_replaced(String id1) throws Exception { + String doc = k.getDocument().get(world.index, world.collection, id1); + Assert.assertNull(this.errorMessage); + + Gson gson = new Gson(); + Source s = gson.fromJson(doc, Source.class); + Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + } + + @When("^I update the documents \'([^\"]*)\' and \'([^\"]*)\'$") + public void i_update_the_documents(String doc1, String doc2) throws Exception { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + String docs = "{\"documents\":[{\"_id\":\""+doc1+"\", \"body\":{\"foo\":\"barz\"}}, {\"_id\":\""+doc2+"\", \"body\":{\"foo\":\"barz\"}}]}"; + try { + k.getDocument().mUpdate(world.index, world.collection, docs, o); + this.partialException = false; + } catch (PartialException e) { + this.partialException = true; + } catch (KuzzleException e) { + this.errorMessage = e.getMessage(); + } + } + + @Then("^the document \'([^\"]*)\' should be updated") + public void the_documents_should_be_updated(String id1) throws Exception { + Assert.assertNull(this.errorMessage); + String doc = k.getDocument().get(world.index, world.collection, id1); + Assert.assertNull(this.errorMessage); + + Gson gson = new Gson(); + Source s = gson.fromJson(doc, Source.class); + Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + } + + @When("^I createOrReplace the documents \'([^\"]*)\' and \'([^\"]*)\'$") + public void i_createOrReplace_the_documents(String doc1, String doc2) throws Exception { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + String docs = "{\"documents\":[{\"_id\":\""+doc1+"\", \"body\":{\"foo\":\"barz\"}}, {\"_id\":\""+doc2+"\", \"body\":{\"foo\":\"barz\"}}]}"; + try { + k.getDocument().mCreateOrReplace(world.index, world.collection, docs, o); + this.partialException = false; + } catch (PartialException e) { + this.partialException = true; + } catch (KuzzleException e) { + this.errorMessage = e.getMessage(); + } + } + + @Then("^the document \'([^\"]*)\' should be created") + public void the_documents_should_be_created(String id1) throws Exception { + Assert.assertNull(this.errorMessage); + String doc = k.getDocument().get(world.index, world.collection, id1); + Assert.assertNull(this.errorMessage); + + Gson gson = new Gson(); + Source s = gson.fromJson(doc, Source.class); + Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + } + + @When("^I check if \'([^\"]*)\' exists$") + public void i_createOrReplace_the_documents(String doc) throws Exception { + this.documentExists = false; + try { + this.documentExists = k.getDocument().exists(world.index, world.collection, doc); + } catch (KuzzleException e) { + this.errorMessage = e.getMessage(); + } + } + + @Then("^the document should exists$") + public void the_document_should_exists() throws Exception { + Assert.assertNull(this.errorMessage); + Assert.assertTrue(this.documentExists); + } + + @Then("^the document should not exists$") + public void the_document_should_not_exists() throws Exception { + Assert.assertNull(this.errorMessage); + Assert.assertFalse(this.documentExists); + } + + @When("^I get document \'([^\"]*)\' and \'([^\"]*)\'$") + public void i_get_document_mget_my_document_id_and_mget_my_document_id(String id1, String id2) throws Exception { + try { + StringVector v = new StringVector(); + v.add(id1); + v.add(id2); + jsonDocuments = k.getDocument().mGet(world.index, world.collection, v, false); + } catch (KuzzleException e) { + this.errorMessage = e.getMessage(); + } + } + + @Then("^the documents should be retrieved$") + public void the_documents_should_be_retrieved() throws Exception { + Assert.assertNull(this.errorMessage); + Assert.assertNotNull(this.jsonDocuments); } } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java index 33fcc563..51f4aa1c 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java @@ -1,5 +1,6 @@ package gradle.cucumber; +import cucumber.api.java.Before; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; @@ -7,10 +8,15 @@ import org.junit.Assert; public class Geofencedefs { - private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); + private Kuzzle k; private NotificationResult content = null; private String documentId; + @Before + public void before() { + k = KuzzleSingleton.getInstance(); + } + @Given("^I subscribe to \"([^\"]*)\" collection$") public void i_subscribe_to_collection(String collection) throws Exception { String filter = "{" + diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index bb8ed5dc..410a48ef 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -1,5 +1,7 @@ package gradle.cucumber; +import cucumber.api.java.After; +import cucumber.api.java.Before; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; @@ -7,11 +9,23 @@ import org.junit.Assert; public class Subscribedefs { - private Kuzzle k = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); + private Kuzzle k; private String roomId; private NotificationContent content = null; private World world; + @Before + public void before() { + k = KuzzleSingleton.getInstance(); + } + + @After + public void after() { + if (roomId != null) { + k.getRealtime().unsubscribe(roomId); + } + } + @Given("^I subscribe to \'([^\"]*)\'$") public void i_subscribe_to(String collection) throws Exception { roomId = k.getRealtime().subscribe(world.index, collection, "{}", new NotificationListener() { @@ -24,6 +38,7 @@ public void onMessage(NotificationResult res) { @Given("^I subscribe to \'([^\"]*)\' with filter \'(.*)\'$") public void i_subscribe_with_filter(String collection, String filter) throws Exception { + content = null; roomId = k.getRealtime().subscribe(world.index, collection, filter, new NotificationListener() { @Override public void onMessage(NotificationResult res) { diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java index adc4f464..cb0ce952 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java @@ -1,6 +1,5 @@ package gradle.cucumber; -import cucumber.api.PendingException; import cucumber.api.java.After; import cucumber.api.java.Before; import cucumber.api.java.en.Given; @@ -21,7 +20,9 @@ public void before() { @After public void after() { - k.getAuth().logout(); + if (k != null && (k.getJwt() == null || !k.getJwt().equals(""))) { + k.getAuth().logout(); + } } @Given("^there is an user with id \'([^\"]*)\'$") diff --git a/internal/wrappers/features/realtime.feature b/internal/wrappers/features/realtime.feature index db681523..694ef07a 100644 --- a/internal/wrappers/features/realtime.feature +++ b/internal/wrappers/features/realtime.feature @@ -34,9 +34,8 @@ Feature: Realtime subscription Scenario: Stop receiving notification when I unsubscribe Given Kuzzle Server is running + And the collection has a document with id 'my-document-id' And I subscribe to 'test-collection' - And the collection has a document with id 'my-document-id' - And I received a notification And I unsubscribe from 'test-collection' When I publish a document Then I do not receive a notification \ No newline at end of file diff --git a/types/search_result.go b/types/search_result.go index 30561bc8..424132d2 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -51,8 +51,6 @@ func NewSearchResult(collection string, filters json.RawMessage, options QueryOp Options: NewQueryOptions(), } - sr.Options.SetScrollId(parsed.ScrollID) - if options != nil { sr.Options.SetFrom(options.From()) sr.Options.SetSize(options.Size()) From 0705895b1c4905f1c4fce1d96cadae5396494055 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 13 Jun 2018 12:43:52 +0200 Subject: [PATCH 212/363] fix unit test --- document/count_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/document/count_test.go b/document/count_test.go index e84a21e2..1192eb50 100644 --- a/document/count_test.go +++ b/document/count_test.go @@ -70,12 +70,12 @@ func TestCountDocument(t *testing.T) { assert.Equal(t, "index", parsedQuery.Index) assert.Equal(t, "collection", parsedQuery.Collection) - return &types.KuzzleResponse{Result: []byte(`1`)} + return &types.KuzzleResponse{Result: json.RawMessage("{\"count\":42}")} }, } k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) res, err := d.Count("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) - assert.Equal(t, 1, res) + assert.Equal(t, 42, res) } From 61701ffb924503d77442a94b63fe3294a7bfc965 Mon Sep 17 00:00:00 2001 From: jenow Date: Wed, 13 Jun 2018 17:31:25 +0200 Subject: [PATCH 213/363] java e2e test on index controller --- index/mDelete.go | 6 +- internal/wrappers/features/index.feature | 11 ++- .../test/java/gradle/cucumber/Indexdefs.java | 83 +++++++++++++++++++ 3 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java diff --git a/index/mDelete.go b/index/mDelete.go index 6a3d0b86..e7753e66 100644 --- a/index/mDelete.go +++ b/index/mDelete.go @@ -29,10 +29,14 @@ func (i *Index) MDelete(indexes []string, options types.QueryOptions) ([]string, result := make(chan *types.KuzzleResponse) + type body struct { + Indexes []string `json:"indexes"` + } + query := &types.KuzzleRequest{ Controller: "index", Action: "mDelete", - Body: indexes, + Body: &body{indexes}, } go i.kuzzle.Query(query, options, result) diff --git a/internal/wrappers/features/index.feature b/internal/wrappers/features/index.feature index a109092f..e24c22d0 100644 --- a/internal/wrappers/features/index.feature +++ b/internal/wrappers/features/index.feature @@ -2,11 +2,18 @@ Feature: Index controller Scenario: Create should create an index Given Kuzzle Server is running + And there is no index called 'test-index' When I create an index called 'test-index' Then the index should exists Scenario: Create should return an error when the index already exists - Given Given Kuzzle Server is running + Given Kuzzle Server is running And there is an index 'test-index' When I create an index called 'test-index' - Then I get an error \ No newline at end of file + Then I get an error + + Scenario: Delete multiple indexes + Given Kuzzle Server is running + And there is the indexes 'test-index' and 'test-index2' + When I delete the indexes 'test-index' and 'test-index2' + Then indexes 'test-index' and 'test-index2' doesn't exist \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java new file mode 100644 index 00000000..38a01d97 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java @@ -0,0 +1,83 @@ +package gradle.cucumber; + +import cucumber.api.PendingException; +import cucumber.api.java.Before; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.Kuzzle; +import io.kuzzle.sdk.KuzzleException; +import io.kuzzle.sdk.QueryOptions; +import io.kuzzle.sdk.StringVector; +import org.junit.Assert; + +public class Indexdefs { + private Kuzzle k; + private World world; + private String errorMessage; + + @Before + public void before() { + k = KuzzleSingleton.getInstance(); + } + + @Given("^there is no index called \'([^\"]*)\'$") + public void there_is_no_index_called(String index) { + try { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + k.getIndex().delete_(index, o); + } catch (KuzzleException e) {} + } + + @When("^I create an index called \'([^\"]*)\'$") + public void i_create_an_index_called_test_index(String index) throws Exception { + try { + k.getIndex().create(index); + } catch (KuzzleException e) { + this.errorMessage = e.getMessage(); + } + world.index = index; + } + + @Then("^the index should exists$") + public void the_index_should_exists() throws Exception { + Assert.assertTrue(k.getIndex().exists(world.index)); + } + + + @Then("^I get an error$") + public void i_get_an_error() throws Exception { + Assert.assertNotNull(this.errorMessage); + } + + @Given("^there is the indexes \'([^\"]*)\' and \'([^\"]*)\'$") + public void there_is_the_indexes_test_index_and_test_index(String index1, String index2) throws Exception { + try { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + k.getIndex().create(index1, o); + k.getIndex().create(index2, o); + } catch(Exception e) {} + } + + @When("^I delete the indexes \'([^\"]*)\' and \'([^\"]*)\'$") + public void i_delete_the_indexes_test_index_and_test_index(String index1, String index2) throws Exception { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + StringVector v = new StringVector(); + v.add(index1); + v.add(index2); + + k.getIndex().mDelete(v, o); + } + + @Then("^indexes \'([^\"]*)\' and \'([^\"]*)\' doesn't exist$") + public void indexes_test_index_and_test_index_doesn_t_exist(String index1, String index2) throws Exception { + Assert.assertFalse(k.getIndex().exists(index1)); + Assert.assertFalse(k.getIndex().exists(index2)); + } +} From 701f07878b9f03c536cb964ac7ba7fa6324cb2c1 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Thu, 14 Jun 2018 14:03:56 +0200 Subject: [PATCH 214/363] Launch Java SDK tests on CodePipeline (#146) * Launch Java SDK tests on CodePipeline Add Continuous Integration with CodePipeline running E2E and Unit Tests for all languages To manually test this branch : - Choose .codepipeline/builds/*.yml matching your machine architecture and replay all the steps. - Go check CodePipeline last build status and logs on AWS Other : - Fix paths in `internal/wrappers/features/run*.sh` for CI environment. * Add helper scripts * Update codepipeline config --- .codepipeline/builds/amd64.yml | 14 +++++++++++ .codepipeline/builds/armv7.yml | 10 ++++++++ .codepipeline/builds/i386.yml | 14 +++++++++++ .codepipeline/deploys/amd64.yml | 9 ++++++++ .codepipeline/deploys/i386.yml | 9 ++++++++ .codepipeline/docker-compose.yml | 27 ++++++++++++++++++++++ .codepipeline/start_kuzzle.sh | 11 +++++++++ .codepipeline/tests/amd64.yml | 14 +++++++++++ .codepipeline/tests/golang.yml | 18 +++++++++++++++ .codepipeline/tests/i386.yml | 14 +++++++++++ .gitignore | 4 +++- buildspec-build-java_amd64.yml | 15 ------------ buildspec-build-java_armv7.yml | 16 ------------- buildspec-build-java_i686.yml | 15 ------------ internal/wrappers/Makefile | 4 ++-- internal/wrappers/build_cpp_test.sh | 2 +- internal/wrappers/features/e2e.sh | 4 ++-- internal/wrappers/features/fixtures/run.sh | 13 ++++++----- internal/wrappers/features/run_cpp.sh | 7 ++++++ internal/wrappers/features/run_java.sh | 5 ++-- 20 files changed, 165 insertions(+), 60 deletions(-) create mode 100644 .codepipeline/builds/amd64.yml create mode 100644 .codepipeline/builds/armv7.yml create mode 100644 .codepipeline/builds/i386.yml create mode 100644 .codepipeline/deploys/amd64.yml create mode 100644 .codepipeline/deploys/i386.yml create mode 100644 .codepipeline/docker-compose.yml create mode 100644 .codepipeline/start_kuzzle.sh create mode 100644 .codepipeline/tests/amd64.yml create mode 100644 .codepipeline/tests/golang.yml create mode 100644 .codepipeline/tests/i386.yml delete mode 100644 buildspec-build-java_amd64.yml delete mode 100644 buildspec-build-java_armv7.yml delete mode 100644 buildspec-build-java_i686.yml create mode 100644 internal/wrappers/features/run_cpp.sh diff --git a/.codepipeline/builds/amd64.yml b/.codepipeline/builds/amd64.yml new file mode 100644 index 00000000..52a32599 --- /dev/null +++ b/.codepipeline/builds/amd64.yml @@ -0,0 +1,14 @@ +version: 0.2 + +phases: + install: + commands: + - docker pull kuzzleio/sdk-cross:amd64 + build: + commands: + - docker run -a stdout -a stderr --net host --rm --privileged --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /build.sh +artifacts: + files: + - '**/*' + - '.codepipeline/*' + base-directory: '${CODEBUILD_SRC_DIR}' diff --git a/.codepipeline/builds/armv7.yml b/.codepipeline/builds/armv7.yml new file mode 100644 index 00000000..2a1c095d --- /dev/null +++ b/.codepipeline/builds/armv7.yml @@ -0,0 +1,10 @@ +version: 0.2 + +phases: + install: + commands: + - docker run --rm --privileged multiarch/qemu-user-static:register + - docker pull kuzzleio/sdk-cross:armv7 + build: + commands: + - docker run --rm --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:armv7 /build.sh diff --git a/.codepipeline/builds/i386.yml b/.codepipeline/builds/i386.yml new file mode 100644 index 00000000..444d2b4a --- /dev/null +++ b/.codepipeline/builds/i386.yml @@ -0,0 +1,14 @@ +version: 0.2 + +phases: + install: + commands: + - docker pull kuzzleio/sdk-cross:i386 + build: + commands: + - docker run -a stdout -a stderr --net host --rm --privileged --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:i386 /build.sh +artifacts: + files: + - '**/*' + - '.codepipeline/*' + base-directory: '${CODEBUILD_SRC_DIR}' diff --git a/.codepipeline/deploys/amd64.yml b/.codepipeline/deploys/amd64.yml new file mode 100644 index 00000000..e4aa57fa --- /dev/null +++ b/.codepipeline/deploys/amd64.yml @@ -0,0 +1,9 @@ +version: 0.2 + +phases: + install: + commands: + - docker pull kuzzleio/sdk-cross:amd64 + build: + commands: + - docker run -a stdout -a stderr --privileged --rm --net host --name deploy-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /deploy.sh diff --git a/.codepipeline/deploys/i386.yml b/.codepipeline/deploys/i386.yml new file mode 100644 index 00000000..9f3bf19b --- /dev/null +++ b/.codepipeline/deploys/i386.yml @@ -0,0 +1,9 @@ +version: 0.2 + +phases: + install: + commands: + - docker pull kuzzleio/sdk-cross:i386 + build: + commands: + - docker run -a stdout -a stderr --privileged --rm --net host --name deploy-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:i386 /deploy.sh diff --git a/.codepipeline/docker-compose.yml b/.codepipeline/docker-compose.yml new file mode 100644 index 00000000..b6a76c52 --- /dev/null +++ b/.codepipeline/docker-compose.yml @@ -0,0 +1,27 @@ +version: '2' + +services: + kuzzle: + image: kuzzleio/kuzzle + ports: + - "7512:7512" + cap_add: + - SYS_PTRACE + depends_on: + - redis + - elasticsearch + container_name: kuzzle + environment: + - kuzzle_services__db__client__host=http://elasticsearch:9200 + - kuzzle_services__internalCache__node__host=redis + - kuzzle_services__memoryStorage__node__host=redis + - NODE_ENV=production + + redis: + image: redis:3.2 + + elasticsearch: + image: kuzzleio/elasticsearch:5.4.1 + environment: + - cluster.name=kuzzle + - "ES_JAVA_OPTS=-Xms256m -Xmx256m" diff --git a/.codepipeline/start_kuzzle.sh b/.codepipeline/start_kuzzle.sh new file mode 100644 index 00000000..59234a7b --- /dev/null +++ b/.codepipeline/start_kuzzle.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -ex +# Download and launch custom Kuzzle stack +KUZZLE_CHECK_CONNECTIVITY_CMD="curl -o /dev/null http://localhost:7512" + +docker-compose -f .codepipeline/docker-compose.yml up -d + +while ! $KUZZLE_CHECK_CONNECTIVITY_CMD &> /dev/null + do + sleep 2 + done diff --git a/.codepipeline/tests/amd64.yml b/.codepipeline/tests/amd64.yml new file mode 100644 index 00000000..b43933f2 --- /dev/null +++ b/.codepipeline/tests/amd64.yml @@ -0,0 +1,14 @@ +version: 0.2 + +phases: + install: + commands: + - docker pull kuzzleio/sdk-cross:amd64 + - sysctl -w vm.max_map_count=262144 + - bash .codepipeline/start_kuzzle.sh + build: + commands: + - docker run -a stdout -a stderr --privileged --rm --network codepipeline_default --link kuzzle --name test-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /test.sh + post_build: + commands: + - docker kill codepipeline_elasticsearch_1 codepipeline_redis_1 kuzzle diff --git a/.codepipeline/tests/golang.yml b/.codepipeline/tests/golang.yml new file mode 100644 index 00000000..46320eb0 --- /dev/null +++ b/.codepipeline/tests/golang.yml @@ -0,0 +1,18 @@ +version: 0.2 + +phases: + install: + commands: + - cp -fr ./* /go/src/github.com/kuzzleio/sdk-go/ + - cd /go/src/github.com/kuzzleio/sdk-go + - go get ./... + build: + commands: + - gofmt -l . + - gofmt -l ./internal/wrappers + - for d in $(go list ./... | grep -v vendor); do go test -timeout 1m -covermode=count "$d"; done +artifacts: + files: + - '**/*' + - '.codepipeline/*' + base-directory: '${CODEBUILD_SRC_DIR}' diff --git a/.codepipeline/tests/i386.yml b/.codepipeline/tests/i386.yml new file mode 100644 index 00000000..3aaac976 --- /dev/null +++ b/.codepipeline/tests/i386.yml @@ -0,0 +1,14 @@ +version: 0.2 + +phases: + install: + commands: + - docker pull kuzzleio/sdk-cross:i386 + - sysctl -w vm.max_map_count=262144 + - bash .codepipeline/start_kuzzle.sh + build: + commands: + - docker run -a stdout -a stderr --privileged --rm --network codepipeline_default --link kuzzle --name test-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:i386 /test.sh + post_build: + commands: + - docker kill codepipeline_elasticsearch_1 codepipeline_redis_1 kuzzle diff --git a/.gitignore b/.gitignore index 6d944e3d..5a4cbf08 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ main.go # Custom test file test.go _build*/ -build/ \ No newline at end of file +build/ +kcore_wrap.cxx +kcore_wrap.h diff --git a/buildspec-build-java_amd64.yml b/buildspec-build-java_amd64.yml deleted file mode 100644 index 60e81be8..00000000 --- a/buildspec-build-java_amd64.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/cgo-cross:amd64 - build: - commands: - - docker run --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/cgo-cross:amd64 & - - sleep 5 - - docker exec build-machine /build.sh - - docker kill build-machine -artifacts: - files: - - internal/wrappers/build/java/io/kuzzle/sdk/kuzzlesdk.jar diff --git a/buildspec-build-java_armv7.yml b/buildspec-build-java_armv7.yml deleted file mode 100644 index f4b4be09..00000000 --- a/buildspec-build-java_armv7.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker run --rm --privileged multiarch/qemu-user-static:register - - docker pull kuzzleio/cgo-cross:armv7 - build: - commands: - - docker run --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/cgo-cross:armv7 & - - sleep 5 - - docker exec build-machine /build.sh - - docker kill build-machine -artifacts: - files: - - internal/wrappers/build/java/io/kuzzle/sdk/kuzzlesdk.jar diff --git a/buildspec-build-java_i686.yml b/buildspec-build-java_i686.yml deleted file mode 100644 index ff1e1225..00000000 --- a/buildspec-build-java_i686.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/cgo-cross:i386 - build: - commands: - - docker run --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/cgo-cross:i386 & - - sleep 5 - - docker exec build-machine /build.sh - - docker kill build-machine -artifacts: - files: - - internal/wrappers/build/java/io/kuzzle/sdk/kuzzlesdk.jar diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 3e641c82..48a90702 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -93,9 +93,9 @@ java: makedir core_java swig_java wrapper_java java_object taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources mv build/java/io/kuzzle/sdk/libkuzzle-wrapper-java.so build/io/kuzzle/sdk/resources - mkdir -p $(ROOTOUTDIR)/java/src/main/java + mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ - cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - + cd build/java && sh gradlew sourcesJar jar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class cp -p $(GOTARGET) $(OUTDIR) cp -p $(GOTARGETSO) $(OUTDIR) diff --git a/internal/wrappers/build_cpp_test.sh b/internal/wrappers/build_cpp_test.sh index 30bbe971..a8dff408 100755 --- a/internal/wrappers/build_cpp_test.sh +++ b/internal/wrappers/build_cpp_test.sh @@ -1,5 +1,5 @@ #/bin/bash +set -e cmake -E make_directory _build_cpp_tests cmake -E chdir _build_cpp_tests cmake ../features/step_defs_cpp cmake --build _build_cpp_tests -- -j - diff --git a/internal/wrappers/features/e2e.sh b/internal/wrappers/features/e2e.sh index 1054e198..67f6a5ed 100755 --- a/internal/wrappers/features/e2e.sh +++ b/internal/wrappers/features/e2e.sh @@ -1,3 +1,3 @@ #!/bin/bash - -internal/wrappers/features/run_$1.sh \ No newline at end of file +set -e +sh internal/wrappers/features/run_$1.sh diff --git a/internal/wrappers/features/fixtures/run.sh b/internal/wrappers/features/fixtures/run.sh index 79228753..52c90843 100755 --- a/internal/wrappers/features/fixtures/run.sh +++ b/internal/wrappers/features/fixtures/run.sh @@ -1,19 +1,20 @@ #!/bin/bash - +set -e CONTENT_TYPE="Content-Type: application/json" + KUZZLE_HOST=http://localhost:7512 # update rights for anonymous user -curl -X PUT -H $CONTENT_TYPE -d @rights.json $KUZZLE_HOST/roles/anonymous/_update +curl -X PUT -H "$CONTENT_TYPE" -d @rights.json $KUZZLE_HOST/roles/anonymous/_update # create index -curl -X POST -H $CONTENT_TYPE $KUZZLE_HOST/index/_create +curl -X POST -H "$CONTENT_TYPE" $KUZZLE_HOST/index/_create # create collection -curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/collection +curl -X PUT -H "$CONTENT_TYPE" $KUZZLE_HOST/index/collection # create geofence collection -curl -X PUT -H $CONTENT_TYPE $KUZZLE_HOST/index/geofence +curl -X PUT -H "$CONTENT_TYPE" $KUZZLE_HOST/index/geofence #update mapping for geofence collection -curl -X PUT -H $CONTENT_TYPE -d @mapping.json $KUZZLE_HOST/index/geofence/_mapping \ No newline at end of file +curl -X PUT -H "$CONTENT_TYPE" -d @mapping.json $KUZZLE_HOST/index/geofence/_mapping diff --git a/internal/wrappers/features/run_cpp.sh b/internal/wrappers/features/run_cpp.sh new file mode 100644 index 00000000..92287b45 --- /dev/null +++ b/internal/wrappers/features/run_cpp.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -e +cd internal/wrappers +./build_cpp_tests.sh̀ +./_build_cpp_tests/KuzzleSDKStepDefs > /dev/null && +cucumber +cd - diff --git a/internal/wrappers/features/run_java.sh b/internal/wrappers/features/run_java.sh index 78c21113..4e290c8e 100755 --- a/internal/wrappers/features/run_java.sh +++ b/internal/wrappers/features/run_java.sh @@ -1,4 +1,5 @@ #!/bin/bash - +set -e cd internal/wrappers/features/java -taskset -c 1 gradle cucumber \ No newline at end of file +gradle cucumber +cd - From 78d454699165811c354d9c9cccc5a518b88261f5 Mon Sep 17 00:00:00 2001 From: jenow Date: Thu, 14 Jun 2018 16:07:47 +0200 Subject: [PATCH 215/363] java e2e collection controller --- internal/wrappers/cgo/kuzzle/collection.go | 19 +-- internal/wrappers/features/collection.feature | 60 ++++++++ .../java/gradle/cucumber/Collectiondefs.java | 131 ++++++++++++++++++ 3 files changed, 198 insertions(+), 12 deletions(-) create mode 100644 internal/wrappers/features/collection.feature create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 3e94d2e7..e5fbe05b 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -77,9 +77,8 @@ func kuzzle_collection_exists(c *C.collection, index *C.char, col *C.char, optio //export kuzzle_collection_list func kuzzle_collection_list(c *C.collection, index *C.char, options *C.query_options) *C.string_result { res, err := (*collection.Collection)(c.instance).List(C.GoString(index), SetQueryOptions(options)) - var stringResult string - json.Unmarshal(res, &stringResult) - return goToCStringResult(&stringResult, err) + s := string(res) + return goToCStringResult(&s, err) } // Mapping @@ -87,15 +86,13 @@ func kuzzle_collection_list(c *C.collection, index *C.char, options *C.query_opt //export kuzzle_collection_get_mapping func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.string_result { res, err := (*collection.Collection)(c.instance).GetMapping(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - var stringResult string - stringResult = string(res) - return goToCStringResult(&stringResult, err) + s := string(res) + return goToCStringResult(&s, err) } //export kuzzle_collection_update_mapping func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.error_result { - newBody, _ := json.Marshal(body) - err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), newBody, SetQueryOptions(options)) + err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCErrorResult(err) } @@ -123,8 +120,7 @@ func kuzzle_collection_search_specifications(c *C.collection, options *C.query_o //export kuzzle_collection_update_specifications func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.string_result { - newBody, _ := json.Marshal(body) - res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), newBody, SetQueryOptions(options)) + res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) var stringResult string stringResult = string(res) return goToCStringResult(&stringResult, err) @@ -132,7 +128,6 @@ func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col //export kuzzle_collection_validate_specifications func kuzzle_collection_validate_specifications(c *C.collection, body *C.char, options *C.query_options) *C.bool_result { - newBody, _ := json.Marshal(body) - res, err := (*collection.Collection)(c.instance).ValidateSpecifications(newBody, SetQueryOptions(options)) + res, err := (*collection.Collection)(c.instance).ValidateSpecifications(json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCBoolResult(res, err) } diff --git a/internal/wrappers/features/collection.feature b/internal/wrappers/features/collection.feature new file mode 100644 index 00000000..5e60dcfb --- /dev/null +++ b/internal/wrappers/features/collection.feature @@ -0,0 +1,60 @@ +Feature: Collection management + + Scenario: Create a collection + Given Kuzzle Server is running + And there is an index 'test-index' + When I create a collection 'collection-test-collection' + Then the collection should exists + + Scenario: Check if a collection exists + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I check if the collection exists + Then it should exists + + Scenario: List existing collections + Given Kuzzle Server is running + And there is an index 'list-test-index' + And it has a collection 'test-collection1' + And it has a collection 'test-collection2' + When I list the collections + Then I should have 2 collections + + Scenario: Truncate a collection + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + And the collection has a document with id 'my-document-id2' + When I truncate the collection + Then it should be empty + + Scenario: Create a collection with a custom mapping + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I update the mapping + Then the mapping should be updated + + Scenario: Update specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I update the specifications + Then they should be updated + + Scenario: Validate specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I validate the specifications + Then they should be validated + + Scenario: Delete specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And has specifications + When I delete the specifications + Then the specifications must not exist \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java new file mode 100644 index 00000000..8b5362e3 --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java @@ -0,0 +1,131 @@ +package gradle.cucumber; + +import cucumber.api.java.Before; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import io.kuzzle.sdk.Kuzzle; +import io.kuzzle.sdk.NotFoundException; +import io.kuzzle.sdk.QueryOptions; +import io.kuzzle.sdk.SearchResult; +import org.junit.Assert; + +import javax.management.remote.NotificationResult; + +public class Collectiondefs { + private Kuzzle k; + private World world; + private boolean exists = false; + String listCollections; + private boolean validateSpecs = false; + + @Before + public void before() { + k = KuzzleSingleton.getInstance(); + } + + @When("^I create a collection \'([^\"]*)\'$") + public void i_create_a_collection_test_collection(String collection) throws Exception { + k.getCollection().create(world.index, collection); + world.collection = collection; + } + + @Then("^the collection should exists$") + public void the_collection_should_exists() throws Exception { + Assert.assertTrue(k.getCollection().exists(world.index, world.collection)); + } + + @When("^I check if the collection exists$") + public void i_check_if_the_collection_exists() throws Exception { + exists = k.getCollection().exists(world.index, world.collection); + } + + @Then("^it should exists$") + public void it_should_exists() throws Exception { + Assert.assertTrue(exists); + } + + @When("^I list the collections$") + public void i_list_the_collections() throws Exception { + listCollections = k.getCollection().list(world.index); + } + + @Then("^I should have 2 collections$") + public void i_should_have_collections() throws Exception { + Assert.assertNotNull(this.listCollections); + Assert.assertEquals("{\"type\":\"all\",\"collections\":[{\"name\":\"test-collection1\",\"type\":\"stored\"},{\"name\":\"test-collection2\",\"type\":\"stored\"}],\"from\":0,\"size\":10}", this.listCollections); + } + + @When("^I truncate the collection$") + public void i_truncate_the_collection() throws Exception { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + k.getCollection().truncate(world.index, world.collection, o); + } + + @Then("^it should be empty$") + public void it_should_be_empty() throws Exception { + SearchResult res = k.getDocument().search(world.index, world.collection, "{}"); + Assert.assertEquals("[]", res.getDocuments()); + } + + @When("^I update the mapping$") + public void i_update_the_mapping() throws Exception { + k.getCollection().updateMapping(world.index, world.collection, "{" + + "\"properties\": {" + + " \"foo\": {" + + " \"type\": \"string\"" + + " }" + + "}" + + "}"); + } + + @Then("^the mapping should be updated$") + public void the_mapping_should_be_updated() throws Exception { + String mapping = k.getCollection().getMapping(world.index, world.collection); + Assert.assertEquals("{\"test-index\":{\"mappings\":{\"test-collection\":{\"properties\":{\"foo\":{\"type\":\"text\",\"fields\":{\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}}}}}}}", mapping); + } + + @When("^I update the specifications$") + public void i_update_the_specifications() throws Exception { + k.getCollection().updateSpecifications(world.index, world.collection, "{\""+world.index+"\":{\""+world.collection+"\":{\"strict\":true}}}"); + } + + @Then("^they should be updated$") + public void they_should_be_updated() throws Exception { + Assert.assertEquals("{\"validation\":{\"strict\":true},\"index\":\"test-index\",\"collection\":\"test-collection\"}", k.getCollection().getSpecifications(world.index, world.collection)); + } + + @When("^I validate the specifications$") + public void i_validate_the_specifications() throws Exception { + this.validateSpecs = k.getCollection().validateSpecifications("{\""+world.index+"\":{\""+world.collection+"\":{\"strict\":true}}}"); + } + + @Then("^they should be validated$") + public void they_should_be_validated() throws Exception { + Assert.assertTrue(this.validateSpecs); + } + + @Given("^has specifications$") + public void has_specifications() throws Exception { + k.getCollection().updateSpecifications(world.index, world.collection, "{\""+world.index+"\":{\""+world.collection+"\":{\"strict\":true}}}"); + } + + @When("^I delete the specifications$") + public void i_delete_the_specifications() throws Exception { + k.getCollection().deleteSpecifications(world.index, world.collection); + } + + @Then("^the specifications must not exist$") + public void the_specifications_must_not_exist() throws Exception { + boolean notFound = false; + try { + k.getCollection().getSpecifications(world.index, world.collection); + } catch (NotFoundException e) { + notFound = true; + } + Assert.assertTrue(notFound); + } + +} From d55c86ad1d2821545ce9ec5007c9cf128f3e46bb Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 15 Jun 2018 14:20:35 +0200 Subject: [PATCH 216/363] fix tests --- .../src/test/java/gradle/cucumber/Documentdefs.java | 10 +++++----- .../test/java/gradle/cucumber/UserManagementdefs.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index 5e3f90bb..e2a65864 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -109,7 +109,7 @@ public void the_document_is_successfully_replaced() throws Exception { Gson gson = new Gson(); Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); } @Given("^the collection doesn't have a document with id \'([^\"]*)\'$") @@ -166,7 +166,7 @@ public void the_document_is_successfully_updated() throws Exception { Gson gson = new Gson(); Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); } @When("^I search a document with id \'([^\"]*)\'$") @@ -273,7 +273,7 @@ public void the_documents_should_be_replaced(String id1) throws Exception { Gson gson = new Gson(); Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); } @When("^I update the documents \'([^\"]*)\' and \'([^\"]*)\'$") @@ -300,7 +300,7 @@ public void the_documents_should_be_updated(String id1) throws Exception { Gson gson = new Gson(); Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); } @When("^I createOrReplace the documents \'([^\"]*)\' and \'([^\"]*)\'$") @@ -327,7 +327,7 @@ public void the_documents_should_be_created(String id1) throws Exception { Gson gson = new Gson(); Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("{\"foo\":\"barz\"}", s._source.toString()); + Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); } @When("^I check if \'([^\"]*)\' exists$") diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java index cb0ce952..0ad46aef 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java @@ -93,7 +93,7 @@ public void i_get_my_user_info() throws Exception { @Then("^the response '_source' field contains the pair \'([^\"]*)\':\'([^\"]*)\'$") public void the_response__source_field_contains_the_pair(String key, String value) throws Exception { - Assert.assertEquals(currentUser.getContent(), "{\""+key+"\":\""+value+"\",\"profileIds\":[\"default\"]}"); + Assert.assertEquals(currentUser.getContent(), "{\"_kuzzle_info\":{\"author\":\"-1\",\"createdAt\":1528886173598,\"updatedAt\":null,\"updater\":null},\""+key+"\":\""+value+"\",\"profileIds\":[\"default\"]}"); } @When("^I logout$") From 21a94b2faecdc70e6c48867c84362639341d145f Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 18 Jun 2018 11:22:11 +0200 Subject: [PATCH 217/363] wip --- internal/wrappers/features/documents.feature | 4 ++-- .../src/test/java/gradle/cucumber/Documentdefs.java | 12 ++++++++---- .../java/gradle/cucumber/UserManagementdefs.java | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index 9bd16b61..c2c31c03 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -87,7 +87,7 @@ Feature: Document management And it has a collection 'delete-test-collection' And the collection has a document with id 'mdelete-my-document-id' And the collection has a document with id 'mdelete-my-document-id2' - When I delete the documents 'mdelete-my-document-id' and 'mdelete-my-document-id2' + When I delete the documents ["mdelete-my-document-id", "mdelete-my-document-id2"] And I count how many documents there is in the collection Then I shall receive 0 @@ -97,7 +97,7 @@ Feature: Document management And it has a collection 'mdelete-test-collection' And the collection has a document with id 'mdelete-my-document-id' And the collection has a document with id 'mdelete-my-document-id2' - When I delete the documents 'mdelete-my-document-id' and 'mdelete-my-document-id42' + When I delete the documents ["mdelete-my-document-id", "mdelete-my-document-id2"] Then I count how many documents there is in the collection And I shall receive 1 And I get a partial error diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index e2a65864..c9a31f82 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -9,6 +9,8 @@ import io.kuzzle.sdk.*; import org.junit.Assert; +import java.util.List; + public class Documentdefs { private Kuzzle k; private String errorMessage; @@ -206,14 +208,16 @@ public void i_shall_receive(int nbDocuments) throws Exception { this.nbDocuments = 0; } - @When("^I delete the documents \'([^\"]*)\' and \'([^\"]*)\'$") - public void i_delete_the_documents(String doc1, String doc2) throws Exception { + @When("^I delete the documents \\[([\"]*)\\]$") + public void i_delete_the_documents(List docs) throws Exception { QueryOptions o = new QueryOptions(); o.setRefresh("wait_for"); + System.out.println(docs.get(0)); + System.out.println(docs.get(1)); StringVector v = new StringVector(); - v.add(doc1); - v.add(doc2); + v.add(docs.get(0)); + v.add(docs.get(1)); try { k.getDocument().mDelete(world.index, world.collection, v, o); this.partialException = false; diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java index 0ad46aef..46436895 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java @@ -93,7 +93,7 @@ public void i_get_my_user_info() throws Exception { @Then("^the response '_source' field contains the pair \'([^\"]*)\':\'([^\"]*)\'$") public void the_response__source_field_contains_the_pair(String key, String value) throws Exception { - Assert.assertEquals(currentUser.getContent(), "{\"_kuzzle_info\":{\"author\":\"-1\",\"createdAt\":1528886173598,\"updatedAt\":null,\"updater\":null},\""+key+"\":\""+value+"\",\"profileIds\":[\"default\"]}"); + Assert.assertNotNull(currentUser.getContent()); } @When("^I logout$") From 79bde1f3e6d96fecf0bf7c7dc2998fc0e15445fa Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 18 Jun 2018 11:31:16 +0200 Subject: [PATCH 218/363] wip --- internal/wrappers/features/documents.feature | 4 ++-- .../test/java/gradle/cucumber/Documentdefs.java | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index c2c31c03..a7d95583 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -87,7 +87,7 @@ Feature: Document management And it has a collection 'delete-test-collection' And the collection has a document with id 'mdelete-my-document-id' And the collection has a document with id 'mdelete-my-document-id2' - When I delete the documents ["mdelete-my-document-id", "mdelete-my-document-id2"] + When I delete the documents 'mdelete-my-document-id' and 'mdelete-my-document-id2' And I count how many documents there is in the collection Then I shall receive 0 @@ -97,7 +97,7 @@ Feature: Document management And it has a collection 'mdelete-test-collection' And the collection has a document with id 'mdelete-my-document-id' And the collection has a document with id 'mdelete-my-document-id2' - When I delete the documents ["mdelete-my-document-id", "mdelete-my-document-id2"] + When I delete the documents 'mdelete-my-document-id' and 'mdelete-my-document-unknown' Then I count how many documents there is in the collection And I shall receive 1 And I get a partial error diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index c9a31f82..d040c041 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -208,16 +208,18 @@ public void i_shall_receive(int nbDocuments) throws Exception { this.nbDocuments = 0; } - @When("^I delete the documents \\[([\"]*)\\]$") - public void i_delete_the_documents(List docs) throws Exception { + @When("^I delete the documents \'([^\"]*)\' and \'([^\"]*)\'$") + public void i_delete_the_documents(String doc1, String doc2) throws Exception { QueryOptions o = new QueryOptions(); o.setRefresh("wait_for"); - System.out.println(docs.get(0)); - System.out.println(docs.get(1)); + //System.out.println(docs.get(0)); + //System.out.println(docs.get(1)); StringVector v = new StringVector(); - v.add(docs.get(0)); - v.add(docs.get(1)); + //v.add(docs.get(0)); + //v.add(docs.get(1)); + v.add(doc1); + v.add(doc2); try { k.getDocument().mDelete(world.index, world.collection, v, o); this.partialException = false; From 1e98ad261fdea330ec39303ca4ad8ddd6912226e Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 18 Jun 2018 11:43:29 +0200 Subject: [PATCH 219/363] fixes from PR comments --- internal/wrappers/cgo/kuzzle/c_to_go.go | 2 +- internal/wrappers/cgo/kuzzle/document.go | 4 +--- internal/wrappers/features/documents.feature | 22 +++++++++---------- .../java/gradle/cucumber/Documentdefs.java | 16 +++++--------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go index 55dea422..96449d6e 100644 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ b/internal/wrappers/cgo/kuzzle/c_to_go.go @@ -37,7 +37,7 @@ func cToGoStrings(arr **C.char, len C.size_t) []string { } tmpslice := (*[1 << 27]*C.char)(unsafe.Pointer(arr))[:len:len] - goStrings := make([]string, 0) + goStrings := make([]string, 0, len) for _, s := range tmpslice { goStrings = append(goStrings, C.GoString(s)) diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go index 348345c3..36602f7f 100644 --- a/internal/wrappers/cgo/kuzzle/document.go +++ b/internal/wrappers/cgo/kuzzle/document.go @@ -118,9 +118,7 @@ func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, //export kuzzle_document_search func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.search_result { res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - r := goToCSearchResult(res, err) - - return r + return goToCSearchResult(res, err) } //export kuzzle_document_mcreate diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index a7d95583..9db3a4cb 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -87,7 +87,7 @@ Feature: Document management And it has a collection 'delete-test-collection' And the collection has a document with id 'mdelete-my-document-id' And the collection has a document with id 'mdelete-my-document-id2' - When I delete the documents 'mdelete-my-document-id' and 'mdelete-my-document-id2' + When I delete the documents ['mdelete-my-document-id', 'mdelete-my-document-id2'] And I count how many documents there is in the collection Then I shall receive 0 @@ -97,7 +97,7 @@ Feature: Document management And it has a collection 'mdelete-test-collection' And the collection has a document with id 'mdelete-my-document-id' And the collection has a document with id 'mdelete-my-document-id2' - When I delete the documents 'mdelete-my-document-id' and 'mdelete-my-document-unknown' + When I delete the documents ['mdelete-my-document-id', 'mdelete-my-document-unknown'] Then I count how many documents there is in the collection And I shall receive 1 And I get a partial error @@ -108,7 +108,7 @@ Feature: Document management And it has a collection 'mcreate-test-collection' And the collection doesn't have a document with id 'mcreate-my-document-id' And the collection doesn't have a document with id 'mcreate-my-document-id2' - When I create the documents 'mcreate-my-document-id' and 'mcreate-my-document-id2' + When I create the documents ['mcreate-my-document-id', 'mcreate-my-document-id2'] And I count how many documents there is in the collection Then I should have no partial error And I shall receive 2 @@ -117,7 +117,7 @@ Feature: Document management Given Kuzzle Server is running And there is an index 'test-index' And it has a collection 'mcreate-test-collection' - When I create the documents 'mcreate-my-document-id' and 'mcreate-my-document-id2' + When I create the documents ['mcreate-my-document-id', 'mcreate-my-document-id2'] And I count how many documents there is in the collection Then I shall receive 2 And I get a partial error @@ -128,7 +128,7 @@ Feature: Document management And it has a collection 'mreplace-test-collection' And the collection has a document with id 'mreplace-my-document-id' And the collection has a document with id 'mreplace-my-document-id2' - When I replace the documents 'mreplace-my-document-id' and 'mreplace-my-document-id2' + When I replace the documents ['mreplace-my-document-id', 'mreplace-my-document-id2'] Then I should have no partial error And the document 'mreplace-my-document-id' should be replaced And the document 'mreplace-my-document-id2' should be replaced @@ -139,7 +139,7 @@ Feature: Document management And it has a collection 'mreplace-test-collection' And the collection has a document with id 'mreplace-my-document-id' And the collection has a document with id 'mreplace-my-document-id2' - When I replace the documents 'unknown' and 'mreplace-my-document-id2' + When I replace the documents ['unknown', 'mreplace-my-document-id2'] And the document 'mreplace-my-document-id2' should be replaced And I get a partial error @@ -149,7 +149,7 @@ Feature: Document management And it has a collection 'mreplace-test-collection' And the collection has a document with id 'mreplace-my-document-id' And the collection has a document with id 'mreplace-my-document-id2' - When I update the documents 'mreplace-my-document-id' and 'mreplace-my-document-id2' + When I update the documents ['mreplace-my-document-id', 'mreplace-my-document-id2'] Then I should have no partial error And the document 'mreplace-my-document-id' should be replaced And the document 'mreplace-my-document-id2' should be replaced @@ -160,7 +160,7 @@ Feature: Document management And it has a collection 'mupdate-test-collection' And the collection has a document with id 'mupdate-my-document-id' And the collection has a document with id 'mupdate-my-document-id2' - When I update the documents 'unknown' and 'mupdate-my-document-id2' + When I update the documents ['unknown', 'mupdate-my-document-id2'] And the document 'mupdate-my-document-id2' should be updated And I get a partial error @@ -168,7 +168,7 @@ Feature: Document management Given Kuzzle Server is running And there is an index 'test-index' And it has a collection 'mcreateorreplace-test-collection' - When I createOrReplace the documents 'mcreateorreplace-my-document-id' and 'mcreateorreplace-my-document-id2' + When I createOrReplace the documents ['mcreateorreplace-my-document-id', 'mcreateorreplace-my-document-id2'] Then I should have no partial error And the document 'mcreateorreplace-my-document-id' should be created And the document 'mcreateorreplace-my-document-id2' should be created @@ -179,7 +179,7 @@ Feature: Document management And it has a collection 'mcreateorreplace-test-collection' And the collection has a document with id 'mcreateorreplace-my-document-id' And the collection has a document with id 'mcreateorreplace-my-document-id2' - When I createOrReplace the documents 'mcreateorreplace-my-document-id' and 'mcreateorreplace-my-document-id2' + When I createOrReplace the documents ['mcreateorreplace-my-document-id', 'mcreateorreplace-my-document-id2'] Then I should have no partial error And the document 'mcreateorreplace-my-document-id' should be replaced And the document 'mcreateorreplace-my-document-id2' should be replaced @@ -206,5 +206,5 @@ Feature: Document management And it has a collection 'mget-test-collection' And the collection has a document with id 'mget-my-document-id' And the collection has a document with id 'mget-my-document-id2' - When I get document 'mget-my-document-id' and 'mget-my-document-id2' + When I get document ['mget-my-document-id', 'mget-my-document-id2'] Then the documents should be retrieved \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index d040c041..5a65f124 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -208,16 +208,12 @@ public void i_shall_receive(int nbDocuments) throws Exception { this.nbDocuments = 0; } - @When("^I delete the documents \'([^\"]*)\' and \'([^\"]*)\'$") + @When("^I delete the documents \\[\'(.*)\', \'(.*)\'\\]$") public void i_delete_the_documents(String doc1, String doc2) throws Exception { QueryOptions o = new QueryOptions(); o.setRefresh("wait_for"); - //System.out.println(docs.get(0)); - //System.out.println(docs.get(1)); StringVector v = new StringVector(); - //v.add(docs.get(0)); - //v.add(docs.get(1)); v.add(doc1); v.add(doc2); try { @@ -239,7 +235,7 @@ public void i_get_a_partial_error() { this.partialException = false; } - @When("^I create the documents \'([^\"]*)\' and \'([^\"]*)\'$") + @When("^I create the documents \\[\'(.*)\', \'(.*)\'\\]$") public void i_create_the_documents(String doc1, String doc2) throws Exception { QueryOptions o = new QueryOptions(); o.setRefresh("wait_for"); @@ -258,7 +254,7 @@ public void i_should_have_no_partial_error() { Assert.assertFalse(this.partialException); } - @When("^I replace the documents \'([^\"]*)\' and \'([^\"]*)\'$") + @When("^I replace the documents \\[\'(.*)\', \'(.*)\'\\]$") public void i_replace_the_documents(String doc1, String doc2) throws Exception { QueryOptions o = new QueryOptions(); o.setRefresh("wait_for"); @@ -282,7 +278,7 @@ public void the_documents_should_be_replaced(String id1) throws Exception { Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); } - @When("^I update the documents \'([^\"]*)\' and \'([^\"]*)\'$") + @When("^I update the documents \\[\'(.*)\', \'(.*)\'\\]$") public void i_update_the_documents(String doc1, String doc2) throws Exception { QueryOptions o = new QueryOptions(); o.setRefresh("wait_for"); @@ -309,7 +305,7 @@ public void the_documents_should_be_updated(String id1) throws Exception { Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); } - @When("^I createOrReplace the documents \'([^\"]*)\' and \'([^\"]*)\'$") + @When("^I createOrReplace the documents \\[\'(.*)\', \'(.*)\'\\]$") public void i_createOrReplace_the_documents(String doc1, String doc2) throws Exception { QueryOptions o = new QueryOptions(); o.setRefresh("wait_for"); @@ -358,7 +354,7 @@ public void the_document_should_not_exists() throws Exception { Assert.assertFalse(this.documentExists); } - @When("^I get document \'([^\"]*)\' and \'([^\"]*)\'$") + @When("^I get document \\[\'(.*)\', \'(.*)\'\\]$") public void i_get_document_mget_my_document_id_and_mget_my_document_id(String id1, String id2) throws Exception { try { StringVector v = new StringVector(); From 0949f328f83b271d3de69256c4ea8782ef488a1e Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 18 Jun 2018 11:54:34 +0200 Subject: [PATCH 220/363] fixes from pr --- internal/wrappers/features/documents.feature | 14 +++++--------- .../test/java/gradle/cucumber/Documentdefs.java | 15 ++++++++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index 9db3a4cb..74a3f165 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -88,8 +88,7 @@ Feature: Document management And the collection has a document with id 'mdelete-my-document-id' And the collection has a document with id 'mdelete-my-document-id2' When I delete the documents ['mdelete-my-document-id', 'mdelete-my-document-id2'] - And I count how many documents there is in the collection - Then I shall receive 0 + Then I must have 0 documents in the collection Scenario: Delete multiple documents with partial error Given Kuzzle Server is running @@ -98,8 +97,7 @@ Feature: Document management And the collection has a document with id 'mdelete-my-document-id' And the collection has a document with id 'mdelete-my-document-id2' When I delete the documents ['mdelete-my-document-id', 'mdelete-my-document-unknown'] - Then I count how many documents there is in the collection - And I shall receive 1 + Then I must have 1 documents in the collection And I get a partial error Scenario: Create multiple documents with no error @@ -109,17 +107,15 @@ Feature: Document management And the collection doesn't have a document with id 'mcreate-my-document-id' And the collection doesn't have a document with id 'mcreate-my-document-id2' When I create the documents ['mcreate-my-document-id', 'mcreate-my-document-id2'] - And I count how many documents there is in the collection - Then I should have no partial error - And I shall receive 2 + Then I must have 2 documents in the collection + And I should have no partial error Scenario: Create multiple documents with partial error Given Kuzzle Server is running And there is an index 'test-index' And it has a collection 'mcreate-test-collection' When I create the documents ['mcreate-my-document-id', 'mcreate-my-document-id2'] - And I count how many documents there is in the collection - Then I shall receive 2 + Then I must have 2 documents in the collection And I get a partial error Scenario: Replace multiple documents with no error diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index 5a65f124..80403365 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -197,17 +197,22 @@ public void the_document_is_not_found() throws Exception { Assert.assertEquals("[]", this.documents.getDocuments()); } - @When("^I count how many documents there is in the collection$") - public void i_count_how_many_documents_there_is_in_the_collection() throws Exception { - nbDocuments = k.getDocument().count_(world.index, world.collection, "{}"); - } - @Then("^I shall receive (\\d+)$") public void i_shall_receive(int nbDocuments) throws Exception { Assert.assertEquals(nbDocuments, this.nbDocuments); this.nbDocuments = 0; } + @Then("^I must have (\\d+) documents in the collection$") + public void i_must_have_documents_in_the_collection(int nb) { + Assert.assertEquals(nb, k.getDocument().count_(world.index, world.collection, "{}")); + } + + @When("^I count how many documents there is in the collection$") + public void i_count_how_many_documents_there_is_in_the_collection() throws Exception { + nbDocuments = k.getDocument().count_(world.index, world.collection, "{}"); + } + @When("^I delete the documents \\[\'(.*)\', \'(.*)\'\\]$") public void i_delete_the_documents(String doc1, String doc2) throws Exception { QueryOptions o = new QueryOptions(); From 6d6156969f55d22f839cdabace0634733c3e16dd Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 18 Jun 2018 13:49:49 +0200 Subject: [PATCH 221/363] fix from pr's comment --- internal/wrappers/features/collection.feature | 5 +++-- .../java/gradle/cucumber/Collectiondefs.java | 22 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/internal/wrappers/features/collection.feature b/internal/wrappers/features/collection.feature index 5e60dcfb..720ca707 100644 --- a/internal/wrappers/features/collection.feature +++ b/internal/wrappers/features/collection.feature @@ -19,7 +19,8 @@ Feature: Collection management And it has a collection 'test-collection1' And it has a collection 'test-collection2' When I list the collections - Then I should have 2 collections + Then the result contains 2 hits + And the content should not be null Scenario: Truncate a collection Given Kuzzle Server is running @@ -28,7 +29,7 @@ Feature: Collection management And the collection has a document with id 'my-document-id' And the collection has a document with id 'my-document-id2' When I truncate the collection - Then it should be empty + Then the collection shall be empty Scenario: Create a collection with a custom mapping Given Kuzzle Server is running diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java index 8b5362e3..6e0162d1 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java @@ -4,6 +4,9 @@ import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; +import gherkin.deps.com.google.gson.Gson; +import gherkin.deps.com.google.gson.JsonArray; +import gherkin.deps.com.google.gson.JsonObject; import io.kuzzle.sdk.Kuzzle; import io.kuzzle.sdk.NotFoundException; import io.kuzzle.sdk.QueryOptions; @@ -50,8 +53,21 @@ public void i_list_the_collections() throws Exception { listCollections = k.getCollection().list(world.index); } - @Then("^I should have 2 collections$") - public void i_should_have_collections() throws Exception { + class Col { + JsonArray collections; + } + + @Then("^the result contains (\\d+) hits$") + public void the_result_contains_hits(int nb) throws Exception { + Gson gson = new Gson(); + Col c = gson.fromJson(listCollections, Collectiondefs.Col.class); + + Assert.assertEquals(nb, c.collections.size()); + + } + + @Then("^the content should not be null$") + public void i() { Assert.assertNotNull(this.listCollections); Assert.assertEquals("{\"type\":\"all\",\"collections\":[{\"name\":\"test-collection1\",\"type\":\"stored\"},{\"name\":\"test-collection2\",\"type\":\"stored\"}],\"from\":0,\"size\":10}", this.listCollections); } @@ -64,7 +80,7 @@ public void i_truncate_the_collection() throws Exception { k.getCollection().truncate(world.index, world.collection, o); } - @Then("^it should be empty$") + @Then("^the collection shall be empty$") public void it_should_be_empty() throws Exception { SearchResult res = k.getDocument().search(world.index, world.collection, "{}"); Assert.assertEquals("[]", res.getDocuments()); From 47803dc8f08889b3989142183e90d44efae926b3 Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 18 Jun 2018 15:22:29 +0200 Subject: [PATCH 222/363] fix CMakeLists.txt --- README.md | 9 ++++- .../features/step_defs_cpp/CMakeLists.txt | 3 +- .../step_defs_cpp/kuzzle-sdk-steps.cpp | 37 +------------------ 3 files changed, 10 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 45326a6f..f6078fae 100644 --- a/README.md +++ b/README.md @@ -66,19 +66,24 @@ You can also get html coverage by running #### JAVA ```sh -cd internal/wrappers/features/java +cd internal/wrappers +make java +cd features/java gradle cucumber ``` #### C++ ```sh +make cpp cd internal/wrappers ./build_cpp_tests.sh̀ ./_build_cpp_tests/KuzzleSDKStepDefs & -cucumber features/*.features +cucumber features/*.feature ``` + + ## Wrappers ### Dependencies diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt index c7ae644f..46bd2f6c 100644 --- a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt +++ b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt @@ -94,7 +94,8 @@ set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost if(Boost_UNIT_TEST_FRAMEWORK_FOUND) set (CMAKE_CXX_STANDARD 11) - add_executable(KuzzleSDKStepDefs kuzzle-sdk-steps kuzzle_utils) + FILE(GLOB SRCFILES *.cpp) + add_executable(KuzzleSDKStepDefs ${SRCFILES}) add_dependencies(KuzzleSDKStepDefs project_cucumber_cpp) diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index d978a62b..93a5d3d2 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -1,39 +1,4 @@ -#include -#define EXPECT_EQ BOOST_CHECK_EQUAL -#include -#include - -#include "auth.hpp" -#include "collection.hpp" -#include "document.hpp" -#include "index.hpp" -#include "kuzzle.hpp" - -#include "kuzzle_utils.h" - -#include "json_spirit/json_spirit.h" - -using cucumber::ScenarioScope; - -using namespace kuzzleio; -using std::cout; -using std::endl; -using std::string; - -struct KuzzleCtx { - Kuzzle* kuzzle = NULL; - options kuzzle_options; - - string user_id; - string index; - string collection; - string jwt; - - user* currentUser = NULL; - json_spirit::Value_type customUserDataType = json_spirit::null_type; - - bool success; -}; +#include "steps.hpp" BEFORE() { kuz_log_sep(); } From a2086fe784e07fcf1027734433ec7675ccee4e2b Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 18 Jun 2018 15:44:22 +0200 Subject: [PATCH 223/363] typo --- internal/wrappers/features/documents.feature | 6 +++--- .../java/src/test/java/gradle/cucumber/Documentdefs.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature index 74a3f165..3895e026 100644 --- a/internal/wrappers/features/documents.feature +++ b/internal/wrappers/features/documents.feature @@ -157,7 +157,7 @@ Feature: Document management And the collection has a document with id 'mupdate-my-document-id' And the collection has a document with id 'mupdate-my-document-id2' When I update the documents ['unknown', 'mupdate-my-document-id2'] - And the document 'mupdate-my-document-id2' should be updated + Then the document 'mupdate-my-document-id2' should be updated And I get a partial error Scenario: CreateOrReplace (create) multiple documents with no error @@ -194,7 +194,7 @@ Feature: Document management And it has a collection 'exist-test-collection' And the collection has a document with id 'exist-my-document-id' When I check if 'exist-my-document-unknown' exists - Then the document should not exists + Then the document should not exist Scenario: Get multiple document Given Kuzzle Server is running @@ -202,5 +202,5 @@ Feature: Document management And it has a collection 'mget-test-collection' And the collection has a document with id 'mget-my-document-id' And the collection has a document with id 'mget-my-document-id2' - When I get document ['mget-my-document-id', 'mget-my-document-id2'] + When I get documents ['mget-my-document-id', 'mget-my-document-id2'] Then the documents should be retrieved \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index 80403365..d99f28dc 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -353,13 +353,13 @@ public void the_document_should_exists() throws Exception { Assert.assertTrue(this.documentExists); } - @Then("^the document should not exists$") + @Then("^the document should not exist$") public void the_document_should_not_exists() throws Exception { Assert.assertNull(this.errorMessage); Assert.assertFalse(this.documentExists); } - @When("^I get document \\[\'(.*)\', \'(.*)\'\\]$") + @When("^I get documents \\[\'(.*)\', \'(.*)\'\\]$") public void i_get_document_mget_my_document_id_and_mget_my_document_id(String id1, String id2) throws Exception { try { StringVector v = new StringVector(); From d7a2962f25789af617703bfe0841d0d59fe27fff Mon Sep 17 00:00:00 2001 From: jenow Date: Mon, 18 Jun 2018 16:10:01 +0200 Subject: [PATCH 224/363] add header --- .../wrappers/features/step_defs_cpp/steps.hpp | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 internal/wrappers/features/step_defs_cpp/steps.hpp diff --git a/internal/wrappers/features/step_defs_cpp/steps.hpp b/internal/wrappers/features/step_defs_cpp/steps.hpp new file mode 100644 index 00000000..44681e91 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/steps.hpp @@ -0,0 +1,42 @@ +#ifndef _STEPS_HPP_ +#define _STEPS_HPP_ + +#include +#define EXPECT_EQ BOOST_CHECK_EQUAL +#include +#include + +#include "auth.hpp" +#include "collection.hpp" +#include "document.hpp" +#include "index.hpp" +#include "realtime.hpp" +#include "kuzzle.hpp" + +#include "kuzzle_utils.h" + +#include "json_spirit/json_spirit.h" + +using cucumber::ScenarioScope; + +using namespace kuzzleio; +using std::cout; +using std::endl; +using std::string; + +struct KuzzleCtx { + Kuzzle* kuzzle = NULL; + options kuzzle_options; + + string user_id; + string index; + string collection; + string jwt; + + user* currentUser = NULL; + json_spirit::Value_type customUserDataType = json_spirit::null_type; + + bool success; +}; + +#endif \ No newline at end of file From 34578325354e69efd4aa911e95946aba20753c8f Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Mon, 18 Jun 2018 14:59:12 +0200 Subject: [PATCH 225/363] Fix C++ test execution * Fix typos in test scripts * Automatically change the testing kuzzle hostname according to the test execution environment (CI / dev machine) * Add README.md directives Add Continuous Integration with CodePipeline running E2E and Unit Tests for all languages To manually test this branch : - Choose .codepipeline/build*.yml matching your machine architecture and replay all the steps. - Go check CodePipeline last build status and logs on AWS Other : - Fix paths in `internal/wrappers/features/run*.sh` for CI environment. fix kuzzleio/kuzzle-backlog#232 Merge remote-tracking branch 'origin/java-deploy' into test-automation Merge remote-tracking branch 'origin/1.x' into test-automation Merge remote-tracking branch 'origin/java-deploy' into test-automation Merge remote-tracking branch 'origin/1.x' into test-automation Update codepipeline config Fix hostname in step defs c++ Fix Limit resources use fix tests script c++ --- README.md | 28 +++++++++++++++++++ .../{build_cpp_test.sh => build_cpp_tests.sh} | 2 +- internal/wrappers/features/e2e.sh | 3 -- internal/wrappers/features/run_cpp.sh | 4 +-- .../step_defs_cpp/kuzzle-sdk-steps.cpp | 9 +++++- 5 files changed, 39 insertions(+), 7 deletions(-) rename internal/wrappers/{build_cpp_test.sh => build_cpp_tests.sh} (75%) delete mode 100755 internal/wrappers/features/e2e.sh diff --git a/README.md b/README.md index 865a99b8..1abf509b 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,34 @@ You can generate all sdk's at once by typing make all ``` +## Generate wrappers and launch e2e tests using Docker + +You can use Docker to simplify wrappers generation and testing + +### Build + +In project root, use: + +```bash +$ docker run --rm -it --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /build.sh +``` + +This command will build all wrappers using our Docker Image + +### Testing + +E2E tests need a running Kuzzle instance so run the script: + +```bash +$ sh .codepipeline/start_kuzzle.sh +``` + +Now run tests using Docker: + +```bash +$ docker run --rm -it --network codepipeline_default --link kuzzle --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /test.sh +``` + ## License [Apache 2](LICENSE.md) diff --git a/internal/wrappers/build_cpp_test.sh b/internal/wrappers/build_cpp_tests.sh similarity index 75% rename from internal/wrappers/build_cpp_test.sh rename to internal/wrappers/build_cpp_tests.sh index a8dff408..d2ddff0d 100755 --- a/internal/wrappers/build_cpp_test.sh +++ b/internal/wrappers/build_cpp_tests.sh @@ -2,4 +2,4 @@ set -e cmake -E make_directory _build_cpp_tests cmake -E chdir _build_cpp_tests cmake ../features/step_defs_cpp -cmake --build _build_cpp_tests -- -j +cmake --build _build_cpp_tests -- -j2 diff --git a/internal/wrappers/features/e2e.sh b/internal/wrappers/features/e2e.sh deleted file mode 100755 index 67f6a5ed..00000000 --- a/internal/wrappers/features/e2e.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -set -e -sh internal/wrappers/features/run_$1.sh diff --git a/internal/wrappers/features/run_cpp.sh b/internal/wrappers/features/run_cpp.sh index 92287b45..c3f1c36e 100644 --- a/internal/wrappers/features/run_cpp.sh +++ b/internal/wrappers/features/run_cpp.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e cd internal/wrappers -./build_cpp_tests.sh̀ -./_build_cpp_tests/KuzzleSDKStepDefs > /dev/null && +./build_cpp_tests.sh +./_build_cpp_tests/KuzzleSDKStepDefs > /dev/null & cucumber cd - diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index d978a62b..28baed88 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -2,6 +2,7 @@ #define EXPECT_EQ BOOST_CHECK_EQUAL #include #include +#include #include "auth.hpp" #include "collection.hpp" @@ -144,8 +145,14 @@ GIVEN("^Kuzzle Server is running$") ScenarioScope ctx; ctx->kuzzle_options = KUZZLE_OPTIONS_DEFAULT; ctx->kuzzle_options.connect = MANUAL; + std::string hostname = "localhost"; + + if (std::getenv("KUZZLE_HOST") != NULL) { + hostname = std::getenv("KUZZLE_HOST"); + } + try { - ctx->kuzzle = new Kuzzle("localhost", &ctx->kuzzle_options); + ctx->kuzzle = new Kuzzle(hostname, &ctx->kuzzle_options); } catch (KuzzleException e) { K_LOG_E(e.getMessage().c_str()); } From 11788730e10184e250784bf9512e9948f0117e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Tue, 19 Jun 2018 16:23:41 +0200 Subject: [PATCH 226/363] Java e2e index controller (#162) * fixes from pr's comments * fixes from pr's comments * fixes from pr's comments * update swig for travis * update travis.yml * update swig binary in Makefile * update Makefile * update Makefile * update Makefile * update Makefile * update Makefile * update Makefile * update Makefile * update Makefile * run tests in docker * fix makefile * fix cpp build * fix build cpp --- .travis.yml | 8 ++++++-- internal/wrappers/Makefile | 12 ++++++++++-- internal/wrappers/features/index.feature | 6 +++--- .../src/test/java/gradle/cucumber/Documentdefs.java | 4 ++-- .../src/test/java/gradle/cucumber/Indexdefs.java | 8 ++++---- .../src/test/java/gradle/cucumber/Subscribedefs.java | 2 +- internal/wrappers/templates/java/core.i | 2 ++ test.sh | 1 - 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e3892f6..f0582424 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,15 @@ +sudo: true language: go go: - 1.9 dist: trusty +services: + - docker install: - - sudo apt-get install -y build-essential swig oracle-java8-installer g++ python3-dev mono-mcs + - sudo apt-get install -y build-essential swig3.0 oracle-java8-installer g++ python3-dev - go get -t -v ./... script: - - bash ./test.sh + - ./test.sh + - docker run --rm -it --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /build.sh after_success: - cd .cover && bash <(curl -s https://codecov.io/bash) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 0b887f9c..5943f451 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -90,6 +90,8 @@ core_python: core_java core_csharp: core_java +core_cpp: core_java + wrapper_java: $(OBJS) wrapper_python: $(OBJS) @@ -139,6 +141,13 @@ else endif $(SWIG) -Wall -c++ -csharp -namespace Kuzzleio -dllimport kuzzle-wrapper-csharp -outdir $(OUTDIR) -o $(SRCS) $(INCS) templates/csharp/core.i +makedir: +ifeq ($(OS),Windows_NT) + @if not exist $(subst /,\,$(OUTDIR)) mkdir $(subst /,\,$(OUTDIR)) +else + mkdir -p $(OUTDIR) +endif + java: LANGINCLUDE = $(JAVAINCLUDE) java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk java: core_java swig_java wrapper_java java_object @@ -175,9 +184,8 @@ python: core_python swig_python wrapper_python python_object cp -p $(GOTARGETSO) $(OUTDIR) cpp: OUTDIR = $(ROOTOUTDIR)/cpp -cpp: makedir $(CPPSDK) cpp: LANGUAGE = c++ -cpp: core +cpp: makedir core_cpp $(CPPSDK) ar rvs $(OUTDIR)/libcpp$(STATICLIB) $(OUTDIR)/*.o g++ -shared -fPIC -o $(OUTDIR)/libcpp$(DYNLIB) -Wl,--whole-archive $(OUTDIR)/libcpp$(STATICLIB) build/c/$(LIB_PREFIX)kuzzlesdk$(STATICLIB) -Wl,--no-whole-archive diff --git a/internal/wrappers/features/index.feature b/internal/wrappers/features/index.feature index e24c22d0..736f8c72 100644 --- a/internal/wrappers/features/index.feature +++ b/internal/wrappers/features/index.feature @@ -4,9 +4,9 @@ Feature: Index controller Given Kuzzle Server is running And there is no index called 'test-index' When I create an index called 'test-index' - Then the index should exists + Then the index should exist - Scenario: Create should return an error when the index already exists + Scenario: Create should return an error when the index already exist Given Kuzzle Server is running And there is an index 'test-index' When I create an index called 'test-index' @@ -16,4 +16,4 @@ Feature: Index controller Given Kuzzle Server is running And there is the indexes 'test-index' and 'test-index2' When I delete the indexes 'test-index' and 'test-index2' - Then indexes 'test-index' and 'test-index2' doesn't exist \ No newline at end of file + Then indexes 'test-index' and 'test-index2' don't exist \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java index d99f28dc..4deff108 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java @@ -120,7 +120,7 @@ public void the_collection_doesn_t_have_a_document_with_id(String id) throws Exc options.setRefresh("wait_for"); try { - k.getDocument().delete_(world.index, world.collection, id, options); + k.getDocument().delete(world.index, world.collection, id, options); } catch (KuzzleException e) {} } @@ -139,7 +139,7 @@ public void i_replace_a_document_with_id(String id) throws Exception { public void i_delete_a_document_with_id(String id) throws Exception { this.errorMessage = null; try { - k.getDocument().delete_(world.index, world.collection, id); + k.getDocument().delete(world.index, world.collection, id); } catch (KuzzleException e) { this.errorMessage = e.getMessage(); } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java index 38a01d97..9ad484ed 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java @@ -27,7 +27,7 @@ public void there_is_no_index_called(String index) { QueryOptions o = new QueryOptions(); o.setRefresh("wait_for"); - k.getIndex().delete_(index, o); + k.getIndex().delete(index, o); } catch (KuzzleException e) {} } @@ -41,7 +41,7 @@ public void i_create_an_index_called_test_index(String index) throws Exception { world.index = index; } - @Then("^the index should exists$") + @Then("^the index should exist$") public void the_index_should_exists() throws Exception { Assert.assertTrue(k.getIndex().exists(world.index)); } @@ -75,8 +75,8 @@ public void i_delete_the_indexes_test_index_and_test_index(String index1, String k.getIndex().mDelete(v, o); } - @Then("^indexes \'([^\"]*)\' and \'([^\"]*)\' doesn't exist$") - public void indexes_test_index_and_test_index_doesn_t_exist(String index1, String index2) throws Exception { + @Then("^indexes \'([^\"]*)\' and \'([^\"]*)\' don't exist$") + public void indexes_test_index_and_test_index_don_t_exist(String index1, String index2) throws Exception { Assert.assertFalse(k.getIndex().exists(index1)); Assert.assertFalse(k.getIndex().exists(index2)); } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index 410a48ef..53030031 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -80,7 +80,7 @@ public void i_unsubscribe() throws Exception { @When("^I delete the document with id \'([^\"]*)\'$") public void i_delete_the_document_with_id(String id) throws Exception { - k.getDocument().delete_(world.index, world.collection, id); + k.getDocument().delete(world.index, world.collection, id); Thread.sleep(1000); } diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i index 8387b24f..fc7df466 100644 --- a/internal/wrappers/templates/java/core.i +++ b/internal/wrappers/templates/java/core.i @@ -26,6 +26,8 @@ %rename(NotificationContent) notification_content; %rename(SubscribeToSelf) subscribe_to_self; +%rename(delete) delete_; + %ignore *::error; %ignore *::status; %ignore *::stack; diff --git a/test.sh b/test.sh index 0e05e209..09100923 100755 --- a/test.sh +++ b/test.sh @@ -45,7 +45,6 @@ linter_check . linter_check ./internal/wrappers generate_cover_data show_cover_report func -make_wrappers case "$1" in "") ;; From c3367cbe8f9de771f4ea5061b4906a8348816202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Wed, 20 Jun 2018 13:41:17 +0200 Subject: [PATCH 227/363] Java e2e collection controller (#163) * java e2e collection controller * fix from pr's comment * fixes from pr's comments * fixes from pr's comments * fixes from pr's comments * update swig for travis * update travis.yml * update swig binary in Makefile * update Makefile * update Makefile * update Makefile * update Makefile * update Makefile * update Makefile * update Makefile * update Makefile * run tests in docker * fix makefile * fix makefile * fix cpp build * fix build cpp * fix scenario --- internal/wrappers/Makefile | 2 +- internal/wrappers/cgo/kuzzle/collection.go | 19 +-- internal/wrappers/features/collection.feature | 61 ++++++++ .../java/gradle/cucumber/Collectiondefs.java | 146 ++++++++++++++++++ 4 files changed, 215 insertions(+), 13 deletions(-) create mode 100644 internal/wrappers/features/collection.feature create mode 100644 internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 5943f451..2eda7c98 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -158,7 +158,7 @@ java: core_java swig_java wrapper_java java_object mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - - rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class + #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class cp -p $(GOTARGET) $(OUTDIR) cp -p $(GOTARGETSO) $(OUTDIR) diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go index 3e94d2e7..e5fbe05b 100644 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ b/internal/wrappers/cgo/kuzzle/collection.go @@ -77,9 +77,8 @@ func kuzzle_collection_exists(c *C.collection, index *C.char, col *C.char, optio //export kuzzle_collection_list func kuzzle_collection_list(c *C.collection, index *C.char, options *C.query_options) *C.string_result { res, err := (*collection.Collection)(c.instance).List(C.GoString(index), SetQueryOptions(options)) - var stringResult string - json.Unmarshal(res, &stringResult) - return goToCStringResult(&stringResult, err) + s := string(res) + return goToCStringResult(&s, err) } // Mapping @@ -87,15 +86,13 @@ func kuzzle_collection_list(c *C.collection, index *C.char, options *C.query_opt //export kuzzle_collection_get_mapping func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.string_result { res, err := (*collection.Collection)(c.instance).GetMapping(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - var stringResult string - stringResult = string(res) - return goToCStringResult(&stringResult, err) + s := string(res) + return goToCStringResult(&s, err) } //export kuzzle_collection_update_mapping func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.error_result { - newBody, _ := json.Marshal(body) - err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), newBody, SetQueryOptions(options)) + err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCErrorResult(err) } @@ -123,8 +120,7 @@ func kuzzle_collection_search_specifications(c *C.collection, options *C.query_o //export kuzzle_collection_update_specifications func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.string_result { - newBody, _ := json.Marshal(body) - res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), newBody, SetQueryOptions(options)) + res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) var stringResult string stringResult = string(res) return goToCStringResult(&stringResult, err) @@ -132,7 +128,6 @@ func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col //export kuzzle_collection_validate_specifications func kuzzle_collection_validate_specifications(c *C.collection, body *C.char, options *C.query_options) *C.bool_result { - newBody, _ := json.Marshal(body) - res, err := (*collection.Collection)(c.instance).ValidateSpecifications(newBody, SetQueryOptions(options)) + res, err := (*collection.Collection)(c.instance).ValidateSpecifications(json.RawMessage(C.GoString(body)), SetQueryOptions(options)) return goToCBoolResult(res, err) } diff --git a/internal/wrappers/features/collection.feature b/internal/wrappers/features/collection.feature new file mode 100644 index 00000000..418e0e89 --- /dev/null +++ b/internal/wrappers/features/collection.feature @@ -0,0 +1,61 @@ +Feature: Collection management + + Scenario: Create a collection + Given Kuzzle Server is running + And there is an index 'test-index' + When I create a collection 'collection-test-collection' + Then the collection 'collection-test-collection' should exists + + Scenario: Check if a collection exists + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I check if the collection 'test-collection' exists + Then the collection should exist + + Scenario: List existing collections + Given Kuzzle Server is running + And there is an index 'list-test-index' + And it has a collection 'test-collection1' + And it has a collection 'test-collection2' + When I list the collections of 'list-test-index' + Then the result contains 2 hits + And the content should not be null + + Scenario: Truncate a collection + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + And the collection has a document with id 'my-document-id2' + When I truncate the collection 'test-collection' + Then the collection 'test-collection' shall be empty + + Scenario: Create a collection with a custom mapping + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I update the mapping of collection 'test-collection' + Then the mapping of 'test-collection' should be updated + + Scenario: Update specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I update the specifications of the collection 'test-collection' + Then the specifications of 'test-collection' should be updated + + Scenario: Validate specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I validate the specifications of 'test-collection' + Then the specifications of 'test-collection' should be updated + + Scenario: Delete specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And has specifications + When I delete the specifications of 'test-collection' + Then the specifications of 'test-collection' must not exist \ No newline at end of file diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java new file mode 100644 index 00000000..4d048c8c --- /dev/null +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java @@ -0,0 +1,146 @@ +package gradle.cucumber; + +import cucumber.api.java.Before; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import gherkin.deps.com.google.gson.Gson; +import gherkin.deps.com.google.gson.JsonArray; +import io.kuzzle.sdk.Kuzzle; +import io.kuzzle.sdk.NotFoundException; +import io.kuzzle.sdk.QueryOptions; +import io.kuzzle.sdk.SearchResult; +import org.junit.Assert; + +import javax.management.remote.NotificationResult; + +public class Collectiondefs { + private Kuzzle k; + private World world; + private boolean exists = false; + String listCollections; + private boolean validateSpecs = false; + + @Before + public void before() { + k = KuzzleSingleton.getInstance(); + } + + @When("^I create a collection \'([^\"]*)\'$") + public void i_create_a_collection_test_collection(String collection) throws Exception { + k.getCollection().create(world.index, collection); + world.collection = collection; + } + + @Then("^the collection \'([^\"]*)\' should exists$") + public void the_collection_should_exists(String collection) throws Exception { + Assert.assertTrue(k.getCollection().exists(world.index, collection)); + } + + @When("^I check if the collection \'([^\"]*)\' exists$") + public void i_check_if_the_collection_exists(String collection) throws Exception { + exists = k.getCollection().exists(world.index, collection); + } + + @Then("^the collection should exist$") + public void it_should_exists() throws Exception { + Assert.assertTrue(exists); + } + + @When("^I list the collections of \'([^\"]*)\'$") + public void i_list_the_collections(String index) throws Exception { + listCollections = k.getCollection().list(index); + } + + class Col { + JsonArray collections; + } + + @Then("^the result contains (\\d+) hits$") + public void the_result_contains_hits(int nb) throws Exception { + Gson gson = new Gson(); + Col c = gson.fromJson(listCollections, Collectiondefs.Col.class); + + Assert.assertEquals(nb, c.collections.size()); + + } + + @Then("^the content should not be null$") + public void i() { + Assert.assertNotNull(this.listCollections); + Assert.assertEquals("{\"type\":\"all\",\"collections\":[{\"name\":\"test-collection1\",\"type\":\"stored\"},{\"name\":\"test-collection2\",\"type\":\"stored\"}],\"from\":0,\"size\":10}", this.listCollections); + } + + @When("^I truncate the collection \'([^\"]*)\'$") + public void i_truncate_the_collection(String collection) throws Exception { + QueryOptions o = new QueryOptions(); + o.setRefresh("wait_for"); + + k.getCollection().truncate(world.index, collection, o); + } + + @Then("^the collection \'([^\"]*)\' shall be empty$") + public void it_should_be_empty(String collection) throws Exception { + SearchResult res = k.getDocument().search(world.index, collection, "{}"); + Assert.assertEquals("[]", res.getDocuments()); + } + + @When("^I update the mapping of collection \'([^\"]*)\'$") + public void i_update_the_mapping(String collection) throws Exception { + k.getCollection().updateMapping(world.index, collection, "{" + + "\"properties\": {" + + " \"foo\": {" + + " \"type\": \"string\"" + + " }" + + "}" + + "}"); + } + + @Then("^the mapping of \'([^\"]*)\' should be updated$") + public void the_mapping_should_be_updated(String collection) throws Exception { + String mapping = k.getCollection().getMapping(world.index, collection); + Assert.assertEquals("{\"test-index\":{\"mappings\":{\"test-collection\":{\"properties\":{\"foo\":{\"type\":\"text\",\"fields\":{\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}}}}}}}", mapping); + } + + @When("^I update the specifications of the collection \'([^\"]*)\'$") + public void i_update_the_specifications(String collection) throws Exception { + k.getCollection().updateSpecifications(world.index, world.collection, "{\"" + world.index + "\":{\""+ collection +"\":{\"strict\":true}}}"); + } + + @Then("^the specifications of \'([^\"]*)\' should be updated$") + public void the_specifications_of_collection_should_be_updated(String collection) throws Exception { + Assert.assertEquals("{\"validation\":{\"strict\":true},\"index\":\"test-index\",\"collection\":\"test-collection\"}", k.getCollection().getSpecifications(world.index, collection)); + } + + @When("^I validate the specifications of \'([^\"]*)\'$") + public void i_validate_the_specifications(String collection) throws Exception { + this.validateSpecs = k.getCollection().validateSpecifications("{\""+world.index+"\":{\""+collection+"\":{\"strict\":true}}}"); + } + + @Then("^they should be validated$") + public void they_should_be_validated() throws Exception { + Assert.assertTrue(this.validateSpecs); + } + + @Given("^has specifications$") + public void has_specifications() throws Exception { + k.getCollection().updateSpecifications(world.index, world.collection, "{\""+world.index+"\":{\""+world.collection+"\":{\"strict\":true}}}"); + } + + @When("^I delete the specifications of \'([^\"]*)\'$") + public void i_delete_the_specifications(String collection) throws Exception { + k.getCollection().deleteSpecifications(world.index, collection); + } + + @Then("^the specifications of \'([^\"]*)\' must not exist$") + public void the_specifications_must_not_exist(String collection) throws Exception { + boolean notFound = false; + try { + k.getCollection().getSpecifications(world.index, collection); + } catch (NotFoundException e) { + notFound = true; + } + Assert.assertTrue(notFound); + } + +} From cadd72ef8c491650bf4307b35f1935c78d01c0ae Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Wed, 20 Jun 2018 18:08:06 +0200 Subject: [PATCH 228/363] Update Travis CI (#166) * Update Travis CI * Clean test.sh * Process Isolation using Docker images * Include Wrappers E2E Tests * Remove containers kill --- .codepipeline/start_kuzzle.sh | 13 ++++--- .travis.yml | 25 ++++++++----- internal/wrappers/Makefile | 24 ++++++------ internal/wrappers/features/index.feature | 2 +- .../step_defs_cpp/kuzzle-sdk-steps.cpp | 37 +------------------ test.sh | 6 +-- 6 files changed, 37 insertions(+), 70 deletions(-) diff --git a/.codepipeline/start_kuzzle.sh b/.codepipeline/start_kuzzle.sh index 59234a7b..f50fa847 100644 --- a/.codepipeline/start_kuzzle.sh +++ b/.codepipeline/start_kuzzle.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash -set -ex +set -e # Download and launch custom Kuzzle stack -KUZZLE_CHECK_CONNECTIVITY_CMD="curl -o /dev/null http://localhost:7512" docker-compose -f .codepipeline/docker-compose.yml up -d -while ! $KUZZLE_CHECK_CONNECTIVITY_CMD &> /dev/null - do - sleep 2 - done +printf 'Waiting for Kuzzle stack to be up and running' + +until $(curl --output /dev/null --silent --head --fail http://localhost:7512); do + printf '.' + sleep 5 +done diff --git a/.travis.yml b/.travis.yml index f0582424..87dd5dc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,20 @@ -sudo: true language: go -go: - - 1.9 -dist: trusty +sudo: required services: - docker -install: - - sudo apt-get install -y build-essential swig3.0 oracle-java8-installer g++ python3-dev - - go get -t -v ./... -script: +go: + - "1.10" + +before_install: + - sudo sysctl -w vm.max_map_count=262144 + - docker pull kuzzleio/sdk-cross:amd64 + - go get -u ./... + +script: - ./test.sh - - docker run --rm -it --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /build.sh + - docker run -a stdout -a stderr --net host --rm --privileged --name build-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /build.sh + - sh .codepipeline/start_kuzzle.sh + - docker run -a stdout -a stderr --privileged --rm --network codepipeline_default --link kuzzle --name test-machine --mount type=bind,source="$(pwd)",target=/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /test.sh + after_success: - - cd .cover && bash <(curl -s https://codecov.io/bash) +- bash <(curl -s https://codecov.io/bash) diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index 2eda7c98..cfc8064e 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -10,7 +10,7 @@ ifeq ($(OS),Windows_NT) MV = rename CMDSEP = & ROOT_DIR_CLEAN = $(subst /,\,$(ROOT_DIR)) - LIB_PREFIX = + LIB_PREFIX = else STATICLIB = .a DYNLIB = .so @@ -119,7 +119,7 @@ swig: swig_java: ifeq ($(OS),Windows_NT) - @if not exist $(OUTDIR) mkdir $(OUTDIR) + @if not exist $(OUTDIR) mkdir $(OUTDIR) else mkdir -p $(OUTDIR) endif @@ -127,7 +127,7 @@ endif swig_python: ifeq ($(OS),Windows_NT) - @if not exist $(OUTDIR) mkdir $(OUTDIR) + @if not exist $(OUTDIR) mkdir $(OUTDIR) else mkdir -p $(OUTDIR) endif @@ -155,7 +155,7 @@ java: core_java swig_java wrapper_java java_object taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources mv build/java/io/kuzzle/sdk/$(LIB_PREFIX)kuzzle-wrapper-java.so build/io/kuzzle/sdk/resources - mkdir -p $(ROOTOUTDIR)/java/src/main/java + mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class @@ -192,15 +192,15 @@ cpp: makedir core_cpp $(CPPSDK) clean: ifeq ($(OS),Windows_NT) if exist kcore_wrap.cxx $(RM) kcore_wrap.cxx - if exist kcore_wrap.h $(RM) kcore_wrap.h - if exist kcore_wrap.o $(RM) kcore_wrap.o - if exist build$(PATHSEP)c $(RRM) build$(PATHSEP)c - if exist build$(PATHSEP)java$(PATHSEP)src $(RRM) build$(PATHSEP)java$(PATHSEP)src - if exist build$(PATHSEP)java$(PATHSEP)io $(RRM) build$(PATHSEP)java$(PATHSEP)io - if exist build$(PATHSEP)java$(PATHSEP)build $(RRM) build$(PATHSEP)java$(PATHSEP)build + if exist kcore_wrap.h $(RM) kcore_wrap.h + if exist kcore_wrap.o $(RM) kcore_wrap.o + if exist build$(PATHSEP)c $(RRM) build$(PATHSEP)c + if exist build$(PATHSEP)java$(PATHSEP)src $(RRM) build$(PATHSEP)java$(PATHSEP)src + if exist build$(PATHSEP)java$(PATHSEP)io $(RRM) build$(PATHSEP)java$(PATHSEP)io + if exist build$(PATHSEP)java$(PATHSEP)build $(RRM) build$(PATHSEP)java$(PATHSEP)build if exist build$(PATHSEP)python $(RRM) build$(PATHSEP)python - if exist build$(PATHSEP)csharp $(RRM) build$(PATHSEP)csharp - if exist build$(PATHSEP)io $(RRM) build$(PATHSEP)io + if exist build$(PATHSEP)csharp $(RRM) build$(PATHSEP)csharp + if exist build$(PATHSEP)io $(RRM) build$(PATHSEP)io else $(RRM) build/c $(RRM) build/java/src build/java/io build/java/build diff --git a/internal/wrappers/features/index.feature b/internal/wrappers/features/index.feature index 736f8c72..c2f41f0d 100644 --- a/internal/wrappers/features/index.feature +++ b/internal/wrappers/features/index.feature @@ -16,4 +16,4 @@ Feature: Index controller Given Kuzzle Server is running And there is the indexes 'test-index' and 'test-index2' When I delete the indexes 'test-index' and 'test-index2' - Then indexes 'test-index' and 'test-index2' don't exist \ No newline at end of file + Then indexes 'test-index' and 'test-index2' don't exist diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index 28baed88..3d16f748 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -1,40 +1,5 @@ -#include -#define EXPECT_EQ BOOST_CHECK_EQUAL -#include -#include #include - -#include "auth.hpp" -#include "collection.hpp" -#include "document.hpp" -#include "index.hpp" -#include "kuzzle.hpp" - -#include "kuzzle_utils.h" - -#include "json_spirit/json_spirit.h" - -using cucumber::ScenarioScope; - -using namespace kuzzleio; -using std::cout; -using std::endl; -using std::string; - -struct KuzzleCtx { - Kuzzle* kuzzle = NULL; - options kuzzle_options; - - string user_id; - string index; - string collection; - string jwt; - - user* currentUser = NULL; - json_spirit::Value_type customUserDataType = json_spirit::null_type; - - bool success; -}; +#include "steps.hpp" BEFORE() { kuz_log_sep(); } diff --git a/test.sh b/test.sh index 09100923..4a297305 100755 --- a/test.sh +++ b/test.sh @@ -34,17 +34,13 @@ linter_check() { fi } -make_wrappers() { - cd "${dir}/internal/wrappers" - make all -} - cd "$dir" linter_check . linter_check ./internal/wrappers generate_cover_data show_cover_report func + case "$1" in "") ;; From 1388f3d31ec82ad69db5b12e945cf12c35d8e65d Mon Sep 17 00:00:00 2001 From: "Aschen (Adrien Maret)" Date: Thu, 21 Jun 2018 16:57:00 +0200 Subject: [PATCH 229/363] Collection first and second scenario --- internal/wrappers/features/collection.feature | 74 +++++++++---------- internal/wrappers/features/run_cpp.sh | 4 +- .../step_defs_cpp/kuzzle-sdk-steps.cpp | 16 +--- .../wrappers/features/step_defs_cpp/steps.hpp | 3 +- 4 files changed, 42 insertions(+), 55 deletions(-) diff --git a/internal/wrappers/features/collection.feature b/internal/wrappers/features/collection.feature index b667b632..79a9b4b0 100644 --- a/internal/wrappers/features/collection.feature +++ b/internal/wrappers/features/collection.feature @@ -22,40 +22,40 @@ Feature: Collection management Then the result contains 2 hits And the content should not be null - Scenario: Truncate a collection - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - And the collection has a document with id 'my-document-id2' - When I truncate the collection 'test-collection' - Then the collection 'test-collection' shall be empty - - Scenario: Create a collection with a custom mapping - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - When I update the mapping of collection 'test-collection' - Then the mapping of 'test-collection' should be updated - - Scenario: Update specifications - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - When I update the specifications of the collection 'test-collection' - Then the specifications of 'test-collection' should be updated - - Scenario: Validate specifications - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - When I validate the specifications of 'test-collection' - Then the specifications of 'test-collection' should be updated - - Scenario: Delete specifications - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And has specifications - When I delete the specifications of 'test-collection' - Then the specifications of 'test-collection' must not exist + # Scenario: Truncate a collection + # Given Kuzzle Server is running + # And there is an index 'test-index' + # And it has a collection 'test-collection' + # And the collection has a document with id 'my-document-id' + # And the collection has a document with id 'my-document-id2' + # When I truncate the collection 'test-collection' + # Then the collection 'test-collection' shall be empty + # + # Scenario: Create a collection with a custom mapping + # Given Kuzzle Server is running + # And there is an index 'test-index' + # And it has a collection 'test-collection' + # When I update the mapping of collection 'test-collection' + # Then the mapping of 'test-collection' should be updated + # + # Scenario: Update specifications + # Given Kuzzle Server is running + # And there is an index 'test-index' + # And it has a collection 'test-collection' + # When I update the specifications of the collection 'test-collection' + # Then the specifications of 'test-collection' should be updated + # + # Scenario: Validate specifications + # Given Kuzzle Server is running + # And there is an index 'test-index' + # And it has a collection 'test-collection' + # When I validate the specifications of 'test-collection' + # Then the specifications of 'test-collection' should be updated + # + # Scenario: Delete specifications + # Given Kuzzle Server is running + # And there is an index 'test-index' + # And it has a collection 'test-collection' + # And has specifications + # When I delete the specifications of 'test-collection' + # Then the specifications of 'test-collection' must not exist diff --git a/internal/wrappers/features/run_cpp.sh b/internal/wrappers/features/run_cpp.sh index c3f1c36e..12884841 100644 --- a/internal/wrappers/features/run_cpp.sh +++ b/internal/wrappers/features/run_cpp.sh @@ -2,6 +2,6 @@ set -e cd internal/wrappers ./build_cpp_tests.sh -./_build_cpp_tests/KuzzleSDKStepDefs > /dev/null & -cucumber +./_build_cpp_tests/KuzzleSDKStepDefs & +cucumber features/collection.feature cd - diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index 3d16f748..cf97073d 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -125,7 +125,7 @@ GIVEN("^Kuzzle Server is running$") BOOST_CHECK(error == NULL); } -GIVEN("^there is an index '(test-index)'$") +GIVEN("^there is an index \'([^\"]*)\'$") { REGEX_PARAM(std::string, index_name); ScenarioScope ctx; @@ -144,20 +144,6 @@ GIVEN("^there is an index '(test-index)'$") } } -GIVEN("^it has a collection '(test-collection)'$") -{ - REGEX_PARAM(std::string, collection_name); - ScenarioScope ctx; - ctx->collection = collection_name; - - K_LOG_D("Creating collection: %s", collection_name.c_str()); - try { - ctx->kuzzle->collection->create(ctx->index, ctx->collection); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } -} GIVEN("^the collection has a document with id '(my-document-id)'$") { diff --git a/internal/wrappers/features/step_defs_cpp/steps.hpp b/internal/wrappers/features/step_defs_cpp/steps.hpp index 44681e91..cf4516ec 100644 --- a/internal/wrappers/features/step_defs_cpp/steps.hpp +++ b/internal/wrappers/features/step_defs_cpp/steps.hpp @@ -37,6 +37,7 @@ struct KuzzleCtx { json_spirit::Value_type customUserDataType = json_spirit::null_type; bool success; + int hits; }; -#endif \ No newline at end of file +#endif From c4f520c71503cc3673589f3f71ea035dda68c2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Thu, 21 Jun 2018 17:39:17 +0200 Subject: [PATCH 230/363] e2e test of realtime controller in cpp sdk (#168) * wip * wip * wip * wip * wip * wip * wip * wip * realtime e2e cpp * fix memleak * set refs to null * comment content of kuzzle-sdk-steps * fix * fix * fix --- internal/wrappers/cpp/realtime.cpp | 2 +- .../java/gradle/cucumber/Subscribedefs.java | 6 +- internal/wrappers/features/realtime.feature | 10 +- .../step_defs_cpp/kuzzle-sdk-steps.cpp | 445 +++++++++--------- .../features/step_defs_cpp/kuzzle_utils.h | 5 + .../features/step_defs_cpp/realtime-steps.cpp | 115 +++++ .../wrappers/features/step_defs_cpp/steps.hpp | 16 + .../wrappers/headers/sdk_wrappers_internal.h | 2 +- 8 files changed, 373 insertions(+), 228 deletions(-) create mode 100644 internal/wrappers/features/step_defs_cpp/realtime-steps.cpp diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp index 909ebb22..9608f1fc 100644 --- a/internal/wrappers/cpp/realtime.cpp +++ b/internal/wrappers/cpp/realtime.cpp @@ -92,5 +92,5 @@ namespace kuzzleio { bool ret = r->result; kuzzle_free_bool_result(r); return ret; -} + } } diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java index 53030031..621e7903 100644 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java @@ -26,7 +26,7 @@ public void after() { } } - @Given("^I subscribe to \'([^\"]*)\'$") + @Given("^I subscribe to \'(.*)\'$") public void i_subscribe_to(String collection) throws Exception { roomId = k.getRealtime().subscribe(world.index, collection, "{}", new NotificationListener() { @Override @@ -36,7 +36,7 @@ public void onMessage(NotificationResult res) { }); } - @Given("^I subscribe to \'([^\"]*)\' with filter \'(.*)\'$") + @Given("^I subscribe to \'(.*)\' with \'(.*)\' as filter$") public void i_subscribe_with_filter(String collection, String filter) throws Exception { content = null; roomId = k.getRealtime().subscribe(world.index, collection, filter, new NotificationListener() { @@ -47,7 +47,7 @@ public void onMessage(NotificationResult res) { }); } - @When("^I create a document in \"([^\"]*)\"$") + @When("^I create a document in \'([^\"]*)\'$") public void i_create_a_document_in(String collection) throws Exception { k.getDocument().create(world.index, collection, "", "{}"); Thread.sleep(1000); diff --git a/internal/wrappers/features/realtime.feature b/internal/wrappers/features/realtime.feature index 694ef07a..c3a3d562 100644 --- a/internal/wrappers/features/realtime.feature +++ b/internal/wrappers/features/realtime.feature @@ -5,7 +5,7 @@ Feature: Realtime subscription And there is an index 'test-index' And it has a collection 'test-collection' And I subscribe to 'test-collection' - When I create a document in "test-collection" + When I create a document in 'test-collection' Then I receive a notification Scenario: Receive notifications when a document is updated @@ -13,7 +13,7 @@ Feature: Realtime subscription And there is an index 'test-index' And it has a collection 'test-collection' And the collection has a document with id 'my-document-id' - And I subscribe to 'test-collection' with filter '{"equals": {"foo": "barz"}}' + And I subscribe to 'test-collection' with '{"equals": {"foo": "barz"}}' as filter When I update the document with id 'my-document-id' and content 'foo' = 'barz' Then I receive a notification @@ -28,14 +28,18 @@ Feature: Realtime subscription Scenario: Receive notifications when a document is published Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' And I subscribe to 'test-collection' When I publish a document Then I receive a notification Scenario: Stop receiving notification when I unsubscribe Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' And the collection has a document with id 'my-document-id' And I subscribe to 'test-collection' - And I unsubscribe from 'test-collection' + And I unsubscribe When I publish a document Then I do not receive a notification \ No newline at end of file diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index 3d16f748..efa07566 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -1,284 +1,289 @@ #include #include "steps.hpp" -BEFORE() { kuz_log_sep(); } +// Anonymous namespace to handle a linker error +// see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files +namespace { + BEFORE() { kuz_log_sep(); } -GIVEN("^I create a user 'useradmin' with password 'testpwd' with id 'useradmin-id'$") { pending(); } + GIVEN("^I create a user 'useradmin' with password 'testpwd' with id 'useradmin-id'$") { pending(); } -WHEN("^I try to create a document with id '(my-document)'$") -{ - REGEX_PARAM(std::string, document_id); + WHEN("^I try to create a document with id '(my-document)'$") + { + REGEX_PARAM(std::string, document_id); - ScenarioScope ctx; + ScenarioScope ctx; - try { - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); + try { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); + } catch (KuzzleException e) { + BOOST_FAIL(e.getMessage()); + } } -} -GIVEN("^I update my user custom data with the pair ([\\w]+):(.+)$") -{ - REGEX_PARAM(std::string, fieldname); - REGEX_PARAM(std::string, fieldvalue); + GIVEN("^I update my user custom data with the pair ([\\w]+):(.+)$") + { + REGEX_PARAM(std::string, fieldname); + REGEX_PARAM(std::string, fieldvalue); - ScenarioScope ctx; + ScenarioScope ctx; - string data = "{\"" + fieldname + "\":" + fieldvalue + "}"; + string data = "{\"" + fieldname + "\":" + fieldvalue + "}"; - K_LOG_D("Updating user data with : %s", data.c_str()); + K_LOG_D("Updating user data with : %s", data.c_str()); - try { - ctx->kuzzle->auth->updateSelf(data); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); + try { + ctx->kuzzle->auth->updateSelf(data); + } catch (KuzzleException e) { + K_LOG_E(e.getMessage().c_str()); + } } -} -THEN("^the response 'content' field contains the pair ([\\w]+):(.+)$") -{ - K_LOG_I("Checking user content field"); - REGEX_PARAM(std::string, fieldname); - REGEX_PARAM(std::string, expected_fieldvalue); + THEN("^the response 'content' field contains the pair c:(.+)$") + { + K_LOG_I("Checking user content field"); + REGEX_PARAM(std::string, fieldname); + REGEX_PARAM(std::string, expected_fieldvalue); - ScenarioScope ctx; - - json_spirit::Value userContentValue; - std::string userContent = ctx->currentUser->content; - json_spirit::read(userContent, userContentValue); - - json_spirit::write_formatted(userContentValue); + ScenarioScope ctx; - json_spirit::Value fieldvalue = json_spirit::find_value(userContentValue.get_obj(), fieldname); - switch (fieldvalue.type()) { - case json_spirit::str_type: { - std::string s = fieldvalue.get_str(); - K_LOG_D("Field value: \"%s\" of type string", s.c_str()); - BOOST_CHECK("\"" + s + "\"" == expected_fieldvalue); - break; - } - case json_spirit::bool_type: { - auto b = fieldvalue.get_bool(); - string s = b ? "true" : "false"; - K_LOG_D("Field value: \"%s\" of type bool", b ? "true" : "false"); - BOOST_CHECK(s == expected_fieldvalue); - break; - } - case json_spirit::int_type: { - auto i = fieldvalue.get_int(); - K_LOG_D("Field value: %d of type int", i); - string s = std::to_string(i); - BOOST_CHECK(s == expected_fieldvalue); - break; - } - case json_spirit::real_type: { - float f = fieldvalue.get_real(); - K_LOG_D("Field value: %f of type real", f); - float e = std::stof(expected_fieldvalue); - K_LOG_D("Expected value: %f", e); - BOOST_CHECK(f == std::stof(expected_fieldvalue)); - break; + json_spirit::Value userContentValue; + std::string userContent = ctx->currentUser->content; + json_spirit::read(userContent, userContentValue); + + json_spirit::write_formatted(userContentValue); + + json_spirit::Value fieldvalue = json_spirit::find_value(userContentValue.get_obj(), fieldname); + switch (fieldvalue.type()) { + case json_spirit::str_type: { + std::string s = fieldvalue.get_str(); + K_LOG_D("Field value: \"%s\" of type string", s.c_str()); + BOOST_CHECK("\"" + s + "\"" == expected_fieldvalue); + break; + } + case json_spirit::bool_type: { + auto b = fieldvalue.get_bool(); + string s = b ? "true" : "false"; + K_LOG_D("Field value: \"%s\" of type bool", b ? "true" : "false"); + BOOST_CHECK(s == expected_fieldvalue); + break; + } + case json_spirit::int_type: { + auto i = fieldvalue.get_int(); + K_LOG_D("Field value: %d of type int", i); + string s = std::to_string(i); + BOOST_CHECK(s == expected_fieldvalue); + break; + } + case json_spirit::real_type: { + float f = fieldvalue.get_real(); + K_LOG_D("Field value: %f of type real", f); + float e = std::stof(expected_fieldvalue); + K_LOG_D("Expected value: %f", e); + BOOST_CHECK(f == std::stof(expected_fieldvalue)); + break; + } + // TODO: Add obj test case... } - // TODO: Add obj test case... + + ctx->customUserDataType = fieldvalue.type(); } - ctx->customUserDataType = fieldvalue.type(); -} + THEN("^is a string$") + { + ScenarioScope ctx; + BOOST_CHECK(ctx->customUserDataType == json_spirit::str_type); + } -THEN("^is a string$") -{ - ScenarioScope ctx; - BOOST_CHECK(ctx->customUserDataType == json_spirit::str_type); -} + THEN("^is a number$") + { + ScenarioScope ctx; + BOOST_CHECK(ctx->customUserDataType == json_spirit::int_type || ctx->customUserDataType == json_spirit::real_type); + } -THEN("^is a number$") -{ - ScenarioScope ctx; - BOOST_CHECK(ctx->customUserDataType == json_spirit::int_type || ctx->customUserDataType == json_spirit::real_type); -} + THEN("^is a bool$") + { + ScenarioScope ctx; + BOOST_CHECK(ctx->customUserDataType == json_spirit::bool_type); + } -THEN("^is a bool$") -{ - ScenarioScope ctx; - BOOST_CHECK(ctx->customUserDataType == json_spirit::bool_type); -} + GIVEN("^Kuzzle Server is running$") + { + K_LOG_I("Connecting to Kuzzle on 'localhost:7512'"); + ScenarioScope ctx; + ctx->kuzzle_options = KUZZLE_OPTIONS_DEFAULT; + ctx->kuzzle_options.connect = MANUAL; + std::string hostname = "localhost"; -GIVEN("^Kuzzle Server is running$") -{ - K_LOG_I("Connecting to Kuzzle on 'localhost:7512'"); - ScenarioScope ctx; - ctx->kuzzle_options = KUZZLE_OPTIONS_DEFAULT; - ctx->kuzzle_options.connect = MANUAL; - std::string hostname = "localhost"; + if (std::getenv("KUZZLE_HOST") != NULL) { + hostname = std::getenv("KUZZLE_HOST"); + } - if (std::getenv("KUZZLE_HOST") != NULL) { - hostname = std::getenv("KUZZLE_HOST"); + try { + ctx->kuzzle = new Kuzzle(hostname, &ctx->kuzzle_options); + } catch (KuzzleException e) { + K_LOG_E(e.getMessage().c_str()); + } + char* error = ctx->kuzzle->connect(); + BOOST_CHECK(error == NULL); } - try { - ctx->kuzzle = new Kuzzle(hostname, &ctx->kuzzle_options); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); + GIVEN("^there is an index '(test-index)'$") + { + REGEX_PARAM(std::string, index_name); + ScenarioScope ctx; + ctx->index = index_name; + + if (!ctx->kuzzle->index->exists(index_name)) { + K_LOG_D("Creating index: %s", index_name.c_str()); + try { + ctx->kuzzle->index->create(index_name); + } catch (KuzzleException e) { + K_LOG_E(e.getMessage().c_str()); + BOOST_FAIL(e.getMessage()); + } + } else { + K_LOG_D("Using existing index: %s", index_name.c_str()); + } } - char* error = ctx->kuzzle->connect(); - BOOST_CHECK(error == NULL); -} -GIVEN("^there is an index '(test-index)'$") -{ - REGEX_PARAM(std::string, index_name); - ScenarioScope ctx; - ctx->index = index_name; + GIVEN("^it has a collection '(test-collection)'$") + { + REGEX_PARAM(std::string, collection_name); + ScenarioScope ctx; + ctx->collection = collection_name; - if (!ctx->kuzzle->index->exists(index_name)) { - K_LOG_D("Creating index: %s", index_name.c_str()); + K_LOG_D("Creating collection: %s", collection_name.c_str()); try { - ctx->kuzzle->index->create(index_name); + ctx->kuzzle->collection->create(ctx->index, ctx->collection); } catch (KuzzleException e) { K_LOG_E(e.getMessage().c_str()); BOOST_FAIL(e.getMessage()); } - } else { - K_LOG_D("Using existing index: %s", index_name.c_str()); } -} -GIVEN("^it has a collection '(test-collection)'$") -{ - REGEX_PARAM(std::string, collection_name); - ScenarioScope ctx; - ctx->collection = collection_name; - - K_LOG_D("Creating collection: %s", collection_name.c_str()); - try { - ctx->kuzzle->collection->create(ctx->index, ctx->collection); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } -} + GIVEN("^the collection has a document with id '(my-document-id)'$") + { + REGEX_PARAM(std::string, document_id); -GIVEN("^the collection has a document with id '(my-document-id)'$") -{ - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; + ScenarioScope ctx; - try { - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); - } catch (KuzzleException e) { - e.getMessage(); + try { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); + } catch (KuzzleException e) { + e.getMessage(); + } } -} -GIVEN("^the collection doesn't have a document with id '(my-document-id)'$") -{ - REGEX_PARAM(std::string, document_id); + GIVEN("^the collection doesn't have a document with id '(my-document-id)'$") + { + REGEX_PARAM(std::string, document_id); - ScenarioScope ctx; + ScenarioScope ctx; - try { - ctx->kuzzle->document->delete_(ctx->index, ctx->collection, document_id); - } catch (KuzzleException e) { + try { + ctx->kuzzle->document->delete_(ctx->index, ctx->collection, document_id); + } catch (KuzzleException e) { + } } -} -WHEN("^I try to create a new document with id 'my-document-id'$") -{ - REGEX_PARAM(std::string, document_id); + WHEN("^I try to create a new document with id 'my-document-id'$") + { + REGEX_PARAM(std::string, document_id); - ScenarioScope ctx; - ctx->success = true; - try { - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); - } catch (KuzzleException e) { + ScenarioScope ctx; ctx->success = true; + try { + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); + } catch (KuzzleException e) { + ctx->success = true; + } } -} -THEN("^I get an error with message 'document alread exists'$") -{ - ScenarioScope ctx; - BOOST_CHECK(ctx->success == false); -} + THEN("^I get an error with message 'document alread exists'$") + { + ScenarioScope ctx; + BOOST_CHECK(ctx->success == false); + } -GIVEN("^'test-index'/'test-collection' does't have a document with id " - "'my-document-id'$") -{ - pending(); -} + GIVEN("^'test-index'/'test-collection' does't have a document with id " + "'my-document-id'$") + { + pending(); + } -THEN("^the document is successfully created$") -{ - ScenarioScope ctx; - BOOST_CHECK(ctx->success == false); -} + THEN("^the document is successfully created$") + { + ScenarioScope ctx; + BOOST_CHECK(ctx->success == false); + } -GIVEN("^there is an user with id '([\\w\\-]+)'$") -{ - REGEX_PARAM(std::string, user_id); - ScenarioScope ctx; - ctx->user_id = user_id; -} + GIVEN("^there is an user with id '([\\w\\-]+)'$") + { + REGEX_PARAM(std::string, user_id); + ScenarioScope ctx; + ctx->user_id = user_id; + } + + GIVEN("^the user has 'local' credentials with name '([\\w\\-]+)' and password " + "'([\\w\\-]+)'$") + { + REGEX_PARAM(std::string, username); + REGEX_PARAM(std::string, password); + ScenarioScope ctx; -GIVEN("^the user has 'local' credentials with name '([\\w\\-]+)' and password " - "'([\\w\\-]+)'$") -{ - REGEX_PARAM(std::string, username); - REGEX_PARAM(std::string, password); - ScenarioScope ctx; + kuzzle_user_create(ctx->kuzzle, ctx->user_id, username, password); + } - kuzzle_user_create(ctx->kuzzle, ctx->user_id, username, password); -} + WHEN("^I log in as '([\\w\\-]+)':'([\\w\\-]+)'$") + { + REGEX_PARAM(std::string, username); + REGEX_PARAM(std::string, password); + ScenarioScope ctx; -WHEN("^I log in as '([\\w\\-]+)':'([\\w\\-]+)'$") -{ - REGEX_PARAM(std::string, username); - REGEX_PARAM(std::string, password); - ScenarioScope ctx; - - string jwt; - try { - jwt = ctx->kuzzle->auth->login("local", get_login_creds(username, password)); - K_LOG_D("Logged in as '%s'", username.c_str()); - K_LOG_D("JWT is: %s", jwt.c_str()); - } catch (KuzzleException e) { - K_LOG_W(e.getMessage().c_str()); + string jwt; + try { + jwt = ctx->kuzzle->auth->login("local", get_login_creds(username, password)); + K_LOG_D("Logged in as '%s'", username.c_str()); + K_LOG_D("JWT is: %s", jwt.c_str()); + } catch (KuzzleException e) { + K_LOG_W(e.getMessage().c_str()); + } + ctx->jwt = jwt; } - ctx->jwt = jwt; -} -THEN("^the retrieved JWT is valid$") -{ - ScenarioScope ctx; - token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); - BOOST_CHECK(v->valid); -} + THEN("^the retrieved JWT is valid$") + { + ScenarioScope ctx; + token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); + BOOST_CHECK(v->valid); + } -THEN("^the retrieved JWT is invalid$") -{ - ScenarioScope ctx; - token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); - BOOST_CHECK(!v->valid); -} -WHEN("^I logout$") { + THEN("^the retrieved JWT is invalid$") + { ScenarioScope ctx; - ctx->kuzzle->auth->logout(); -} + token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); + BOOST_CHECK(!v->valid); + } + WHEN("^I logout$") { + ScenarioScope ctx; + ctx->kuzzle->auth->logout(); + } -WHEN("^I get my user info$") -{ - ScenarioScope ctx; + WHEN("^I get my user info$") + { + ScenarioScope ctx; - try { - ctx->currentUser = ctx->kuzzle->auth->getCurrentUser(); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - } + try { + ctx->currentUser = ctx->kuzzle->auth->getCurrentUser(); + } catch (KuzzleException e) { + K_LOG_E(e.getMessage().c_str()); + } - K_LOG_D("current user = 0x%p", ctx->currentUser); - K_LOG_D("Current user content: %s", ctx->currentUser->content); + K_LOG_D("current user = 0x%p", ctx->currentUser); + K_LOG_D("Current user content: %s", ctx->currentUser->content); + + BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, "Failed to retrieve current user"); + } - BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, "Failed to retrieve current user"); } diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h index 8b6eb381..04aabf1e 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h +++ b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h @@ -1,3 +1,6 @@ +#ifndef _KUZZLE_UTIL_HPP_ +#define _KUZZLE_UTIL_HPP_ + #include #include #define TXT_COLOR_RESET "\e[0m" @@ -45,3 +48,5 @@ std::string get_login_creds(const std::string &username, void kuzzle_user_create(kuzzleio::Kuzzle *kuzzle, const std::string &user_id, const std::string &username, const std::string &password); + +#endif \ No newline at end of file diff --git a/internal/wrappers/features/step_defs_cpp/realtime-steps.cpp b/internal/wrappers/features/step_defs_cpp/realtime-steps.cpp new file mode 100644 index 00000000..3cb65528 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/realtime-steps.cpp @@ -0,0 +1,115 @@ +#include "steps.hpp" + +// Anonymous namespace to handle a linker error +// see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files +namespace { + + GIVEN("^I subscribe to \'(.*)\'$") { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + ctx->listener = new CustomNotificationListener(); + + try { + ctx->room_id = ctx->kuzzle->realtime->subscribe(ctx->index, collection_id, "{}", ctx->listener); + } catch (KuzzleException e) { + BOOST_FAIL(e.getMessage()); + } + } + + WHEN("^I create a document in \'([^\"]*)\'$") { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + query_options options = {0}; + options.refresh = (char *)"wait_for"; + + try { + ctx->kuzzle->document->create(ctx->index, ctx->collection, "", "{\"foo\":\"bar\"}", &options); + } catch (KuzzleException e) { + BOOST_FAIL(e.getMessage()); + } + } + + THEN("^I receive a notification$") { + ScenarioScope ctx; + sleep(1); + BOOST_CHECK(ctx->notif_result != NULL); + ctx->kuzzle->realtime->unsubscribe(ctx->room_id); + delete ctx->listener; + delete ctx->notif_result; + ctx->notif_result = NULL; + ctx->listener = NULL; + } + + GIVEN("^I subscribe to \'([^\"]*)\' with \'(.*)\' as filter$") { + REGEX_PARAM(std::string, collection_id); + REGEX_PARAM(std::string, filter); + + ScenarioScope ctx; + + ctx->listener = new CustomNotificationListener(); + + try { + ctx->kuzzle->realtime->subscribe(ctx->index, collection_id, filter, ctx->listener); + } catch (KuzzleException e) { + BOOST_FAIL(e.getMessage()); + } + } + + WHEN("^I update the document with id \'([^\"]*)\' and content \'([^\"]*)\' = \'([^\"]*)\'$") { + REGEX_PARAM(std::string, document_id); + REGEX_PARAM(std::string, key); + REGEX_PARAM(std::string, value); + + ScenarioScope ctx; + + try { + ctx->kuzzle->document->update(ctx->index, ctx->collection, document_id, "{\""+key+"\":\""+value+"\"}"); + } catch (KuzzleException e) { + BOOST_FAIL(e.getMessage()); + } + } + + WHEN("^I delete the document with id \'([^\"]*)\'$") { + REGEX_PARAM(std::string, document_id); + + ScenarioScope ctx; + + try { + ctx->kuzzle->document->delete_(ctx->index, ctx->collection, document_id); + } catch (KuzzleException e) { + BOOST_FAIL(e.getMessage()); + } + } + + WHEN("^I publish a document$") { + ScenarioScope ctx; + + try { + ctx->kuzzle->realtime->publish(ctx->index, ctx->collection, "{}"); + } catch (KuzzleException e) { + BOOST_FAIL(e.getMessage()); + } + } + + GIVEN("^I unsubscribe$") { + ScenarioScope ctx; + + try { + ctx->kuzzle->realtime->unsubscribe(ctx->room_id); + ctx->notif_result = NULL; + delete ctx->listener; + } catch (KuzzleException e) { + BOOST_FAIL(e.getMessage()); + } + } + + THEN("^I do not receive a notification$") { + ScenarioScope ctx; + + BOOST_CHECK(ctx->notif_result == NULL); + } +} \ No newline at end of file diff --git a/internal/wrappers/features/step_defs_cpp/steps.hpp b/internal/wrappers/features/step_defs_cpp/steps.hpp index 44681e91..2edb1ed6 100644 --- a/internal/wrappers/features/step_defs_cpp/steps.hpp +++ b/internal/wrappers/features/step_defs_cpp/steps.hpp @@ -24,6 +24,8 @@ using std::cout; using std::endl; using std::string; +class CustomNotificationListener; + struct KuzzleCtx { Kuzzle* kuzzle = NULL; options kuzzle_options; @@ -33,10 +35,24 @@ struct KuzzleCtx { string collection; string jwt; + string room_id; + user* currentUser = NULL; json_spirit::Value_type customUserDataType = json_spirit::null_type; bool success; + + notification_result *notif_result = NULL; + CustomNotificationListener *listener; +}; + +class CustomNotificationListener : public NotificationListener { + public: + virtual void onMessage(notification_result *res) const { + ScenarioScope ctx; + + ctx->notif_result = res; + } }; #endif \ No newline at end of file diff --git a/internal/wrappers/headers/sdk_wrappers_internal.h b/internal/wrappers/headers/sdk_wrappers_internal.h index 13fc5a31..00f12f5f 100644 --- a/internal/wrappers/headers/sdk_wrappers_internal.h +++ b/internal/wrappers/headers/sdk_wrappers_internal.h @@ -43,4 +43,4 @@ static bool kuzzle_filter_query(kuzzle_queue_filter f, const char *rq) { return f(rq); } -#endif +#endif \ No newline at end of file From d587a0aebb54049108c5675c659d591ef6433a7b Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Fri, 22 Jun 2018 10:07:58 +0200 Subject: [PATCH 231/363] KZL-114 : [C++] Index controller tests (#167) * KZL-114 : [C++] Index controller tests * Add regexp * Put index steps in separate file * Add BOOST_FAIL in exceptions --- .gitignore | 2 + internal/wrappers/Makefile | 4 +- internal/wrappers/features/index.feature | 6 +- .../features/step_defs_cpp/index-steps.cpp | 106 ++++++++++++++++++ .../step_defs_cpp/kuzzle-sdk-steps.cpp | 25 +---- .../features/step_defs_cpp/kuzzle_utils.h | 2 +- 6 files changed, 120 insertions(+), 25 deletions(-) create mode 100644 internal/wrappers/features/step_defs_cpp/index-steps.cpp diff --git a/.gitignore b/.gitignore index 5a4cbf08..f98808c9 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ _build*/ build/ kcore_wrap.cxx kcore_wrap.h + +internal/wrappers/kcore_wrap\.o diff --git a/internal/wrappers/Makefile b/internal/wrappers/Makefile index cfc8064e..9a5bf355 100644 --- a/internal/wrappers/Makefile +++ b/internal/wrappers/Makefile @@ -152,12 +152,12 @@ java: LANGINCLUDE = $(JAVAINCLUDE) java: OUTDIR = $(ROOTOUTDIR)/java/io/kuzzle/sdk java: core_java swig_java wrapper_java java_object #rm -rf $(OUTDIR)/kcore_wrap.o $(OUTDIR)/libkuzzlesdk.a $(OUTDIR)/libkuzzlesdk.so - taskset -c 1 $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java + $(JAVA_HOME)/bin/javac $(OUTDIR)/*.java mkdir -p $(ROOTOUTDIR)/io/kuzzle/sdk/resources mv build/java/io/kuzzle/sdk/$(LIB_PREFIX)kuzzle-wrapper-java.so build/io/kuzzle/sdk/resources mkdir -p $(ROOTOUTDIR)/java/src/main/java ln -sf $(ROOTOUTDIR)/java/io/kuzzle/sdk/* $(ROOTOUTDIR)/java/src/main/java/ - cd build/java && taskset -c 1 sh gradlew sourcesJar jar javadocJar && cd - + cd build/java && sh gradlew sourcesJar jar javadocJar && cd - #rm -f $(OUTDIR)/*.java $(OUTDIR)/*.class cp -p $(GOTARGET) $(OUTDIR) cp -p $(GOTARGETSO) $(OUTDIR) diff --git a/internal/wrappers/features/index.feature b/internal/wrappers/features/index.feature index c2f41f0d..325237ad 100644 --- a/internal/wrappers/features/index.feature +++ b/internal/wrappers/features/index.feature @@ -14,6 +14,6 @@ Feature: Index controller Scenario: Delete multiple indexes Given Kuzzle Server is running - And there is the indexes 'test-index' and 'test-index2' - When I delete the indexes 'test-index' and 'test-index2' - Then indexes 'test-index' and 'test-index2' don't exist + And there is the indexes 'test-index1' and 'test-index2' + When I delete the indexes 'test-index1' and 'test-index2' + Then indexes 'test-index1' and 'test-index2' don't exist diff --git a/internal/wrappers/features/step_defs_cpp/index-steps.cpp b/internal/wrappers/features/step_defs_cpp/index-steps.cpp new file mode 100644 index 00000000..cba90e77 --- /dev/null +++ b/internal/wrappers/features/step_defs_cpp/index-steps.cpp @@ -0,0 +1,106 @@ +#include "steps.hpp" + +// Anonymous namespace to handle a linker error +// see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files +namespace { + + GIVEN("^there is no index called \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, index_name); + ScenarioScope ctx; + + try { + ctx->kuzzle->index->delete_(index_name); + } catch (KuzzleException e) { + K_LOG_E(e.getMessage().c_str()); + BOOST_FAIL(e.getMessage()); + } + } + + GIVEN("^there is an index \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, index_name); + ScenarioScope ctx; + ctx->index = index_name; + + if (!ctx->kuzzle->index->exists(index_name)) { + K_LOG_D("Creating index: %s", index_name.c_str()); + try { + ctx->kuzzle->index->create(index_name); + } catch (KuzzleException e) { + K_LOG_E(e.getMessage().c_str()); + BOOST_FAIL(e.getMessage()); + } + } else { + K_LOG_D("Using existing index: %s", index_name.c_str()); + } + } + + GIVEN("^there is the indexes \'([^\"]*)\' and \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, index_name1); + REGEX_PARAM(std::string, index_name2); + ScenarioScope ctx; + + try { + ctx->kuzzle->index->create(index_name1); + ctx->kuzzle->index->create(index_name2); + } catch(KuzzleException e) { + K_LOG_E(e.getMessage().c_str()); + BOOST_FAIL(e.getMessage()); + } + } + + WHEN("^I delete the indexes \'([^\"]*)\' and \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, index_name1); + REGEX_PARAM(std::string, index_name2); + ScenarioScope ctx; + + std::vector v; + + v.push_back(index_name1); + v.push_back(index_name2); + + try { + ctx->kuzzle->index->mDelete(v); + } catch(KuzzleException e) { + K_LOG_E(e.getMessage().c_str()); + BOOST_FAIL(e.getMessage()); + } + } + + WHEN("^I create an index called \'([^\"]*)\'$") + { + + REGEX_PARAM(std::string, index_name); + ScenarioScope ctx; + + K_LOG_D("Creating index: %s", index_name.c_str()); + try { + ctx->kuzzle->index->create(index_name); + ctx->index = index_name; + } catch (KuzzleException e) { + ctx->success = false; + K_LOG_E(e.getMessage().c_str()); + } + } + + THEN("^the index should exist$") + { + ScenarioScope ctx; + BOOST_CHECK(ctx->kuzzle->index->exists(ctx->index)); + } + + THEN("^indexes \'([^\"]*)\' and \'([^\"]*)\' don't exist$") + { + REGEX_PARAM(std::string, index_name1); + REGEX_PARAM(std::string, index_name2); + ScenarioScope ctx; + + BOOST_CHECK( + !ctx->kuzzle->index->exists(index_name1) && + !ctx->kuzzle->index->exists(index_name2) + ); + } +} diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index efa07566..b3acf08e 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -128,25 +128,6 @@ namespace { BOOST_CHECK(error == NULL); } - GIVEN("^there is an index '(test-index)'$") - { - REGEX_PARAM(std::string, index_name); - ScenarioScope ctx; - ctx->index = index_name; - - if (!ctx->kuzzle->index->exists(index_name)) { - K_LOG_D("Creating index: %s", index_name.c_str()); - try { - ctx->kuzzle->index->create(index_name); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } - } else { - K_LOG_D("Using existing index: %s", index_name.c_str()); - } - } - GIVEN("^it has a collection '(test-collection)'$") { REGEX_PARAM(std::string, collection_name); @@ -206,6 +187,12 @@ namespace { BOOST_CHECK(ctx->success == false); } + THEN("^I get an error$") + { + ScenarioScope ctx; + BOOST_CHECK(ctx->success == false); + } + GIVEN("^'test-index'/'test-collection' does't have a document with id " "'my-document-id'$") { diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h index 04aabf1e..d56dc386 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h +++ b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h @@ -49,4 +49,4 @@ void kuzzle_user_create(kuzzleio::Kuzzle *kuzzle, const std::string &user_id, const std::string &username, const std::string &password); -#endif \ No newline at end of file +#endif From 570a7e83ccba37a6d6ffefa5685dc6c00f3a9416 Mon Sep 17 00:00:00 2001 From: "Aschen (Adrien Maret)" Date: Fri, 22 Jun 2018 16:39:35 +0200 Subject: [PATCH 232/363] Add steps for collection --- internal/wrappers/features/collection.feature | 74 ++++---- internal/wrappers/features/run_cpp.sh | 2 +- .../step_defs_cpp/collection-steps.cpp | 161 +++++++++++++++++- .../step_defs_cpp/kuzzle-sdk-steps.cpp | 46 ++--- .../wrappers/features/step_defs_cpp/steps.hpp | 1 + 5 files changed, 214 insertions(+), 70 deletions(-) diff --git a/internal/wrappers/features/collection.feature b/internal/wrappers/features/collection.feature index 79a9b4b0..9a06b2f4 100644 --- a/internal/wrappers/features/collection.feature +++ b/internal/wrappers/features/collection.feature @@ -22,40 +22,40 @@ Feature: Collection management Then the result contains 2 hits And the content should not be null - # Scenario: Truncate a collection - # Given Kuzzle Server is running - # And there is an index 'test-index' - # And it has a collection 'test-collection' - # And the collection has a document with id 'my-document-id' - # And the collection has a document with id 'my-document-id2' - # When I truncate the collection 'test-collection' - # Then the collection 'test-collection' shall be empty - # - # Scenario: Create a collection with a custom mapping - # Given Kuzzle Server is running - # And there is an index 'test-index' - # And it has a collection 'test-collection' - # When I update the mapping of collection 'test-collection' - # Then the mapping of 'test-collection' should be updated - # - # Scenario: Update specifications - # Given Kuzzle Server is running - # And there is an index 'test-index' - # And it has a collection 'test-collection' - # When I update the specifications of the collection 'test-collection' - # Then the specifications of 'test-collection' should be updated - # - # Scenario: Validate specifications - # Given Kuzzle Server is running - # And there is an index 'test-index' - # And it has a collection 'test-collection' - # When I validate the specifications of 'test-collection' - # Then the specifications of 'test-collection' should be updated - # - # Scenario: Delete specifications - # Given Kuzzle Server is running - # And there is an index 'test-index' - # And it has a collection 'test-collection' - # And has specifications - # When I delete the specifications of 'test-collection' - # Then the specifications of 'test-collection' must not exist + Scenario: Truncate a collection + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And the collection has a document with id 'my-document-id' + And the collection has a document with id 'my-document-id2' + When I truncate the collection 'test-collection' + Then the collection 'test-collection' shall be empty + + Scenario: Create a collection with a custom mapping + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I update the mapping of collection 'test-collection' + Then the mapping of 'test-collection' should be updated + + Scenario: Update specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I update the specifications of the collection 'test-collection' + Then the specifications of 'test-collection' should be updated + + Scenario: Validate specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + When I validate the specifications of 'test-collection' + Then they should be validated + + Scenario: Delete specifications + Given Kuzzle Server is running + And there is an index 'test-index' + And it has a collection 'test-collection' + And has specifications + When I delete the specifications of 'test-collection' + Then the specifications of 'test-collection' must not exist diff --git a/internal/wrappers/features/run_cpp.sh b/internal/wrappers/features/run_cpp.sh index 12884841..5968a536 100644 --- a/internal/wrappers/features/run_cpp.sh +++ b/internal/wrappers/features/run_cpp.sh @@ -3,5 +3,5 @@ set -e cd internal/wrappers ./build_cpp_tests.sh ./_build_cpp_tests/KuzzleSDKStepDefs & -cucumber features/collection.feature +cucumber cd - diff --git a/internal/wrappers/features/step_defs_cpp/collection-steps.cpp b/internal/wrappers/features/step_defs_cpp/collection-steps.cpp index a019cdc7..32b32cbb 100644 --- a/internal/wrappers/features/step_defs_cpp/collection-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/collection-steps.cpp @@ -3,7 +3,8 @@ // Anonymous namespace to handle a linker error // see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files namespace { - WHEN("^I create a collection \'([^\"]*)\'$") { + WHEN("^I create a collection \'([^\"]*)\'$") + { REGEX_PARAM(std::string, collection_id); ScenarioScope ctx; @@ -15,7 +16,8 @@ namespace { } } - THEN("^the collection \'([^\"]*)\' should exists$") { + THEN("^the collection \'([^\"]*)\' should exists$") + { REGEX_PARAM(std::string, collection_id); ScenarioScope ctx; @@ -23,7 +25,8 @@ namespace { BOOST_CHECK(ctx->kuzzle->collection->exists(ctx->index, collection_id) == true); } - WHEN("^I check if the collection \'([^\"]*)\' exists$") { + WHEN("^I check if the collection \'([^\"]*)\' exists$") + { REGEX_PARAM(std::string, collection_id); ScenarioScope ctx; @@ -31,15 +34,19 @@ namespace { ctx->success = ctx->kuzzle->collection->exists(ctx->index, collection_id); } - THEN("^the collection should exist$") { + THEN("^the collection should exist$") + { ScenarioScope ctx; BOOST_CHECK(ctx->success == true); + + ctx->success = false; } GIVEN("^it has a collection \'([^\"]*)\'$") { REGEX_PARAM(std::string, collection_name); + ScenarioScope ctx; ctx->collection = collection_name; @@ -52,4 +59,150 @@ namespace { } } + WHEN("^I list the collections of \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, index_name); + + ScenarioScope ctx; + + ctx->content = ctx->kuzzle->collection->list(index_name); + + json_spirit::Value collectionsList; + json_spirit::read(ctx->content, collectionsList); + json_spirit::Value field_value = json_spirit::find_value(collectionsList.get_obj(), "collections"); + + ctx->hits = field_value.get_array().size(); + } + + GIVEN("^the collection has a document with id \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, document_id); + + ScenarioScope ctx; + + query_options options = {0}; + options.refresh = (char*)"wait_for"; + + ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); + } + + WHEN("^I truncate the collection \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + query_options options = {0}; + options.refresh = (char*)"wait_for"; + + ctx->kuzzle->collection->truncate(ctx->index, collection_id, &options); + } + + THEN("^the collection \'([^\"]*)\' shall be empty$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + search_result *result = ctx->kuzzle->document->search(ctx->index, collection_id, "{}"); + + BOOST_CHECK(result->total == 0); + + kuzzle_free_search_result(result); + } + + WHEN("^I update the mapping of collection \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + std::string mapping = "{\"properties\": {\"gordon\": {\"type\": \"keyword\"}}}"; + + ctx->kuzzle->collection->updateMapping(ctx->index, collection_id, mapping); + } + + THEN("^the mapping of \'([^\"]*)\' should be updated$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + std::string mapping = ctx->kuzzle->collection->getMapping(ctx->index, collection_id); + std::string expected_mapping = "{\"" + ctx->index + "\":{\"mappings\":{\"" + collection_id + "\":{\"properties\":{\"a\":{\"type\":\"text\",\"fields\":{\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}},\"foo\":{\"type\":\"text\",\"fields\":{\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}},\"gordon\":{\"type\":\"keyword\"}}}}}}"; + + BOOST_CHECK(mapping == expected_mapping); + } + + WHEN("^I update the specifications of the collection \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + std::string specifications = "{\"" + ctx->index + "\":{\""+ collection_id +"\":{\"strict\":false}}}"; + + ctx->kuzzle->collection->updateSpecifications(ctx->index, collection_id, specifications); + } + + THEN("^the specifications of \'([^\"]*)\' should be updated$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + std::string specifications = ctx->kuzzle->collection->getSpecifications(ctx->index, collection_id); + std::string expected_specifications = "{\"validation\":{\"strict\":false},\"index\":\"" + ctx->index + "\",\"collection\":\"" + collection_id + "\"}"; + + BOOST_CHECK(specifications == expected_specifications); + + ctx->kuzzle->collection->updateSpecifications(ctx->index, collection_id, "{\"" + ctx->index + "\":{\""+ collection_id +"\":{\"strict\":true}}}"); + } + + WHEN("^I validate the specifications of \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + std::string specifications = "{\"" + ctx->index + "\":{\"" + collection_id + "\":{\"strict\":true}}}"; + + ctx->success = ctx->kuzzle->collection->validateSpecifications(specifications); + } + + THEN("^they should be validated$") + { + ScenarioScope ctx; + + BOOST_CHECK(ctx->success == true); + + ctx->success = false; + } + + GIVEN("^has specifications$") + { + ScenarioScope ctx; + + std::string specifications = "{\"" + ctx->index + "\":{\""+ ctx->collection +"\":{\"strict\":true}}}"; + + ctx->kuzzle->collection->updateSpecifications(ctx->index, ctx->collection, specifications); + } + + WHEN("^I delete the specifications of \'([^\"]*)\'$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + ctx->kuzzle->collection->deleteSpecifications(ctx->index, collection_id); + } + + THEN("^the specifications of \'([^\"]*)\' must not exist$") + { + REGEX_PARAM(std::string, collection_id); + + ScenarioScope ctx; + + BOOST_CHECK(ctx->kuzzle->collection->getSpecifications(ctx->index, collection_id) == ""); + } } diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp index b3acf08e..9efb167a 100644 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp @@ -128,34 +128,6 @@ namespace { BOOST_CHECK(error == NULL); } - GIVEN("^it has a collection '(test-collection)'$") - { - REGEX_PARAM(std::string, collection_name); - ScenarioScope ctx; - ctx->collection = collection_name; - - K_LOG_D("Creating collection: %s", collection_name.c_str()); - try { - ctx->kuzzle->collection->create(ctx->index, ctx->collection); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } - } - - GIVEN("^the collection has a document with id '(my-document-id)'$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - try { - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}"); - } catch (KuzzleException e) { - e.getMessage(); - } - } - GIVEN("^the collection doesn't have a document with id '(my-document-id)'$") { REGEX_PARAM(std::string, document_id); @@ -273,4 +245,22 @@ namespace { BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, "Failed to retrieve current user"); } + THEN("^the result contains (\\d+) hits$") + { + REGEX_PARAM(unsigned int, hits); + + ScenarioScope ctx; + + BOOST_CHECK(hits == ctx->hits); + + ctx->hits = -1; + } + + THEN("^the content should not be null$") + { + ScenarioScope ctx; + + BOOST_CHECK(ctx->content != ""); + } + } diff --git a/internal/wrappers/features/step_defs_cpp/steps.hpp b/internal/wrappers/features/step_defs_cpp/steps.hpp index fdb14574..3c4b9de8 100644 --- a/internal/wrappers/features/step_defs_cpp/steps.hpp +++ b/internal/wrappers/features/step_defs_cpp/steps.hpp @@ -42,6 +42,7 @@ struct KuzzleCtx { bool success; int hits; + string content; notification_result *notif_result = NULL; CustomNotificationListener *listener; From f9dff1d3b1c9b3cc2ec86ac78b640062d08d50d5 Mon Sep 17 00:00:00 2001 From: "Aschen (Adrien Maret)" Date: Mon, 25 Jun 2018 15:35:03 +0200 Subject: [PATCH 233/363] add running specific feature file --- .github/pull_request_template.md | 4 ++-- internal/wrappers/README.md | 3 +++ internal/wrappers/features/run_cpp.sh | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 2078aa12..b6246ca4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,5 +1,5 @@ @@ -11,7 +11,7 @@ ## What does this PR do ? - + -## What does this PR do ? +## What does this PR do? zJLd&vVqLkmS4BiD*$uoMxW|#zjBghEf zY->VN$QZ=^kVjRrBuRBO*WSJ83fY8tAsg0l4|WlN_+nr@QSG@h*@8frYlEN-HPD1+ z`FI;aELzQa!+P+#7Fls+gknx*QCm{g5+etHEy7SQ-sm`bL zwSRn%Ds>`0Jvt3wc^|bBgeU3=7VV5E<*_Ayi3`&gb4>};7jbO~>k2#SC-UZ-<|FbZ zCtJ(4BHSioFh5ygXChtqJE9%|&2LvypvyG_ojC$K5#Nm$GlRfFAz&!ziu#lJ9lvlI zYb^vLI>Ha82K^5rjx#8+u;f+3wO2^a&)NI6*69k5C21dTc} z|1>T$_9>GhO>y;W_Sku|#_@vr4IPuqrXQV64;y?B8=V-bN4yKm8K>tHh{Cn&8>^O= zc4$5sO!;ntp4|fv{Jk3R{JpN$NHuA`e*io@_d4j68wf-i^V=#Q6X~%&DSu77!sv8bj+L-tmN`f&~!4M zn zNlj=wAdNpZP58T$EAVUF#aA@U+-K6A*kA3l#>ix~@x#qtw%wrIM9b=fF}v_f++UJ^ zjV|eBP`wwrg2)xtCs3Ud6k)2d24r)UXXm=u-mE~L;ZkZ`o+?lr)}?$r>V@$3xInMV z6Pme_r%TnQ`C7TpH!CB4@4=&Kk1nJVMzt+&i}p1_&+n^jvM;X2j4!U1ek?N%QnXJ` z$_wzG%1U1rV#6nHzO@Ljo8UWhVm{-d5$Z2=>6+yx-n(rIE8z_bzSyRf{l+p9KP}WX zURd?s^C2jaA6osgRg~^2AY3p+guC8LBb-c>||BvcYtTmjhlS=k&c39kJgP}vh<5m z#DK|O@2;kt))IjF$7dpS%y~7#-#%g(I(VYl$YQEOo^rz%D)BopnuLe$N>WIu>DPRy?#93>CyCkM<1{ADA#8~Vq92si`*Ew}%}xc={9A`JgX2x0h- zWDiH+{)f@=zkm!nn$am~IY!!MIVNe@5vh5($&tM;Unb~A#^stI|ALbMf9ro`ngEq{ z|B-3(_dmg8Vr%t30!ZS9?~-|e*A5lne)KP%ZGZc5A>+SAkC?cMIM~?%(G*!Ldo$qm z!ySmP{3ouGr1}qkdH6`W=5V{J%|FQd1+J_7X~L2))0V>Js58HZ%y1X&3{wz93Ih5z z^O@MEe-m%TvTkU_DJD1G869qL`&_oU9Bix$1O$9QIfj#i!=4>2aiH|ZfD%q6Jqmkq z6M7Ls5{dyl2kv#X%)$?DN)WWyFC78%fYa-rMl};+W7Zz9QeS;nPqMZ9)LvmrN2V^m z=gnP(n(*|UxVBk&=rt@5Ng6HJUp#szFDjY3ZGJlxc2+W9Y8}6C`pmgJq7qF~uh6CB zTqhz&7-}0#bF)v=8*>?N!N}JfV_W+5fZJlmO$?BXq$HTBZw?QtmYT6)oadt-j(%id z*$OhU(eD}W-GpYr=sZeH!mXqYJ>?E;rm-?**7vLPGHCDm`loKlvErB~n=&k@`pnRZ zGk+A?mH125Zf%4$PP?#dDUg3n442XEu14ITac^fZFV)v$2N-u-OcI5Cl}hE3+#y23 zjrf|10+{Qd0-RHdhK`Mk&WEs_IVs3z2qWg9zU}b{iMYEgPJMrwG435_?$G6GeD+Ep zXc>j8rl$#u90d8 zR8uVCY+Xh&oxWhQN+~=4Ra~9?*E4*4EOvM{hBUclsIpVY(gw`+ zsVdH){1;k>tc}{9UkVB#`6`~@!xAed<6*ftsSk061kwiuil3x!c z>V_?U-HUE}4Km9D5xzs9`OCNeS-JmNivNx8{qIFtrLLoa4+Q(GF{6_x!M7ahWFY`Eia6a#=vSjmD34{Uan&@^(KaL~Sjp7T}ZlmY8!PGYq_P z=a7Gka6k=*Pwy(7JtMU zTx*@E3Ye}euE4*y7UCeL359bC(kdubZN^mDb&aH5dQBg21p0~Xi!Q55V{#}}TK;hD zt(PmZbVw7IqqzuvIPLpJt3%GF@I&aE`}u z=0|I<1WxVh$pm{ca;v%}S3rkL> zo0ZEdY@*Z4w3Fd!m*_J1?Xp?djlPILD%l1@lXC{wd5i9f4Ux>Rs2yM*vbRUBV;`2f zJ9|}oL>6~216K(b4pmC388BkJ#U}@i_0>!EZULU>z7NNo-tx7NuTXo|_E<=B`B_ok zS_nm-C-wTBNj%v4Ux9o%d#rgMyc(s-Zh8H^X48%zQh>Tycc76iE^b3A>UDIKM?Cg* zRTMQzH1|j0_xy0Qfc%K1pGt#WFmi*S*%76~rNSvjx#Avg%~6+va&!pA(Y!b6)GJe_-2G1@o=K0G zrw~{iXTF6@{p5x794aZ~pXj0r0?dUkb?4JIKCLS`6mm%3cCEV!Hz-lA&7SHFo@3Fj zE;vw43#o-|3q^le_=EKsCsao_0V}oZk7pv@E+>rB@6|Rf?WI6`sjh7ZNrA?Mjm zxf}P|`jJ}>P|4FhXBr!pFmmU62q5cx>ZA7))CK!Q@AX`qeZf+KT`BvDs`&(Y#!cv( zn(x+Q24F_qXsHHa+=U~7@nvs)wYACF{Wj7O{G2?EC-rL8jR*gRv{@a{8z|61_lIha z0AgVm32I?iGy)0AL*E-wIM*%WyZr1WYu{cxd8(DR4Vj~Y(TfGeS7~$_;gu+4 zTXFbJ7#LE}PhlDoUZ*SZ(`kY3!JK&L?#LIoB8;2X1{bQFK@UN#{_06K!dJc<$F3CS!f+xY8?03k& z2DA*$?9oY4X9rW(58Fw@*FC|@a>4L@D`-|8yOqi4N}k8C|MfcB{jX5Q5jom;QTlDIRR~(-v%F1?P)AptH3e=Z|MM?&fAxLX&FMI8E9sTCx`UPqWVFC?qiPdOT zY+Wq4hx;(7gfHkNFF=8~49F(*ephuub&mx=gvxN6L#XAzyJrlL7el#XSQQLo7|IGxw|yk_`!be_nV0k;E*cX( zHiQaRi}fR1ug+iRlh+t+IkkN2jSfc84fT-YS^eW>5r{TUv+j%hf0?PMAtVuSfltK( z_*8&W%D)ah|MXP;GQC7A$;tE!qWH}&49?Y*Q%{kx!-?0((Ml>|fWg6Tv>dnFN`0+g zPyFCS{s0L`Y?aG{_$iE?oaNPU3CsdJd_2YP;hQ9MCCo(2q)>scM$FrUFR|@?OQhZI z#;IQB+82WLAyn`(2CIQX<%t~&3BXG$YYS!z!k5ZR9pRu}n}ffwk!co3d@%8&-F-S~Fzqd@`dZac6XMtZNmTjU zl=x5oUxj}v^(=KA4|HG`rb0|($6Z0QoOQ;AD}=S1(-zbgqG_>alC+@{3$bD?4xW`w zm2C}=csym=8u+?D0PP4{IjYT=<9lWCBrV8hH^$QsRs;yzID_qcp$&DBWvg zB{NpqD0N`(E~5NQqKPmb!Vr-{SPX5U1k@wwh>Hc;CflylCsVr0>#I1FE=N@1FKbN@ zCH>*Az>X-_t7C`tIrSJSR}o>rs&8m6!iFyxI?5|m&#TYJJa1d2uC zUL9Q&YQbBR4pVgmMakovWd~u;<#i z4VhX{@xQ|4f6j;)zNBb9YQ=|X3N=_Pgf!4{pu|mf4K`sJ?T%SLhg9Igl9zoqgj)ES zLJlfGTJF~NP_p1Adwso^^v&~A#lP2H>z6~PDS5JbHBN_?f#IX6*w>qMAYrIUbtdAO zwn|qWzEYcW{^rVx`kFHlRMHILO;H1*aaHdu(fdFp2-yHPlBrymL$NxJqDArL!Si^+H z)VFdA-FI|mK9~BQb>OEhDKzA3twArhZ!t+Q#!v6EhipA{M<@$Sf>Qgr4S9Rt7$-=B zEt&1tq@bGXXrP$!XnjgrmGC;P$VPk8{Wo*B`08@%S2uNDUXSZHt7Mv|YRT}E3;1E) z#iWf#R;r*1RW3Kas&(Tz$LZ%e5B;PB%W@vbxPo-*q6^ilN|YPJ*#pboi;UuJukPBfA zD2pP(`WqcN0jfbJ4Qp>yAvYcG?4PWY-q?#s#&Nf#ll~I;eQ#aK{$RB47*dh~cKE3+F-?Q%V{b>dz(36dJ*lD1p;Wv;FZ zqRF#EE-xXNE^RL&>`@Hr#eJ&`c6p%X(Y%|KGOsyBrop`i=D)#P8BwBT-+AhG@r_H1ajPoqlC0pc1&p%uBN0#b) z^pDjnws|zUV=#q+j1SXqB~k|sfkCH`4~NKU(6=^`(}1`>nK=ZYEpP+%2b$pJrIFF;P~hEhPn5D!-QzJ#Rd4{)Y8QP&0= z_BelO1Byn@ zKoi;jH1Y|J68c;4p4g{llQz8jetWo$$dn=mgjg^7Z}(CLD=?{hM@HW7VQ4D4?T-An z0>tJUr|+I%!zf`eBBCKjw)V|ic2%jh!*Z+AdKWem)K-M6ZseB2bWUl-`fsqV0V0!cR%56K-%{izCQQ zuqaDQxRtYutBRZP zKfe8U!sdYbsXV$8%Ex4LZ7qW$%9jmPx}yP4 zkWFxO#4kUtbAH6`h~ONaVbNo?hsHe}j%TKEZ>FVXrSSoAl6NSQKr`5?xD2ZwGM2&g z@wUTZMr-ISWIOzeQBo)@j5~qhu(15H(s5UkzfDkS0ph1k>TmWhu%EB@JQ` z>TSi$t~Y}*bY&GnSdqxQL;8WndSE*15m_pH z$9^fcKRcmL6nwP$B2c}}<6#?by?7rKsryCsqwLJ ze=T;$RN*6lBjB0F+8uT0C1Rq}BB<$lc;$=FJ<0JfQHm30EqA&sg-NSW3wP<|Gz8PM>Jxd$)RlO5u27E$yScHz zA14qe4&n4-=2eN?4bVb0dk>IJYYJ(yfHTGAdXGJ6XlT<&OAB1rI(lK-Wq0Z`UDrK% zxRz-dd&dhTCoo7t2^f!USjWVV`baIf=p2mm)aA`o{AVLh6;MW^z(^btE^`;7Z`PAy zC`}D`4J=Sjp+^{Ixk>uE>lAHLcgY&U#7Yq9N1|W_TMAVW35AcSelQ=BGKQmchJltV zbnkze^F3crR|@|&<3sk|?^scj8e`dkqOQ9k@aEW4^;R zmw>}epDDY5kCz8pc(ld;$YKU^?M+ zems4sBF0ReVAXfD6QHKYeWztCxn37~zG;S&6XlWfg^faE?MtuAOl`ByW^;#y?<(n- z;YgKZ$vB_RNgm7b3`OWN2194mWa#V|)BYzGfV1x%a0D;A8QPMy8 z=WFK!*GScUQSEHoKJ8Nj1~F}_pH$=yY7mmY&0`TW;Ykg+K`~bn?WXRI4CG=ac5**| zVT~fRfDLZGxbVh2&129pX`Qf8$4V1}(t2)>7h___ghz<1yFJm zb)t(DTQg7PRzhZ#%`tt&Jy6&nbPeA1NHWSl7yXr`K{^?`EmETYiHwMDHxMA#!oaw0 zs9(jubjzoIFj+mnPp&8)*p+HE{6L(@C#H;yv20;_On#1P1s9E*MJPBO%_MpDvphFv z<6ZL4=;4u3#-AlDXH$IpcJf#iK@utYfO#hk|{z)s`~j2Yqm|6XqY z(TRl3%pIJ8i6j5E71^nvYhd`>*E>2jSV|%$HCq-6kuZgTe34RwpKC$;VVB5RYWLMh zPUEMZMMD`dUO40f{@W~)_F(fS&n(kB@jGf(_Ah)9=0L<4ws&WPNxuv3DZhuchQ}IU zQ$iHP1Cok<&#+jtvi52243EUs(vwHZfa(rn#wh$Y4K-2g;ZGvn{W8=mNQ!h!c2Nw6-y=xAlkgMQp;n`IhsDNLrcjfqr526Ym5fA z9bsGTJkQE%(Y3+|J7Ygt0cyY4$Z|nj&W@cuh`}o%>cLf%8d3Ejm+$v6KYV|!6^7k> zJ-mYLIy+aFA&%3KJ-v40$l`+QNBm1?dU=^Rhgu`Udg(zs1KY;jFJE-%ZfmtrSG|v; z)ik7RQD^82Fgf_w;xd2m7Q$FpNj1v>F8T~z*_eW15WvtSMN)@WNtWv^Uk19IHv28Y zwEqLkuvmkY8jYMNQjEKidFUFPype1#&BkGCe;jW@l<}<|WX4m%E*&JLEsJOeg{mX+ zBQ9%p`~_Yt;%(V9Ij#a>W8oG(6-0#t&JHxRW?lJ2yZMqvj#}eFiNLBeu2qp(y?ASQ zhD&_e$lx5kh$E8#{JwJxU_^bmrcvvWSK&Q468nme&{NTi<9G!xi z%&NjsZs>D?fn&SI#<92MPAduEzAHkpJ4ITZ4zp@HoN;1$U;Aj6f2y@Ey;)yoT{$Ow zr)^3ww6c5|;gH9wJ?+NZp~NayNSrzKEUXs``WSbq8KI&yo3r#;!H`HZ7&nKn*4vju)9<*BOh7mmu#(tK#|C4A_ zN%tZ&`!69EfqQBC4|v}?Ph;qh9LtOTusI@Z8(UCtTU1bYBI0{-Qrl$C&boZzDVK5FX4ouZ+T!b>!Sso#I`O9deKCT+uHEPPCCB$vqh7b}m1?EaDwv?70Hw5fgiox3mc zO0iogzg@f#cUUq982UoXK6P)lLGKM@ZUX)lw(M?(E$0I^&IRCpMg0GAhKLxsm`T~Y znAy8nxdP*hRDjwudkf%H>u3bz9sXywbdk!c{j4Ag->L2zR2ZNUQBhS}I=4;ftDg{! z5`?I51O}*bd6z>%^zvvO-D=qr<_9TL2gVQR-)sRPt&=P2C~_o{G^3MePvdFayVoU` zmjWQAyENd00|@GK@qK)5Ym0R?eUyZlgldEw09O?rR!bHN>3wv7=_(-{psCvR_w7h4 zQ-{e$3vI$>JGgz0qe8h4fh<%_;Z*JHLDvyim!mK4u*)<&@3E$xhwmUCQ7cjKv=hO0 zlikH@5L&jo-V`fCEV7*ulC2e*`*>Df`AdRN*HwfJ4L-sPNrw{tYtaR*z+v$O;aF5$ z^s{7}2=|2+iC#(d-8iUuY^>z6VvIOKrOS_Zu}@Wmph4flwdw2cprrm~?cO4YIzE2G zif`EL{niTFNXS&u4z~)3a$r^&-GI5w#U-+G*{Li~@N3y}4b4(8$7%_VXn1pG)0mNSMNtbXqfydnD`XI+KT7laJ>1yP296NHJ{ zUs2h`d9xB?T6bxbd1c(w6S)~u$($f%qu(qYMyBJ6*s6lg*s2p8L_sP^k(=n)`?$PB zk0_RXo7@9MZC(+TS5@|@OW2A#glm~38)}AY9hjG5F1?!Ny-?wmIF8 zyuf~uejq&v`(Q8jWpm&;rIp)mV`=TF`~O7>=b+2oy$J;ZQi}?t`2SxDRK^~d?*8}5 z?(c0+#ns5w?C&$)y5{lUfXB~H&hrr09yA(F#i*GX&UN@87|`JpgIftcfdI>sMCs$C>8fy!80c8 zkg}s^mFea|M$8lU7iC9ZevP!JT;C~J{j`k@V8bdSohapsN{KV7;7`5WqFMt-o@TN& z>|6`Jc?ZA!m%0#bVmZtEDshF_{Gk;Nz4g-6Wb5SU6az}dBW;w{1G4;T1Sf2

Qox z0`xkkAPQweAlfOtBr;PCpCyY@I(B}_q2#9zd3W%J|3eWKpVLA(TO z5%Zf>!cM)^YQ?&n@bvEeMq7qf)_Rqe86vho+bO6^&4TNMJrCK9V`zKRuXfd8M5%~s`9IYm95q_DwQl# zw{#U3?nojDov=wtw2sQ^BnoussoxlxR&D21ZG+h=hHHPRxddwfoNLfm=2*#>S;;QV z!b3X2P@Y~tG@ zEsv?a$avqb z!A;+xKmVyOCP2?u_M?6ro!|6p3hE1XWYaW#CmFc3%s^$13Jd-mV|FHKD;5_gD8=oL zv9{Lt);bu_WV&2XT749?b+HvE@zDP45=p1BaTTD|Ujs_}Pptcu-!Z)p9f!fEsGcW0 zNI*A-;X6d73JsXdwnqOVLo}*B?BqJxV>?b(wQd&e?en)d{)G}U1e&OCD|aImZ`3H6ub*NDlQpCW z7Fvb22s61l4U30fGmyZE_9%KpbX?j2jtpKREvCcg;qd6)+bMk%rMajuBY7%4@T_MqDUPcc-On;3{h}TDaHHiD8llM)Y zenv30d7+wIdgsx!>bknt{ArjL-`i3>%>zm7b1aEWPdW0}Dn`+tNiz|#nDU#_Mw2GC zF??~VSmm`iB5JmNJnfW{;S|zFTxex&mW5Oa^r*W%uJM>*pmo=TO24r~ap-AG@Z^z& z@ag%!NpczPaLM}v-G7twO{k8Y@*^M&%;gdP$@biw`0`qQ$SNmi*8mkopTL?V(*&}c zBLjqsFZ6T@g5&L+aa)+Qr61|;9SRLU@j)Cb*v4VnqP&h-Cqz$)nB3x)s@C4u!g%pM zEyb*^R3|r3{4MKBUPH?(D8W81Y2Wi>?d83MZ{MQ=!DaVyWJQG-->ZYzQh6mm-2RAr zwJeG0GKJdfJyLuoeXc_f?Ancb`$9pUO=9Ebr%&VtFna#h@=(gm!2vLt`(x|`>{9<} z;LQAwbHwG{$}BQEX-KrBUk$h+Oe|hb=vXisNt!NgrwZ!qNZKii4fNz~AIrU&Cthe& z52`m1Pr}7=!w75=OcL=4TjSp2n8D(|{FJg?rBNVX+2cqF#nR*srLf3GN^A4tb~jU^ zw^00dk6n`pHdS@eyf=nvnjNK@PwmDHX|tg8hQda*<{Z&cN~6kAkK*PmYn!Yzdc&qo zZRN_;yI>xRqWF|ahf0Yk&#(p9mfqqvcEXjhG7XuCqJKPLZjihSvsrMYmv?GtZtpBC zygaAfZLcR?ncPb{QqRN2JsWmcosmDIY;l(-I{^F9WE4l-zK$g{sJwQ;rCrzj0d1cdA`jz{$1?pXrG=acA{?JbGvy(oh&ivO9cX;@g)xX}$b5Kq948PdDBiJbiYt zR0vER&T`jt{Dj;JtKbTgsy#L^0Zs{7FHT^NL1-580djJX)=Wk;e1aj-1UzILng@P` zgo%F__Zz9(sqT9~vJ}FxsRdQtC%d@`Y#?J>qrJisrL;3PxBXf$=g6%%F_Kn$wT!uy>CK@uaU z0F>zhy{(7o7W{}c*oBRdoE}3X9G68iyzT}{29wew58xymHl3&f zuKG?e$hb&uX*2Ki=|a54*X&bX`B`dyny*-oDJu~g-4!B*9?~JIa+lH+$w8>&CeB|M zHvac;C8+@GF9lftZ_OM3ZT2pD_C|l3H&!SuSWnBsak1EK_1KA#TB#1nPbCna#xZ|L zpr$O$`yj6vKXAO9!cL#;+Jqw2C99vUJ7z+5)ek$x)ON(BhmLXEvqt zE!l_#8jiyN2{>H4nZuoy$hkMW7~ZA(&|1LI{Yc%}K>^G0u+8Mhn>+&O@;9PmZ+CBO zd<`V`uQ_1;u#fK2XLP6rV;~bO>TAn7O zQMZ>EM(ELT)0mClcC7IkY##L4t!cV?uT^+Uv(ezz;AQS!p56^|2ln2^-NffhZ58{8k5t*V zK`^yH?32h(0seh<&w7XO%$Z1y)w53NfD`s^S{ugGPuHN8_N`V=MyaLW6}=7_9keUc zvywH`bHX{CBFadUFYkPsYx=p;Pq^#j9gMo|hCtf!oZMZ6X~|VEMT>W)6bPXLuT2Ap zJ%ZZk@$w9(`$o7^Iy-RnM@|Xu={|tY$Y&YlR*My=zA-==mW?tW$O31Vktg8KK&8c| zt&F3QqchlLNVw7JK-*T|@o?4G%0i>wMA$*6Ho#wB=#~XnqUXjFR}?T@Q0ZC4cK~uy zai|eukdf#KcZjRHEmS(8y5K?=Gy&|vDh_o+kTdxq`%T@zMMso0AuN*p|hGHue ztCRZL7%~=DgK+i8FgEJPi?!01K5?H;fX!C`Y@X$J)=Gca{L9sQqSC)S;ohgSlXA>x zl|!Cx$o0kf70i=VQyK_; z&K^)rtR@yP*;m_RzF|SzbaP7PBWHUc?&b|#+I6n2Hfgbm;0k9HKrS{`Z4Dakb4dY*Nn57C#) z=ECn}*Y1u~%pvL}>{5-!9ou<#23Q+=AWl%|Fh%D`@94AW$~9{*_^6gdOv_vO&i4#0 zi>d7wf0OY^@!GR6z5U_yf%%@H zb_*}SllSF=(a5w$dA9WgP&+VDPtU-lb%--Yg=2F}3b)WP0VEyFbgc;K0!u_p1{4rl zuT+SIC>2yD51g9c>`p3T&p2+oQL(5e|2W(B$-NV`5TnJLPXMj)X95zlFc(T zV;*6TyX^>C`K+kBi4bGJ>i#^BW(A^ z2R?pZE|5he!8_?UlcB|w%_0M@^j3}-P=KiErPlGVW3{%4&fPv#IAO4uW)`Fs%HdX0 z4uXay5=!}E#1_g(zlx6i4*S=UAd|qct{89ztmyBuO26J4`s1zm+aQoAuk}+_iK|wv z)>%rbE^X5#f=rmq8cBx`-;@{04=R@PmRT(5WWZS2n1skDm#0`Jkoy++K0nNb`4v30 znKSlSX6s(oFqg~Iu@@rhE)gMy+y%s!B#=XC5lrSbcUrKR$z_rHy{EXWQk4a zmmK_S-=qaodySWOuo0Yn0BnhzJa^IL{EV%fVr%SpfN3d4*xzu`(i-(9^dQMw_P_=J3AAf)c! zAse)jx9GXO<_2en3`Uh-2z8`DF&5mVd9kgOIN~Y#PHsnmFyg$b8z^Yy(D02 zoKEp6SSnKeg4dW0^j?V;Nn5Msgfom9_Ra|-8Eq(DM2}Po zznRFri~2Y@(7*&=g{uWLz>v=P+NbkQ%-4S*!O-i6?^~ojVUXKfh^9Jb%7Ug488T`; zw%)u^R7wXUN^k!Ch~9-yz2O91qMVV+)k#Se#gDM&Z-nT)& z`UYdx9f?)jAU1d0MkwkmwszZ9x^9G4YoBv2mCTx!u*`eK7){fT)5EE;*$DjXHpwDf z+B>rK9jC1zCQ1Bc10wytMU7r7OkgF~_?uGdw*u+T705iMs*&&Kw3bSnqm-`FrA}vr z!W%guPH=rNWM0$5a=0G^P$m1Q?MNLmXp%Z3rbRtARBplpqpfO+n%Hn7vqA5C%b-Qp z+eQD1+DQj-rcg*QeYitDz0(!Y!KC7r^cItL6*ZnfuNh6R}}T(~1u5O?VNB zazm$B2ZzJRrqkk@@!TD{k*wqsa-1eO`MW5waLvX58*vi*Apt}OUQ@w(Q1@!D(UW>e zcO0zH`fRacvP`=RNHEB@r>%OdxQEbG=|2&qN@3-lQ4o9cuW<6K2YgR3sl()d2)fvc z^ksPGL6UJVNL3_`?cQoV;vZTJcT;DI>_PSo?%u7+8!E%x9~O@p)qhSD8#35D$v7(K zI6H7FIw1XofP_Jo4t<=rHzC9K+?pUdAhr){`9xQE^SUL8+nAY5f+8iU;k}(35!A}5 zm!^M^MqQWaj~5xVnv+C0ya7h81TgadkGbxzefOD);{eG3q$gwNrNF|#Fj-_Od}ULz z8YDP=@sNU0v3OxgT0-}CLj^Eu&V#2(x0Rm<)4@G1UWXF*)%qk{j5g%S*Y$OeJ? zrF-59F#A3AL1aYzc$qfI_b6}LRCM2~8=I9THdQ0E{)ZU}7FdO>e;(H)(3iSoVHkG|S#aj2Tq z13192TLHUM^uIHq{rjM;u=Z28^GTWv3EBa)vBW`cSytEb%bhW8nkXY3-V(wH_O-Kb zkP}(sZUe(T&)sG?G50O_tqA(K)qYg?c>VH6H#`}x6q z^DW3M^$!}RaP~A_2mO^0sqR|=y3Sp>BC03%Qygt*H(XbIm%!HvtsA@`B>Z=aS*)YC zBhe6n2D$h$SNia^wYS>hGET4Ig|KlNT5>U(35bGx_ujl-I|9FIiUn z%A!qX4=Gi_*^Yx@ek2!es9RP$&WoWkyKoO_s3fM*-ZWPXC|6kr#%W@9iJ6;+K=B8_ zgLBgb&2+wc=YH{yfsSfL79Qm*NZAv+`Eg?!%5~Vh$RK}sRimWG^2(=ISXblie3Gsm zkK2$-;pwf)lq+C2v?v$rk~-@{_#m}iJ}PhSt9AF`&k?MvcWSmHaa$jN`&g7=<{wAR zNZ3fLv?YO6KfWer;3IoQUMtDBm|b|oLr4eVAU1OGL+}d=m5|f}Yjo!b6}I*bgVH1ubk21&MUkV)QN7<&uymkUFE>r< zRJC!XLc#MB*=_8uo-W;Fba(JOkRc)8K>If?}tg%gm)QkX(fIQa|paNyJ8fcJnWvT2Uz|@W^8=TE8K%hO4V={C$dIW zk<_T%6h2)427`Bs0W+9r@(4Pvw#;mAk!7(6hSdultQxeDKf*0j9hHq63p&l*E(FHq zl~K*c=h162i{3RX9UFFpLROYIRdmX|o1R3iy^YjVKc=N{?5{iTVIC(6EOWfq@NLSw zX(u)6dvXRcHYKWnVf9zj!?PJ-8WU%! zdEZM6*bp}($=xSOM%u!x2^BAKOZfSc!}MT;t8+GqQSzI5X>Z1-J85T-mVmxY<0e^& z7~XF%qlW1*u9!0frNO=uAfZ7yv-Y6Y*;5X@{vO#^|7xb1f=&>p>&?AtPz(}mu9AG+ zz|9w;ukfOIUX0b>>nJ9vB|CHsz+>vFxdQ5rvAY&;vA40ZJ@E0nI_}!cuNc>j zSfe|EQlVpN8lnf%3D(b?beq9Cc!v}_9kvVOKl6CnmZr&i#72Zag{PpMy*G}v??HyN zO8&AaWQrqa{}nGEUv*xlXQ8qs4naxzP?UxmT=QK4?m>78a}pL0&=Q;c3^)#t!f1&S za(5yxVC4v$X(0N*9uQ{#cWj(`#rCG-Fy;-80sV-kOj z2GWhcO2{(!nHJH6m|ycyyR3e(1*Lpu%Di-DmI<$Ds$;f-TjN3dA?wU(@|vonx3EIX zvO;F{Y?*^0Rg9YWI(pgRlx^)M)8_linWXm9eri4t%5Z%1yno}DEvqY6k$yKOSQ2ZhtlABUwteQ;g#Dy+(+fYbu;gkjV3cE;=xrY2}c4kOd}3t7r&sENjgXy znUD)|0haHPGcN6??4{G-@)Q3IDSjGyXcsp%y_+6S;$Vc0b1NIKkL6@vL;TH&G9EN7 z!BoD~ATT2@UmJydh+b;QsXQ08fM3Lau_Rtxs?@Q(n71U!?Nv#xN`dkTB@}L{v|2f~ zgd>}hv_frR+Ls-@{0!_EqclpDX?LgXu=nMP?v+pj=2soU@eGc2WSy|LF$`+MaHO@1 zhDpSL?PBePnGXhy870Ohpxc%^nZ#OSu?|iPxTCMka)~2?Ex#DWTfP}^Gp|*Or+N($ zQ6$-*5s=d@(4Fi4GY2wjvX^gYIPH`g;WZpM7$N}#q!p%7H-OJ%`!2m`J3J?&cy|* z5T_-Ly24xvz21zOCgLSfhT}vAfoj*h`pQiA69$4zq^jA&u)cD-qqJjDjvT#D=(ROt zD`W%1>hrz84DCcI9d^@6MUhmk8W?HsTx`teYYH#gQ21=SvA-eIHqgLB&GnUAAMu_5 zhMo$13J`_-s2Yn01^OamS(fznfc$a!R1(H;*&bty{za2&E=b0lC_ z%Vjwk`jnU}N?NVHPDWvp(0-JcnKYG6Qh#}3(WtM1l$&EKP}dD(!(@PWm8E$}?9QLS z`NQCgQ-+k0SGzeeYrAE?tH*G^c+~!3-FUc{y4k0MjiyZnpTtjL z381SjY6g#q`z-qOVTxHSg;*tz&@|R@ zbd<#4L`k4$XfR3evmym5l>K0ejVsGDFsJt0>nQEKmyeC%{8MAi_D_t0IFy7QY4g-n z*$FU?>hw$S?UfVN+v&=N-w2r(;tEv2<~B`zshv9{vDDNLdT{+P9!98t*glCKUPD*c zqphqt*%2Vls{*U$`>20h>&v0hlUialwQWKswd1Mh?w@ax?Z#WBTMn)@-DnuW*N>;M zVH~ss-kIoe(1U}Z!hM!y8iL+XL+S6M#faI!ejL(TSO=|o7xF|tkSf|x?e#X0bh(yg z>p(Vw%Re_n;~=SfZFO#@P@mpona|<`%Ski&e!|2jR0Q;6xol8{U8AU#^wb9#&B+7# zFQZX!D6nbNT1;be>MZr)NcW1__de&zjTwb~`!Z-7WkDm4pF{!gn`r3Jap-PQM>E@r zEtY#WVi#wgfC=2Vi2}^BNerB=P)oDU%s;gcZ<2n2jh#PeEkKPh&SCM{xw7IxXc4{r<4&%*uV_Gv8Q+3Qhh%eVQI1h(0MS(iKGBXp@ z6JVyswUL`@^?^OSq*zJitjTufqqxBRw!Q#$?Drtd7;gdU#Nm*4Mi!epVqr>5$U&Oa zDx`Tb==O!0LY8$mGYyNqdv?$sY1`^oAJd?WeZb5M-Rt{QDKQwf%?mHfFM8pjTuNKu z7o8$CEe4$I+wroMqnh}r8MYbh^YK^)m4ZA`8qw`*J*DF{V49W0-o5*5CuTLUw*!4# zr>QGXH0V%>g7BeW@*(i+snwxfE1t_hCK*TkJoJ(gf>UXGAraOGZ{L=Z)JR8}tY#%UPMNjFrCF~oCZ!m7FJr`mg`l^aM7h@ij z`rIV83S-NA9C9XNDn-Ar-F~HH!LY(76AzC39mvBsLOCR7 z)+%U0;re8Yg>L1nrq@oAMq3p_M-?*+HGLz+$oU%8<*UZKYIchR6de_7?}31DT)og`sIzEIud*k%-vx2vN1K0@Qi6W~ z;UFffX2pQKL3I%%fMh_*&1>f}4%qGC$Lhu6icketpd5QtG+F3A4P?SeuaZ7zx=X@~ zCKHk-Uuxd{n%SPr6hL+phIOEJb*hED6U0d^Gf{%Li{Nq2Kunl+&fV_G58vOaEOL3k50-xR_JxGz3#Y-H5vu<;srb1&&Y@gH4W^p5(6H zYqP+udfjjY@l`EIZ?#>cWi#mhN(45K5!Y}hT)iK^XQYGtXo??=q#HAZ5cqwZ{YJyvsQjT;hwxjKG~P+9F4rG?~i9wQJmdgjF*-( zOV#UgMn!x|viNZH7UgcRJ0boAhZ;p{Q=4=5sWK2hbM}=J-}O`hG4d9%%e3P=!DD-b zawq6f5-tv!JEhR=BN=H*?t z_If)wCJljVi(fKcWW$QUpZy|b)mI5IbrJgh@AU!gcp?`)tZ4}QT4zrM1D zE^&Zn$mLu4uCz*((eyPQogGX~UWdVBe7qZ@Ya`khCn;Roe~M+_OpWRE5g|4^@_m%R zoW@0zD(O|NN@dG1jl;ztVf*%)#nsa3AkK;U9}=gw4u*gIDpO$LEZ>?(An6fYs<8;*w~0zLKZkzj`%#s4Dw@oz-@WA&41ie9!O%NmtJ!8VqLle z{mt9ct`*G6U7`ovlEgM8Ob6CoWkqaX=8(?@W_;f1C6g$$(|F=gvb6$D!4Eo{%flDi zPZzsm`D9-lP)A4d(as?3mxOZ~l{f=4^tK^`bYb+wzd?LmA}=+BP|zR`miv6<$Fh&r z$Joi|CNv5Ky4HK?uH!Vp5`qrCGnrFaWeUgeHcuC%b`k05IO$b$@^B|#hAkXP4E;XA zMW{b($tup}Tm3hX)Fhpn={dyv6sk-iZcg68H6cj7Vam|vd>w8yHEuG*(`trkHVm1T z)9zkk@?o&|k7g}yGP<33NU<#eUxH&;{N#hS63$`*1+Tn~oF{l90@*HaB#DNzIVWe| z@JJ1PoU;_C5_5C9f*2zG&{m}nml)P$52s|#S;7qm1Cw`;3+3;d(5wi`QnHhVqN8Ok z_t9SMM2|9G$y31@dG2Td|EfTgi>jt*r$rN;^?Dg-Ru*+ok)@gE{Z#0sykHAfjSv+u z4pk|3&n9`I3^qr07B6ykI$e5T6;OrgXOs;8Z+FX3h)Y$ds5v-RO$bYBZ#Yt1I4*#k zH^?+YK6P6^qM>e}7I*@mxZ+^321%#BmN3qh*v-)hnXoyI&rBxJASagLZ9XcZpD)C$~!S=cnRMT(r0mO1)9 zVyyKv?tkl-542I>%2KL$v(MRi7k^m^OeN8rN3LCV&J8QmOA5E|e6hw)WIf7@NL3PG zJEIg3foR7ew7h}8Y0fD{vxMIxG0ODuM6ro3fM_(4YDVO!EsI?zwsOEDg-C5%L;kE% zd}g+U4Xw|NZQeOE`tHGfhBgUGy%dYKv;2@S=?hsv2}aKWaQ|vK+UVfjCG&nVkQaUO zZGDIVmO)i2-D+Qol?hB@2M2m(^9V2rIXi<}$n759e9{KQL0d|YeBT}|)v{!m9%pyG zQi?(Uh=GKt-kx;C{5-nuuFt#iDTWeJHVP3d67OK~CF~2!0?xdWM_Z8LMe^XPjB_;^ zRjo;3Bu%yeC8`-SPpm%k7JU$l{T7D9_L&Bj!%#gjpSC<>vEW-QI#}@$^|0#L801gX zM21{}j5Re(BI4GxEM!JyX+(JHD!B4T?Kt23U$I1>_oX5+zjw=D6548v=0bx(%5nlR z`G!Su*&opq)w)5Qx>|rd^P9p0B!#I!d)O0^bsXy4MT-h^B&an zT&hJ+4N@_Uy1qvoTuBrSrAubJG<|(Fy+hzB|R5B8)Q{XHddbNgL0yaQ%e3oTLY#+!pzjN}(n7xHrUFzGr0dTGZJVThU%RY3H|s z;hhqPbHCB*&=#2U@o0BexSg$qAXx9Tk^13HJ$?fgy+@(P_ZI17liCVmndH!8+I?#b zI}ST+ZGJd45Pn~gyai!7Rq=1umAa~vlei?>l~POc*dp`u_jn4f9!3009cE>kb_ZC~ zk}edI3O{;BN?r4O+7#uo9fMdz8#x(Wok^tW(s3ON3e!6tu#}Wdvy?paa(IK+80Nd$ zTp{jt>|By+a`m}-4s8Kiq_a>sk*XfzTrrbmcZ;d3XB+~Xhh*Z>kM|q<*!rF&RlR9X z<%wx|5wntIqjvYFi3Z#~v5CFnuR4R!9@h@{%ALLH;&((;6J&c%_>N%vOP4mbjyX>% zAPcXuHr`vl<;pMTR$tI`a;z^N)7Z{*Kzk?)Ym+$iVy?N5YZtWzX5GSkBD@^_m%|l?>l8;#$nbby= z70Hd{fj~Bjk>1*e^F+WldSI)>1)sXdZdfiyZ5CwPf~g;|lO4`59z(I+vlFjPW`F3Y za^V!@dV#rHn%>B*DlymX*?I@Uo?zeK$-i4{-_F$Et4|)a7Q2$+pK>@8`Y|q96rD>#oIDVK*+lpFDe%FLJ{&`C*WK`Dwpi&zd~f zGP*()xIf$tKFlt{L9>&tvpRZy`brL)(|KE&8Zr2QQR<3Rds1t;FT=Jy+!Z zGB)k4(aw6zN`miKm^@M~k+%feU-zDP{<>kR;cA_d0Pu_U13Wyx@b3J}!EX4cAm@MY zk*X~Cyi-Ab5?&gZ60BD0k6IyCnr2NhVhbXia4iYnB9_8jBC`{-Rfj^fz?X?JNthf6 z)ex7+od_%}1WilwVhHywV1y**Nn*LZ7<*^acCG@~!NGtbG228(1K2rbyW!aLG-;mV zd3xyQ0luYOmB~R2f?@E5i$K|yOR^*L{m@#~laJpmozuHgLR=j%ET-96NT@5rt#miKK(YEQbW#J;BlX9pFw&ERcRz=`p~tW>_eq1$YOWBx#9 zN%&zLyK4Q_)OwvdcI*Uw87l0|NAOjTLq}`!a$2-^3JBrAerFf{UA} zSV~|uhRq0VI^@^CF%hqX*l&N=z}y)Xc^G6JEw(>0OO{c^B*CRKC44_78X}njD&;zU zZd@9^$8-dFA;s@Ll%XPFq9}oCVN=_?lR+H7A1?)o=T#YS&3=Yy&|r3vF7JHn2%H$R zLcS8weK~f#;7TmYp-;1)2(&`%c{pSod3}u=MCiykRi*h+&W@GW=koM4v@Qa~$UwqG zsBg1DjpFv&Qb!gcK|%?jofFwrPy(IjACKcmuY3_>r1Amcw9L8LTw>px-L{}K87fV* zqFg2FKsiu-iY;~_=lnH=qvLRk?^6TiheUO*lL2On%gOXv(3!I4Y3t%xT%mg5aUdGdG4GpU1!wY>+`;RSnI86o zn&Uny$$U3ln5%0R16umR-^s_BpH#X?d|9iRFL8QZ zY!)PEdakEjt$w%OpvCk&ium?>ml|dx9vGao6TEN)&O9H zQ?(!L)@p|}xT>8Z=W^&O$Zh^EMxH92H|JiUJfGhZ8J_O4Ff=eJBRxX!BwZjf_XwXF zJt}sNpF2Q;x7)F19F%M`M54yF&bexYwu60E*rTb5K^|F8@I!v|QyC{#@OKg7&R7QGaU(D2C`GEb(UO4cZ*AXwIW7Z(dm!` z%bC5Z{ryOc26$!#7F~wW7OhJtp`c&p(Rfw^n84|Hgca;NSPNyMNY?2G+XnPDHnS%aNeG)n3MPjio~E`y@mAG3_QpCxUm0pk2@F4T>kS0 zkMNE=0&l4MJ>z>?!_&67R!}mRce%|P5No^v`U(2SVB1b~($#_bn_zL@Eo2EL_vWgk zx|A{sV&cwKEVG*c3U^oZZIq!^p zQa){S$s7xy>)Lxo>gmj|jrCZu##a*0GwMRW?Lim%KpU=ARsD`;)4MGIMw?hHpVKbm z)q?1TUIboH@npEjIo(r#3ehHO6r4@mEuw3JGj>;hW+fiqtEf%1bep)SZFsI}9v z0+~%Q@eEAQIDSt*?pOyI{Aydc2;H6`-Y9X!Xn%!D^ype2xdR~GH?f?)yNIn24Thn(7Y?{F`=H!D(JNs=g!Wd zR0k-q7s!&r9NtR(8?)@eY6k4KFjGS(z(eRR^M+y<&HGSnEngi>cwAW7eyN%=249!{ z2GT#zh{1d1`tI~{L!tcUz6F^h``YX~43W08_9Jp$Kwy-q0DCKo;GTN%H=ph?fLBxE zESz;_nFi__#r;Q|PUT`9qMol*kz5Ba2`VND1GR3Z05uO;L%C@?+|IX@n-mPk6yUr( zG3Exrl8;1r*g5Znd}ShqS4gq1YCb@~3C9{;X|Bb5rk8k-*Lsb-#s@0Y&qoWiBEZ-N za%#P9B%GkNnriCBNLO`gGX$wFnL%DW6_-tgf9vebF)eCe0NKBXq>d%tvk-n;Zt?&- zel6=`<$Qk?Ur~nBLSGf68L~ts*Qj|J+ynA`&wbyTj;kB*j&j8o>xPUVvlz-o~`P;bu$04{sM)ybs zjei{pX=tQ6!7tQA;v+@Pr5XxDZIdknp~ExlDFE}g5#Ue@vUEvbp@R2;8Yk|!%?TBc z5%jtSY@{Dk7b1yyre?A|WS)7hu`zu5;rZj0E<6R9p{%T&B%UAt+k4vVyq%!1bTP_; znD<$IRFuSa8s29gnkYWqY}XWQc7%aLA$W{f+Ntmr)eK*!tbPqBQ3*JrqS!Bi>ekmD z-heW0@lN)u9i$YfbdRcv*r6{Z6z@XNR^wyTnOB6 zXEL^?7a4Fsi*V!cOW3ApFxU_3J|v#AD4Nir@87vnYMsWKZ z*`{%!koSx#jm_z`mNbps*RD}&4{Sf^DF^r!$g#~`LE<{cK%z5dbX7Gz}Lkv#VyIC(58=rn|46|`NWI5CJqqK-HiEk8*PI{qzwF_3*TLEM{Bh?mN9h+_K{Bp;)37iNA|PO;G)#!-5QEhjvSUQ0#}s3`f@CaW>Zkz z=8*Zn545hcPzWM0uy>MFy}C6q^_-sL4+@AhuekawJaVnJzkpRCxSzT|7QIh2CwaR} zlz=!37KLyT6&Qs{9;_4kVW*wvYBq$O6hD~LcQHWUM|>vo8WI)jW5s-!<5%M&ZE}g5 zrWq`#wfZ7hRi)K)4CQvLi2P+UT5LL>0Snl!PMsyvPCfp;4AbSxnv@ihOcxQZV%&gWnR5;M3Gz8 z3PeJg682V6)pam0?CMj3u^^~o4v^660+Afd9@%~sB;T!9;#MC`y=yA^a2VP6PRv~^ z>L;sUE2bT~O|M5_O}?b&S;MhD_A`|%Y2{E0`yzdb`{Yms&UUpfH~czuEN`<0Bb6L6 z(cyuHH%rL`Qk;C(p!$swGKGWx5CvTa)C|Zep>0veW!-z`Pr0cyj#QwdlzAK_rhtE` z^VFeAxh;;>e}MdT5&HH=w+a&AQ6d1YpUIj3Erkv^vHQ<5=sPdP&mkZn0M+>b*Khi*7y%G;Dp?tN(SKG#@^&_oIn5MKQ#cVF@Gwb0rx*^{96+KpQwKJ z!E-qR-2SQJzvb%x#(d_ko_q#qSt)255SuNTm;X!fIC${Aj~hI1px{HmNt5Z|B<142{>fK?(i1SO}v2iGX4dS z6W|&7CqTf+;p)cc;Fjizl8S=p@r85bmb1fWPTo^e=bXa zm+2R+1xOoPIynI3L4?gLjra@<01Q%k)_VV!P5mVSNQwK3CZNOR03H5U;|K%1{=Xm) zvDX7+a8v?F35wcS8A;mMSUB1Kx@(Tg&Etyz!tsoNmXbd=9B@a6{}0grPCNC}_I{1K zcdY7A3P4!`TmYay6&%1X_(hY&{$q8&#>*^2yZr*_V`e~ZhQH!LQvVvy+QCuJ((=FA za3*v!FCpMfy#{k8dyTa*D02neux`1wJ8E{|4=U%3tyl@F&1eEBje~ z<|uhCwgA9Cy;MJAcV1S0nX%-#a`xXV|0ik0f1eG$gnyZZ;u)UY^lxqZ5B%?}BwiA| zRFZ!t8n^r#(VyD?Uv%YP!oQS6e}*@*{wMesljWDNFO|TbVS8=<3HHx^hL@NxWo4f+ zN1Xl%^N%Qi|Mq2kDd75y+T{EjsQ+Eg^=0#4ic&rkNxALt}nsf=eTz3|_l`Ul~R zmrO5Z37(mBqJD$v4|CxArAWa`s+ZB=&r}MrzfA@BzS#a*+3h9C%i!8)60?NgCi&xi z{gd3tOO}^WoX;%ANx#kV=a|ly1TQ1#o(UvU|33--SC74nX?mt21gzR#jB$VZy#M>7 z_CNdTWpK+gzDL$?;Qw=|%gcUy84K`C)(lvW{I4JL>q*wj9q4DwzPOF^WS)0PCNf(M*m|Nf9ZL7 zrors`zbV~+^TYh7&HwSb{Ml*p)9dnFtN>vD%?BeZ0SZ_L{S5e{2hstYLKp!2EfCQE E17(ftEC2ui diff --git a/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties b/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 568c50bf..00000000 --- a/internal/wrappers/build/java/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip diff --git a/internal/wrappers/build/java/gradlew b/internal/wrappers/build/java/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/internal/wrappers/build/java/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/internal/wrappers/build/java/gradlew.bat b/internal/wrappers/build/java/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/internal/wrappers/build/java/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/internal/wrappers/build/java/settings.gradle b/internal/wrappers/build/java/settings.gradle deleted file mode 100644 index 25da16a3..00000000 --- a/internal/wrappers/build/java/settings.gradle +++ /dev/null @@ -1,10 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user guide at https://docs.gradle.org/4.5.1/userguide/multi_project_builds.html - */ - -rootProject.name = 'kuzzlesdk' diff --git a/internal/wrappers/build_cpp_tests.sh b/internal/wrappers/build_cpp_tests.sh deleted file mode 100755 index d2ddff0d..00000000 --- a/internal/wrappers/build_cpp_tests.sh +++ /dev/null @@ -1,5 +0,0 @@ -#/bin/bash -set -e -cmake -E make_directory _build_cpp_tests -cmake -E chdir _build_cpp_tests cmake ../features/step_defs_cpp -cmake --build _build_cpp_tests -- -j2 diff --git a/internal/wrappers/cgo/kuzzle/auth.go b/internal/wrappers/cgo/kuzzle/auth.go deleted file mode 100644 index 39f399d5..00000000 --- a/internal/wrappers/cgo/kuzzle/auth.go +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - - #include - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "encoding/json" - "sync" - "unsafe" - - "github.com/kuzzleio/sdk-go/auth" - "github.com/kuzzleio/sdk-go/kuzzle" -) - -// map which stores instances to keep references in case the gc passes -var authInstances sync.Map - -//register new instance of server -func registerAuth(instance interface{}, ptr unsafe.Pointer) { - authInstances.Store(instance, ptr) -} - -// unregister an instance from the instances map -//export unregisterAuth -func unregisterAuth(a *C.auth) { - authInstances.Delete(a) -} - -// Allocates memory -//export kuzzle_new_auth -func kuzzle_new_auth(a *C.auth, k *C.kuzzle) { - kuz := (*kuzzle.Kuzzle)(k.instance) - auth := auth.NewAuth(kuz) - - ptr := unsafe.Pointer(auth) - a.instance = ptr - a.k = k - - registerAuth(a, ptr) -} - -//export kuzzle_check_token -func kuzzle_check_token(a *C.auth, token *C.char) *C.token_validity { - result := (*C.token_validity)(C.calloc(1, C.sizeof_token_validity)) - - res, err := (*auth.Auth)(a.instance).CheckToken(C.GoString(token)) - if err != nil { - Set_token_validity_error(result, err) - return result - } - - result.valid = C.bool(res.Valid) - result.state = C.CString(res.State) - result.expires_at = C.ulonglong(res.ExpiresAt) - - return result -} - -//export kuzzle_create_my_credentials -func kuzzle_create_my_credentials(a *C.auth, strategy *C.char, credentials *C.char, options *C.query_options) *C.string_result { - res, err := (*auth.Auth)(a.instance).CreateMyCredentials( - C.GoString(strategy), - json.RawMessage(C.GoString(credentials)), - SetQueryOptions(options)) - - str := string(res) - return goToCStringResult(&str, err) -} - -//export kuzzle_credentials_exist -func kuzzle_credentials_exist(a *C.auth, strategy *C.char, options *C.query_options) *C.bool_result { - res, err := (*auth.Auth)(a.instance).CredentialsExist( - C.GoString(strategy), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_delete_my_credentials -func kuzzle_delete_my_credentials(a *C.auth, strategy *C.char, options *C.query_options) *C.error_result { - err := (*auth.Auth)(a.instance).DeleteMyCredentials( - C.GoString(strategy), - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_get_current_user -func kuzzle_get_current_user(a *C.auth) *C.user_result { - u, err := (*auth.Auth)(a.instance).GetCurrentUser() - - return goToCUserResult(a.k, u, err) -} - -//export kuzzle_get_my_credentials -func kuzzle_get_my_credentials(a *C.auth, strategy *C.char, options *C.query_options) *C.string_result { - res, err := (*auth.Auth)(a.instance).GetMyCredentials( - C.GoString(strategy), - SetQueryOptions(options)) - - str := string(res) - return goToCStringResult(&str, err) -} - -//export kuzzle_get_my_rights -func kuzzle_get_my_rights(a *C.auth, options *C.query_options) *C.user_rights_result { - res, err := (*auth.Auth)(a.instance).GetMyRights(SetQueryOptions(options)) - - return goToCUserRightsResult(res, err) -} - -//export kuzzle_get_strategies -func kuzzle_get_strategies(a *C.auth, options *C.query_options) *C.string_array_result { - res, err := (*auth.Auth)(a.instance).GetStrategies(SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_login -func kuzzle_login(a *C.auth, strategy *C.char, credentials *C.char, expires_in *C.int) *C.string_result { - var expire int - if expires_in != nil { - expire = int(*expires_in) - } - - res, err := (*auth.Auth)(a.instance).Login(C.GoString(strategy), json.RawMessage(C.GoString(credentials)), &expire) - - return goToCStringResult(&res, err) -} - -//export kuzzle_logout -func kuzzle_logout(a *C.auth) *C.char { - err := (*auth.Auth)(a.instance).Logout() - if err != nil { - return C.CString(err.Error()) - } - - return nil -} - -//export kuzzle_update_my_credentials -func kuzzle_update_my_credentials(a *C.auth, strategy *C.char, credentials *C.char, options *C.query_options) *C.string_result { - res, err := (*auth.Auth)(a.instance).UpdateMyCredentials( - C.GoString(strategy), - json.RawMessage(C.GoString(credentials)), - SetQueryOptions(options)) - - str := string(res) - return goToCStringResult(&str, err) -} - -//export kuzzle_update_self -func kuzzle_update_self(a *C.auth, data *C.char, options *C.query_options) *C.user_result { - res, err := (*auth.Auth)(a.instance).UpdateSelf( - json.RawMessage(C.GoString(data)), - SetQueryOptions(options)) - - return goToCUserResult(a.k, res, err) -} - -//export kuzzle_validate_my_credentials -func kuzzle_validate_my_credentials(a *C.auth, strategy *C.char, credentials *C.char, options *C.query_options) *C.bool_result { - res, err := (*auth.Auth)(a.instance).ValidateMyCredentials( - C.GoString(strategy), - json.RawMessage(C.GoString(credentials)), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/c_to_go.go b/internal/wrappers/cgo/kuzzle/c_to_go.go deleted file mode 100644 index bc9a2294..00000000 --- a/internal/wrappers/cgo/kuzzle/c_to_go.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include - #include "kuzzlesdk.h" -*/ -import "C" -import ( - "encoding/json" - "unsafe" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/security" - "github.com/kuzzleio/sdk-go/types" -) - -// convert a C char** to a go array of string -func cToGoStrings(arr **C.char, len C.size_t) []string { - if len == 0 { - return nil - } - - tmpslice := (*[1 << 27]*C.char)(unsafe.Pointer(arr))[:len:len] - goStrings := make([]string, 0, len) - - for _, s := range tmpslice { - goStrings = append(goStrings, C.GoString(s)) - } - - return goStrings -} - -func cToGoShards(cShards *C.shards) *types.Shards { - return &types.Shards{ - Total: int(cShards.total), - Successful: int(cShards.successful), - Failed: int(cShards.failed), - } -} - -func cToGoKuzzleMeta(cMeta *C.meta) *types.Meta { - return &types.Meta{ - Author: C.GoString(cMeta.author), - CreatedAt: int(cMeta.created_at), - UpdatedAt: int(cMeta.updated_at), - Updater: C.GoString(cMeta.updater), - Active: bool(cMeta.active), - DeletedAt: int(cMeta.deleted_at), - } -} - -func cToGoCollection(c *C.collection) *collection.Collection { - return collection.NewCollection((*kuzzle.Kuzzle)(c.k.instance)) -} - -func cToGoPolicyRestriction(r *C.policy_restriction) *types.PolicyRestriction { - restriction := &types.PolicyRestriction{ - Index: C.GoString(r.index), - } - - if r.collections == nil { - return restriction - } - - slice := (*[1<<28 - 1]*C.char)(unsafe.Pointer(r.collections))[:r.collections_length:r.collections_length] - for _, col := range slice { - restriction.Collections = append(restriction.Collections, C.GoString(col)) - } - - return restriction -} - -func cToGoPolicy(p *C.policy) *types.Policy { - policy := &types.Policy{ - RoleId: C.GoString(p.role_id), - } - - if p.restricted_to == nil { - return policy - } - - slice := (*[1<<28 - 1]*C.policy_restriction)(unsafe.Pointer(p.restricted_to))[:p.restricted_to_length] - for _, crestriction := range slice { - policy.RestrictedTo = append(policy.RestrictedTo, cToGoPolicyRestriction(crestriction)) - } - - return policy -} - -func cToGoProfile(p *C.profile) *security.Profile { - profile := &security.Profile{ - Id: C.GoString(p.id), - } - - if p.policies == nil { - return profile - } - - slice := (*[1<<28 - 1]*C.policy)(unsafe.Pointer(p.policies))[:p.policies_length] - for _, cpolicy := range slice { - profile.Policies = append(profile.Policies, cToGoPolicy(cpolicy)) - } - - return profile -} - -func cToGoUser(u *C.kuzzle_user) *security.User { - if u == nil { - return nil - } - - user := security.NewUser(C.GoString(u.id), nil) - - return user -} - -func cToGoUserRigh(r *C.user_right) *types.UserRights { - right := &types.UserRights{ - Controller: C.GoString(r.controller), - Action: C.GoString(r.action), - Index: C.GoString(r.index), - Value: C.GoString(r.value), - } - - return right -} - -func cToGoSearchResult(s *C.search_result) *types.SearchResult { - opts := types.NewQueryOptions() - - opts.SetSize(int(s.options.size)) - opts.SetFrom(int(s.options.from)) - opts.SetScrollId(C.GoString(s.options.scroll_id)) - - c, _ := json.Marshal(s.collection) - - var documents json.RawMessage - d, _ := json.Marshal(s.documents) - documents = d - - return &types.SearchResult{ - Collection: string(c), - Documents: documents, - Total: int(s.total), - Fetched: int(s.fetched), - Options: opts, - Filters: json.RawMessage(C.GoString(s.filters)), - } -} - -func cToGoKuzzleNotificationChannel(c *C.kuzzle_notification_listener) chan<- types.KuzzleNotification { - return make(chan<- types.KuzzleNotification) -} diff --git a/internal/wrappers/cgo/kuzzle/collection.go b/internal/wrappers/cgo/kuzzle/collection.go deleted file mode 100644 index 284411db..00000000 --- a/internal/wrappers/cgo/kuzzle/collection.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "encoding/json" - "sync" - "unsafe" - - "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/kuzzle" -) - -// map which stores instances to keep references in case the gc passes -var collectionInstances sync.Map - -// register new instance to the instances map -func registerCollection(instance interface{}, ptr unsafe.Pointer) { - collectionInstances.Store(instance, ptr) -} - -// unregister an instance from the instances map -//export unregisterCollection -func unregisterCollection(c *C.collection) { - collectionInstances.Delete(c) -} - -// Allocates memory -//export kuzzle_new_collection -func kuzzle_new_collection(c *C.collection, k *C.kuzzle) { - kuz := (*kuzzle.Kuzzle)(k.instance) - col := collection.NewCollection(kuz) - - ptr := unsafe.Pointer(col) - c.instance = ptr - c.k = k - - registerCollection(c, ptr) -} - -//export kuzzle_collection_create -func kuzzle_collection_create(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.error_result { - var rawBody json.RawMessage - - if body != nil { - rawBody = json.RawMessage(C.GoString(body)) - } - - err := (*collection.Collection)(c.instance).Create(C.GoString(index), C.GoString(col), rawBody, SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_collection_truncate -func kuzzle_collection_truncate(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.error_result { - err := (*collection.Collection)(c.instance).Truncate(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_collection_exists -func kuzzle_collection_exists(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).Exists(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_collection_list -func kuzzle_collection_list(c *C.collection, index *C.char, options *C.query_options) *C.string_result { - res, err := (*collection.Collection)(c.instance).List(C.GoString(index), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -// Mapping - -//export kuzzle_collection_get_mapping -func kuzzle_collection_get_mapping(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.string_result { - res, err := (*collection.Collection)(c.instance).GetMapping(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_collection_update_mapping -func kuzzle_collection_update_mapping(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.error_result { - err := (*collection.Collection)(c.instance).UpdateMapping(C.GoString(index), C.GoString(col), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -// Specifications - -//export kuzzle_collection_delete_specifications -func kuzzle_collection_delete_specifications(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.error_result { - err := (*collection.Collection)(c.instance).DeleteSpecifications(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_collection_get_specifications -func kuzzle_collection_get_specifications(c *C.collection, index *C.char, col *C.char, options *C.query_options) *C.string_result { - res, err := (*collection.Collection)(c.instance).GetSpecifications(C.GoString(index), C.GoString(col), SetQueryOptions(options)) - var stringResult string - stringResult = string(res) - return goToCStringResult(&stringResult, err) -} - -//export kuzzle_collection_search_specifications -func kuzzle_collection_search_specifications(c *C.collection, options *C.query_options) *C.search_result { - res, err := (*collection.Collection)(c.instance).SearchSpecifications(SetQueryOptions(options)) - return goToCSearchResult(res, err) -} - -//export kuzzle_collection_update_specifications -func kuzzle_collection_update_specifications(c *C.collection, index *C.char, col *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*collection.Collection)(c.instance).UpdateSpecifications(C.GoString(index), C.GoString(col), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - var stringResult string - stringResult = string(res) - return goToCStringResult(&stringResult, err) -} - -//export kuzzle_collection_validate_specifications -func kuzzle_collection_validate_specifications(c *C.collection, body *C.char, options *C.query_options) *C.bool_result { - res, err := (*collection.Collection)(c.instance).ValidateSpecifications(json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/destructors.go b/internal/wrappers/cgo/kuzzle/destructors.go deleted file mode 100644 index 7244d71b..00000000 --- a/internal/wrappers/cgo/kuzzle/destructors.go +++ /dev/null @@ -1,762 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -std=c99 -I../../../headers - - #include - #include "kuzzlesdk.h" - - static void free_char_array(char **arr, size_t length) { - if (arr != NULL) { - for(int i = 0; i < length; i++) { - free(arr[i]); - } - - free(arr); - } - } -*/ -import "C" - -import ( - "unsafe" -) - -//export kuzzle_free_kuzzle_request -func kuzzle_free_kuzzle_request(st *C.kuzzle_request) { - if st != nil { - C.free(unsafe.Pointer(st.request_id)) - C.free(unsafe.Pointer(st.controller)) - C.free(unsafe.Pointer(st.action)) - C.free(unsafe.Pointer(st.index)) - C.free(unsafe.Pointer(st.collection)) - C.free(unsafe.Pointer(st.id)) - C.free(unsafe.Pointer(st.scroll)) - C.free(unsafe.Pointer(st.scroll_id)) - C.free(unsafe.Pointer(st.strategy)) - C.free(unsafe.Pointer(st.scope)) - C.free(unsafe.Pointer(st.state)) - C.free(unsafe.Pointer(st.user)) - C.free(unsafe.Pointer(st.member)) - C.free(unsafe.Pointer(st.member1)) - C.free(unsafe.Pointer(st.member2)) - C.free(unsafe.Pointer(st.unit)) - C.free(unsafe.Pointer(st.field)) - C.free(unsafe.Pointer(st.subcommand)) - C.free(unsafe.Pointer(st.pattern)) - C.free(unsafe.Pointer(st.min)) - C.free(unsafe.Pointer(st.max)) - C.free(unsafe.Pointer(st.limit)) - C.free(unsafe.Pointer(st.match)) - - C.free_char_array(st.members, st.members_length) - C.free_char_array(st.keys, st.keys_length) - C.free_char_array(st.fields, st.fields_length) - - C.free(unsafe.Pointer(st.body)) - C.free(unsafe.Pointer(st.volatiles)) - C.free(unsafe.Pointer(st.options)) - - C.free(unsafe.Pointer(st)) - } - -} - -//export kuzzle_free_query_object -func kuzzle_free_query_object(st *C.query_object) { - if st != nil { - C.free(unsafe.Pointer(st.query)) - C.free(unsafe.Pointer(st.request_id)) - - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_offline_queue -func kuzzle_free_offline_queue(st *C.offline_queue) { - if st != nil && st.queries != nil { - queries := (*[1<<28 - 1]*C.query_object)(unsafe.Pointer(st.queries))[:int(st.queries_length):int(st.queries_length)] - - for _, query := range queries { - kuzzle_free_query_object(query) - } - - C.free(unsafe.Pointer(st.queries)) - } - - C.free(unsafe.Pointer(st)) -} - -//export kuzzle_free_query_options -func kuzzle_free_query_options(st *C.query_options) { - if st != nil { - C.free(unsafe.Pointer(st.scroll)) - C.free(unsafe.Pointer(st.scroll_id)) - C.free(unsafe.Pointer(st.refresh)) - C.free(unsafe.Pointer(st.if_exist)) - C.free(unsafe.Pointer(st.volatiles)) - - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_room_options -func kuzzle_free_room_options(st *C.room_options) { - if st != nil { - C.free(unsafe.Pointer(st.scope)) - C.free(unsafe.Pointer(st.state)) - C.free(unsafe.Pointer(st.user)) - C.free(unsafe.Pointer(st.volatiles)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_options -func kuzzle_free_options(st *C.options) { - if st != nil { - C.free(unsafe.Pointer(st.refresh)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_meta -func kuzzle_free_meta(st *C.meta) { - if st != nil { - C.free(unsafe.Pointer(st.author)) - C.free(unsafe.Pointer(st.updater)) - C.free(unsafe.Pointer(st)) - } -} - -// do not export => used to free the content of a structure -// and not the structure itself -func _free_policy_restriction(st *C.policy_restriction) { - if st != nil { - C.free(unsafe.Pointer(st.index)) - C.free_char_array(st.collections, st.collections_length) - } -} - -//export kuzzle_free_policy_restriction -func kuzzle_free_policy_restriction(st *C.policy_restriction) { - _free_policy_restriction(st) - C.free(unsafe.Pointer(st)) -} - -// do not export => used to free the content of a structure -// and not the structure itself -func _free_policy(st *C.policy) { - if st != nil { - C.free(unsafe.Pointer(st.role_id)) - - if st.restricted_to != nil { - restrictions := (*[1<<27 - 1]C.policy_restriction)(unsafe.Pointer(st.restricted_to))[:int(st.restricted_to_length):int(st.restricted_to_length)] - - for _, restriction := range restrictions { - _free_policy_restriction(&restriction) - } - - C.free(unsafe.Pointer(st.restricted_to)) - } - } -} - -//export kuzzle_free_policy -func kuzzle_free_policy(st *C.policy) { - _free_policy(st) - C.free(unsafe.Pointer(st)) -} - -// do not export => used to free the content of a structure -// and not the structure itself -func _free_profile(st *C.profile) { - if st != nil { - C.free(unsafe.Pointer(st.id)) - - if st.policies != nil { - policies := (*[1<<27 - 1]C.policy)(unsafe.Pointer(st.policies))[:int(st.policies_length):int(st.policies_length)] - - for _, policy := range policies { - _free_policy(&policy) - } - - C.free(unsafe.Pointer(st.policies)) - } - } -} - -//export kuzzle_free_profile -func kuzzle_free_profile(st *C.profile) { - _free_profile(st) - C.free(unsafe.Pointer(st)) -} - -//do not export -func _free_role(st *C.role) { - if st != nil { - C.free(unsafe.Pointer(st.id)) - C.free(unsafe.Pointer(st.controllers)) - } -} - -//export kuzzle_free_role -func kuzzle_free_role(st *C.role) { - _free_role(st) - C.free(unsafe.Pointer(st)) -} - -//do not export -func _free_user(st *C.kuzzle_user) { - if st != nil { - C.free(unsafe.Pointer(st.id)) - C.free(unsafe.Pointer(st.content)) - C.free_char_array(st.profile_ids, st.profile_ids_length) - } -} - -//export kuzzle_free_user -func kuzzle_free_user(st *C.kuzzle_user) { - _free_user(st) - C.free(unsafe.Pointer(st)) -} - -//export kuzzle_free_user_data -func kuzzle_free_user_data(st *C.user_data) { - if st != nil { - C.free(unsafe.Pointer(st.content)) - C.free_char_array(st.profile_ids, st.profile_ids_length) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_collection -func kuzzle_free_collection(st *C.collection) { - if st != nil { - C.free(unsafe.Pointer(st.instance)) - C.free(unsafe.Pointer(st.k)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_document -func kuzzle_free_document(st *C.document) { - if st != nil { - C.free(unsafe.Pointer(st.instance)) - C.free(unsafe.Pointer(st.k)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_notification_content -func kuzzle_free_notification_content(st *C.notification_content) { - if st != nil { - C.free(unsafe.Pointer(st.id)) - kuzzle_free_meta(st.m) - C.free(unsafe.Pointer(st.content)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_notification_result -func kuzzle_free_notification_result(st *C.notification_result) { - if st != nil { - C.free(unsafe.Pointer(st.request_id)) - C.free(unsafe.Pointer(st.index)) - C.free(unsafe.Pointer(st.collection)) - C.free(unsafe.Pointer(st.controller)) - C.free(unsafe.Pointer(st.action)) - C.free(unsafe.Pointer(st.protocol)) - C.free(unsafe.Pointer(st.scope)) - C.free(unsafe.Pointer(st.state)) - C.free(unsafe.Pointer(st.user)) - C.free(unsafe.Pointer(st.n_type)) - C.free(unsafe.Pointer(st.room_id)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - - C.free(unsafe.Pointer(st.volatiles)) - - kuzzle_free_notification_content(st.result) - - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_profile_result -func kuzzle_free_profile_result(st *C.profile_result) { - if st != nil { - kuzzle_free_profile(st.p) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_profiles_result -func kuzzle_free_profiles_result(st *C.profiles_result) { - if st != nil { - if st.profiles != nil { - profiles := (*[1<<27 - 1]C.profile)(unsafe.Pointer(st.profiles))[:int(st.profiles_length):int(st.profiles_length)] - - for _, profile := range profiles { - _free_profile(&profile) - } - - C.free(unsafe.Pointer(st.profiles)) - } - - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_role_result -func kuzzle_free_role_result(st *C.role_result) { - if st != nil { - kuzzle_free_role(st.r) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -// do not export => used to free the content of a structure -// and not the structure itself -func _free_user_right(st *C.user_right) { - if st != nil { - C.free(unsafe.Pointer(st.controller)) - C.free(unsafe.Pointer(st.action)) - C.free(unsafe.Pointer(st.index)) - C.free(unsafe.Pointer(st.collection)) - C.free(unsafe.Pointer(st.value)) - } -} - -//export kuzzle_free_subscribe_result -func kuzzle_free_subscribe_result(st *C.subscribe_result) { - if st != nil { - C.free(unsafe.Pointer(st.room)) - C.free(unsafe.Pointer(st.channel)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_user_right -func kuzzle_free_user_right(st *C.user_right) { - _free_user_right(st) - C.free(unsafe.Pointer(st)) -} - -//export kuzzle_free_user_rights_result -func kuzzle_free_user_rights_result(st *C.user_rights_result) { - if st != nil { - if st.result != nil { - rights := (*[1<<26 - 1]C.user_right)(unsafe.Pointer(st.result))[:int(st.user_rights_length):int(st.user_rights_length)] - - for _, right := range rights { - _free_user_right(&right) - } - - C.free(unsafe.Pointer(st.result)) - } - - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_user_result -func kuzzle_free_user_result(st *C.user_result) { - if st != nil { - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -// do not export => used to free the content of a structure -// and not the structure itself -func _free_statistics(st *C.statistics) { - if st != nil { - C.free(unsafe.Pointer(st.completed_requests)) - C.free(unsafe.Pointer(st.connections)) - C.free(unsafe.Pointer(st.failed_requests)) - C.free(unsafe.Pointer(st.ongoing_requests)) - } -} - -//export kuzzle_free_statistics -func kuzzle_free_statistics(st *C.statistics) { - _free_statistics(st) - C.free(unsafe.Pointer(st)) -} - -//export kuzzle_free_statistics_result -func kuzzle_free_statistics_result(st *C.statistics_result) { - if st != nil { - kuzzle_free_statistics(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_all_statistics_result -func kuzzle_free_all_statistics_result(st *C.all_statistics_result) { - if st != nil { - if st.result != nil { - stats := (*[1<<26 - 1]C.statistics)(unsafe.Pointer(st.result)) - - for _, stat := range stats { - _free_statistics(&stat) - } - - C.free(unsafe.Pointer(st.result)) - } - - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_geopos_result -func kuzzle_free_geopos_result(st *C.geopos_result) { - if st != nil { - C.free(unsafe.Pointer(st.result)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_token_validity -func kuzzle_free_token_validity(st *C.token_validity) { - if st != nil { - C.free(unsafe.Pointer(st.state)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_kuzzle_response -func kuzzle_free_kuzzle_response(st *C.kuzzle_response) { - if st != nil { - C.free(unsafe.Pointer(st.request_id)) - C.free(unsafe.Pointer(st.index)) - C.free(unsafe.Pointer(st.collection)) - C.free(unsafe.Pointer(st.controller)) - C.free(unsafe.Pointer(st.action)) - C.free(unsafe.Pointer(st.room_id)) - C.free(unsafe.Pointer(st.channel)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - - C.free(unsafe.Pointer(st.result)) - C.free(unsafe.Pointer(st.volatiles)) - - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_json_result -func kuzzle_free_json_result(st *C.json_result) { - if st != nil { - C.free(unsafe.Pointer(st.result)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_bool_result -func kuzzle_free_bool_result(st *C.bool_result) { - if st != nil { - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_int_result -func kuzzle_free_int_result(st *C.int_result) { - if st != nil { - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_double_result -func kuzzle_free_double_result(st *C.double_result) { - if st != nil { - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_int_array_result -func kuzzle_free_int_array_result(st *C.int_array_result) { - if st != nil { - C.free(unsafe.Pointer(st.result)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_string_result -func kuzzle_free_string_result(st *C.string_result) { - if st != nil { - C.free(unsafe.Pointer(st.result)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_string_array_result -func kuzzle_free_string_array_result(st *C.string_array_result) { - if st != nil { - C.free_char_array(st.result, st.result_length) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_profile_search -func kuzzle_free_profile_search(st *C.profile_search) { - if st != nil { - C.free(unsafe.Pointer(st.scroll_id)) - - if st.hits != nil { - hits := (*[1<<27 - 1]C.profile)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] - - for _, profile := range hits { - _free_profile(&profile) - } - - C.free(unsafe.Pointer(st.hits)) - } - - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_role_search -func kuzzle_free_role_search(st *C.role_search) { - if st != nil { - if st.hits != nil { - hits := (*[1<<27 - 1]C.role)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] - - for _, role := range hits { - _free_role(&role) - } - - C.free(unsafe.Pointer(st.hits)) - } - - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_ack_result -func kuzzle_free_ack_result(st *C.ack_result) { - if st != nil { - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_shards_result -func kuzzle_free_shards_result(st *C.shards_result) { - if st != nil { - C.free(unsafe.Pointer(st.result)) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_specification -func kuzzle_free_specification(st *C.specification) { - if st != nil { - C.free(unsafe.Pointer(st.fields)) - C.free(unsafe.Pointer(st.validators)) - C.free(unsafe.Pointer(st)) - } -} - -//do not export -func _free_specification_entry(st *C.specification_entry) { - if st != nil { - kuzzle_free_specification(st.validation) - C.free(unsafe.Pointer(st.index)) - C.free(unsafe.Pointer(st.collection)) - } -} - -//export kuzzle_free_specification_entry -func kuzzle_free_specification_entry(st *C.specification_entry) { - _free_specification_entry(st) - C.free(unsafe.Pointer(st)) -} - -//export kuzzle_free_specification_result -func kuzzle_free_specification_result(st *C.specification_result) { - if st != nil { - kuzzle_free_specification(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_search_result -func kuzzle_free_search_result(st *C.search_result) { - if st != nil { - kuzzle_free_query_options(st.options) - C.free(unsafe.Pointer(st.aggregations)) - C.free(unsafe.Pointer(st.filters)) - - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_search_profiles_result -func kuzzle_free_search_profiles_result(st *C.search_profiles_result) { - if st != nil { - kuzzle_free_profile_search(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_search_roles_result -func kuzzle_free_search_roles_result(st *C.search_roles_result) { - if st != nil { - kuzzle_free_role_search(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_specification_search -func kuzzle_free_specification_search(st *C.specification_search) { - if st != nil { - if st.hits != nil { - hits := (*[1<<27 - 1]C.specification_entry)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] - - for _, entry := range hits { - _free_specification_entry(&entry) - } - - C.free(unsafe.Pointer(st.hits)) - C.free(unsafe.Pointer(st.scroll_id)) - C.free(unsafe.Pointer(st)) - } - } -} - -//export kuzzle_free_specification_search_result -func kuzzle_free_specification_search_result(st *C.specification_search_result) { - if st != nil { - kuzzle_free_specification_search(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_error_result -func kuzzle_free_error_result(st *C.error_result) { - if st != nil { - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//do not export -func _free_collection_entry(st *C.collection_entry) { - if st != nil { - C.free(unsafe.Pointer(st.name)) - } -} - -//export kuzzle_free_collection_entry -func kuzzle_free_collection_entry(st *C.collection_entry) { - _free_collection_entry(st) - C.free(unsafe.Pointer(st)) -} - -//export kuzzle_free_collection_entry_result -func kuzzle_free_collection_entry_result(st *C.collection_entry_result) { - if st != nil { - if st.result != nil { - entries := (*[1<<27 - 1]C.collection_entry)(unsafe.Pointer(st.result))[:int(st.result_length):int(st.result_length)] - - for _, entry := range entries { - _free_collection_entry(&entry) - } - - C.free(unsafe.Pointer(st.result)) - } - - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_user_search -func kuzzle_free_user_search(st *C.user_search) { - if st != nil { - if st.hits != nil { - hits := (*[1<<26 - 1]C.kuzzle_user)(unsafe.Pointer(st.hits))[:int(st.hits_length):int(st.hits_length)] - - for _, user := range hits { - _free_user(&user) - } - - C.free(unsafe.Pointer(st.hits)) - } - - C.free(unsafe.Pointer(st.scroll_id)) - C.free(unsafe.Pointer(st)) - } -} - -//export kuzzle_free_search_users_result -func kuzzle_free_search_users_result(st *C.search_users_result) { - if st != nil { - kuzzle_free_user_search(st.result) - C.free(unsafe.Pointer(st.error)) - C.free(unsafe.Pointer(st.stack)) - C.free(unsafe.Pointer(st)) - } -} diff --git a/internal/wrappers/cgo/kuzzle/document.go b/internal/wrappers/cgo/kuzzle/document.go deleted file mode 100644 index d3342d85..00000000 --- a/internal/wrappers/cgo/kuzzle/document.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "encoding/json" - "sync" - "unsafe" - - "github.com/kuzzleio/sdk-go/document" - "github.com/kuzzleio/sdk-go/kuzzle" -) - -// map which stores instances to keep references in case the gc passes -var documentInstances sync.Map - -// register new instance to the instances map -func registerDocument(instance interface{}, ptr unsafe.Pointer) { - documentInstances.Store(instance, ptr) -} - -// unregister an instance from the instances map -//export unregisterDocument -func unregisterDocument(d *C.document) { - documentInstances.Delete(d) -} - -//export kuzzle_new_document -func kuzzle_new_document(d *C.document, k *C.kuzzle) { - kuz := (*kuzzle.Kuzzle)(k.instance) - doc := document.NewDocument(kuz) - - ptr := unsafe.Pointer(doc) - d.instance = ptr - d.k = k - registerDocument(doc, ptr) -} - -//export kuzzle_document_count -func kuzzle_document_count(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.int_result { - res, err := (*document.Document)(d.instance).Count(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - return goToCIntResult(res, err) -} - -//export kuzzle_document_exists -func kuzzle_document_exists(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.query_options) *C.bool_result { - res, err := (*document.Document)(d.instance).Exists(C.GoString(index), C.GoString(collection), C.GoString(id), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_document_create -func kuzzle_document_create(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Create(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_create_or_replace -func kuzzle_document_create_or_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).CreateOrReplace(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_delete -func kuzzle_document_delete(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Delete(C.GoString(index), C.GoString(collection), C.GoString(id), SetQueryOptions(options)) - return goToCStringResult(&res, err) -} - -//export kuzzle_document_delete_by_query -func kuzzle_document_delete_by_query(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_array_result { - res, err := (*document.Document)(d.instance).DeleteByQuery(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) - return goToCStringArrayResult(res, err) -} - -//export kuzzle_document_get -func kuzzle_document_get(d *C.document, index *C.char, collection *C.char, id *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Get(C.GoString(index), C.GoString(collection), C.GoString(id), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_replace -func kuzzle_document_replace(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Replace(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_update -func kuzzle_document_update(d *C.document, index *C.char, collection *C.char, id *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).Update(C.GoString(index), C.GoString(collection), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_validate -func kuzzle_document_validate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.bool_result { - res, err := (*document.Document)(d.instance).Validate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_document_search -func kuzzle_document_search(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.search_result { - res, err := (*document.Document)(d.instance).Search(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - return goToCSearchResult(res, err) -} - -//export kuzzle_document_mcreate -func kuzzle_document_mcreate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MCreate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_mcreate_or_replace -func kuzzle_document_mcreate_or_replace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MCreateOrReplace(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_mdelete -func kuzzle_document_mdelete(d *C.document, index *C.char, collection *C.char, ids **C.char, l C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*document.Document)(d.instance).MDelete(C.GoString(index), C.GoString(collection), cToGoStrings(ids, l), SetQueryOptions(options)) - return goToCStringArrayResult(res, err) -} - -//export kuzzle_document_mget -func kuzzle_document_mget(d *C.document, index *C.char, collection *C.char, ids **C.char, l C.size_t, includeTrash C.bool, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MGet(C.GoString(index), C.GoString(collection), cToGoStrings(ids, l), bool(includeTrash), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_mreplace -func kuzzle_document_mreplace(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MReplace(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} - -//export kuzzle_document_mupdate -func kuzzle_document_mupdate(d *C.document, index *C.char, collection *C.char, body *C.char, options *C.query_options) *C.string_result { - res, err := (*document.Document)(d.instance).MUpdate(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - s := string(res) - return goToCStringResult(&s, err) -} diff --git a/internal/wrappers/cgo/kuzzle/errors.go b/internal/wrappers/cgo/kuzzle/errors.go deleted file mode 100644 index 73c7a08c..00000000 --- a/internal/wrappers/cgo/kuzzle/errors.go +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../../headers - - #include "kuzzlesdk.h" -*/ -import "C" - -import ( - "github.com/kuzzleio/sdk-go/types" -) - -// apply a types.KuzzleError on a json_result* C struct -func Set_json_result_error(s *C.json_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a token_validity* C struct -func Set_token_validity_error(s *C.token_validity, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a ack_result* C struct -func Set_ack_result_error(s *C.ack_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a bool_result* C struct -func Set_bool_result_error(s *C.bool_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a kuzzle_response* C struct -func Set_kuzzle_response_error(s *C.kuzzle_response, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a statistics* C struct -func Set_statistics_error(s *C.statistics_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a statistics* C struct -func Set_subscribe_error(s *C.subscribe_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a string_array_result* C struct -func Set_string_array_result_error(s *C.string_array_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a int_result* C struct -func Set_int_result_error(s *C.int_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a int_array_result* C struct -func Set_int_array_result_error(s *C.int_array_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a date_result* C struct -func Set_date_result_error(s *C.date_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a string_result* C struct -func Set_string_result_error(s *C.string_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a shards* C struct -func Set_shards_result_error(s *C.shards_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a search_result* C struct -func Set_search_result_error(s *C.search_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -// apply a types.KuzzleError on a all_statistics_result* C struct -func Set_all_statistics_error(s *C.all_statistics_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_specification_result_err(s *C.specification_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_specification_search_result_error(s *C.specification_search_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_double_result_error(s *C.double_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_json_array_result_error(s *C.json_array_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_profile_result_error(s *C.profile_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_role_result_error(s *C.role_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_search_profiles_result_error(s *C.search_profiles_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_search_roles_result_error(s *C.search_roles_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_search_users_result_error(s *C.search_users_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_user_result_error(s *C.user_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_profiles_result_error(s *C.profiles_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_roles_result_error(s *C.roles_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_user_rights_error(s *C.user_rights_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_notification_result_error(s *C.notification_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_collection_entry_error(s *C.collection_entry_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_error_result_error(s *C.error_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func Set_room_result_error(s *C.room_result, err error) { - setErr(&s.status, &s.error, &s.stack, err) -} - -func setErr(status *C.int, error **C.char, stack **C.char, err error) { - kuzzleError := err.(types.KuzzleError) - *status = C.int(kuzzleError.Status) - *error = C.CString(kuzzleError.Message) - - if len(kuzzleError.Stack) > 0 { - *stack = C.CString(kuzzleError.Stack) - } -} diff --git a/internal/wrappers/cgo/kuzzle/go_to_c.go b/internal/wrappers/cgo/kuzzle/go_to_c.go deleted file mode 100644 index c7ac2fd2..00000000 --- a/internal/wrappers/cgo/kuzzle/go_to_c.go +++ /dev/null @@ -1,766 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "encoding/json" - "unsafe" - - "github.com/kuzzleio/sdk-go/security" - "github.com/kuzzleio/sdk-go/types" -) - -func duplicateCollection(ptr *C.collection) *C.collection { - dest := (*C.collection)(C.calloc(1, C.sizeof_collection)) - - dest.k = ptr.k - - return dest -} - -// Allocates memory -func goToCMeta(gMeta *types.Meta) *C.meta { - if gMeta == nil { - return nil - } - - result := (*C.meta)(C.calloc(1, C.sizeof_meta)) - result.author = C.CString(gMeta.Author) - result.created_at = C.ulonglong(gMeta.CreatedAt) - result.updated_at = C.ulonglong(gMeta.UpdatedAt) - result.deleted_at = C.ulonglong(gMeta.DeletedAt) - result.updater = C.CString(gMeta.Updater) - result.active = C.bool(gMeta.Active) - - return result -} - -// Allocates memory -func goToCShards(gShards *types.Shards) *C.shards { - if gShards == nil { - return nil - } - - result := (*C.shards)(C.calloc(1, C.sizeof_shards)) - result.failed = C.int(gShards.Failed) - result.successful = C.int(gShards.Successful) - result.total = C.int(gShards.Total) - - return result -} - -// Allocates memory -func goToCNotificationContent(gNotifContent *types.NotificationResult) *C.notification_content { - result := (*C.notification_content)(C.calloc(1, C.sizeof_notification_content)) - result.id = C.CString(gNotifContent.Id) - result.m = goToCMeta(gNotifContent.Meta) - result.count = C.int(gNotifContent.Count) - marshalled, _ := json.Marshal(gNotifContent) - result.content = C.CString(string(marshalled)) - - return result -} - -// Allocates memory -func goToCNotificationResult(gNotif *types.KuzzleNotification) *C.notification_result { - result := (*C.notification_result)(C.calloc(1, C.sizeof_notification_result)) - - if gNotif.Error.Error() != "" { - Set_notification_result_error(result, gNotif.Error) - return result - } - - result.volatiles = C.CString(string(gNotif.Volatile)) - result.request_id = C.CString(gNotif.RequestId) - result.result = goToCNotificationContent(gNotif.Result) - result.index = C.CString(gNotif.Index) - result.collection = C.CString(gNotif.Collection) - result.controller = C.CString(gNotif.Controller) - result.action = C.CString(gNotif.Action) - result.protocol = C.CString(gNotif.Protocol) - result.scope = C.CString(gNotif.Scope) - result.state = C.CString(gNotif.State) - result.user = C.CString(gNotif.User) - result.n_type = C.CString(gNotif.Type) - result.room_id = C.CString(gNotif.RoomId) - result.timestamp = C.ulonglong(gNotif.Timestamp) - result.status = C.int(gNotif.Status) - - return result -} - -func goToCKuzzleResponse(gRes *types.KuzzleResponse) *C.kuzzle_response { - result := (*C.kuzzle_response)(C.calloc(1, C.sizeof_kuzzle_response)) - - result.request_id = C.CString(gRes.RequestId) - - bufResult := C.CString(string(gRes.Result)) - result.result = bufResult - C.free(unsafe.Pointer(bufResult)) - - result.volatiles = C.CString(string(gRes.Volatile)) - result.index = C.CString(gRes.Index) - result.collection = C.CString(gRes.Collection) - result.controller = C.CString(gRes.Controller) - result.action = C.CString(gRes.Action) - result.room_id = C.CString(gRes.RoomId) - result.channel = C.CString(gRes.Channel) - result.status = C.int(gRes.Status) - - if gRes.Error.Error() != "" { - // The error might be a partial error - Set_kuzzle_response_error(result, gRes.Error) - } - - return result -} - -func goToCPolicyRestriction(restriction *types.PolicyRestriction, dest *C.policy_restriction) *C.policy_restriction { - var crestriction *C.policy_restriction - if dest == nil { - crestriction = (*C.policy_restriction)(C.calloc(1, C.sizeof_policy_restriction)) - } else { - crestriction = dest - } - crestriction.index = C.CString(restriction.Index) - crestriction.collections_length = C.size_t(len(restriction.Collections)) - - if restriction.Collections != nil { - crestriction.collections = (**C.char)(C.calloc(C.size_t(len(restriction.Collections)), C.sizeof_char_ptr)) - collections := (*[1<<28 - 1]*C.char)(unsafe.Pointer(crestriction.collections))[:len(restriction.Collections)] - - for i, col := range restriction.Collections { - collections[i] = C.CString(col) - } - } - - return crestriction -} - -// Allocates memory -func goToCStringResult(goRes *string, err error) *C.string_result { - result := (*C.string_result)(C.calloc(1, C.sizeof_string_result)) - - if err != nil { - Set_string_result_error(result, err) - return result - } - - if goRes != nil { - result.result = C.CString(*goRes) - } - - return result -} - -func goToCSubscribeResult(goRes *types.SubscribeResult, err error) *C.subscribe_result { - result := (*C.subscribe_result)(C.calloc(1, C.sizeof_subscribe_result)) - - if err != nil { - Set_subscribe_error(result, err) - return result - } - - result.room = C.CString(goRes.Room) - result.channel = C.CString(goRes.Channel) - - return result -} - -func goToCStringArrayResult(goRes []string, err error) *C.string_array_result { - result := (*C.string_array_result)(C.calloc(1, C.sizeof_string_array_result)) - - if err != nil { - Set_string_array_result_error(result, err) - return result - } - - if goRes != nil { - result.result = (**C.char)(C.calloc(C.size_t(len(goRes)), C.sizeof_char_ptr)) - result.result_length = C.size_t(len(goRes)) - - cArray := (*[1<<28 - 1]*C.char)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] - - for i, substring := range goRes { - cArray[i] = C.CString(substring) - } - } - - return result -} - -// Allocates memory -func goToCIntResult(goRes int, err error) *C.int_result { - result := (*C.int_result)(C.calloc(1, C.sizeof_int_result)) - - if err != nil { - Set_int_result_error(result, err) - return result - } - - result.result = C.longlong(goRes) - - return result -} - -//Allocates memory -func goToCIntArrayResult(goRes []int, err error) *C.int_array_result { - result := (*C.int_array_result)(C.calloc(1, C.sizeof_int_array_result)) - - if err != nil { - Set_int_array_result_error(result, err) - return result - } - - if goRes != nil { - result.result = (*C.longlong)(C.calloc(C.size_t(len(goRes)), C.sizeof_longlong)) - result.result_length = C.size_t(len(goRes)) - - cArray := (*[1<<20 - 1]C.longlong)(unsafe.Pointer(result.result))[:len(goRes):len(goRes)] - - for i, num := range goRes { - cArray[i] = C.longlong(num) - } - } - - return result -} - -// Allocates memory -func goToCDoubleResult(goRes float64, err error) *C.double_result { - result := (*C.double_result)(C.calloc(1, C.sizeof_double_result)) - - if err != nil { - Set_double_result_error(result, err) - return result - } - - result.result = C.double(goRes) - - return result -} - -func goToCPolicy(policy *types.Policy, dest *C.policy) *C.policy { - var cpolicy *C.policy - if dest == nil { - cpolicy = (*C.policy)(C.calloc(1, C.sizeof_policy)) - } else { - cpolicy = dest - } - - cpolicy.role_id = C.CString(policy.RoleId) - cpolicy.restricted_to_length = C.size_t(len(policy.RestrictedTo)) - - if policy.RestrictedTo != nil { - cpolicy.restricted_to = (*C.policy_restriction)(C.calloc(C.size_t(len(policy.RestrictedTo)), C.sizeof_policy_restriction)) - restrictions := (*[1<<27 - 1]C.policy_restriction)(unsafe.Pointer(cpolicy.restricted_to))[:len(policy.RestrictedTo)] - - for i, restriction := range policy.RestrictedTo { - goToCPolicyRestriction(restriction, &restrictions[i]) - } - } - - return cpolicy -} - -func goToCProfile(k *C.kuzzle, profile *security.Profile, dest *C.profile) *C.profile { - var cprofile *C.profile - if dest == nil { - cprofile = (*C.profile)(C.calloc(1, C.sizeof_profile)) - } else { - cprofile = dest - } - - cprofile.id = C.CString(profile.Id) - cprofile.policies_length = C.size_t(len(profile.Policies)) - cprofile.k = k - - if profile.Policies != nil { - cprofile.policies = (*C.policy)(C.calloc(C.size_t(len(profile.Policies)), C.sizeof_policy)) - policies := (*[1<<27 - 1]C.policy)(unsafe.Pointer(cprofile.policies))[:len(profile.Policies)] - for i, policy := range profile.Policies { - goToCPolicy(policy, &policies[i]) - } - } - - return cprofile -} - -func goToCProfileSearchResult(k *C.kuzzle, res *security.ProfileSearchResult, err error) *C.search_profiles_result { - result := (*C.search_profiles_result)(C.calloc(1, C.sizeof_search_profiles_result)) - - if err != nil { - Set_search_profiles_result_error(result, err) - return result - } - - result.result = (*C.profile_search)(C.calloc(1, C.sizeof_profile_search)) - result.result.hits_length = C.size_t(len(res.Hits)) - result.result.total = C.uint(res.Total) - if res.ScrollId != "" { - result.result.scroll_id = C.CString(res.ScrollId) - } - - if len(res.Hits) > 0 { - result.result.hits = (*C.profile)(C.calloc(C.size_t(len(res.Hits)), C.sizeof_profile)) - profiles := (*[1<<27 - 1]C.profile)(unsafe.Pointer(result.result.hits))[:len(res.Hits)] - - for i, profile := range res.Hits { - goToCProfile(k, profile, &profiles[i]) - } - } - - return result -} - -func goToCRoleSearchResult(k *C.kuzzle, res *security.RoleSearchResult, err error) *C.search_roles_result { - result := (*C.search_roles_result)(C.calloc(1, C.sizeof_search_roles_result)) - - if err != nil { - Set_search_roles_result_error(result, err) - return result - } - - result.result = (*C.role_search)(C.calloc(1, C.sizeof_role_search)) - result.result.hits_length = C.size_t(len(res.Hits)) - result.result.total = C.uint(res.Total) - - if len(res.Hits) > 0 { - result.result.hits = (*C.role)(C.calloc(C.size_t(len(res.Hits)), C.sizeof_role)) - cArray := (*[1<<27 - 1]C.role)(unsafe.Pointer(result.result.hits))[:len(res.Hits):len(res.Hits)] - - for i, role := range res.Hits { - goToCRole(k, role, &cArray[i]) - } - } - - return result -} - -// Allocates memory -func goToCBoolResult(goRes bool, err error) *C.bool_result { - result := (*C.bool_result)(C.calloc(1, C.sizeof_bool_result)) - - if err != nil { - Set_bool_result_error(result, err) - return result - } - - result.result = C.bool(goRes) - - return result -} - -// Allocates memory -func goToCSearchResult(goRes *types.SearchResult, err error) *C.search_result { - result := (*C.search_result)(C.calloc(1, C.sizeof_search_result)) - - if err != nil { - Set_search_result_error(result, err) - return result - } - - result.collection = C.CString(string(goRes.Collection)) - result.documents = C.CString(string(goRes.Documents)) - - result.fetched = C.uint(goRes.Fetched) - result.total = C.uint(goRes.Total) - - if goRes.Filters != nil { - result.filters = C.CString(string(goRes.Filters)) - } - - result.options = (*C.query_options)(C.calloc(1, C.sizeof_query_options)) - if goRes.Options != nil { - result.options.from = C.long(goRes.Options.From()) - result.options.size = C.long(goRes.Options.Size()) - - if goRes.Options.ScrollId() != "" { - result.options.scroll_id = C.CString(goRes.Options.ScrollId()) - } - } - - if len(goRes.Aggregations) > 0 { - result.aggregations = C.CString(string(goRes.Aggregations)) - } - - return result -} - -func goToCRole(k *C.kuzzle, role *security.Role, dest *C.role) *C.role { - var crole *C.role - if dest == nil { - crole = (*C.role)(C.calloc(1, C.sizeof_role)) - } else { - crole = dest - } - - crole.id = C.CString(role.Id) - crole.k = k - - if role.Controllers != nil { - ctrls, _ := json.Marshal(role.Controllers) - crole.controllers = C.CString(string(ctrls)) - } - - return crole -} - -// Allocates memory -func goToCSpecification(goSpec *types.Specification) *C.specification { - result := (*C.specification)(C.calloc(1, C.sizeof_specification)) - - result.strict = C.bool(goSpec.Strict) - flds, _ := json.Marshal(goSpec.Fields) - result.fields = C.CString(string(flds)) - result.validators = C.CString(string(goSpec.Validators)) - return result -} - -// Allocates memory -func goToCSpecificationEntry(goEntry *types.SpecificationEntry, dest *C.specification_entry) *C.specification_entry { - var result *C.specification_entry - if dest == nil { - result = (*C.specification_entry)(C.calloc(1, C.sizeof_specification_entry)) - } else { - result = dest - } - - result.index = C.CString(goEntry.Index) - result.collection = C.CString(goEntry.Collection) - result.validation = goToCSpecification(goEntry.Validation) - - return result -} - -// Allocates memory -func goToCSpecificationResult(goRes *types.Specification, err error) *C.specification_result { - result := (*C.specification_result)(C.calloc(1, C.sizeof_specification_result)) - - if err != nil { - Set_specification_result_err(result, err) - return result - } - - result.result = goToCSpecification(goRes) - - return result -} - -// Allocates memory -func goToCSpecificationSearchResult(goRes *types.SpecificationSearchResult, err error) *C.specification_search_result { - result := (*C.specification_search_result)(C.calloc(1, C.sizeof_specification_search_result)) - - if err != nil { - Set_specification_search_result_error(result, err) - return result - } - - result.result = (*C.specification_search)(C.calloc(1, C.sizeof_specification_search)) - result.result.hits_length = C.size_t(len(goRes.Hits)) - result.result.total = C.uint(goRes.Total) - - if goRes.ScrollId != "" { - result.result.scroll_id = C.CString(goRes.ScrollId) - } - - if len(goRes.Hits) > 0 { - result.result.hits = (*C.specification_entry)(C.calloc(C.size_t(len(goRes.Hits)), C.sizeof_specification_entry)) - cArray := (*[1<<27 - 1]C.specification_entry)(unsafe.Pointer(result.result.hits))[:len(goRes.Hits):len(goRes.Hits)] - - for i, spec := range goRes.Hits { - goToCSpecificationEntry(&spec.Source, &cArray[i]) - } - } - - return result -} - -func goToCProfileResult(k *C.kuzzle, res *security.Profile, err error) *C.profile_result { - result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) - if err != nil { - Set_profile_result_error(result, err) - return result - } - - result.p = goToCProfile(k, res, nil) - return result -} - -func goToCUserData(data *types.UserData) (*C.user_data, error) { - if data == nil { - return nil, nil - } - - cdata := (*C.user_data)(C.calloc(1, C.sizeof_user_data)) - - if data.Content != nil { - cnt, err := json.Marshal(data.Content) - if err != nil { - return nil, err - } - jsonO := C.CString(string(cnt)) - cdata.content = jsonO - } - - if data.ProfileIds != nil { - cdata.profile_ids_length = C.size_t(len(data.ProfileIds)) - cdata.profile_ids = (**C.char)(C.calloc(C.size_t(len(data.ProfileIds)), C.sizeof_char_ptr)) - carray := (*[1<<27 - 1]*C.char)(unsafe.Pointer(cdata.profile_ids))[:len(data.ProfileIds):len(data.ProfileIds)] - - for i, profileId := range data.ProfileIds { - carray[i] = C.CString(profileId) - } - } - - return cdata, nil -} - -func goToCUser(k *C.kuzzle, user *security.User, dest *C.kuzzle_user) (*C.kuzzle_user, error) { - if user == nil { - return nil, nil - } - - var cuser *C.kuzzle_user - if dest == nil { - cuser = (*C.kuzzle_user)(C.calloc(1, C.sizeof_kuzzle_user)) - } else { - cuser = dest - } - - cuser.id = C.CString(user.Id) - cuser.k = k - - if user.Content != nil { - cnt, err := json.Marshal(user.Content) - if err != nil { - return nil, err - } - - cuser.content = C.CString(string(cnt)) - } - - if user.ProfileIds != nil { - cuser.profile_ids_length = C.size_t(len(user.ProfileIds)) - cuser.profile_ids = (**C.char)(C.calloc(C.size_t(len(user.ProfileIds)), C.sizeof_char_ptr)) - carray := (*[1<<28 - 1]*C.char)(unsafe.Pointer(cuser.profile_ids))[:len(user.ProfileIds):len(user.ProfileIds)] - - for i, profileId := range user.ProfileIds { - carray[i] = C.CString(profileId) - } - } - - return cuser, nil -} - -func goToCUserResult(k *C.kuzzle, user *security.User, err error) *C.user_result { - result := (*C.user_result)(C.calloc(1, C.sizeof_user_result)) - if err != nil { - Set_user_result_error(result, err) - return result - } - - cuser, err := goToCUser(k, user, nil) - if err != nil { - Set_user_result_error(result, err) - return result - } - - result.result = cuser - - return result -} - -func goToCProfilesResult(k *C.kuzzle, profiles []*security.Profile, err error) *C.profiles_result { - result := (*C.profiles_result)(C.calloc(1, C.sizeof_profiles_result)) - if err != nil { - Set_profiles_result_error(result, err) - return result - } - - result.profiles_length = C.size_t(len(profiles)) - - if profiles != nil { - result.profiles = (*C.profile)(C.calloc(C.size_t(len(profiles)), C.sizeof_profile)) - carray := (*[1<<27 - 1]C.profile)(unsafe.Pointer(result.profiles))[:len(profiles):len(profiles)] - - for i, profile := range profiles { - goToCProfile(k, profile, &carray[i]) - } - } - - return result -} - -func goToCRolesResult(k *C.kuzzle, roles []*security.Role, err error) *C.roles_result { - result := (*C.roles_result)(C.calloc(1, C.sizeof_roles_result)) - if err != nil { - Set_roles_result_error(result, err) - return result - } - - result.roles_length = C.size_t(len(roles)) - - if roles != nil { - result.roles = (*C.role)(C.calloc(C.size_t(len(roles)), C.sizeof_role)) - carray := (*[1<<27 - 1]C.role)(unsafe.Pointer(result.roles))[:len(roles):len(roles)] - - for i, role := range roles { - goToCRole(k, role, &carray[i]) - } - } - - return result -} - -func goToCUserRight(right *types.UserRights, dest *C.user_right) *C.user_right { - if right == nil { - return nil - } - - var cright *C.user_right - if dest == nil { - cright = (*C.user_right)(C.calloc(1, C.sizeof_user_right)) - } else { - cright = dest - } - - cright.controller = C.CString(right.Controller) - cright.action = C.CString(right.Action) - cright.index = C.CString(right.Index) - cright.collection = C.CString(right.Collection) - cright.value = C.CString(right.Value) - - return cright -} - -func goToCUserRightsResult(rights []*types.UserRights, err error) *C.user_rights_result { - result := (*C.user_rights_result)(C.calloc(1, C.sizeof_user_rights_result)) - if err != nil { - Set_user_rights_error(result, err) - return result - } - - result.user_rights_length = C.size_t(len(rights)) - if rights != nil { - result.result = (*C.user_right)(C.calloc(C.size_t(len(rights)), C.sizeof_user_right)) - carray := (*[1<<26 - 1]C.user_right)(unsafe.Pointer(result.result))[:len(rights):len(rights)] - - for i, right := range rights { - goToCUserRight(right, &carray[i]) - } - } - - return result -} - -func goToCUserSearchResult(k *C.kuzzle, res *security.UserSearchResult, err error) *C.search_users_result { - result := (*C.search_users_result)(C.calloc(1, C.sizeof_search_users_result)) - - if err != nil { - Set_search_users_result_error(result, err) - return result - } - - result.result = (*C.user_search)(C.calloc(1, C.sizeof_user_search)) - result.result.hits_length = C.size_t(len(res.Hits)) - result.result.total = C.uint(res.Total) - if res.ScrollId != "" { - result.result.scroll_id = C.CString(res.ScrollId) - } - - if len(res.Hits) > 0 { - result.result.hits = (*C.kuzzle_user)(C.calloc(C.size_t(len(res.Hits)), C.sizeof_kuzzle_user)) - users := (*[1<<26 - 1]C.kuzzle_user)(unsafe.Pointer(result.result.hits))[:len(res.Hits)] - - for i, user := range res.Hits { - goToCUser(k, user, &users[i]) - } - } - - return result -} - -func fillCollectionList(collection *types.CollectionsList, entry *C.collection_entry) { - if collection == nil { - return - } - - entry.persisted = collection.Type == "persisted" - entry.name = C.CString(collection.Name) -} - -func goToCCollectionListResult(collections []*types.CollectionsList, err error) *C.collection_entry_result { - result := (*C.collection_entry_result)(C.calloc(1, C.sizeof_collection_entry_result)) - if err != nil { - Set_collection_entry_error(result, err) - return result - } - - if collections != nil { - result.result = (*C.collection_entry)(C.calloc(C.size_t(len(collections)), C.sizeof_collection_entry)) - result.result_length = C.size_t(len(collections)) - carray := (*[1<<27 - 1]C.collection_entry)(unsafe.Pointer(result.result))[:len(collections):len(collections)] - - for i, collection := range collections { - fillCollectionList(collection, &carray[i]) - } - } - - return result -} - -// Allocates memory -func fillStatistics(src *types.Statistics, dest *C.statistics) { - dest.ongoing_requests = C.CString(string(src.OngoingRequests)) - dest.completed_requests = C.CString(string(src.CompletedRequests)) - dest.connections = C.CString(string(src.Connections)) - dest.failed_requests = C.CString(string(src.FailedRequests)) - dest.timestamp = C.ulonglong(src.Timestamp) -} - -// Allocates memory -func goToCErrorResult(err error) *C.error_result { - if err == nil { - return nil - } - - result := (*C.error_result)(C.calloc(1, C.sizeof_error_result)) - Set_error_result_error(result, err) - - return result -} - -// Allocates memory -func goToCDateResult(goRes int, err error) *C.date_result { - result := (*C.date_result)(C.calloc(1, C.sizeof_date_result)) - - if err != nil { - Set_date_result_error(result, err) - return result - } - - result.result = C.longlong(goRes) - - return result -} diff --git a/internal/wrappers/cgo/kuzzle/index.go b/internal/wrappers/cgo/kuzzle/index.go deleted file mode 100644 index 4209b6a3..00000000 --- a/internal/wrappers/cgo/kuzzle/index.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "sync" - "unsafe" - - indexPkg "github.com/kuzzleio/sdk-go/index" - "github.com/kuzzleio/sdk-go/kuzzle" -) - -// map which stores instances to keep references in case the gc passes -var indexInstances sync.Map - -//register new instance of index -func registerIndex(instance interface{}, ptr unsafe.Pointer) { - indexInstances.Store(instance, ptr) -} - -// unregister an instance from the instances map -//export unregisterIndex -func unregisterIndex(i *C.kuzzle_index) { - indexInstances.Delete(i) -} - -// Allocates memory -//export kuzzle_new_index -func kuzzle_new_index(i *C.kuzzle_index, k *C.kuzzle) { - kuz := (*kuzzle.Kuzzle)(k.instance) - index := indexPkg.NewIndex(kuz) - - ptr := unsafe.Pointer(index) - i.instance = ptr - i.k = k - - registerIndex(i, ptr) -} - -//export kuzzle_index_create -func kuzzle_index_create(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.error_result { - err := (*indexPkg.Index)(i.instance).Create(C.GoString(index), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_index_delete -func kuzzle_index_delete(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.error_result { - err := (*indexPkg.Index)(i.instance).Delete(C.GoString(index), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_index_mdelete -func kuzzle_index_mdelete(i *C.kuzzle_index, indexes **C.char, l C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*indexPkg.Index)(i.instance).MDelete(cToGoStrings(indexes, l), SetQueryOptions(options)) - return goToCStringArrayResult(res, err) -} - -//export kuzzle_index_exists -func kuzzle_index_exists(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.bool_result { - res, err := (*indexPkg.Index)(i.instance).Exists(C.GoString(index), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_index_refresh -func kuzzle_index_refresh(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.error_result { - err := (*indexPkg.Index)(i.instance).Refresh(C.GoString(index), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_index_refresh_internal -func kuzzle_index_refresh_internal(i *C.kuzzle_index, options *C.query_options) *C.error_result { - err := (*indexPkg.Index)(i.instance).RefreshInternal(SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_index_set_auto_refresh -func kuzzle_index_set_auto_refresh(i *C.kuzzle_index, index *C.char, autoRefresh C.bool, options *C.query_options) *C.error_result { - err := (*indexPkg.Index)(i.instance).SetAutoRefresh(C.GoString(index), bool(autoRefresh), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_index_get_auto_refresh -func kuzzle_index_get_auto_refresh(i *C.kuzzle_index, index *C.char, options *C.query_options) *C.bool_result { - res, err := (*indexPkg.Index)(i.instance).GetAutoRefresh(C.GoString(index), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} - -//export kuzzle_index_list -func kuzzle_index_list(i *C.kuzzle_index, options *C.query_options) *C.string_array_result { - res, err := (*indexPkg.Index)(i.instance).List(SetQueryOptions(options)) - return goToCStringArrayResult(res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/kuzzle.go b/internal/wrappers/cgo/kuzzle/kuzzle.go deleted file mode 100644 index 0f583b21..00000000 --- a/internal/wrappers/cgo/kuzzle/kuzzle.go +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "encoding/json" - "sync" - "time" - "unsafe" - - "github.com/kuzzleio/sdk-go/connection" - "github.com/kuzzleio/sdk-go/connection/websocket" - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" -) - -// map which stores instances to keep references in case the gc passes -var instances sync.Map - -// map which stores channel and function's pointers adresses for listeners -var listeners_list map[uintptr]chan<- interface{} - -// register new instance to the instances map -func registerKuzzle(instance interface{}, ptr unsafe.Pointer) { - instances.Store(instance, ptr) -} - -// unregister an instance from the instances map -//export unregisterKuzzle -func unregisterKuzzle(k *C.kuzzle) { - instances.Delete(k) -} - -//export kuzzle_new_kuzzle -func kuzzle_new_kuzzle(k *C.kuzzle, host, protocol *C.char, options *C.options) { - var c connection.Connection - - if listeners_list == nil { - listeners_list = make(map[uintptr]chan<- interface{}) - } - - opts := SetOptions(options) - - if C.GoString(protocol) == "websocket" { - c = websocket.NewWebSocket(C.GoString(host), opts) - } - - inst, err := kuzzle.NewKuzzle(c, opts) - - if err != nil { - panic(err.Error()) - } - - ptr := unsafe.Pointer(inst) - k.instance = ptr - k.loader = nil - - registerKuzzle(inst, ptr) -} - -//export kuzzle_get_document_controller -func kuzzle_get_document_controller(k *C.kuzzle) *C.document { - d := (*C.document)(C.calloc(1, C.sizeof_document)) - - d.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Document)) - d.k = k - return d -} - -//export kuzzle_get_auth_controller -func kuzzle_get_auth_controller(k *C.kuzzle) *C.auth { - a := (*C.auth)(C.calloc(1, C.sizeof_auth)) - - a.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Auth)) - a.k = k - return a -} - -//export kuzzle_get_index_controller -func kuzzle_get_index_controller(k *C.kuzzle) *C.kuzzle_index { - i := (*C.kuzzle_index)(C.calloc(1, C.sizeof_kuzzle_index)) - - i.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Index)) - i.k = k - return i -} - -//export kuzzle_get_jwt -func kuzzle_get_jwt(k *C.kuzzle) *C.char { - return C.CString((*kuzzle.Kuzzle)(k.instance).Jwt()) -} - -//export kuzzle_set_jwt -func kuzzle_set_jwt(k *C.kuzzle, jwt *C.char) { - (*kuzzle.Kuzzle)(k.instance).SetJwt(C.GoString(jwt)) -} - -//export kuzzle_get_server_controller -func kuzzle_get_server_controller(k *C.kuzzle) *C.server { - s := (*C.server)(C.calloc(1, C.sizeof_server)) - - s.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Server)) - s.k = k - return s -} - -//export kuzzle_get_collection_controller -func kuzzle_get_collection_controller(k *C.kuzzle) *C.collection { - c := (*C.collection)(C.calloc(1, C.sizeof_collection)) - - c.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Collection)) - c.k = k - return c -} - -//export kuzzle_get_realtime_controller -func kuzzle_get_realtime_controller(k *C.kuzzle) *C.realtime { - rt := (*C.realtime)(C.calloc(1, C.sizeof_realtime)) - - rt.instance = unsafe.Pointer(unsafe.Pointer((*kuzzle.Kuzzle)(k.instance).Realtime)) - rt.k = k - return rt -} - -// Allocates memory -//export kuzzle_connect -func kuzzle_connect(k *C.kuzzle) *C.char { - err := (*kuzzle.Kuzzle)(k.instance).Connect() - if err != nil { - return C.CString(err.Error()) - } - - return nil -} - -//export kuzzle_disconnect -func kuzzle_disconnect(k *C.kuzzle) { - (*kuzzle.Kuzzle)(k.instance).Disconnect() -} - -//export kuzzle_emit_event -func kuzzle_emit_event(k *C.kuzzle, event C.int, body *C.char) { - (*kuzzle.Kuzzle)(k.instance).EmitEvent(int(event), C.GoString(body)) -} - -//export kuzzle_get_offline_queue -func kuzzle_get_offline_queue(k *C.kuzzle) *C.offline_queue { - result := (*C.offline_queue)(C.calloc(1, C.sizeof_offline_queue)) - - offlineQueue := (*kuzzle.Kuzzle)(k.instance).OfflineQueue() - result.queries_length = C.size_t(len(offlineQueue)) - - result.queries = (**C.query_object)(C.calloc(result.queries_length, C.sizeof_query_object_ptr)) - queryObjects := (*[1<<28 - 1]*C.query_object)(unsafe.Pointer(result.queries))[:result.queries_length:result.queries_length] - - idx := 0 - for _, queryObject := range offlineQueue { - queryObjects[idx] = (*C.query_object)(C.calloc(1, C.sizeof_query_object)) - queryObjects[idx].timestamp = C.ulonglong(queryObject.Timestamp.Unix()) - queryObjects[idx].request_id = C.CString(queryObject.RequestId) - mquery, _ := json.Marshal(queryObject.Query) - - buffer := C.CString(string(mquery)) - queryObjects[idx].query = C.CString(C.GoString(buffer)) - C.free(unsafe.Pointer(buffer)) - - idx++ - } - - return result -} - -//export kuzzle_flush_queue -func kuzzle_flush_queue(k *C.kuzzle) { - (*kuzzle.Kuzzle)(k.instance).FlushQueue() -} - -//export kuzzle_play_queue -func kuzzle_play_queue(k *C.kuzzle) { - (*kuzzle.Kuzzle)(k.instance).PlayQueue() -} - -//export kuzzle_start_queuing -func kuzzle_start_queuing(k *C.kuzzle) { - (*kuzzle.Kuzzle)(k.instance).StartQueuing() -} - -//export kuzzle_stop_queuing -func kuzzle_stop_queuing(k *C.kuzzle) { - (*kuzzle.Kuzzle)(k.instance).StopQueuing() -} - -//export kuzzle_add_listener -// TODO loop and close on Unsubscribe -func kuzzle_add_listener(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data unsafe.Pointer) { - c := make(chan interface{}) - - listeners_list[uintptr(unsafe.Pointer(cb))] = c - (*kuzzle.Kuzzle)(k.instance).AddListener(int(e), c) - go func() { - for { - res, ok := <-c - if ok == false { - break - } - r, _ := json.Marshal(res) - - C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) - } - }() -} - -//export kuzzle_once -func kuzzle_once(k *C.kuzzle, e C.int, cb C.kuzzle_event_listener, data unsafe.Pointer) { - c := make(chan interface{}) - - listeners_list[uintptr(unsafe.Pointer(cb))] = c - (*kuzzle.Kuzzle)(k.instance).Once(int(e), c) - go func() { - res := <-c - - r, _ := json.Marshal(res) - - C.kuzzle_trigger_event(e, cb, C.CString(string(r)), data) - }() -} - -//export kuzzle_listener_count -func kuzzle_listener_count(k *C.kuzzle, event C.int) int { - return (*kuzzle.Kuzzle)(k.instance).ListenerCount(int(event)) -} - -//export kuzzle_remove_listener -func kuzzle_remove_listener(k *C.kuzzle, event C.int, cb unsafe.Pointer) { - (*kuzzle.Kuzzle)(k.instance).RemoveListener(int(event), listeners_list[uintptr(cb)]) -} - -//export kuzzle_remove_all_listeners -func kuzzle_remove_all_listeners(k *C.kuzzle, event C.int) { - (*kuzzle.Kuzzle)(k.instance).RemoveAllListeners(int(event)) -} - -//export kuzzle_get_auto_queue -func kuzzle_get_auto_queue(k *C.kuzzle) C.bool { - return C.bool((*kuzzle.Kuzzle)(k.instance).AutoQueue()) -} - -//export kuzzle_set_auto_queue -func kuzzle_set_auto_queue(k *C.kuzzle, value C.bool) { - (*kuzzle.Kuzzle)(k.instance).SetAutoQueue(bool(value)) -} - -//export kuzzle_get_auto_reconnect -func kuzzle_get_auto_reconnect(k *C.kuzzle) C.bool { - return C.bool((*kuzzle.Kuzzle)(k.instance).AutoReconnect()) -} - -//export kuzzle_get_auto_resubscribe -func kuzzle_get_auto_resubscribe(k *C.kuzzle) C.bool { - return C.bool((*kuzzle.Kuzzle)(k.instance).AutoResubscribe()) -} - -//export kuzzle_get_auto_replay -func kuzzle_get_auto_replay(k *C.kuzzle) C.bool { - return C.bool((*kuzzle.Kuzzle)(k.instance).AutoReplay()) -} - -//export kuzzle_set_auto_replay -func kuzzle_set_auto_replay(k *C.kuzzle, value C.bool) { - (*kuzzle.Kuzzle)(k.instance).SetAutoReplay(bool(value)) -} - -//export kuzzle_get_host -func kuzzle_get_host(k *C.kuzzle) *C.char { - return C.CString((*kuzzle.Kuzzle)(k.instance).Host()) -} - -//export kuzzle_get_offline_queue_loader -func kuzzle_get_offline_queue_loader(k *C.kuzzle) C.kuzzle_offline_queue_loader { - return k.loader -} - -//export kuzzle_set_offline_queue_loader -func kuzzle_set_offline_queue_loader(k *C.kuzzle, loader C.kuzzle_offline_queue_loader) { - k.loader = loader -} - -//export kuzzle_get_port -func kuzzle_get_port(k *C.kuzzle) C.int { - return C.int((*kuzzle.Kuzzle)(k.instance).Port()) -} - -//export kuzzle_get_queue_filter -func kuzzle_get_queue_filter(k *C.kuzzle) C.kuzzle_queue_filter { - return k.filter -} - -//export kuzzle_set_queue_filter -func kuzzle_set_queue_filter(k *C.kuzzle, f C.kuzzle_queue_filter) { - k.filter = f - - if f != nil { - filter := func(q []byte) bool { - return bool(C.kuzzle_filter_query(f, (*C.char)(unsafe.Pointer(&q[0])))) - } - - (*kuzzle.Kuzzle)(k.instance).SetQueueFilter(filter) - } else { - (*kuzzle.Kuzzle)(k.instance).SetQueueFilter(nil) - } -} - -//export kuzzle_get_queue_max_size -func kuzzle_get_queue_max_size(k *C.kuzzle) C.int { - return C.int((*kuzzle.Kuzzle)(k.instance).QueueMaxSize()) -} - -//export kuzzle_set_queue_max_size -func kuzzle_set_queue_max_size(k *C.kuzzle, size C.int) { - (*kuzzle.Kuzzle)(k.instance).SetQueueMaxSize(int(size)) -} - -//export kuzzle_get_queue_ttl -func kuzzle_get_queue_ttl(k *C.kuzzle) C.int { - return C.int((*kuzzle.Kuzzle)(k.instance).QueueTTL()) -} - -//export kuzzle_set_queue_ttl -func kuzzle_set_queue_ttl(k *C.kuzzle, ttl C.int) { - (*kuzzle.Kuzzle)(k.instance).SetQueueTTL(time.Duration(ttl)) -} - -//export kuzzle_get_replay_interval -func kuzzle_get_replay_interval(k *C.kuzzle) C.int { - return C.int((*kuzzle.Kuzzle)(k.instance).ReplayInterval()) -} - -//export kuzzle_set_replay_interval -func kuzzle_set_replay_interval(k *C.kuzzle, interval C.int) { - (*kuzzle.Kuzzle)(k.instance).SetReplayInterval(time.Duration(interval)) -} - -//export kuzzle_get_reconnection_delay -func kuzzle_get_reconnection_delay(k *C.kuzzle) C.int { - return C.int((*kuzzle.Kuzzle)(k.instance).ReconnectionDelay()) -} - -//export kuzzle_get_ssl_connection -func kuzzle_get_ssl_connection(k *C.kuzzle) C.bool { - return C.bool((*kuzzle.Kuzzle)(k.instance).SslConnection()) -} - -//export kuzzle_get_volatile -func kuzzle_get_volatile(k *C.kuzzle) *C.char { - r := C.CString(string((*kuzzle.Kuzzle)(k.instance).Volatile())) - return r -} - -//export kuzzle_set_volatile -func kuzzle_set_volatile(k *C.kuzzle, v *C.char) { - (*kuzzle.Kuzzle)(k.instance).SetVolatile(types.VolatileData(C.GoString(v))) -} - -func main() { - -} diff --git a/internal/wrappers/cgo/kuzzle/memory_storage.go b/internal/wrappers/cgo/kuzzle/memory_storage.go deleted file mode 100644 index d3d6990e..00000000 --- a/internal/wrappers/cgo/kuzzle/memory_storage.go +++ /dev/null @@ -1,1309 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - - #include - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" - - static void assign_geopos(double (*ptr)[2], int idx, double lon, double lat) { - ptr[idx][0] = lon; - ptr[idx][1] = lat; - } -*/ -import "C" -import ( - "encoding/json" - "unsafe" - - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" -) - -//export kuzzle_ms_append -func kuzzle_ms_append(k *C.kuzzle, key *C.char, value *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Append( - C.GoString(key), - C.GoString(value), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_bitcount -func kuzzle_ms_bitcount(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Bitcount( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_bitop -func kuzzle_ms_bitop(k *C.kuzzle, key *C.char, operation *C.char, keys **C.char, klen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Bitop( - C.GoString(key), - C.GoString(operation), - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_bitpos -func kuzzle_ms_bitpos(k *C.kuzzle, key *C.char, bit C.uchar, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Bitpos( - C.GoString(key), - int(bit), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_dbsize -func kuzzle_ms_dbsize(k *C.kuzzle, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Dbsize(SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_decr -func kuzzle_ms_decr(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Decr( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_decrby -func kuzzle_ms_decrby(k *C.kuzzle, key *C.char, value C.int, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Decrby( - C.GoString(key), - int(value), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_del -func kuzzle_ms_del(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Del( - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_exists -func kuzzle_ms_exists(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Exists( - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_expire -func kuzzle_ms_expire(k *C.kuzzle, key *C.char, seconds C.ulong, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Expire( - C.GoString(key), - int(seconds), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_expireat -func kuzzle_ms_expireat(k *C.kuzzle, key *C.char, ts C.ulonglong, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Expireat( - C.GoString(key), - int(ts), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_flushdb -func kuzzle_ms_flushdb(k *C.kuzzle, options *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Flushdb(SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_geoadd -func kuzzle_ms_geoadd(k *C.kuzzle, key *C.char, points **C.point, plen C.size_t, options *C.query_options) *C.int_result { - wrapped := (*[1 << 20]*C.point)(unsafe.Pointer(points))[:plen:plen] - gopoints := make([]*types.GeoPoint, int(plen)) - - for i, jobj := range wrapped { - stringified, _ := json.Marshal(jobj) - gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) - json.Unmarshal(gobytes, gopoints[i]) - } - - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Geoadd( - C.GoString(key), - gopoints, - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_geodist -func kuzzle_ms_geodist(k *C.kuzzle, key *C.char, member1 *C.char, member2 *C.char, options *C.query_options) *C.double_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Geodist( - C.GoString(key), - C.GoString(member1), - C.GoString(member2), - SetQueryOptions(options)) - - return goToCDoubleResult(res, err) -} - -//export kuzzle_ms_geohash -func kuzzle_ms_geohash(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Geohash( - C.GoString(key), - cToGoStrings(members, mlen), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_geopos -func kuzzle_ms_geopos(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, options *C.query_options) *C.geopos_result { - result := (*C.geopos_result)(C.calloc(1, C.sizeof_geopos_result)) - - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Geopos( - C.GoString(key), - cToGoStrings(members, mlen), - SetQueryOptions(options)) - - if err != nil { - kuzzleError := err.(types.KuzzleError) - result.status = C.int(kuzzleError.Status) - result.error = C.CString(kuzzleError.Message) - - if len(kuzzleError.Stack) > 0 { - result.stack = C.CString(kuzzleError.Stack) - } - return result - } - - result.result_length = C.size_t(len(res)) - result.result = (*[2]C.double)(C.calloc(result.result_length, C.sizeof_geopos_arr)) - - for i, pos := range res { - C.assign_geopos(result.result, C.int(i), C.double(pos.Lon), C.double(pos.Lat)) - } - - return result -} - -//export kuzzle_ms_georadius -func kuzzle_ms_georadius(k *C.kuzzle, key *C.char, lon C.double, lat C.double, dist C.double, unit *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Georadius( - C.GoString(key), - float64(lon), - float64(lat), - float64(dist), - C.GoString(unit), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_georadiusbymember -func kuzzle_ms_georadiusbymember(k *C.kuzzle, key *C.char, member *C.char, dist C.double, unit *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Georadiusbymember( - C.GoString(key), - C.GoString(member), - float64(dist), - C.GoString(unit), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_get -func kuzzle_ms_get(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Get( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_getbit -func kuzzle_ms_getbit(k *C.kuzzle, key *C.char, offset C.int, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Getbit( - C.GoString(key), - int(offset), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_getrange -func kuzzle_ms_getrange(k *C.kuzzle, key *C.char, start C.int, end C.int, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Getrange( - C.GoString(key), - int(start), - int(end), - SetQueryOptions(options)) - - return goToCStringResult(&res, err) -} - -//export kuzzle_ms_getset -func kuzzle_ms_getset(k *C.kuzzle, key *C.char, value *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Getset( - C.GoString(key), - C.GoString(value), - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_hdel -func kuzzle_ms_hdel(k *C.kuzzle, key *C.char, fields **C.char, flen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hdel( - C.GoString(key), - cToGoStrings(fields, flen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_hexists -func kuzzle_ms_hexists(k *C.kuzzle, key *C.char, field *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hexists( - C.GoString(key), - C.GoString(field), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_hget -func kuzzle_ms_hget(k *C.kuzzle, key *C.char, field *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hget( - C.GoString(key), - C.GoString(field), - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_hgetall -func kuzzle_ms_hgetall(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hgetall( - C.GoString(key), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_hincrby -func kuzzle_ms_hincrby(k *C.kuzzle, key *C.char, field *C.char, value C.long, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hincrby( - C.GoString(key), - C.GoString(field), - int(value), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_hincrbyfloat -func kuzzle_ms_hincrbyfloat(k *C.kuzzle, key *C.char, field *C.char, value C.double, options *C.query_options) *C.double_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hincrbyfloat( - C.GoString(key), - C.GoString(field), - float64(value), - SetQueryOptions(options)) - - return goToCDoubleResult(res, err) -} - -//export kuzzle_ms_hkeys -func kuzzle_ms_hkeys(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hkeys( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_hlen -func kuzzle_ms_hlen(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hlen( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_hmget -func kuzzle_ms_hmget(k *C.kuzzle, key *C.char, fields **C.char, flen C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hmget( - C.GoString(key), - cToGoStrings(fields, flen), - SetQueryOptions(options)) - - // Ms.Hmget returns a []*string value and goToCStringArrayResult - // only accept a []string one - var converted []string - - if err == nil { - converted = make([]string, len(res), len(res)) - - for i, val := range res { - converted[i] = *val - } - } - - return goToCStringArrayResult(converted, err) -} - -//export kuzzle_ms_hmset -func kuzzle_ms_hmset(k *C.kuzzle, key *C.char, entries **C.ms_hash_field, elen C.size_t, options *C.query_options) *C.error_result { - wrapped := (*[1 << 20]*C.ms_hash_field)(unsafe.Pointer(entries))[:elen:elen] - goentries := make([]*types.MsHashField, int(elen)) - - for i, jobj := range wrapped { - stringified, _ := json.Marshal(jobj) - gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) - json.Unmarshal(gobytes, goentries[i]) - } - - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hmset( - C.GoString(key), - goentries, - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_hscan -func kuzzle_ms_hscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hscan( - C.GoString(key), - int(cursor), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_hset -func kuzzle_ms_hset(k *C.kuzzle, key *C.char, field *C.char, value *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hset( - C.GoString(key), - C.GoString(field), - C.GoString(value), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_hsetnx -func kuzzle_ms_hsetnx(k *C.kuzzle, key *C.char, field *C.char, value *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hsetnx( - C.GoString(key), - C.GoString(field), - C.GoString(value), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_hstrlen -func kuzzle_ms_hstrlen(k *C.kuzzle, key *C.char, field *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hstrlen( - C.GoString(key), - C.GoString(field), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_hvals -func kuzzle_ms_hvals(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Hvals( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_incr -func kuzzle_ms_incr(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Incr( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_incrby -func kuzzle_ms_incrby(k *C.kuzzle, key *C.char, value C.long, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Incrby( - C.GoString(key), - int(value), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_incrbyfloat -func kuzzle_ms_incrbyfloat(k *C.kuzzle, key *C.char, value C.double, options *C.query_options) *C.double_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Incrbyfloat( - C.GoString(key), - float64(value), - SetQueryOptions(options)) - - return goToCDoubleResult(res, err) -} - -//export kuzzle_ms_keys -func kuzzle_ms_keys(k *C.kuzzle, pattern *C.char, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Keys( - C.GoString(pattern), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_lindex -func kuzzle_ms_lindex(k *C.kuzzle, key *C.char, index C.long, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Lindex( - C.GoString(key), - int(index), - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_linsert -func kuzzle_ms_linsert(k *C.kuzzle, key *C.char, position *C.char, pivot *C.char, value *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Linsert( - C.GoString(key), - C.GoString(position), - C.GoString(pivot), - C.GoString(value), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_llen -func kuzzle_ms_llen(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Llen( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_lpop -func kuzzle_ms_lpop(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Lpop( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_lpush -func kuzzle_ms_lpush(k *C.kuzzle, key *C.char, values **C.char, vlen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Lpush( - C.GoString(key), - cToGoStrings(values, vlen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_lpushx -func kuzzle_ms_lpushx(k *C.kuzzle, key *C.char, value *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Lpushx( - C.GoString(key), - C.GoString(value), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_lrange -func kuzzle_ms_lrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Lrange( - C.GoString(key), - int(start), - int(stop), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_lrem -func kuzzle_ms_lrem(k *C.kuzzle, key *C.char, count C.long, value *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Lrem( - C.GoString(key), - int(count), - C.GoString(value), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_lset -func kuzzle_ms_lset(k *C.kuzzle, key *C.char, index C.long, value *C.char, options *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Lset( - C.GoString(key), - int(index), - C.GoString(value), - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_ltrim -func kuzzle_ms_ltrim(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Ltrim( - C.GoString(key), - int(start), - int(stop), - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_mget -func kuzzle_ms_mget(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Mget( - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - var converted []string - - if err == nil { - converted = make([]string, len(res), len(res)) - - for i, val := range res { - converted[i] = *val - } - } - - return goToCStringArrayResult(converted, err) -} - -//export kuzzle_ms_mset -func kuzzle_ms_mset(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, options *C.query_options) *C.error_result { - wrapped := (*[1 << 20]*C.ms_key_value)(unsafe.Pointer(entries))[:elen:elen] - goentries := make([]*types.MSKeyValue, int(elen)) - - for i, jobj := range wrapped { - stringified, _ := json.Marshal(jobj) - gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) - json.Unmarshal(gobytes, goentries[i]) - } - - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Mset( - goentries, - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_msetnx -func kuzzle_ms_msetnx(k *C.kuzzle, entries **C.ms_key_value, elen C.size_t, options *C.query_options) *C.bool_result { - wrapped := (*[1 << 20]*C.ms_key_value)(unsafe.Pointer(entries))[:elen:elen] - goentries := make([]*types.MSKeyValue, int(elen)) - - for i, jobj := range wrapped { - stringified, _ := json.Marshal(jobj) - gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) - json.Unmarshal(gobytes, goentries[i]) - } - - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Msetnx( - goentries, - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_object -func kuzzle_ms_object(k *C.kuzzle, key *C.char, subcommand *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Object( - C.GoString(key), - C.GoString(subcommand), - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_persist -func kuzzle_ms_persist(k *C.kuzzle, key *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Persist( - C.GoString(key), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_pexpire -func kuzzle_ms_pexpire(k *C.kuzzle, key *C.char, ttl C.ulong, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Pexpire( - C.GoString(key), - int(ttl), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_pexpireat -func kuzzle_ms_pexpireat(k *C.kuzzle, key *C.char, ts C.ulonglong, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Pexpireat( - C.GoString(key), - uint64(ts), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_pfadd -func kuzzle_ms_pfadd(k *C.kuzzle, key *C.char, elements **C.char, elen C.size_t, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Pfadd( - C.GoString(key), - cToGoStrings(elements, elen), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_pfcount -func kuzzle_ms_pfcount(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Pfcount( - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_pfmerge -func kuzzle_ms_pfmerge(k *C.kuzzle, key *C.char, sources **C.char, slen C.size_t, options *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Pfmerge( - C.GoString(key), - cToGoStrings(sources, slen), - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_ping -func kuzzle_ms_ping(k *C.kuzzle, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Ping( - SetQueryOptions(options)) - - return goToCStringResult(&res, err) -} - -//export kuzzle_ms_psetex -func kuzzle_ms_psetex(k *C.kuzzle, key *C.char, value *C.char, ttl C.ulong, options *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Psetex( - C.GoString(key), - C.GoString(value), - int(ttl), - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_pttl -func kuzzle_ms_pttl(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Pttl( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_randomkey -func kuzzle_ms_randomkey(k *C.kuzzle, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Randomkey( - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_rename -func kuzzle_ms_rename(k *C.kuzzle, key *C.char, newkey *C.char, options *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Rename( - C.GoString(key), - C.GoString(newkey), - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_renamenx -func kuzzle_ms_renamenx(k *C.kuzzle, key *C.char, newkey *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Renamenx( - C.GoString(key), - C.GoString(newkey), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_rpop -func kuzzle_ms_rpop(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Rpop( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_rpoplpush -func kuzzle_ms_rpoplpush(k *C.kuzzle, key *C.char, dest *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Rpoplpush( - C.GoString(key), - C.GoString(dest), - SetQueryOptions(options)) - - return goToCStringResult(res, err) -} - -//export kuzzle_ms_rpush -func kuzzle_ms_rpush(k *C.kuzzle, key *C.char, values **C.char, vlen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Rpush( - C.GoString(key), - cToGoStrings(values, vlen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_rpushx -func kuzzle_ms_rpushx(k *C.kuzzle, key *C.char, value *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Rpushx( - C.GoString(key), - C.GoString(value), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_sadd -func kuzzle_ms_sadd(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sadd( - C.GoString(key), - cToGoStrings(members, mlen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_scan -func kuzzle_ms_scan(k *C.kuzzle, cursor C.int, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Scan( - int(cursor), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_scard -func kuzzle_ms_scard(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Scard( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_sdiff -func kuzzle_ms_sdiff(k *C.kuzzle, key *C.char, keys **C.char, klen C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sdiff( - C.GoString(key), - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_sdiffstore -func kuzzle_ms_sdiffstore(k *C.kuzzle, key *C.char, keys **C.char, klen C.size_t, dest *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sdiffstore( - C.GoString(key), - cToGoStrings(keys, klen), - C.GoString(dest), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_set -func kuzzle_ms_set(k *C.kuzzle, key *C.char, value *C.char, options *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Set( - C.GoString(key), - C.GoString(value), - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_setex -func kuzzle_ms_setex(k *C.kuzzle, key *C.char, value *C.char, ttl C.ulong, options *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Setex( - C.GoString(key), - C.GoString(value), - int(ttl), - SetQueryOptions(options)) - - return goToCErrorResult(err) -} - -//export kuzzle_ms_setnx -func kuzzle_ms_setnx(k *C.kuzzle, key *C.char, value *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Setnx( - C.GoString(key), - C.GoString(value), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_sinter -func kuzzle_ms_sinter(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sinter( - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_sinterstore -func kuzzle_ms_sinterstore(k *C.kuzzle, dest *C.char, keys **C.char, klen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sinterstore( - C.GoString(dest), - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_sismember -func kuzzle_ms_sismember(k *C.kuzzle, key *C.char, member *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sismember( - C.GoString(key), - C.GoString(member), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_smembers -func kuzzle_ms_smembers(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Smembers( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_smove -func kuzzle_ms_smove(k *C.kuzzle, key *C.char, dest *C.char, member *C.char, options *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Smove( - C.GoString(key), - C.GoString(dest), - C.GoString(member), - SetQueryOptions(options)) - - return goToCBoolResult(res, err) -} - -//export kuzzle_ms_sort -func kuzzle_ms_sort(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sort( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_spop -func kuzzle_ms_spop(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Spop( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_srandmember -func kuzzle_ms_srandmember(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Srandmember( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_srem -func kuzzle_ms_srem(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Srem( - C.GoString(key), - cToGoStrings(members, mlen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_sscan -func kuzzle_ms_sscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sscan( - C.GoString(key), - int(cursor), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_strlen -func kuzzle_ms_strlen(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Strlen( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_sunion -func kuzzle_ms_sunion(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sunion( - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_sunionstore -func kuzzle_ms_sunionstore(k *C.kuzzle, dest *C.char, keys **C.char, klen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Sunionstore( - C.GoString(dest), - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_time -func kuzzle_ms_time(k *C.kuzzle, options *C.query_options) *C.int_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Time( - SetQueryOptions(options)) - - return goToCIntArrayResult(res, err) -} - -//export kuzzle_ms_touch -func kuzzle_ms_touch(k *C.kuzzle, keys **C.char, klen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Touch( - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_ttl -func kuzzle_ms_ttl(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Ttl( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_type -func kuzzle_ms_type(k *C.kuzzle, key *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Type( - C.GoString(key), - SetQueryOptions(options)) - - return goToCStringResult(&res, err) -} - -//export kuzzle_ms_zadd -func kuzzle_ms_zadd(k *C.kuzzle, key *C.char, elements **C.ms_sorted_set, elen C.size_t, options *C.query_options) *C.int_result { - wrapped := (*[1 << 20]*C.ms_sorted_set)(unsafe.Pointer(elements))[:elen:elen] - goelements := make([]*types.MSSortedSet, int(elen)) - - for i, jobj := range wrapped { - stringified, _ := json.Marshal(jobj) - gobytes := C.GoBytes(unsafe.Pointer(&stringified), C.int(C.strlen(C.CString(string(stringified))))) - json.Unmarshal(gobytes, goelements[i]) - } - - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zadd( - C.GoString(key), - goelements, - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zcard -func kuzzle_ms_zcard(k *C.kuzzle, key *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zcard( - C.GoString(key), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zcount -func kuzzle_ms_zcount(k *C.kuzzle, key *C.char, min C.long, max C.long, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zcount( - C.GoString(key), - int(min), - int(max), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zincrby -func kuzzle_ms_zincrby(k *C.kuzzle, key *C.char, member *C.char, incr C.double, options *C.query_options) *C.double_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zincrby( - C.GoString(key), - C.GoString(member), - float64(incr), - SetQueryOptions(options)) - - return goToCDoubleResult(res, err) -} - -//export kuzzle_ms_zinterstore -func kuzzle_ms_zinterstore(k *C.kuzzle, dest *C.char, keys **C.char, klen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zinterstore( - C.GoString(dest), - cToGoStrings(keys, klen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zlexcount -func kuzzle_ms_zlexcount(k *C.kuzzle, key *C.char, min *C.char, max *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zlexcount( - C.GoString(key), - C.GoString(min), - C.GoString(max), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zrange -func kuzzle_ms_zrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrange( - C.GoString(key), - int(start), - int(stop), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_zrangebylex -func kuzzle_ms_zrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, options *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrangebylex( - C.GoString(key), - C.GoString(min), - C.GoString(max), - SetQueryOptions(options)) - - return goToCStringArrayResult(res, err) -} - -//export kuzzle_ms_zrangebyscore -func kuzzle_ms_zrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrangebyscore( - C.GoString(key), - float64(min), - float64(max), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_zrank -func kuzzle_ms_zrank(k *C.kuzzle, key *C.char, member *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrank( - C.GoString(key), - C.GoString(member), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zrem -func kuzzle_ms_zrem(k *C.kuzzle, key *C.char, members **C.char, mlen C.size_t, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrem( - C.GoString(key), - cToGoStrings(members, mlen), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zremrangebylex -func kuzzle_ms_zremrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zremrangebylex( - C.GoString(key), - C.GoString(min), - C.GoString(max), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zremrangebyrank -func kuzzle_ms_zremrangebyrank(k *C.kuzzle, key *C.char, min C.long, max C.long, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zremrangebyrank( - C.GoString(key), - int(min), - int(max), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zremrangebyscore -func kuzzle_ms_zremrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zremrangebyscore( - C.GoString(key), - float64(min), - float64(max), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zrevrange -func kuzzle_ms_zrevrange(k *C.kuzzle, key *C.char, start C.long, stop C.long, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrange( - C.GoString(key), - int(start), - int(stop), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_zrevrangebylex -func kuzzle_ms_zrevrangebylex(k *C.kuzzle, key *C.char, min *C.char, max *C.char, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrangebylex( - C.GoString(key), - C.GoString(min), - C.GoString(max), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_zrevrangebyscore -func kuzzle_ms_zrevrangebyscore(k *C.kuzzle, key *C.char, min C.double, max C.double, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrangebyscore( - C.GoString(key), - float64(min), - float64(max), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_zrevrank -func kuzzle_ms_zrevrank(k *C.kuzzle, key *C.char, member *C.char, options *C.query_options) *C.int_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zrevrank( - C.GoString(key), - C.GoString(member), - SetQueryOptions(options)) - - return goToCIntResult(res, err) -} - -//export kuzzle_ms_zscan -func kuzzle_ms_zscan(k *C.kuzzle, key *C.char, cursor C.int, options *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zscan( - C.GoString(key), - int(cursor), - SetQueryOptions(options)) - - json0, _ := json.Marshal(res) - - str := string(json0) - return goToCStringResult(&str, err) -} - -//export kuzzle_ms_zscore -func kuzzle_ms_zscore(k *C.kuzzle, key *C.char, member *C.char, options *C.query_options) *C.double_result { - res, err := (*kuzzle.Kuzzle)(k.instance).MemoryStorage.Zscore( - C.GoString(key), - C.GoString(member), - SetQueryOptions(options)) - - return goToCDoubleResult(res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/options.go b/internal/wrappers/cgo/kuzzle/options.go deleted file mode 100644 index 93a2a43c..00000000 --- a/internal/wrappers/cgo/kuzzle/options.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include - #include "kuzzlesdk.h" -*/ -import "C" -import ( - "time" - - "github.com/kuzzleio/sdk-go/types" -) - -//export kuzzle_new_options -func kuzzle_new_options() *C.options { - copts := (*C.options)(C.calloc(1, C.sizeof_options)) - opts := types.NewOptions() - - copts.queue_ttl = C.uint(opts.QueueTTL()) - copts.queue_max_size = C.ulong(opts.QueueMaxSize()) - copts.auto_queue = C.bool(opts.AutoQueue()) - copts.auto_reconnect = C.bool(opts.AutoReconnect()) - copts.auto_replay = C.bool(opts.AutoReplay()) - copts.auto_resubscribe = C.bool(opts.AutoResubscribe()) - copts.reconnection_delay = C.ulong(opts.ReconnectionDelay()) - copts.replay_interval = C.ulong(opts.ReplayInterval()) - - if opts.OfflineMode() == 1 { - copts.offline_mode = C.MANUAL - } else { - copts.offline_mode = C.AUTO - } - - refresh := opts.Refresh() - if len(refresh) > 0 { - copts.refresh = C.CString(refresh) - } - - return copts -} - -func SetQueryOptions(options *C.query_options) (opts types.QueryOptions) { - if options == nil { - return - } - - opts = types.NewQueryOptions() - - opts.SetQueuable(bool(options.queuable)) - opts.SetWithdist(bool(options.withdist)) - opts.SetWithcoord(bool(options.withcoord)) - opts.SetFrom(int(options.from)) - opts.SetSize(int(options.size)) - opts.SetScroll(C.GoString(options.scroll)) - opts.SetScrollId(C.GoString(options.scroll_id)) - opts.SetRefresh(C.GoString(options.refresh)) - opts.SetIfExist(C.GoString(options.if_exist)) - opts.SetRetryOnConflict(int(options.retry_on_conflict)) - volatiles := types.VolatileData(C.GoString(options.volatiles)) - if volatiles != nil { - opts.SetVolatile(volatiles) - } - - return -} - -func SetOptions(options *C.options) (opts types.Options) { - if options == nil { - return - } - - opts = types.NewOptions() - - opts.SetQueueTTL(time.Duration(uint16(options.queue_ttl))) - opts.SetQueueMaxSize(int(options.queue_max_size)) - opts.SetOfflineMode(int(options.offline_mode)) - - opts.SetAutoQueue(bool(options.auto_queue)) - opts.SetAutoReconnect(bool(options.auto_reconnect)) - opts.SetAutoReplay(bool(options.auto_replay)) - opts.SetAutoResubscribe(bool(options.auto_resubscribe)) - opts.SetReconnectionDelay(time.Duration(int(options.reconnection_delay))) - opts.SetReplayInterval(time.Duration(int(options.replay_interval))) - opts.SetRefresh(C.GoString(options.refresh)) - - return -} - -func SetRoomOptions(options *C.room_options) (opts types.RoomOptions) { - opts = types.NewRoomOptions() - - if options != nil { - opts.SetScope(C.GoString(options.scope)) - opts.SetState(C.GoString(options.state)) - opts.SetUsers(C.GoString(options.user)) - - opts.SetSubscribeToSelf(bool(options.subscribe_to_self)) - - if options.volatiles != nil { - opts.SetVolatile(types.VolatileData(C.GoString(options.volatiles))) - } - } - return -} diff --git a/internal/wrappers/cgo/kuzzle/query.go b/internal/wrappers/cgo/kuzzle/query.go deleted file mode 100644 index 85b28a29..00000000 --- a/internal/wrappers/cgo/kuzzle/query.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include - #include "kuzzlesdk.h" -*/ -import "C" -import ( - "encoding/json" - - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/types" -) - -//export kuzzle_query -func kuzzle_query(k *C.kuzzle, request *C.kuzzle_request, options *C.query_options) *C.kuzzle_response { - opts := SetQueryOptions(options) - - req := types.KuzzleRequest{ - RequestId: C.GoString(request.request_id), - Controller: C.GoString(request.controller), - Action: C.GoString(request.action), - Index: C.GoString(request.index), - Collection: C.GoString(request.collection), - Id: C.GoString(request.id), - From: int(request.from), - Size: int(request.size), - Scroll: C.GoString(request.scroll), - ScrollId: C.GoString(request.scroll_id), - Strategy: C.GoString(request.strategy), - ExpiresIn: int(request.expires_in), - Scope: C.GoString(request.scope), - State: C.GoString(request.state), - Users: C.GoString(request.user), - Start: int(request.start), - Stop: int(request.stop), - End: int(request.end), - Bit: int(request.bit), - Member: C.GoString(request.member), - Member1: C.GoString(request.member1), - Member2: C.GoString(request.member2), - Lon: float64(request.lon), - Lat: float64(request.lat), - Distance: float64(request.distance), - Unit: C.GoString(request.unit), - Cursor: int(request.cursor), - Offset: int(request.offset), - Field: C.GoString(request.field), - Subcommand: C.GoString(request.subcommand), - Pattern: C.GoString(request.pattern), - Idx: int(request.idx), - Min: C.GoString(request.min), - Max: C.GoString(request.max), - Limit: C.GoString(request.limit), - Count: int(request.count), - Match: C.GoString(request.match), - } - - if request.body != nil { - req.Body = json.RawMessage(C.GoString(request.body)) - } - - if request.volatiles != nil { - req.Volatile = types.VolatileData(C.GoString(request.volatiles)) - } - - start := int(request.start) - req.Start = start - req.Members = cToGoStrings(request.members, request.members_length) - req.Keys = cToGoStrings(request.keys, request.keys_length) - req.Fields = cToGoStrings(request.fields, request.fields_length) - - resC := make(chan *types.KuzzleResponse) - (*kuzzle.Kuzzle)(k.instance).Query(&req, opts, resC) - - res := <-resC - - return goToCKuzzleResponse(res) -} diff --git a/internal/wrappers/cgo/kuzzle/realtime.go b/internal/wrappers/cgo/kuzzle/realtime.go deleted file mode 100644 index 6c5e917f..00000000 --- a/internal/wrappers/cgo/kuzzle/realtime.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2015-2017 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" - -import ( - "encoding/json" - "sync" - "unsafe" - - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/realtime" - "github.com/kuzzleio/sdk-go/types" -) - -// map which stores instances to keep references in case the gc passes -var realtimeInstances sync.Map - -// register new instance to the instances map -func registerRealtime(instance interface{}, ptr unsafe.Pointer) { - realtimeInstances.Store(instance, ptr) -} - -// unregister an instance from the instances map -//export unregisterRealtime -func unregisterRealtime(rt *C.realtime) { - realtimeInstances.Delete(rt) -} - -// Allocates memory -//export kuzzle_new_realtime -func kuzzle_new_realtime(rt *C.realtime, k *C.kuzzle) { - kuz := (*kuzzle.Kuzzle)(k.instance) - gort := realtime.NewRealtime(kuz) - - ptr := unsafe.Pointer(gort) - rt.instance = ptr - rt.k = k - - registerRealtime(rt, ptr) -} - -//export kuzzle_realtime_count -func kuzzle_realtime_count(rt *C.realtime, index, collection, roomId *C.char, options *C.query_options) *C.int_result { - res, err := (*realtime.Realtime)(rt.instance).Count(C.GoString(index), C.GoString(collection), C.GoString(roomId), SetQueryOptions(options)) - return goToCIntResult(res, err) -} - -//export kuzzle_realtime_list -func kuzzle_realtime_list(rt *C.realtime, index, collection *C.char, options *C.query_options) *C.string_result { - res, err := (*realtime.Realtime)(rt.instance).List(C.GoString(index), C.GoString(collection), SetQueryOptions(options)) - var stringResult string - json.Unmarshal(res, &stringResult) - return goToCStringResult(&stringResult, err) -} - -//export kuzzle_realtime_publish -func kuzzle_realtime_publish(rt *C.realtime, index, collection, body *C.char, options *C.query_options) *C.error_result { - err := (*realtime.Realtime)(rt.instance).Publish(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_realtime_unsubscribe -func kuzzle_realtime_unsubscribe(rt *C.realtime, roomId *C.char, options *C.query_options) *C.error_result { - err := (*realtime.Realtime)(rt.instance).Unsubscribe(C.GoString(roomId), SetQueryOptions(options)) - return goToCErrorResult(err) -} - -//export kuzzle_realtime_subscribe -func kuzzle_realtime_subscribe(rt *C.realtime, index, collection, body *C.char, callback C.kuzzle_notification_listener, data unsafe.Pointer, options *C.room_options) *C.subscribe_result { - c := make(chan types.KuzzleNotification) - subRes, err := (*realtime.Realtime)(rt.instance).Subscribe(C.GoString(index), C.GoString(collection), json.RawMessage(C.GoString(body)), c, SetRoomOptions(options)) - - if err != nil { - return goToCSubscribeResult(subRes, err) - } - - go func() { - for { - res, ok := <-c - if ok == false { - break - } - C.kuzzle_notify(callback, goToCNotificationResult(&res), data) - } - }() - - return goToCSubscribeResult(subRes, err) -} - -//export kuzzle_realtime_validate -func kuzzle_realtime_validate(rt *C.realtime, index, collection, body *C.char, options *C.query_options) *C.bool_result { - res, err := (*realtime.Realtime)(rt.instance).Validate(C.GoString(index), C.GoString(collection), C.GoString(body), SetQueryOptions(options)) - return goToCBoolResult(res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/security.go b/internal/wrappers/cgo/kuzzle/security.go deleted file mode 100644 index 41c66011..00000000 --- a/internal/wrappers/cgo/kuzzle/security.go +++ /dev/null @@ -1,495 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" - -import ( - "encoding/json" - "unsafe" - - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/security" - "github.com/kuzzleio/sdk-go/types" -) - -// --- profile - -//export kuzzle_security_new_profile -func kuzzle_security_new_profile(k *C.kuzzle, id *C.char, policies *C.policy, policies_length C.size_t) *C.profile { - cprofile := (*C.profile)(C.calloc(1, C.sizeof_profile)) - cprofile.id = id - cprofile.policies = policies - cprofile.policies_length = policies_length - cprofile.k = k - - return cprofile -} - -//export kuzzle_security_destroy_profile -func kuzzle_security_destroy_profile(p *C.profile) { - if p == nil { - return - } - - if p.policies != nil { - size := int(p.policies_length) - policies := (*[1<<28 - 1]*C.policy)(unsafe.Pointer(p.policies))[:size:size] - for _, policy := range policies { - C.free(unsafe.Pointer(policy.role_id)) - size = int(policy.restricted_to_length) - restrictions := (*[1<<28 - 1]*C.policy_restriction)(unsafe.Pointer(policy.restricted_to))[:size:size] - for _, restriction := range restrictions { - C.free(unsafe.Pointer(restriction.index)) - size = int(restriction.collections_length) - collections := (*[1<<28 - 1]*C.char)(unsafe.Pointer(restriction.collections))[:size:size] - for _, collection := range collections { - C.free(unsafe.Pointer(collection)) - } - C.free(unsafe.Pointer(restriction.collections)) - } - C.free(unsafe.Pointer(policy.restricted_to)) - } - C.free(unsafe.Pointer(p.policies)) - } - - C.free(unsafe.Pointer(p)) -} - -// --- user - -//export kuzzle_security_new_user -func kuzzle_security_new_user(k *C.kuzzle, id *C.char, d *C.user_data) *C.kuzzle_user { - cuser := (*C.kuzzle_user)(C.calloc(1, C.sizeof_kuzzle_user)) - - cuser.id = id - cuser.k = k - - if d != nil { - cuser.content = d.content - cuser.profile_ids = d.profile_ids - cuser.profile_ids_length = d.profile_ids_length - } - - return cuser -} - -//export kuzzle_security_destroy_user -func kuzzle_security_destroy_user(u *C.kuzzle_user) { - if u == nil { - return - } - - if u.id != nil { - C.free(unsafe.Pointer(u.id)) - } - if u.content != nil { - C.free(unsafe.Pointer(u.content)) - } - if u.profile_ids != nil { - size := int(u.profile_ids_length) - carray := (*[1<<28 - 1]*C.char)(unsafe.Pointer(u.profile_ids))[:size:size] - - for i := 0; i < size; i++ { - C.free(unsafe.Pointer(carray[i])) - } - C.free(unsafe.Pointer(u.profile_ids)) - } - - C.free(unsafe.Pointer(u)) -} - -// --- role - -//export kuzzle_security_new_role -func kuzzle_security_new_role(k *C.kuzzle, id *C.char, c C.controllers) *C.role { - crole := (*C.role)(C.calloc(1, C.sizeof_role)) - crole.id = id - crole.controllers = C.CString(C.GoString(c)) - crole.k = k - - return crole -} - -//export kuzzle_security_destroy_role -func kuzzle_security_destroy_role(r *C.role) { - if r == nil { - return - } - - C.free(unsafe.Pointer(r.controllers)) - C.free(unsafe.Pointer(r)) -} - -//export kuzzle_security_get_profile -func kuzzle_security_get_profile(k *C.kuzzle, id *C.char, o *C.query_options) *C.profile_result { - result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) - options := SetQueryOptions(o) - - profile, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfile(C.GoString(id), options) - if err != nil { - Set_profile_result_error(result, err) - return result - } - - result.p = goToCProfile(k, profile, nil) - - return result -} - -//export kuzzle_security_get_profile_rights -func kuzzle_security_get_profile_rights(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfileRights(C.GoString(id), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_get_profile_mapping -func kuzzle_security_get_profile_mapping(k *C.kuzzle, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetProfileMapping(SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_get_role -func kuzzle_security_get_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.role_result { - result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) - options := SetQueryOptions(o) - - role, err := (*kuzzle.Kuzzle)(k.instance).Security.GetRole(C.GoString(id), options) - if err != nil { - Set_role_result_error(result, err) - return result - } - - result.r = goToCRole(k, role, nil) - - return result -} - -//export kuzzle_security_get_role_mapping -func kuzzle_security_get_role_mapping(k *C.kuzzle, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetRoleMapping(SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_get_user -func kuzzle_security_get_user(k *C.kuzzle, id *C.char, o *C.query_options) *C.user_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetUser(C.GoString(id), SetQueryOptions(o)) - return goToCUserResult(k, res, err) -} - -//export kuzzle_security_get_user_rights -func kuzzle_security_get_user_rights(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetUserRights(C.GoString(id), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_get_user_mapping -func kuzzle_security_get_user_mapping(k *C.kuzzle, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetUserMapping(SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_get_credential_fields -func kuzzle_security_get_credential_fields(k *C.kuzzle, strategy *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentialFields(C.GoString(strategy), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_get_all_credential_fields -func kuzzle_security_get_all_credential_fields(k *C.kuzzle, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetAllCredentialFields(SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_get_credential -func kuzzle_security_get_credential(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentials(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_get_credential_by_id -func kuzzle_security_get_credential_by_id(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.GetCredentialsByID(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_search_profiles -func kuzzle_security_search_profiles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_profiles_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchProfiles(json.RawMessage(C.GoString(body)), options) - - return goToCProfileSearchResult(k, res, err) -} - -//export kuzzle_security_search_roles -func kuzzle_security_search_roles(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_roles_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchRoles(json.RawMessage(C.GoString(body)), options) - - return goToCRoleSearchResult(k, res, err) -} - -//export kuzzle_security_search_users -func kuzzle_security_search_users(k *C.kuzzle, body *C.char, o *C.query_options) *C.search_users_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.SearchUsers(json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - return goToCUserSearchResult(k, res, err) -} - -//export kuzzle_security_delete_role -func kuzzle_security_delete_role(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteRole(C.GoString(id), options) - return goToCStringResult(&res, err) -} - -//export kuzzle_security_delete_profile -func kuzzle_security_delete_profile(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteProfile(C.GoString(id), options) - return goToCStringResult(&res, err) -} - -//export kuzzle_security_delete_user -func kuzzle_security_delete_user(k *C.kuzzle, id *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteUser(C.GoString(id), SetQueryOptions(o)) - return goToCStringResult(&res, err) -} - -//export kuzzle_security_delete_credentials -func kuzzle_security_delete_credentials(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).Security.DeleteCredentials(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) - return goToCErrorResult(err) -} - -//export kuzzle_security_create_profile -func kuzzle_security_create_profile(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.profile_result { - options := SetQueryOptions(o) - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateProfile(C.GoString(id), json.RawMessage(C.GoString(body)), options) - - return goToCProfileResult(k, res, err) -} - -//export kuzzle_security_create_role -func kuzzle_security_create_role(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.role_result { - result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) - options := SetQueryOptions(o) - - role, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateRole(C.GoString(id), json.RawMessage(C.GoString(body)), options) - if err != nil { - Set_role_result_error(result, err) - return result - } - - result.r = goToCRole(k, role, nil) - - return result -} - -//export kuzzle_security_create_user -func kuzzle_security_create_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateUser(json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_create_credentials -func kuzzle_security_create_credentials(k *C.kuzzle, cstrategy, id, body *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateCredentials(C.GoString(cstrategy), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_create_restricted_user -func kuzzle_security_create_restricted_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateRestrictedUser(json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_create_first_admin -func kuzzle_security_create_first_admin(k *C.kuzzle, body *C.char, o *C.query_options) *C.string_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateFirstAdmin(json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - var result string - json.Unmarshal(res, result) - return goToCStringResult(&result, err) -} - -//export kuzzle_security_create_or_replace_profile -func kuzzle_security_create_or_replace_profile(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.profile_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateOrReplaceProfile(C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - return goToCProfileResult(k, res, err) -} - -//export kuzzle_security_create_or_replace_role -func kuzzle_security_create_or_replace_role(k *C.kuzzle, id, body *C.char, o *C.query_options) *C.role_result { - result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) - role, err := (*kuzzle.Kuzzle)(k.instance).Security.CreateOrReplaceRole(C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - if err != nil { - Set_role_result_error(result, err) - return result - } - - result.r = goToCRole(k, role, nil) - - return result -} - -//export kuzzle_security_has_credentials -func kuzzle_security_has_credentials(k *C.kuzzle, strategy *C.char, id *C.char, o *C.query_options) *C.bool_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.HasCredentials(C.GoString(strategy), C.GoString(id), SetQueryOptions(o)) - return goToCBoolResult(res, err) -} - -//export kuzzle_security_replace_user -func kuzzle_security_replace_user(k *C.kuzzle, id, content *C.char, o *C.query_options) *C.user_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.ReplaceUser(C.GoString(id), json.RawMessage(C.GoString(content)), SetQueryOptions(o)) - return goToCUserResult(k, res, err) -} - -//export kuzzle_security_update_credentials -func kuzzle_security_update_credentials(k *C.kuzzle, strategy *C.char, id *C.char, body *C.char, o *C.query_options) *C.error_result { - err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateCredentials(C.GoString(strategy), C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - return goToCErrorResult(err) -} - -//export kuzzle_security_update_profile -func kuzzle_security_update_profile(k *C.kuzzle, id *C.char, body *C.char, o *C.query_options) *C.profile_result { - result := (*C.profile_result)(C.calloc(1, C.sizeof_profile_result)) - options := SetQueryOptions(o) - - profile, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfile(C.GoString(id), json.RawMessage(C.GoString(body)), options) - if err != nil { - Set_profile_result_error(result, err) - return result - } - - result.p = goToCProfile(k, profile, nil) - - return result -} - -//export kuzzle_security_update_profile_mapping -func kuzzle_security_update_profile_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.error_result { - options := SetQueryOptions(o) - err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateProfileMapping(json.RawMessage(C.GoString(body)), options) - return goToCErrorResult(err) -} - -//export kuzzle_security_update_role -func kuzzle_security_update_role(k *C.kuzzle, id *C.char, body *C.char, o *C.query_options) *C.role_result { - result := (*C.role_result)(C.calloc(1, C.sizeof_role_result)) - options := SetQueryOptions(o) - - role, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRole(C.GoString(id), json.RawMessage(C.GoString(body)), options) - if err != nil { - Set_role_result_error(result, err) - return result - } - - result.r = goToCRole(k, role, nil) - - return result -} - -//export kuzzle_security_update_role_mapping -func kuzzle_security_update_role_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.error_result { - options := SetQueryOptions(o) - err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateRoleMapping(json.RawMessage(C.GoString(body)), options) - return goToCErrorResult(err) -} - -//export kuzzle_security_update_user -func kuzzle_security_update_user(k *C.kuzzle, id *C.char, body *C.char, o *C.query_options) *C.user_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUser(C.GoString(id), json.RawMessage(C.GoString(body)), SetQueryOptions(o)) - return goToCUserResult(k, res, err) -} - -//export kuzzle_security_update_user_mapping -func kuzzle_security_update_user_mapping(k *C.kuzzle, body *C.char, o *C.query_options) *C.error_result { - options := SetQueryOptions(o) - err := (*kuzzle.Kuzzle)(k.instance).Security.UpdateUserMapping(json.RawMessage(C.GoString(body)), options) - return goToCErrorResult(err) -} - -//export kuzzle_security_is_action_allowed -func kuzzle_security_is_action_allowed(crights **C.user_right, crlength C.uint, controller *C.char, action *C.char, index *C.char, collection *C.char) C.uint { - rights := make([]*types.UserRights, int(crlength)) - - carray := (*[1<<28 - 1]*C.user_right)(unsafe.Pointer(crights))[:int(crlength):int(crlength)] - for i := 0; i < int(crlength); i++ { - rights[i] = cToGoUserRigh(carray[i]) - } - - res := security.IsActionAllowed(rights, C.GoString(controller), C.GoString(action), C.GoString(index), C.GoString(collection)) - return C.uint(res) -} - -//export kuzzle_security_mdelete_credentials -func kuzzle_security_mdelete_credentials(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.MDeleteCredentials(cToGoStrings(ids, idsSize), SetQueryOptions(o)) - return goToCStringArrayResult(res, err) -} - -//export kuzzle_security_mdelete_roles -func kuzzle_security_mdelete_roles(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.MDeleteRoles(cToGoStrings(ids, idsSize), SetQueryOptions(o)) - return goToCStringArrayResult(res, err) -} - -//export kuzzle_security_mdelete_users -func kuzzle_security_mdelete_users(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.string_array_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.MDeleteUsers(cToGoStrings(ids, idsSize), SetQueryOptions(o)) - return goToCStringArrayResult(res, err) -} - -//export kuzzle_security_mget_profiles -func kuzzle_security_mget_profiles(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.profiles_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.MGetProfiles(cToGoStrings(ids, idsSize), SetQueryOptions(o)) - return goToCProfilesResult(k, res, err) -} - -//export kuzzle_security_mget_roles -func kuzzle_security_mget_roles(k *C.kuzzle, ids **C.char, idsSize C.size_t, o *C.query_options) *C.roles_result { - res, err := (*kuzzle.Kuzzle)(k.instance).Security.MGetRoles(cToGoStrings(ids, idsSize), SetQueryOptions(o)) - return goToCRolesResult(k, res, err) -} diff --git a/internal/wrappers/cgo/kuzzle/server.go b/internal/wrappers/cgo/kuzzle/server.go deleted file mode 100644 index 95810352..00000000 --- a/internal/wrappers/cgo/kuzzle/server.go +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -/* - #cgo CFLAGS: -I../../headers - #include - #include - #include "kuzzlesdk.h" - #include "sdk_wrappers_internal.h" -*/ -import "C" -import ( - "strconv" - "sync" - "time" - "unsafe" - - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/server" -) - -// map which stores instances to keep references in case the gc passes -var serverInstances sync.Map - -//register new instance of server -func registerServer(instance interface{}, ptr unsafe.Pointer) { - serverInstances.Store(instance, ptr) -} - -// unregister an instance from the instances map -//export unregisterServer -func unregisterServer(s *C.server) { - serverInstances.Delete(s) -} - -// Allocates memory -//export kuzzle_new_server -func kuzzle_new_server(s *C.server, k *C.kuzzle) { - kuz := (*kuzzle.Kuzzle)(k.instance) - server := server.NewServer(kuz) - - ptr := unsafe.Pointer(server) - s.instance = ptr - s.k = k - - registerServer(s, ptr) -} - -//export kuzzle_admin_exists -func kuzzle_admin_exists(s *C.server, options *C.query_options) *C.bool_result { - opts := SetQueryOptions(options) - - res, err := (*server.Server)(s.instance).AdminExists(opts) - return goToCBoolResult(res, err) -} - -//export kuzzle_get_all_stats -func kuzzle_get_all_stats(s *C.server, options *C.query_options) *C.string_result { - opts := SetQueryOptions(options) - - stats, err := (*server.Server)(s.instance).GetAllStats(opts) - - str := string(stats) - return goToCStringResult(&str, err) -} - -//export kuzzle_get_stats -func kuzzle_get_stats(s *C.server, start_time C.time_t, stop_time C.time_t, options *C.query_options) *C.string_result { - opts := SetQueryOptions(options) - - t, _ := strconv.ParseInt(C.GoString(C.ctime(&start_time)), 10, 64) - start := time.Unix(t, 0) - t, _ = strconv.ParseInt(C.GoString(C.ctime(&stop_time)), 10, 64) - stop := time.Unix(t, 0) - - res, err := (*server.Server)(s.instance).GetStats(&start, &stop, opts) - - str := string(res) - return goToCStringResult(&str, err) -} - -//export kuzzle_get_last_stats -func kuzzle_get_last_stats(s *C.server, options *C.query_options) *C.string_result { - opts := SetQueryOptions(options) - - res, err := (*server.Server)(s.instance).GetLastStats(opts) - - str := string(res) - return goToCStringResult(&str, err) -} - -//export kuzzle_get_config -func kuzzle_get_config(s *C.server, options *C.query_options) *C.string_result { - res, err := (*server.Server)(s.instance).GetConfig(SetQueryOptions(options)) - - str := string(res) - return goToCStringResult(&str, err) -} - -//export kuzzle_info -func kuzzle_info(s *C.server, options *C.query_options) *C.string_result { - res, err := (*server.Server)(s.instance).Info(SetQueryOptions(options)) - - str := string(res) - return goToCStringResult(&str, err) -} - -//export kuzzle_now -func kuzzle_now(s *C.server, options *C.query_options) *C.date_result { - time, err := (*server.Server)(s.instance).Now(SetQueryOptions(options)) - - return goToCDateResult(int(time), err) -} diff --git a/internal/wrappers/cpp/auth.cpp b/internal/wrappers/cpp/auth.cpp deleted file mode 100644 index 8c520aea..00000000 --- a/internal/wrappers/cpp/auth.cpp +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "kuzzle.hpp" -#include "auth.hpp" - -namespace kuzzleio { - Auth::Auth(Kuzzle *kuzzle) { - _auth = new auth(); - _kuzzle = kuzzle; - kuzzle_new_auth(_auth, kuzzle->_kuzzle); - } - - Auth::Auth(Kuzzle *kuzzle, auth *auth) { - _auth = auth; - _kuzzle = kuzzle; - kuzzle_new_auth(_auth, kuzzle->_kuzzle); - } - - Auth::~Auth() { - unregisterAuth(_auth); - delete(_auth); - } - - token_validity* Auth::checkToken(const std::string& token) { - return kuzzle_check_token(_auth, const_cast(token.c_str())); - } - - std::string Auth::createMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options) { - string_result* r = kuzzle_create_my_credentials(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), options); - if (r->error) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - - bool Auth::credentialsExist(const std::string& strategy, query_options *options) { - bool_result* r = kuzzle_credentials_exist(_auth, const_cast(strategy.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - - void Auth::deleteMyCredentials(const std::string& strategy, query_options *options) { - error_result *r = kuzzle_delete_my_credentials(_auth, const_cast(strategy.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - delete(r); - } - - kuzzle_user* Auth::getCurrentUser() { - user_result *r = kuzzle_get_current_user(_auth); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - kuzzle_user *u = r->result; - kuzzle_free_user_result(r); - return u; - } - - std::string Auth::getMyCredentials(const std::string& strategy, query_options *options) { - string_result *r = kuzzle_get_my_credentials(_auth, const_cast(strategy.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - user_right* Auth::getMyRights(query_options* options) { - user_rights_result *r = kuzzle_get_my_rights(_auth, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - user_right *ret = r->result; - kuzzle_free_user_rights_result(r); - return ret; - } - - std::vector Auth::getStrategies(query_options *options) { - string_array_result *r = kuzzle_get_strategies(_auth, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; r->result[i]; i++) - v.push_back(r->result[i]); - - kuzzle_free_string_array_result(r); - return v; - } - - std::string Auth::login(const std::string& strategy, const std::string& credentials) { - string_result* r = kuzzle_login(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), nullptr); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::string Auth::login(const std::string& strategy, const std::string& credentials, int expires_in) { - string_result* r = kuzzle_login(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), &expires_in); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - void Auth::logout() noexcept { - kuzzle_logout(_auth); - } - - void Auth::setJwt(const std::string& jwt) noexcept { - kuzzle_set_jwt(_kuzzle->_kuzzle, const_cast(jwt.c_str())); - } - - std::string Auth::updateMyCredentials(const std::string& strategy, const std::string& credentials, query_options *options) { - string_result *r = kuzzle_update_my_credentials(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - kuzzle_user* Auth::updateSelf(const std::string& content, query_options* options) { - user_result *r = kuzzle_update_self(_auth, const_cast(content.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - kuzzle_user *ret = r->result; - kuzzle_free_user_result(r); - return ret; - } - - bool Auth::validateMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options) { - bool_result *r = kuzzle_validate_my_credentials(_auth, const_cast(strategy.c_str()), const_cast(credentials.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - -} diff --git a/internal/wrappers/cpp/collection.cpp b/internal/wrappers/cpp/collection.cpp deleted file mode 100644 index 2156ca9b..00000000 --- a/internal/wrappers/cpp/collection.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "kuzzle.hpp" -#include "collection.hpp" - -namespace kuzzleio { - Collection::Collection(Kuzzle* kuzzle) { - _collection = new collection(); - kuzzle_new_collection(_collection, kuzzle->_kuzzle); - } - - Collection::Collection(Kuzzle* kuzzle, collection *collection) { - _collection = collection; - kuzzle_new_collection(collection, kuzzle->_kuzzle); - } - - Collection::~Collection() { - unregisterCollection(_collection); - delete(_collection); - } - - void Collection::create(const std::string& index, const std::string& collection, const std::string* body, query_options *options) { - error_result *r = kuzzle_collection_create( - _collection, - const_cast(index.c_str()), - const_cast(collection.c_str()), - body != nullptr ? const_cast(body->c_str()) : nullptr, - options); - - if (r != nullptr) - throwExceptionFromStatus(r); - - kuzzle_free_error_result(r); - } - - bool Collection::exists(const std::string& index, const std::string& collection, query_options *options) { - bool_result *r = kuzzle_collection_exists(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - - std::string Collection::list(const std::string& index, query_options *options) { - string_result *r = kuzzle_collection_list(_collection, const_cast(index.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - void Collection::truncate(const std::string& index, const std::string& collection, query_options *options) { - error_result *r = kuzzle_collection_truncate(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - - kuzzle_free_error_result(r); - } - - std::string Collection::getMapping(const std::string& index, const std::string& collection, query_options *options) { - string_result *r = kuzzle_collection_get_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - - return ret; - } - - void Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - error_result *r = kuzzle_collection_update_mapping(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - - kuzzle_free_error_result(r); - } - - std::string Collection::getSpecifications(const std::string& index, const std::string& collection, query_options *options) { - string_result *r = kuzzle_collection_get_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - - return ret; - } - - search_result* Collection::searchSpecifications(query_options *options) { - search_result *r = kuzzle_collection_search_specifications(_collection, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - search_result *ret = r; - kuzzle_free_search_result(r); - - return ret; - } - - std::string Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - string_result *r = kuzzle_collection_update_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - - return ret; - } - - bool Collection::validateSpecifications(const std::string& body, query_options *options) { - bool_result *r = kuzzle_collection_validate_specifications(_collection, const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - bool ret = r->result; - kuzzle_free_bool_result(r); - - return ret; - } - - void Collection::deleteSpecifications(const std::string& index, const std::string& collection, query_options *options) { - error_result *r = kuzzle_collection_delete_specifications(_collection, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - - kuzzle_free_error_result(r); - } -} diff --git a/internal/wrappers/cpp/document.cpp b/internal/wrappers/cpp/document.cpp deleted file mode 100644 index 440018c2..00000000 --- a/internal/wrappers/cpp/document.cpp +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "kuzzle.hpp" -#include "document.hpp" - -namespace kuzzleio { - Document::Document(Kuzzle* kuzzle) { - _document = new document(); - kuzzle_new_document(_document, kuzzle->_kuzzle); - } - - Document::Document(Kuzzle* kuzzle, document *document) { - _document = document; - kuzzle_new_document(_document, kuzzle->_kuzzle); - } - - Document::~Document() { - unregisterDocument(_document); - delete(_document); - } - - int Document::count(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - int_result *r = kuzzle_document_count(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - int ret = r->result; - kuzzle_free_int_result(r); - return ret; - } - - bool Document::exists(const std::string& index, const std::string& collection, const std::string& id, query_options *options) { - bool_result *r = kuzzle_document_exists(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - - std::string Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) { - string_result *r = kuzzle_document_create(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::string Document::createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) { - string_result *r = kuzzle_document_create_or_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::string Document::delete_(const std::string& index, const std::string& collection, const std::string& id, query_options *options) { - string_result *r = kuzzle_document_delete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::vector Document::deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - string_array_result *r = kuzzle_document_delete_by_query(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(r->result[i]); - - kuzzle_free_string_array_result(r); - return v; - } - - std::string Document::get(const std::string& index, const std::string& collection, const std::string& id, query_options *options) { - string_result *r = kuzzle_document_get(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::string Document::replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) { - string_result *r = kuzzle_document_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::string Document::update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) { - string_result *r = kuzzle_document_update(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(id.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - bool Document::validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - bool_result *r = kuzzle_document_validate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - - search_result* Document::search(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - search_result *r = kuzzle_document_search(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - return r; - } - - std::string Document::mCreate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - string_result *r = kuzzle_document_mcreate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::string Document::mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - string_result *r = kuzzle_document_mcreate_or_replace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::vector Document::mDelete(const std::string& index, const std::string& collection, const std::vector& ids, query_options *options) { - char **idsArray = new char *[ids.size()]; - int i = 0; - for (auto& id : ids) { - idsArray[i] = const_cast(id.c_str()); - i++; - } - - string_array_result *r = kuzzle_document_mdelete(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), options); - delete[] idsArray; - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(r->result[i]); - - kuzzle_free_string_array_result(r); - return v; - } - - std::string Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options) { - char **idsArray = new char *[ids.size()]; - int i = 0; - for (auto& id : ids) { - idsArray[i] = const_cast(id.c_str()); - i++; - } - - string_result *r = kuzzle_document_mget(_document, const_cast(index.c_str()), const_cast(collection.c_str()), idsArray, ids.size(), includeTrash, options); - delete[] idsArray; - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - - } - std::string Document::mReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - string_result *r = kuzzle_document_mreplace(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - std::string Document::mUpdate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - string_result *r = kuzzle_document_mupdate(_document, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - -} diff --git a/internal/wrappers/cpp/index.cpp b/internal/wrappers/cpp/index.cpp deleted file mode 100644 index cd20c99f..00000000 --- a/internal/wrappers/cpp/index.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "kuzzle.hpp" -#include "index.hpp" -#include - -namespace kuzzleio { - - Index::Index(Kuzzle* kuzzle) { - _index = new kuzzle_index(); - kuzzle_new_index(_index, kuzzle->_kuzzle); - } - - Index::Index(Kuzzle* kuzzle, kuzzle_index *index) { - _index = index; - kuzzle_new_index(index, kuzzle->_kuzzle); - } - - Index::~Index() { - unregisterIndex(_index); - delete(_index); - } - - void Index::create(const std::string& index, query_options *options) { - error_result *r = kuzzle_index_create(_index, const_cast(index.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - kuzzle_free_error_result(r); - } - - void Index::delete_(const std::string& index, query_options *options) { - error_result *r = kuzzle_index_delete(_index, const_cast(index.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - kuzzle_free_error_result(r); - } - - std::vector Index::mDelete(const std::vector& indexes, query_options *options) { - char **indexesArray = new char *[indexes.size()]; - int i = 0; - for (auto& index : indexes) { - indexesArray[i] = const_cast(index.c_str()); - i++; - } - string_array_result *r = kuzzle_index_mdelete(_index, indexesArray, indexes.size(), options); - - delete[] indexesArray; - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(r->result[i]); - - kuzzle_free_string_array_result(r); - return v; - } - - bool Index::exists(const std::string& index, query_options *options) { - bool_result *r = kuzzle_index_exists(_index, const_cast(index.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - - void Index::refresh(const std::string& index, query_options *options) { - error_result *r = kuzzle_index_refresh(_index, const_cast(index.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - kuzzle_free_error_result(r); - } - - void Index::refreshInternal(query_options *options) { - error_result *r = kuzzle_index_refresh_internal(_index, options); - if (r != nullptr) - throwExceptionFromStatus(r); - kuzzle_free_error_result(r); - } - - void Index::setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options) { - error_result *r = kuzzle_index_set_auto_refresh(_index, const_cast(index.c_str()), autoRefresh, options); - if (r != nullptr) - throwExceptionFromStatus(r); - kuzzle_free_error_result(r); - } - - bool Index::getAutoRefresh(const std::string& index, query_options *options) { - bool_result *r = kuzzle_index_get_auto_refresh(_index, const_cast(index.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } - - std::vector Index::list(query_options *options) { - string_array_result *r = kuzzle_index_list(_index, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::vector v; - for (int i = 0; i < r->result_length; i++) - v.push_back(r->result[i]); - - kuzzle_free_string_array_result(r); - return v; - } -} diff --git a/internal/wrappers/cpp/kuzzle.cpp b/internal/wrappers/cpp/kuzzle.cpp deleted file mode 100644 index 3345b38f..00000000 --- a/internal/wrappers/cpp/kuzzle.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include "kuzzle.hpp" -#include "auth.hpp" -#include "index.hpp" -#include "server.hpp" -#include "collection.hpp" -#include "document.hpp" -#include "realtime.hpp" -#include -#include - -namespace kuzzleio { - - KuzzleException::KuzzleException(int status, const std::string& error) - : std::runtime_error(error), status(status) {} - - std::string KuzzleException::getMessage() const { - return what(); - } - - Kuzzle::Kuzzle(const std::string& host, options *opts) { - this->_kuzzle = new kuzzle(); - kuzzle_new_kuzzle(this->_kuzzle, const_cast(host.c_str()), (char*)"websocket", opts); - - this->document = new Document(this, kuzzle_get_document_controller(_kuzzle)); - this->auth = new Auth(this, kuzzle_get_auth_controller(_kuzzle)); - this->index = new Index(this, kuzzle_get_index_controller(_kuzzle)); - this->server = new Server(this, kuzzle_get_server_controller(_kuzzle)); - this->collection = new Collection(this, kuzzle_get_collection_controller(_kuzzle)); - this->realtime = new Realtime(this, kuzzle_get_realtime_controller(_kuzzle)); - } - - Kuzzle::~Kuzzle() { - unregisterKuzzle(this->_kuzzle); - delete(this->_kuzzle); - delete(this->document); - delete(this->auth); - delete(this->index); - delete(this->server); - delete(this->collection); - delete(this->realtime); - } - - char* Kuzzle::connect() noexcept { - return kuzzle_connect(_kuzzle); - } - - void Kuzzle::disconnect() noexcept { - kuzzle_disconnect(_kuzzle); - } - - kuzzle_response* Kuzzle::query(kuzzle_request* query, query_options* options) { - kuzzle_response *r = kuzzle_query(_kuzzle, query, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - return r; - } - - Kuzzle* Kuzzle::playQueue() noexcept { - kuzzle_play_queue(_kuzzle); - return this; - } - - Kuzzle* Kuzzle::setAutoReplay(bool autoReplay) noexcept { - kuzzle_set_auto_replay(_kuzzle, autoReplay); - return this; - } - - Kuzzle* Kuzzle::startQueuing() noexcept { - kuzzle_start_queuing(_kuzzle); - return this; - } - - Kuzzle* Kuzzle::stopQueuing() noexcept { - kuzzle_stop_queuing(_kuzzle); - return this; - } - - Kuzzle* Kuzzle::flushQueue() noexcept { - kuzzle_flush_queue(_kuzzle); - return this; - } - - Kuzzle* Kuzzle::setVolatile(const std::string& volatiles) noexcept { - kuzzle_set_volatile(_kuzzle, const_cast(volatiles.c_str())); - return this; - } - - std::string Kuzzle::getVolatile() noexcept { - return std::string(kuzzle_get_volatile(_kuzzle)); - } - - std::string Kuzzle::getJwt() noexcept { - return std::string(kuzzle_get_jwt(_kuzzle)); - } - - void trigger_event_listener(int event, char* res, void* data) { - EventListener* listener = static_cast(data)->getListeners()[event]; - if (listener) { - (*listener)(res); - } - } - - std::map Kuzzle::getListeners() noexcept { - return _listener_instances; - } - - void Kuzzle::emitEvent(Event& event, const std::string& body) noexcept { - kuzzle_emit_event(_kuzzle, event, const_cast(body.c_str())); - } - - KuzzleEventEmitter* Kuzzle::addListener(Event event, EventListener* listener) { - kuzzle_add_listener(_kuzzle, event, &trigger_event_listener, this); - _listener_instances[event] = listener; - - return this; - } - - KuzzleEventEmitter* Kuzzle::removeListener(Event event, EventListener* listener) { - kuzzle_remove_listener(_kuzzle, event, (void*)&trigger_event_listener); - _listener_instances[event] = nullptr; - - return this; - } - - KuzzleEventEmitter* Kuzzle::removeAllListeners(Event event) { - kuzzle_remove_all_listeners(_kuzzle, event); - - return this; - } - - KuzzleEventEmitter* Kuzzle::once(Event event, EventListener* listener) { - kuzzle_once(_kuzzle, event, &trigger_event_listener, this); - } - - int Kuzzle::listenerCount(Event event) { - return kuzzle_listener_count(_kuzzle, event); - } - -} diff --git a/internal/wrappers/cpp/realtime.cpp b/internal/wrappers/cpp/realtime.cpp deleted file mode 100644 index d4f71ac5..00000000 --- a/internal/wrappers/cpp/realtime.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "kuzzle.hpp" -#include "realtime.hpp" - -namespace kuzzleio { - Realtime::Realtime(Kuzzle *kuzzle) { - _realtime = new realtime(); - kuzzle_new_realtime(_realtime, kuzzle->_kuzzle); - } - - Realtime::Realtime(Kuzzle *kuzzle, realtime *realtime) { - _realtime = realtime; - kuzzle_new_realtime(_realtime, kuzzle->_kuzzle); - } - - Realtime::~Realtime() { - unregisterRealtime(_realtime); - delete(_realtime); - } - - int Realtime::count(const std::string& index, const std::string& collection, const std::string& roomId, query_options *options) { - int_result *r = kuzzle_realtime_count(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(roomId.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - int ret = r->result; - kuzzle_free_int_result(r); - return ret; - } - - NotificationListener* Realtime::getListener(const std::string& roomId) { - return _listener_instances[roomId]; - } - - void call_subscribe_cb(notification_result* res, void* data) { - if (data) { - NotificationListener* listener = static_cast(data)->getListener(res->room_id); - - if (listener) { - (*listener)(res); - } - } - } - - std::string Realtime::list(const std::string& index, const std::string& collection, query_options *options) { - string_result *r = kuzzle_realtime_list(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - kuzzle_free_string_result(r); - return ret; - } - - void Realtime::publish(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - error_result *r = kuzzle_realtime_publish(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - kuzzle_free_error_result(r); - } - - std::string Realtime::subscribe(const std::string& index, const std::string& collection, const std::string& body, NotificationListener* cb, room_options* options) { - subscribe_result *r = kuzzle_realtime_subscribe(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), call_subscribe_cb, this, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - - std::string roomId = r->room; - std::string channel = r->channel; - - _listener_instances[channel] = cb; - kuzzle_free_subscribe_result(r); - return roomId; - } - - void Realtime::unsubscribe(const std::string& roomId, query_options *options) { - error_result *r = kuzzle_realtime_unsubscribe(_realtime, const_cast(roomId.c_str()), options); - if (r != nullptr) - throwExceptionFromStatus(r); - - _listener_instances[roomId] = nullptr; - kuzzle_free_error_result(r); - } - - bool Realtime::validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) { - bool_result *r = kuzzle_realtime_validate(_realtime, const_cast(index.c_str()), const_cast(collection.c_str()), const_cast(body.c_str()), options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - bool ret = r->result; - kuzzle_free_bool_result(r); - return ret; - } -} diff --git a/internal/wrappers/cpp/server.cpp b/internal/wrappers/cpp/server.cpp deleted file mode 100644 index b3ed158b..00000000 --- a/internal/wrappers/cpp/server.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "kuzzle.hpp" -#include "server.hpp" - -namespace kuzzleio { - Server::Server(Kuzzle* kuzzle) { - _server = new server(); - kuzzle_new_server(_server, kuzzle->_kuzzle); - } - - Server::Server(Kuzzle* kuzzle, server *server) { - _server = server; - kuzzle_new_server(_server, kuzzle->_kuzzle); - } - - Server::~Server() { - unregisterServer(_server); - delete(_server); - } - - bool Server::adminExists(query_options *options) { - bool_result* r = kuzzle_admin_exists(_server, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - bool ret = r->result; - delete(r); - return ret; - } - - std::string Server::getAllStats(query_options* options) { - string_result* r = kuzzle_get_all_stats(_server, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - - std::string Server::getStats(time_t start, time_t end, query_options* options) { - string_result* r = kuzzle_get_stats(_server, start, end, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - - std::string Server::getLastStats(query_options* options) { - string_result* r = kuzzle_get_last_stats(_server, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - - std::string Server::getConfig(query_options* options) { - string_result* r = kuzzle_get_config(_server, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - - std::string Server::info(query_options* options) { - string_result* r = kuzzle_info(_server, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - std::string ret = r->result; - delete(r); - return ret; - } - - // java wrapper for this method is in typemap.i - long long Server::now(query_options* options) { - date_result *r = kuzzle_now(_server, options); - if (r->error != nullptr) - throwExceptionFromStatus(r); - long long ret = r->result; - delete(r); - return ret; - } - -} diff --git a/internal/wrappers/features/auth.feature b/internal/wrappers/features/auth.feature deleted file mode 100644 index 116cce89..00000000 --- a/internal/wrappers/features/auth.feature +++ /dev/null @@ -1,35 +0,0 @@ -Feature: User management - - Scenario Outline: Get a valid JWT when login - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - When I log in as : - Then the JWT is - Examples: - | user-name | user-pwd | jwt_validity | - | 'my-user-name' | 'my-user-pwd' | valid | - | 'my-user-name-w' | 'my-user-pwd' | invalid | - | 'my-user-name' | 'my-user-pwd-w' | invalid | - | 'my-user-name-w' | 'my-user-pwd-w' | invalid | - - Scenario Outline: Set user custom data (updateSelf) - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I log in as 'my-user-name':'my-user-pwd' - And I update my user custom data with the pair : - When I get my user info - Then the response '_source' field contains the pair : - Examples: - | field-name | field-value | - | 'my_data' | 'mystringvalue' | - - Scenario: Login out shall revoke the JWT - Given Kuzzle Server is running - And there is an user with id 'my-user-id' - And the user has 'local' credentials with name 'my-user-name' and password 'my-user-pwd' - And I log in as 'my-user-name':'my-user-pwd' - And the JWT is valid - When I logout - Then the JWT is invalid diff --git a/internal/wrappers/features/collection.feature b/internal/wrappers/features/collection.feature deleted file mode 100644 index 96594688..00000000 --- a/internal/wrappers/features/collection.feature +++ /dev/null @@ -1,68 +0,0 @@ -Feature: Collection management - - Scenario: Create a collection - Given Kuzzle Server is running - And there is an index 'test-index' - When I create a collection 'collection-test-collection' - Then the collection 'collection-test-collection' should exist - - Scenario: Check if a collection exists - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - When I check if the collection 'test-collection' exists - Then the collection should exist - - Scenario: List existing collections - Given Kuzzle Server is running - And there is an index 'list-test-index' - And it has a collection 'test-collection1' - And it has a collection 'test-collection2' - When I list the collections of 'list-test-index' - Then the result contains 2 hits - And the content should not be null - - Scenario: Truncate a collection - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - And the collection has a document with id 'my-document-id2' - When I truncate the collection 'test-collection' - Then the collection 'test-collection' should be empty - - Scenario: Create a collection with a custom mapping - Given Kuzzle Server is running - And there is an index 'test-index' - When I create a collection 'test-create-with-mapping' with a mapping - Then the collection 'test-create-with-mapping' should exist - And the mapping of 'test-create-with-mapping' should be updated - - Scenario: Update a collection with a custom mapping - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - When I update the mapping of collection 'test-collection' - Then the mapping of 'test-collection' should be updated - - Scenario: Update specifications - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - When I update the specifications of the collection 'test-collection' - Then the specifications of 'test-collection' should be updated - - Scenario: Validate specifications - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - When I validate the specifications of 'test-collection' - Then they should be validated - - Scenario: Delete specifications - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And has specifications - When I delete the specifications of 'test-collection' - Then the specifications of 'test-collection' must not exist diff --git a/internal/wrappers/features/documents.feature b/internal/wrappers/features/documents.feature deleted file mode 100644 index 6baefc6c..00000000 --- a/internal/wrappers/features/documents.feature +++ /dev/null @@ -1,206 +0,0 @@ -Feature: Document management - - Scenario: Do not allow creating a document with an _id that already exist in the same collection - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - When I create a document with id 'my-document-id' - Then I get an error with message 'Document already exists' - - Scenario: Create a document with create - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection doesn't have a document with id 'my-document-id' - When I create a document with id 'my-document-id' - Then the document is successfully created - - Scenario: Create a document with createOrReplace if it does not exists - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection doesn't have a document with id 'my-document-id' - When I createOrReplace a document with id 'my-document-id' - Then the document is successfully created - - Scenario: Replace a document if it exists - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - When I createOrReplace a document with id 'my-document-id' - Then the document is successfully replaced - - Scenario: Replace a document - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'replace-my-document-id' - When I replace a document with id 'replace-my-document-id' - Then the document is successfully replaced - - Scenario: Delete a document - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'delete-my-document-id' - When I delete the document with id 'delete-my-document-id' - Then the document is successfully deleted - - Scenario: Update a document - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'update-my-document-id' - When I update a document with id 'update-my-document-id' - Then the document is successfully updated - - Scenario: Search a document by id and find it - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'search-my-document-id' - When I search a document with id 'search-my-document-id' - Then the document is successfully found - - Scenario: Search a document by id and don't find it - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'search-my-document-id' - When I search a document with id 'fake-id' - Then the document is not found - - Scenario: Count documents in a collection - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'count-test-collection' - And the collection has a document with id 'count-my-document-id' - And the collection has a document with id 'count-my-document-id2' - And the collection has a document with id 'count-my-document-id3' - When I count how many documents there is in the collection - Then I shall receive 3 - - Scenario: Delete multiple documents with no error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'delete-test-collection' - And the collection has a document with id 'mdelete-my-document-id' - And the collection has a document with id 'mdelete-my-document-id2' - When I delete the documents ['mdelete-my-document-id', 'mdelete-my-document-id2'] - Then I must have 0 documents in the collection - - Scenario: Delete multiple documents with partial error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mdelete-test-collection' - And the collection has a document with id 'mdelete-my-document-id' - And the collection has a document with id 'mdelete-my-document-id2' - When I delete the documents ['mdelete-my-document-id', 'mdelete-my-document-unknown'] - Then I must have 1 documents in the collection - And I get a partial error - - Scenario: Create multiple documents with no error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mcreate-test-collection' - And the collection doesn't have a document with id 'mcreate-my-document-id' - And the collection doesn't have a document with id 'mcreate-my-document-id2' - When I create the documents ['mcreate-my-document-id', 'mcreate-my-document-id2'] - Then I must have 2 documents in the collection - And I should have no partial error - - Scenario: Create multiple documents with partial error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mcreate-test-collection' - When I create the documents ['mcreate-my-document-id', 'mcreate-my-document-id2'] - Then I must have 2 documents in the collection - And I get a partial error - - Scenario: Replace multiple documents with no error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mreplace-test-collection' - And the collection has a document with id 'mreplace-my-document-id' - And the collection has a document with id 'mreplace-my-document-id2' - When I replace the documents ['mreplace-my-document-id', 'mreplace-my-document-id2'] - Then I should have no partial error - And the document 'mreplace-my-document-id' should be replaced - And the document 'mreplace-my-document-id2' should be replaced - - Scenario: Replace multiple documents with partial error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mreplace-test-collection' - And the collection has a document with id 'mreplace-my-document-id' - And the collection has a document with id 'mreplace-my-document-id2' - When I replace the documents ['unknown', 'mreplace-my-document-id2'] - And the document 'mreplace-my-document-id2' should be replaced - And I get a partial error - - Scenario: Update multiple documents with no error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mreplace-test-collection' - And the collection has a document with id 'mreplace-my-document-id' - And the collection has a document with id 'mreplace-my-document-id2' - When I update the documents ['mreplace-my-document-id', 'mreplace-my-document-id2'] - Then I should have no partial error - And the document 'mreplace-my-document-id' should be replaced - And the document 'mreplace-my-document-id2' should be replaced - - Scenario: Update multiple documents with partial error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mupdate-test-collection' - And the collection has a document with id 'mupdate-my-document-id' - And the collection has a document with id 'mupdate-my-document-id2' - When I update the documents ['unknown', 'mupdate-my-document-id2'] - Then the document 'mupdate-my-document-id2' should be updated - And I get a partial error - - Scenario: CreateOrReplace (create) multiple documents with no error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mcreateorreplace-test-collection' - When I createOrReplace the documents ['mcreateorreplace-my-document-id', 'mcreateorreplace-my-document-id2'] - Then I should have no partial error - And the document 'mcreateorreplace-my-document-id' should be created - And the document 'mcreateorreplace-my-document-id2' should be created - - Scenario: CreateOrReplace (replace) multiple documents with no error - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mcreateorreplace-test-collection' - And the collection has a document with id 'mcreateorreplace-my-document-id' - And the collection has a document with id 'mcreateorreplace-my-document-id2' - When I createOrReplace the documents ['mcreateorreplace-my-document-id', 'mcreateorreplace-my-document-id2'] - Then I should have no partial error - And the document 'mcreateorreplace-my-document-id' should be replaced - And the document 'mcreateorreplace-my-document-id2' should be replaced - - Scenario: Check if a document exists - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'exist-test-collection' - And the collection has a document with id 'exist-my-document-id' - When I check if 'exist-my-document-id' exists - Then the document should exist - - Scenario: Check if a document does not exists - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'exist-test-collection' - And the collection has a document with id 'exist-my-document-id' - When I check if 'exist-my-document-unknown' exists - Then the document should not exist - - Scenario: Get multiple document - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'mget-test-collection' - And the collection has a document with id 'mget-my-document-id' - And the collection has a document with id 'mget-my-document-id2' - When I get documents ['mget-my-document-id', 'mget-my-document-id2'] - Then the documents should be retrieved diff --git a/internal/wrappers/features/fixtures/mapping.json b/internal/wrappers/features/fixtures/mapping.json deleted file mode 100644 index 7ac15fa6..00000000 --- a/internal/wrappers/features/fixtures/mapping.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "properties": { - "position": { - "type": "geo_point" - } - } -} \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/rights.json b/internal/wrappers/features/fixtures/rights.json deleted file mode 100644 index c9bac576..00000000 --- a/internal/wrappers/features/fixtures/rights.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "controllers": { - "auth": { - "actions": { - "*": true - } - }, - "security": { - "actions": { - "*": true - } - }, - "collection": { - "actions": { - "*": true - } - }, - "index": { - "actions": { - "*": true - } - }, - "document": { - "actions": { - "*": false - } - } - } -} \ No newline at end of file diff --git a/internal/wrappers/features/fixtures/run.sh b/internal/wrappers/features/fixtures/run.sh deleted file mode 100755 index 52c90843..00000000 --- a/internal/wrappers/features/fixtures/run.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -e -CONTENT_TYPE="Content-Type: application/json" - -KUZZLE_HOST=http://localhost:7512 - -# update rights for anonymous user -curl -X PUT -H "$CONTENT_TYPE" -d @rights.json $KUZZLE_HOST/roles/anonymous/_update - -# create index -curl -X POST -H "$CONTENT_TYPE" $KUZZLE_HOST/index/_create - -# create collection -curl -X PUT -H "$CONTENT_TYPE" $KUZZLE_HOST/index/collection - -# create geofence collection -curl -X PUT -H "$CONTENT_TYPE" $KUZZLE_HOST/index/geofence - -#update mapping for geofence collection -curl -X PUT -H "$CONTENT_TYPE" -d @mapping.json $KUZZLE_HOST/index/geofence/_mapping diff --git a/internal/wrappers/features/index.feature b/internal/wrappers/features/index.feature deleted file mode 100644 index 62630cad..00000000 --- a/internal/wrappers/features/index.feature +++ /dev/null @@ -1,25 +0,0 @@ -Feature: Index controller - - Scenario: Create should create an index - Given Kuzzle Server is running - And there is no index called 'test-index' - When I create an index called 'test-index' - Then the index should exist - - Scenario: Create should return an error when the index already exist - Given Kuzzle Server is running - And there is an index 'test-index' - When I create an index called 'test-index' - Then I get an error - - Scenario: Delete multiple indexes - Given Kuzzle Server is running - And there is the indexes 'test-index1' and 'test-index2' - When I delete the indexes 'test-index1' and 'test-index2' - Then indexes 'test-index1' and 'test-index2' don't exist - - Scenario: List indexes - Given Kuzzle Server is running - And there is the indexes 'test-index1' and 'test-index2' - When I list indexes - Then I get 'test-index1' and 'test-index2' diff --git a/internal/wrappers/features/java/build.gradle b/internal/wrappers/features/java/build.gradle deleted file mode 100644 index 4301227a..00000000 --- a/internal/wrappers/features/java/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -apply plugin: 'java' - -configurations { - cucumberRuntime { - extendsFrom testRuntime - } -} - -compileTestJava { - classpath += files("../../build/java") -} - -task cucumber() { - dependsOn assemble, compileTestJava - doLast { - javaexec { - jvmArgs = ["-Djava.library.path=../../build/io/kuzzle/sdk/resources"] - main = "cucumber.api.cli.Main" - classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output + files('../../build/java') - args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', '../'] - } - } -} - -dependencies { - testCompile 'io.cucumber:cucumber-java:2.3.1' - testCompile 'io.cucumber:cucumber-junit:2.3.1' - - testCompile 'junit:junit:4.12' -} - -repositories { - mavenCentral() -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java deleted file mode 100644 index c4841050..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Collectiondefs.java +++ /dev/null @@ -1,157 +0,0 @@ -package gradle.cucumber; - -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import gherkin.deps.com.google.gson.Gson; -import gherkin.deps.com.google.gson.JsonArray; -import io.kuzzle.sdk.Kuzzle; -import io.kuzzle.sdk.NotFoundException; -import io.kuzzle.sdk.QueryOptions; -import io.kuzzle.sdk.SearchResult; -import org.junit.Assert; - -import javax.management.remote.NotificationResult; - -public class Collectiondefs { - private Kuzzle k; - private World world; - private boolean exists = false; - String listCollections; - private boolean validateSpecs = false; - - @Before - public void before() { - k = KuzzleSingleton.getInstance(); - } - - @When("^I create a collection \'([^\"]*)\'$") - public void i_create_a_collection_test_collection(String collection) throws Exception { - k.getCollection().create(world.index, collection); - world.collection = collection; - } - - @Then("^the collection \'([^\"]*)\' should exist$") - public void the_collection_should_exists(String collection) throws Exception { - Assert.assertTrue(k.getCollection().exists(world.index, collection)); - } - - @When("^I check if the collection \'([^\"]*)\' exists$") - public void i_check_if_the_collection_exists(String collection) throws Exception { - exists = k.getCollection().exists(world.index, collection); - } - - @Then("^the collection should exist$") - public void it_should_exists() throws Exception { - Assert.assertTrue(exists); - } - - @When("^I list the collections of \'([^\"]*)\'$") - public void i_list_the_collections(String index) throws Exception { - listCollections = k.getCollection().list(index); - } - - class Col { - JsonArray collections; - } - - @Then("^the result contains (\\d+) hits$") - public void the_result_contains_hits(int nb) throws Exception { - Gson gson = new Gson(); - Col c = gson.fromJson(listCollections, Collectiondefs.Col.class); - - Assert.assertEquals(nb, c.collections.size()); - - } - - @Then("^the content should not be null$") - public void i() { - Assert.assertNotNull(this.listCollections); - Assert.assertEquals("{\"type\":\"all\",\"collections\":[{\"name\":\"test-collection1\",\"type\":\"stored\"},{\"name\":\"test-collection2\",\"type\":\"stored\"}],\"from\":0,\"size\":10}", this.listCollections); - } - - @When("^I truncate the collection \'([^\"]*)\'$") - public void i_truncate_the_collection(String collection) throws Exception { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - k.getCollection().truncate(world.index, collection, o); - } - - @Then("^the collection \'([^\"]*)\' should be empty$") - public void it_should_be_empty(String collection) throws Exception { - SearchResult res = k.getDocument().search(world.index, collection, "{}"); - Assert.assertEquals("[]", res.getDocuments()); - } - - @When("^I update the mapping of collection \'([^\"]*)\'$") - public void i_update_the_mapping(String collection) throws Exception { - k.getCollection().updateMapping(world.index, collection, "{" + - "\"properties\": {" + - " \"foo\": {" + - " \"type\": \"string\"," + - " \"fields\": {\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}" + - " }" + - "}" + - "}"); - } - - @Then("^the mapping of \'([^\"]*)\' should be updated$") - public void the_mapping_should_be_updated(String collection) throws Exception { - String mapping = k.getCollection().getMapping(world.index, collection); - Assert.assertEquals( - "{\"" + world.index + "\":{\"mappings\":{\"" + collection + "\":{\"properties\":{\"foo\":{\"type\":\"text\",\"fields\":{\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}}}}}}}", mapping); - } - - @When("^I update the specifications of the collection \'([^\"]*)\'$") - public void i_update_the_specifications(String collection) throws Exception { - k.getCollection().updateSpecifications(world.index, world.collection, "{\"" + world.index + "\":{\""+ collection +"\":{\"strict\":true}}}"); - } - - @Then("^the specifications of \'([^\"]*)\' should be updated$") - public void the_specifications_of_collection_should_be_updated(String collection) throws Exception { - Assert.assertEquals("{\"validation\":{\"strict\":true},\"index\":\"test-index\",\"collection\":\"test-collection\"}", k.getCollection().getSpecifications(world.index, collection)); - } - - @When("^I validate the specifications of \'([^\"]*)\'$") - public void i_validate_the_specifications(String collection) throws Exception { - this.validateSpecs = k.getCollection().validateSpecifications("{\""+world.index+"\":{\""+collection+"\":{\"strict\":true}}}"); - } - - @Then("^they should be validated$") - public void they_should_be_validated() throws Exception { - Assert.assertTrue(this.validateSpecs); - } - - @Given("^has specifications$") - public void has_specifications() throws Exception { - k.getCollection().updateSpecifications(world.index, world.collection, "{\""+world.index+"\":{\""+world.collection+"\":{\"strict\":true}}}"); - } - - @When("^I delete the specifications of \'([^\"]*)\'$") - public void i_delete_the_specifications(String collection) throws Exception { - k.getCollection().deleteSpecifications(world.index, collection); - } - - @Then("^the specifications of \'([^\"]*)\' must not exist$") - public void the_specifications_must_not_exist(String collection) throws Exception { - boolean notFound = false; - try { - k.getCollection().getSpecifications(world.index, collection); - } catch (NotFoundException e) { - notFound = true; - } - Assert.assertTrue(notFound); - } - - @When("^I create a collection \'([^\"]*)\' with a mapping$") - public void i_create_a_collection_test_collection_with_mapping(String collection) throws Exception { - String mapping = "{\"properties\": {\"foo\": {" - + "\"type\": \"string\", \"fields\": {" - + "\"keyword\":{\"type\":\"keyword\",\"ignore_above\":256}}" - + "}}}"; - k.getCollection().create(world.index, collection, mapping); - world.collection = collection; - } -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java deleted file mode 100644 index 5254265f..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Documentdefs.java +++ /dev/null @@ -1,381 +0,0 @@ -package gradle.cucumber; - -import cucumber.api.java.en.And; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import gherkin.deps.com.google.gson.Gson; -import gherkin.deps.com.google.gson.JsonObject; -import io.kuzzle.sdk.*; -import org.junit.Assert; - -import java.util.List; - -public class Documentdefs { - private Kuzzle k; - private String errorMessage; - private World world; - private String documentId; - private SearchResult documents; - private int nbDocuments; - private boolean partialException = false; - private boolean documentExists = false; - private String jsonDocuments; - - class Source { - JsonObject _source; - } - - @Given("^Kuzzle Server is running$") - public void kuzzle_Server_is_running() throws Exception { - k = KuzzleSingleton.getInstance(); - - k.connect(); - } - - @Given("^there is an index \'([^\"]*)\'$") - public void there_is_an_index(String index) throws Exception { - world.index = index; - if (!k.getIndex().exists(index)) { - k.getIndex().create(index); - } - } - - @Given("^it has a collection \'([^\"]*)\'$") - public void it_has_a_collection(String collection) throws Exception { - world.collection = collection; - if (!k.getCollection().exists(world.index, collection)) { - k.getCollection().create(world.index, collection); - } - } - - @Given("^the collection has a document with id \'([^\"]*)\'$") - public void the_collection_has_a_document_with_id(String id) throws Exception { - QueryOptions options = new QueryOptions(); - options.setRefresh("wait_for"); - - try { - k.getDocument().create(world.index, world.collection, id, "{\"foo\":\"bar\"}", options); - this.documentId = id; - } catch (BadRequestException e) { - if (!e.getMessage().equals("Document already exists")) { - throw e; - } - } - } - - @When("^I create a document with id \'([^\"]*)\'$") - public void i_try_to_create_a_new_document_with_id(String id) throws Exception { - this.errorMessage = null; - try { - k.getDocument().create(world.index, world.collection, id, "{\"foo\": \"bar\"}"); - this.documentId = id; - this.errorMessage = null; - } catch (BadRequestException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^I get an error with message \'([^\"]*)\'$") - public void i_get_an_error_with_message(String message) throws Exception { - Assert.assertEquals(message, this.errorMessage); - } - - @Then("^the document is successfully created$") - public void the_document_is_successfully_created() throws Exception { - Assert.assertNull(this.errorMessage); - } - - @When("^I update the document with id \'([^\"]*)\' and content \'([^\"]*)\' = \'([^\"]*)\'$") - public void i_update_the_document_with_id_and_content(String id, String key, String value) throws Exception { - QueryOptions options = new QueryOptions(); - options.setRefresh("wait_for"); - - k.getDocument().update(world.index, world.collection, id, "{\""+key+"\":\""+value+"\"}"); - } - - @When("^I createOrReplace a document with id \'([^\"]*)\'$") - public void i_createOrReplace_a_new_document_with_id(String id) throws Exception { - this.errorMessage = null; - try { - k.getDocument().createOrReplace(world.index, world.collection, id, "{\"foo\": \"barz\"}"); - this.documentId = id; - this.errorMessage = null; - } catch (BadRequestException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^the document is successfully replaced$") - public void the_document_is_successfully_replaced() throws Exception { - String doc = k.getDocument().get(world.index, world.collection, this.documentId); - Assert.assertNull(this.errorMessage); - - Gson gson = new Gson(); - Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); - } - - @Given("^the collection doesn't have a document with id \'([^\"]*)\'$") - public void the_collection_doesn_t_have_a_document_with_id(String id) throws Exception { - QueryOptions options = new QueryOptions(); - options.setRefresh("wait_for"); - - try { - k.getDocument().delete(world.index, world.collection, id, options); - } catch (KuzzleException e) {} - } - - @When("^I replace a document with id \'([^\"]*)\'$") - public void i_replace_a_document_with_id(String id) throws Exception { - this.errorMessage = null; - try { - k.getDocument().replace(world.index, world.collection, id, "{\"foo\": \"barz\"}"); - this.documentId = id; - } catch (BadRequestException e) { - this.errorMessage = e.getMessage(); - } - } - - @When("^I delete a document with id \'([^\"]*)\'$") - public void i_delete_a_document_with_id(String id) throws Exception { - this.errorMessage = null; - try { - k.getDocument().delete(world.index, world.collection, id); - } catch (KuzzleException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^the document is successfully deleted") - public void the_document_is_successfully_deleted() throws Exception { - Assert.assertNull(this.errorMessage); - } - - @When("^I update a document with id \'([^\"]*)\'$") - public void i_update_a_document_with_id(String id) throws Exception { - this.errorMessage = null; - try { - k.getDocument().update(world.index, world.collection, id, "{\"foo\": \"barz\"}"); - this.documentId = id; - } catch (BadRequestException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^the document is successfully updated") - public void the_document_is_successfully_updated() throws Exception { - String doc = k.getDocument().get(world.index, world.collection, this.documentId); - Assert.assertNull(this.errorMessage); - - Gson gson = new Gson(); - Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); - } - - @When("^I search a document with id \'([^\"]*)\'$") - public void i_search_a_document_with_id(String id) throws Exception { - this.errorMessage = null; - - try { - QueryOptions options = new QueryOptions(); - options.setSize(42); - this.documents = k.getDocument().search(world.index, world.collection, "{\"query\": {\"bool\": {\"should\":[{\"match\":{\"_id\": \""+id+"\"}}]}}}"); - } catch (BadRequestException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^the document is successfully found$") - public void the_document_is_successfully_found() throws Exception { - Assert.assertNotNull(this.documents); - Assert.assertNotNull(this.documents.getDocuments()); - Assert.assertNotEquals("[]", this.documents.getDocuments()); - } - - @Then("^the document is not found$") - public void the_document_is_not_found() throws Exception { - Assert.assertNotNull(this.documents.getDocuments()); - Assert.assertEquals("[]", this.documents.getDocuments()); - } - - @Then("^I shall receive (\\d+)$") - public void i_shall_receive(int nbDocuments) throws Exception { - Assert.assertEquals(nbDocuments, this.nbDocuments); - this.nbDocuments = 0; - } - - @Then("^I must have (\\d+) documents in the collection$") - public void i_must_have_documents_in_the_collection(int nb) { - Assert.assertEquals(nb, k.getDocument().count(world.index, world.collection, "{}")); - } - - @When("^I count how many documents there is in the collection$") - public void i_count_how_many_documents_there_is_in_the_collection() throws Exception { - nbDocuments = k.getDocument().count(world.index, world.collection, "{}"); - } - - @When("^I delete the documents \\[\'(.*)\', \'(.*)\'\\]$") - public void i_delete_the_documents(String doc1, String doc2) throws Exception { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - StringVector v = new StringVector(); - v.add(doc1); - v.add(doc2); - try { - k.getDocument().mDelete(world.index, world.collection, v, o); - this.partialException = false; - } catch (PartialException e) { - this.partialException = true; - } - } - - @Then("^the collection must be empty$") - public void the_collection_must_be_empty() { - Assert.assertEquals(0, k.getDocument().count(world.index, world.collection, "{}")); - } - - @And("^I get a partial error$") - public void i_get_a_partial_error() { - Assert.assertTrue(this.partialException); - this.partialException = false; - } - - @When("^I create the documents \\[\'(.*)\', \'(.*)\'\\]$") - public void i_create_the_documents(String doc1, String doc2) throws Exception { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - String docs = "{\"documents\":[{\"_id\":\""+doc1+"\", \"body\":{}}, {\"_id\":\""+doc2+"\", \"body\":{}}]}"; - try { - k.getDocument().mCreate(world.index, world.collection, docs, o); - this.partialException = false; - } catch (PartialException e) { - this.partialException = true; - } - } - - @Then("^I should have no partial error$") - public void i_should_have_no_partial_error() { - Assert.assertFalse(this.partialException); - } - - @When("^I replace the documents \\[\'(.*)\', \'(.*)\'\\]$") - public void i_replace_the_documents(String doc1, String doc2) throws Exception { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - String docs = "{\"documents\":[{\"_id\":\""+doc1+"\", \"body\":{\"foo\":\"barz\"}}, {\"_id\":\""+doc2+"\", \"body\":{\"foo\":\"barz\"}}]}"; - try { - k.getDocument().mReplace(world.index, world.collection, docs, o); - this.partialException = false; - } catch (PartialException e) { - this.partialException = true; - } - } - - @Then("^the document \'([^\"]*)\' should be replaced") - public void the_documents_should_be_replaced(String id1) throws Exception { - String doc = k.getDocument().get(world.index, world.collection, id1); - Assert.assertNull(this.errorMessage); - - Gson gson = new Gson(); - Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); - } - - @When("^I update the documents \\[\'(.*)\', \'(.*)\'\\]$") - public void i_update_the_documents(String doc1, String doc2) throws Exception { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - String docs = "{\"documents\":[{\"_id\":\""+doc1+"\", \"body\":{\"foo\":\"barz\"}}, {\"_id\":\""+doc2+"\", \"body\":{\"foo\":\"barz\"}}]}"; - try { - k.getDocument().mUpdate(world.index, world.collection, docs, o); - this.partialException = false; - } catch (PartialException e) { - this.partialException = true; - } catch (KuzzleException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^the document \'([^\"]*)\' should be updated") - public void the_documents_should_be_updated(String id1) throws Exception { - Assert.assertNull(this.errorMessage); - String doc = k.getDocument().get(world.index, world.collection, id1); - Assert.assertNull(this.errorMessage); - - Gson gson = new Gson(); - Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); - } - - @When("^I createOrReplace the documents \\[\'(.*)\', \'(.*)\'\\]$") - public void i_createOrReplace_the_documents(String doc1, String doc2) throws Exception { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - String docs = "{\"documents\":[{\"_id\":\""+doc1+"\", \"body\":{\"foo\":\"barz\"}}, {\"_id\":\""+doc2+"\", \"body\":{\"foo\":\"barz\"}}]}"; - try { - k.getDocument().mCreateOrReplace(world.index, world.collection, docs, o); - this.partialException = false; - } catch (PartialException e) { - this.partialException = true; - } catch (KuzzleException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^the document \'([^\"]*)\' should be created") - public void the_documents_should_be_created(String id1) throws Exception { - Assert.assertNull(this.errorMessage); - String doc = k.getDocument().get(world.index, world.collection, id1); - Assert.assertNull(this.errorMessage); - - Gson gson = new Gson(); - Source s = gson.fromJson(doc, Source.class); - Assert.assertEquals("\"barz\"", s._source.get("foo").toString()); - } - - @When("^I check if \'([^\"]*)\' exists$") - public void i_createOrReplace_the_documents(String doc) throws Exception { - this.documentExists = false; - try { - this.documentExists = k.getDocument().exists(world.index, world.collection, doc); - } catch (KuzzleException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^the document should exist$") - public void the_document_should_exists() throws Exception { - Assert.assertNull(this.errorMessage); - Assert.assertTrue(this.documentExists); - } - - @Then("^the document should not exist$") - public void the_document_should_not_exists() throws Exception { - Assert.assertNull(this.errorMessage); - Assert.assertFalse(this.documentExists); - } - - @When("^I get documents \\[\'(.*)\', \'(.*)\'\\]$") - public void i_get_document_mget_my_document_id_and_mget_my_document_id(String id1, String id2) throws Exception { - try { - StringVector v = new StringVector(); - v.add(id1); - v.add(id2); - jsonDocuments = k.getDocument().mGet(world.index, world.collection, v, false); - } catch (KuzzleException e) { - this.errorMessage = e.getMessage(); - } - } - - @Then("^the documents should be retrieved$") - public void the_documents_should_be_retrieved() throws Exception { - Assert.assertNull(this.errorMessage); - Assert.assertNotNull(this.jsonDocuments); - } -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java deleted file mode 100644 index 51f4aa1c..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Geofencedefs.java +++ /dev/null @@ -1,72 +0,0 @@ -package gradle.cucumber; - -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import io.kuzzle.sdk.*; -import org.junit.Assert; - -public class Geofencedefs { - private Kuzzle k; - private NotificationResult content = null; - private String documentId; - - @Before - public void before() { - k = KuzzleSingleton.getInstance(); - } - - @Given("^I subscribe to \"([^\"]*)\" collection$") - public void i_subscribe_to_collection(String collection) throws Exception { - String filter = "{" + - "\"geoBoundingBox\": {" + - "\"position\": {" + - "\"topLeft\": {" + - "\"lat\": 10," + - "\"lon\": 1" + - "}," + - "\"bottomRight\": {" + - "\"lat\": 1," + - "\"lon\": 10" + - "}" + - "}" + - "}" + - "}"; - - RoomOptions opts = new RoomOptions(); - opts.setUser("all"); - opts.setState("all"); - opts.setScope("all"); - opts.setSubscribeToSelf(true); - - k.getAuth().login("local", "{\"username\": \""+"useradmin"+"\", \"password\":\""+"testpwd"+"\" }", 40000); - - k.getRealtime().subscribe("index", collection, filter, new NotificationListener() { - @Override - public void onMessage(NotificationResult res) { - content = res; - } - }, opts); - } - - @When("^I create a document in \"([^\"]*)\" and inside my geofence$") - public void i_create_a_document_in_and_inside_my_geofence(String collection) throws Exception { - System.err.println("create document"); - documentId = k.getDocument().create("index", collection, "", "{\"position\":{\"lat\": 2, \"lon\": 2}}"); - Thread.sleep(1000); - } - - @Then("^I receive a \"([^\"]*)\" notification$") - public void i_receive_a_notification(String scope) throws Exception { - Assert.assertNotNull(content); - Assert.assertEquals(scope, content.getScope()); - } - - @When("^I update this document to be outside my geofence$") - public void i_update_this_document_to_be_outside_my_geofence() throws Exception { - content = null; - k.getDocument().update("index", "geofence", documentId, "{\"position\":{\"lat\": 30, \"lon\": 20}}"); - Thread.sleep(1000); - } -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java deleted file mode 100644 index e0064ef8..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Indexdefs.java +++ /dev/null @@ -1,100 +0,0 @@ -package gradle.cucumber; - -import cucumber.api.PendingException; -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import io.kuzzle.sdk.Kuzzle; -import io.kuzzle.sdk.KuzzleException; -import io.kuzzle.sdk.QueryOptions; -import io.kuzzle.sdk.StringVector; -import org.junit.Assert; - -public class Indexdefs { - private Kuzzle k; - private World world; - private String errorMessage; - - @Before - public void before() { - k = KuzzleSingleton.getInstance(); - } - - @Given("^there is no index called \'([^\"]*)\'$") - public void there_is_no_index_called(String index) { - try { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - k.getIndex().delete(index, o); - } catch (KuzzleException e) {} - } - - @When("^I create an index called \'([^\"]*)\'$") - public void i_create_an_index_called_test_index(String index) throws Exception { - try { - k.getIndex().create(index); - } catch (KuzzleException e) { - this.errorMessage = e.getMessage(); - } - world.index = index; - } - - @Then("^the index should exist$") - public void the_index_should_exists() throws Exception { - Assert.assertTrue(k.getIndex().exists(world.index)); - } - - - @Then("^I get an error$") - public void i_get_an_error() throws Exception { - Assert.assertNotNull(this.errorMessage); - } - - @Given("^there is the indexes \'([^\"]*)\' and \'([^\"]*)\'$") - public void there_is_the_indexes_test_index_and_test_index(String index1, String index2) throws Exception { - try { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - k.getIndex().create(index1, o); - k.getIndex().create(index2, o); - } catch(Exception e) {} - } - - @When("^I delete the indexes \'([^\"]*)\' and \'([^\"]*)\'$") - public void i_delete_the_indexes_test_index_and_test_index(String index1, String index2) throws Exception { - QueryOptions o = new QueryOptions(); - o.setRefresh("wait_for"); - - StringVector v = new StringVector(); - v.add(index1); - v.add(index2); - - k.getIndex().mDelete(v, o); - } - - @Then("^indexes \'([^\"]*)\' and \'([^\"]*)\' don't exist$") - public void indexes_test_index_and_test_index_don_t_exist(String index1, String index2) throws Exception { - Assert.assertFalse(k.getIndex().exists(index1)); - Assert.assertFalse(k.getIndex().exists(index2)); - } - - @When("^I list indexes$") - public void i_list_indexes() throws Exception { - world.stringArray = k.getIndex().list(); - } - - @Then("^I get \'([^\"]*)\' and \'([^\"]*)\'$") - public void i_get_test_index_and_test_index(String index1, String index2) throws Exception { - int match = 0; - - for (int i = 0; i < world.stringArray.size(); ++i) { - if (world.stringArray.get(i).equals(index1) || world.stringArray.get(i).equals(index2)) - match++; - } - - Assert.assertTrue(match == 2); - } -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/KuzzleSingleton.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/KuzzleSingleton.java deleted file mode 100644 index 152afb57..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/KuzzleSingleton.java +++ /dev/null @@ -1,16 +0,0 @@ -package gradle.cucumber; - -import io.kuzzle.sdk.Kuzzle; - -public class KuzzleSingleton { - private static Kuzzle kuzzle = null; - - public static Kuzzle getInstance() { - if (kuzzle != null) { - return kuzzle; - } - - kuzzle = new Kuzzle((System.getenv().get("KUZZLE_HOST") != null) ? (System.getenv().get("KUZZLE_HOST")) : "localhost"); - return kuzzle; - } -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java deleted file mode 100644 index 621e7903..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/Subscribedefs.java +++ /dev/null @@ -1,92 +0,0 @@ -package gradle.cucumber; - -import cucumber.api.java.After; -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import io.kuzzle.sdk.*; -import org.junit.Assert; - -public class Subscribedefs { - private Kuzzle k; - private String roomId; - private NotificationContent content = null; - private World world; - - @Before - public void before() { - k = KuzzleSingleton.getInstance(); - } - - @After - public void after() { - if (roomId != null) { - k.getRealtime().unsubscribe(roomId); - } - } - - @Given("^I subscribe to \'(.*)\'$") - public void i_subscribe_to(String collection) throws Exception { - roomId = k.getRealtime().subscribe(world.index, collection, "{}", new NotificationListener() { - @Override - public void onMessage(NotificationResult res) { - content = res.getResult(); - } - }); - } - - @Given("^I subscribe to \'(.*)\' with \'(.*)\' as filter$") - public void i_subscribe_with_filter(String collection, String filter) throws Exception { - content = null; - roomId = k.getRealtime().subscribe(world.index, collection, filter, new NotificationListener() { - @Override - public void onMessage(NotificationResult res) { - content = res.getResult(); - } - }); - } - - @When("^I create a document in \'([^\"]*)\'$") - public void i_create_a_document_in(String collection) throws Exception { - k.getDocument().create(world.index, collection, "", "{}"); - Thread.sleep(1000); - } - - @Then("^I( do not)? receive a notification$") - public void i_receive_a_notification(String dont) throws Exception { - Thread.sleep(1000); - if (dont == null) { - Assert.assertNotNull(content); - Assert.assertNotNull(content.getContent()); - content = null; - return; - } - Assert.assertNull(content); - } - - @Given("^I received a notification$") - public void i_received_a_notification() throws Exception { - Thread.sleep(1000); - Assert.assertNotNull(content); - Assert.assertNotNull(content.getContent()); - content = null; - } - - @Given("^I unsubscribe") - public void i_unsubscribe() throws Exception { - k.getRealtime().unsubscribe(roomId); - } - - @When("^I delete the document with id \'([^\"]*)\'$") - public void i_delete_the_document_with_id(String id) throws Exception { - k.getDocument().delete(world.index, world.collection, id); - Thread.sleep(1000); - } - - @When("^I publish a document$") - public void i_publish_a_document() throws Exception { - k.getRealtime().publish(world.index, world.collection, "{}"); - } - -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java deleted file mode 100644 index 570336f4..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/UserManagementdefs.java +++ /dev/null @@ -1,103 +0,0 @@ -package gradle.cucumber; - -import cucumber.api.java.After; -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import io.kuzzle.sdk.*; -import org.junit.Assert; - -public class UserManagementdefs { - private Kuzzle k; - private String userId; - private User currentUser; - - @Before - public void before() { - k = KuzzleSingleton.getInstance(); - } - - @After - public void after() { - if (k != null && (k.getJwt() == null || !k.getJwt().equals(""))) { - k.getAuth().logout(); - } - } - - @Given("^there is an user with id \'([^\"]*)\'$") - public void there_is_an_user_with_id(String id) throws Exception { - this.userId = id; - } - - @Given("^the user has 'local' credentials with name \'([^\"]*)\' and password \'([^\"]*)\'$") - public void the_user_has_local_credentials_with_name_and_password(String name, String password) throws Exception { - KuzzleRequest request = new KuzzleRequest(); - String json = "{\n" + - " \"content\": {\n" + - " \"profileIds\": [\"default\"]" + - " },\n" + - " \"credentials\": {\n" + - " \"local\": {\n" + - " \"username\": \""+name+"\"," + - " \"password\": \""+password+"\"" + - " }\n" + - " }\n" + - "}"; - - request.setController("security"); - request.setAction("createUser"); - request.setId(this.userId); - request.setBody(json); - request.setStrategy("local"); - - try { - k.query(request); - } catch(KuzzleException e) { - if (e.getClass() != PreconditionException.class) { - throw e; - } - } - } - - @When("^I log in as \'([^\"]*)\':\'([^\"]*)\'$") - public void i_log_in_as(String name, String password) throws Exception { - try { - k.getAuth().login("local", "{\"username\": \"" + name + "\", \"password\":\"" + password + "\" }"); - } catch (KuzzleException e) { - if (e.getClass() != UnauthorizedException.class) { - throw e; - } - } - } - - @Then("^the JWT is valid$") - public void the_JWT_is_valid() throws Exception { - Assert.assertTrue(k.getAuth().checkToken(k.getJwt()).getValid()); - } - - @Then("^the JWT is invalid$") - public void the_JWT_is_invalid() throws Exception { - Assert.assertFalse(k.getAuth().checkToken(k.getJwt()).getValid()); - } - - @Given("^I update my user custom data with the pair \'([^\"]*)\':\'([^\"]*)\'$") - public void i_update_my_user_custom_data_with_the_pair(String fieldname, String fieldvalue) throws Exception { - k.getAuth().updateSelf("{\""+fieldname+"\": \""+fieldvalue+"\"}"); - } - - @When("^I get my user info$") - public void i_get_my_user_info() throws Exception { - currentUser = k.getAuth().getCurrentUser(); - } - - @Then("^the response '_source' field contains the pair \'([^\"]*)\':\'([^\"]*)\'$") - public void the_response__source_field_contains_the_pair(String key, String value) throws Exception { - Assert.assertNotNull(currentUser.getContent()); - } - - @When("^I logout$") - public void i_logout() throws Exception { - k.getAuth().logout(); - } -} diff --git a/internal/wrappers/features/java/src/test/java/gradle/cucumber/World.java b/internal/wrappers/features/java/src/test/java/gradle/cucumber/World.java deleted file mode 100644 index c3c7d33c..00000000 --- a/internal/wrappers/features/java/src/test/java/gradle/cucumber/World.java +++ /dev/null @@ -1,9 +0,0 @@ -package gradle.cucumber; - -import io.kuzzle.sdk.*; - -public class World { - public static String index; - public static String collection; - public static StringVector stringArray; -} diff --git a/internal/wrappers/features/realtime.feature b/internal/wrappers/features/realtime.feature deleted file mode 100644 index 0751f7e9..00000000 --- a/internal/wrappers/features/realtime.feature +++ /dev/null @@ -1,45 +0,0 @@ -Feature: Realtime subscription - - Scenario: Receive notifications when a document is created - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And I subscribe to 'test-collection' - When I create a document in 'test-collection' - Then I receive a notification - - Scenario: Receive notifications when a document is updated - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - And I subscribe to 'test-collection' with '{"equals": {"foo": "barz"}}' as filter - When I update the document with id 'my-document-id' and content 'foo' = 'barz' - Then I receive a notification - - Scenario: Receive notifications when a document is deleted - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - And I subscribe to 'test-collection' - When I delete the document with id 'my-document-id' - Then I receive a notification - - Scenario: Receive notifications when a document is published - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And I subscribe to 'test-collection' - When I publish a document - Then I receive a notification - - Scenario: Stop receiving notification when I unsubscribe - Given Kuzzle Server is running - And there is an index 'test-index' - And it has a collection 'test-collection' - And the collection has a document with id 'my-document-id' - And I subscribe to 'test-collection' - And I unsubscribe - When I publish a document - Then I do not receive a notification diff --git a/internal/wrappers/features/run_cpp.sh b/internal/wrappers/features/run_cpp.sh deleted file mode 100644 index d2017860..00000000 --- a/internal/wrappers/features/run_cpp.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -e -cd internal/wrappers -sh ./build_cpp_tests.sh - -FEATURE_FILE=$1 - -if [ -z "$KUZZLE_HOST" ]; then - # For debug - ./_build_cpp_tests/KuzzleSDKStepDefs & -else - # To hide cucumber debug output in CI - ./_build_cpp_tests/KuzzleSDKStepDefs > /dev/null & -fi - -if [ ! -z "$FEATURE_FILE" ]; then - cucumber features/$FEATURE_FILE -else - cucumber -fi - -cd - diff --git a/internal/wrappers/features/run_java.sh b/internal/wrappers/features/run_java.sh deleted file mode 100755 index 4e290c8e..00000000 --- a/internal/wrappers/features/run_java.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -e -cd internal/wrappers/features/java -gradle cucumber -cd - diff --git a/internal/wrappers/features/step_definitions/cucumber.wire b/internal/wrappers/features/step_definitions/cucumber.wire deleted file mode 100644 index 581267b9..00000000 --- a/internal/wrappers/features/step_definitions/cucumber.wire +++ /dev/null @@ -1,6 +0,0 @@ -host: localhost -port: 3902 -timeout: - invoke: 30 - step_matches: 60 - diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/CMakeLists.txt deleted file mode 100644 index 5c461d1f..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -find_package(Boost 1.34 REQUIRED) - -add_library(json_spirit.header INTERFACE) -target_sources(json_spirit.header INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit.h - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_error_position.h - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_reader_template.h - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_stream_reader.h - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_utils.h - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_value.h - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_writer_template.h -) -target_include_directories(json_spirit.header SYSTEM - INTERFACE - ${Boost_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/.. -) - -add_library(json_spirit STATIC EXCLUDE_FROM_ALL - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_reader.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_reader.h - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_value.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_writer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/json_spirit_writer.h -) -target_link_libraries(json_spirit PUBLIC json_spirit.header) diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.h deleted file mode 100644 index 7dac05c3..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef JSON_SPIRIT -#define JSON_SPIRIT - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include "json_spirit_value.h" -#include "json_spirit_reader.h" -#include "json_spirit_writer.h" -#include "json_spirit_utils.h" - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.vcproj b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.vcproj deleted file mode 100644 index ed0e5e0c..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit.vcproj +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_error_position.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_error_position.h deleted file mode 100644 index 4a535ff5..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_error_position.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef JSON_SPIRIT_ERROR_POSITION -#define JSON_SPIRIT_ERROR_POSITION - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include - -namespace json_spirit -{ - // An Error_position exception is thrown by the "read_or_throw" functions below on finding an error. - // Note the "read_or_throw" functions are around 3 times slower than the standard functions "read" - // functions that return a bool. - // - struct Error_position - { - Error_position(); - Error_position( unsigned int line, unsigned int column, const std::string& reason ); - bool operator==( const Error_position& lhs ) const; - unsigned int line_; - unsigned int column_; - std::string reason_; - }; - - inline Error_position::Error_position() - : line_( 0 ) - , column_( 0 ) - { - } - - inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason ) - : line_( line ) - , column_( column ) - , reason_( reason ) - { - } - - inline bool Error_position::operator==( const Error_position& lhs ) const - { - if( this == &lhs ) return true; - - return ( reason_ == lhs.reason_ ) && - ( line_ == lhs.line_ ) && - ( column_ == lhs.column_ ); -} -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.cpp b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.cpp deleted file mode 100644 index 8e2fb5e2..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#include "json_spirit_reader.h" -#include "json_spirit_reader_template.h" - -using namespace json_spirit; - -bool json_spirit::read( const std::string& s, Value& value ) -{ - return read_string( s, value ); -} - -void json_spirit::read_or_throw( const std::string& s, Value& value ) -{ - read_string_or_throw( s, value ); -} - -bool json_spirit::read( std::istream& is, Value& value ) -{ - return read_stream( is, value ); -} - -void json_spirit::read_or_throw( std::istream& is, Value& value ) -{ - read_stream_or_throw( is, value ); -} - -bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ) -{ - return read_range( begin, end, value ); -} - -void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ) -{ - begin = read_range_or_throw( begin, end, value ); -} - -#ifndef BOOST_NO_STD_WSTRING - -bool json_spirit::read( const std::wstring& s, wValue& value ) -{ - return read_string( s, value ); -} - -void json_spirit::read_or_throw( const std::wstring& s, wValue& value ) -{ - read_string_or_throw( s, value ); -} - -bool json_spirit::read( std::wistream& is, wValue& value ) -{ - return read_stream( is, value ); -} - -void json_spirit::read_or_throw( std::wistream& is, wValue& value ) -{ - read_stream_or_throw( is, value ); -} - -bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ) -{ - return read_range( begin, end, value ); -} - -void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ) -{ - begin = read_range_or_throw( begin, end, value ); -} - -#endif - -bool json_spirit::read( const std::string& s, mValue& value ) -{ - return read_string( s, value ); -} - -void json_spirit::read_or_throw( const std::string& s, mValue& value ) -{ - read_string_or_throw( s, value ); -} - -bool json_spirit::read( std::istream& is, mValue& value ) -{ - return read_stream( is, value ); -} - -void json_spirit::read_or_throw( std::istream& is, mValue& value ) -{ - read_stream_or_throw( is, value ); -} - -bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ) -{ - return read_range( begin, end, value ); -} - -void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ) -{ - begin = read_range_or_throw( begin, end, value ); -} - -#ifndef BOOST_NO_STD_WSTRING - -bool json_spirit::read( const std::wstring& s, wmValue& value ) -{ - return read_string( s, value ); -} - -void json_spirit::read_or_throw( const std::wstring& s, wmValue& value ) -{ - read_string_or_throw( s, value ); -} - -bool json_spirit::read( std::wistream& is, wmValue& value ) -{ - return read_stream( is, value ); -} - -void json_spirit::read_or_throw( std::wistream& is, wmValue& value ) -{ - read_stream_or_throw( is, value ); -} - -bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ) -{ - return read_range( begin, end, value ); -} - -void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ) -{ - begin = read_range_or_throw( begin, end, value ); -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.h deleted file mode 100644 index a58bfc10..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef JSON_SPIRIT_READER -#define JSON_SPIRIT_READER - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include "json_spirit_value.h" -#include "json_spirit_error_position.h" -#include - -namespace json_spirit -{ - // functions to reads a JSON values - - bool read( const std::string& s, Value& value ); - bool read( std::istream& is, Value& value ); - bool read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ); - - void read_or_throw( const std::string& s, Value& value ); - void read_or_throw( std::istream& is, Value& value ); - void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value ); - -#ifndef BOOST_NO_STD_WSTRING - - bool read( const std::wstring& s, wValue& value ); - bool read( std::wistream& is, wValue& value ); - bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ); - - void read_or_throw( const std::wstring& s, wValue& value ); - void read_or_throw( std::wistream& is, wValue& value ); - void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value ); - -#endif - - bool read( const std::string& s, mValue& value ); - bool read( std::istream& is, mValue& value ); - bool read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ); - - void read_or_throw( const std::string& s, mValue& value ); - void read_or_throw( std::istream& is, mValue& value ); - void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value ); - -#ifndef BOOST_NO_STD_WSTRING - - bool read( const std::wstring& s, wmValue& value ); - bool read( std::wistream& is, wmValue& value ); - bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ); - - void read_or_throw( const std::wstring& s, wmValue& value ); - void read_or_throw( std::wistream& is, wmValue& value ); - void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value ); - -#endif -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader_template.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader_template.h deleted file mode 100644 index 81cded43..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_reader_template.h +++ /dev/null @@ -1,612 +0,0 @@ -#ifndef JSON_SPIRIT_READER_TEMPLATE -#define JSON_SPIRIT_READER_TEMPLATE - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#include "json_spirit_value.h" -#include "json_spirit_error_position.h" - -//#define BOOST_SPIRIT_THREADSAFE // uncomment for multithreaded use, requires linking to boost.thread - -#include -#include -#include - -#if BOOST_VERSION >= 103800 - #include - #include - #include - #include - #include - #define spirit_namespace boost::spirit::classic -#else - #include - #include - #include - #include - #include - #define spirit_namespace boost::spirit -#endif - -namespace json_spirit -{ - const spirit_namespace::int_parser < boost::int64_t > int64_p = spirit_namespace::int_parser < boost::int64_t >(); - const spirit_namespace::uint_parser< boost::uint64_t > uint64_p = spirit_namespace::uint_parser< boost::uint64_t >(); - - template< class Iter_type > - bool is_eq( Iter_type first, Iter_type last, const char* c_str ) - { - for( Iter_type i = first; i != last; ++i, ++c_str ) - { - if( *c_str == 0 ) return false; - - if( *i != *c_str ) return false; - } - - return true; - } - - template< class Char_type > - Char_type hex_to_num( const Char_type c ) - { - if( ( c >= '0' ) && ( c <= '9' ) ) return c - '0'; - if( ( c >= 'a' ) && ( c <= 'f' ) ) return c - 'a' + 10; - if( ( c >= 'A' ) && ( c <= 'F' ) ) return c - 'A' + 10; - return 0; - } - - template< class Char_type, class Iter_type > - Char_type hex_str_to_char( Iter_type& begin ) - { - const Char_type c1( *( ++begin ) ); - const Char_type c2( *( ++begin ) ); - - return ( hex_to_num( c1 ) << 4 ) + hex_to_num( c2 ); - } - - template< class Char_type, class Iter_type > - Char_type unicode_str_to_char( Iter_type& begin ) - { - const Char_type c1( *( ++begin ) ); - const Char_type c2( *( ++begin ) ); - const Char_type c3( *( ++begin ) ); - const Char_type c4( *( ++begin ) ); - - return ( hex_to_num( c1 ) << 12 ) + - ( hex_to_num( c2 ) << 8 ) + - ( hex_to_num( c3 ) << 4 ) + - hex_to_num( c4 ); - } - - template< class String_type > - void append_esc_char_and_incr_iter( String_type& s, - typename String_type::const_iterator& begin, - typename String_type::const_iterator end ) - { - typedef typename String_type::value_type Char_type; - - const Char_type c2( *begin ); - - switch( c2 ) - { - case 't': s += '\t'; break; - case 'b': s += '\b'; break; - case 'f': s += '\f'; break; - case 'n': s += '\n'; break; - case 'r': s += '\r'; break; - case '\\': s += '\\'; break; - case '/': s += '/'; break; - case '"': s += '"'; break; - case 'x': - { - if( end - begin >= 3 ) // expecting "xHH..." - { - s += hex_str_to_char< Char_type >( begin ); - } - break; - } - case 'u': - { - if( end - begin >= 5 ) // expecting "uHHHH..." - { - s += unicode_str_to_char< Char_type >( begin ); - } - break; - } - } - } - - template< class String_type > - String_type substitute_esc_chars( typename String_type::const_iterator begin, - typename String_type::const_iterator end ) - { - typedef typename String_type::const_iterator Iter_type; - - if( end - begin < 2 ) return String_type( begin, end ); - - String_type result; - - result.reserve( end - begin ); - - const Iter_type end_minus_1( end - 1 ); - - Iter_type substr_start = begin; - Iter_type i = begin; - - for( ; i < end_minus_1; ++i ) - { - if( *i == '\\' ) - { - result.append( substr_start, i ); - - ++i; // skip the '\' - - append_esc_char_and_incr_iter( result, i, end ); - - substr_start = i + 1; - } - } - - result.append( substr_start, end ); - - return result; - } - - template< class String_type > - String_type get_str_( typename String_type::const_iterator begin, - typename String_type::const_iterator end ) - { - assert( end - begin >= 2 ); - - typedef typename String_type::const_iterator Iter_type; - - Iter_type str_without_quotes( ++begin ); - Iter_type end_without_quotes( --end ); - - return substitute_esc_chars< String_type >( str_without_quotes, end_without_quotes ); - } - - inline std::string get_str( std::string::const_iterator begin, std::string::const_iterator end ) - { - return get_str_< std::string >( begin, end ); - } - - inline std::wstring get_str( std::wstring::const_iterator begin, std::wstring::const_iterator end ) - { - return get_str_< std::wstring >( begin, end ); - } - - template< class String_type, class Iter_type > - String_type get_str( Iter_type begin, Iter_type end ) - { - const String_type tmp( begin, end ); // convert multipass iterators to string iterators - - return get_str( tmp.begin(), tmp.end() ); - } - - // this class's methods get called by the spirit parse resulting - // in the creation of a JSON object or array - // - // NB Iter_type could be a std::string iterator, wstring iterator, a position iterator or a multipass iterator - // - template< class Value_type, class Iter_type > - class Semantic_actions - { - public: - - typedef typename Value_type::Config_type Config_type; - typedef typename Config_type::String_type String_type; - typedef typename Config_type::Object_type Object_type; - typedef typename Config_type::Array_type Array_type; - typedef typename String_type::value_type Char_type; - - Semantic_actions( Value_type& value ) - : value_( value ) - , current_p_( 0 ) - { - } - - void begin_obj( Char_type c ) - { - assert( c == '{' ); - - begin_compound< Object_type >(); - } - - void end_obj( Char_type c ) - { - assert( c == '}' ); - - end_compound(); - } - - void begin_array( Char_type c ) - { - assert( c == '[' ); - - begin_compound< Array_type >(); - } - - void end_array( Char_type c ) - { - assert( c == ']' ); - - end_compound(); - } - - void new_name( Iter_type begin, Iter_type end ) - { - assert( current_p_->type() == obj_type ); - - name_ = get_str< String_type >( begin, end ); - } - - void new_str( Iter_type begin, Iter_type end ) - { - add_to_current( get_str< String_type >( begin, end ) ); - } - - void new_true( Iter_type begin, Iter_type end ) - { - assert( is_eq( begin, end, "true" ) ); - - add_to_current( true ); - } - - void new_false( Iter_type begin, Iter_type end ) - { - assert( is_eq( begin, end, "false" ) ); - - add_to_current( false ); - } - - void new_null( Iter_type begin, Iter_type end ) - { - assert( is_eq( begin, end, "null" ) ); - - add_to_current( Value_type() ); - } - - void new_int( boost::int64_t i ) - { - add_to_current( i ); - } - - void new_uint64( boost::uint64_t ui ) - { - add_to_current( ui ); - } - - void new_real( double d ) - { - add_to_current( d ); - } - - private: - - Semantic_actions& operator=( const Semantic_actions& ); - // to prevent "assignment operator could not be generated" warning - - Value_type* add_first( const Value_type& value ) - { - assert( current_p_ == 0 ); - - value_ = value; - current_p_ = &value_; - return current_p_; - } - - template< class Array_or_obj > - void begin_compound() - { - if( current_p_ == 0 ) - { - add_first( Array_or_obj() ); - } - else - { - stack_.push_back( current_p_ ); - - Array_or_obj new_array_or_obj; // avoid copy by building new array or object in place - - current_p_ = add_to_current( new_array_or_obj ); - } - } - - void end_compound() - { - if( current_p_ != &value_ ) - { - current_p_ = stack_.back(); - - stack_.pop_back(); - } - } - - Value_type* add_to_current( const Value_type& value ) - { - if( current_p_ == 0 ) - { - return add_first( value ); - } - else if( current_p_->type() == array_type ) - { - current_p_->get_array().push_back( value ); - - return ¤t_p_->get_array().back(); - } - - assert( current_p_->type() == obj_type ); - - return &Config_type::add( current_p_->get_obj(), name_, value ); - } - - Value_type& value_; // this is the object or array that is being created - Value_type* current_p_; // the child object or array that is currently being constructed - - std::vector< Value_type* > stack_; // previous child objects and arrays - - String_type name_; // of current name/value pair - }; - - template< typename Iter_type > - void throw_error( spirit_namespace::position_iterator< Iter_type > i, const std::string& reason ) - { - throw Error_position( i.get_position().line, i.get_position().column, reason ); - } - - template< typename Iter_type > - void throw_error( Iter_type i, const std::string& reason ) - { - throw reason; - } - - // the spirit grammer - // - template< class Value_type, class Iter_type > - class Json_grammer : public spirit_namespace::grammar< Json_grammer< Value_type, Iter_type > > - { - public: - - typedef Semantic_actions< Value_type, Iter_type > Semantic_actions_t; - - Json_grammer( Semantic_actions_t& semantic_actions ) - : actions_( semantic_actions ) - { - } - - static void throw_not_value( Iter_type begin, Iter_type end ) - { - throw_error( begin, "not a value" ); - } - - static void throw_not_array( Iter_type begin, Iter_type end ) - { - throw_error( begin, "not an array" ); - } - - static void throw_not_object( Iter_type begin, Iter_type end ) - { - throw_error( begin, "not an object" ); - } - - static void throw_not_pair( Iter_type begin, Iter_type end ) - { - throw_error( begin, "not a pair" ); - } - - static void throw_not_colon( Iter_type begin, Iter_type end ) - { - throw_error( begin, "no colon in pair" ); - } - - static void throw_not_string( Iter_type begin, Iter_type end ) - { - throw_error( begin, "not a string" ); - } - - template< typename ScannerT > - class definition - { - public: - - definition( const Json_grammer& self ) - { - using namespace spirit_namespace; - - typedef typename Value_type::String_type::value_type Char_type; - - // first we convert the semantic action class methods to functors with the - // parameter signature expected by spirit - - typedef boost::function< void( Char_type ) > Char_action; - typedef boost::function< void( Iter_type, Iter_type ) > Str_action; - typedef boost::function< void( double ) > Real_action; - typedef boost::function< void( boost::int64_t ) > Int_action; - typedef boost::function< void( boost::uint64_t ) > Uint64_action; - - Char_action begin_obj ( boost::bind( &Semantic_actions_t::begin_obj, &self.actions_, _1 ) ); - Char_action end_obj ( boost::bind( &Semantic_actions_t::end_obj, &self.actions_, _1 ) ); - Char_action begin_array( boost::bind( &Semantic_actions_t::begin_array, &self.actions_, _1 ) ); - Char_action end_array ( boost::bind( &Semantic_actions_t::end_array, &self.actions_, _1 ) ); - Str_action new_name ( boost::bind( &Semantic_actions_t::new_name, &self.actions_, _1, _2 ) ); - Str_action new_str ( boost::bind( &Semantic_actions_t::new_str, &self.actions_, _1, _2 ) ); - Str_action new_true ( boost::bind( &Semantic_actions_t::new_true, &self.actions_, _1, _2 ) ); - Str_action new_false ( boost::bind( &Semantic_actions_t::new_false, &self.actions_, _1, _2 ) ); - Str_action new_null ( boost::bind( &Semantic_actions_t::new_null, &self.actions_, _1, _2 ) ); - Real_action new_real ( boost::bind( &Semantic_actions_t::new_real, &self.actions_, _1 ) ); - Int_action new_int ( boost::bind( &Semantic_actions_t::new_int, &self.actions_, _1 ) ); - Uint64_action new_uint64 ( boost::bind( &Semantic_actions_t::new_uint64, &self.actions_, _1 ) ); - - // actual grammer - - json_ - = value_ | eps_p[ &throw_not_value ] - ; - - value_ - = string_[ new_str ] - | number_ - | object_ - | array_ - | str_p( "true" ) [ new_true ] - | str_p( "false" )[ new_false ] - | str_p( "null" ) [ new_null ] - ; - - object_ - = ch_p('{')[ begin_obj ] - >> !members_ - >> ( ch_p('}')[ end_obj ] | eps_p[ &throw_not_object ] ) - ; - - members_ - = pair_ >> *( ',' >> pair_ ) - ; - - pair_ - = string_[ new_name ] - >> ( ':' | eps_p[ &throw_not_colon ] ) - >> ( value_ | eps_p[ &throw_not_value ] ) - ; - - array_ - = ch_p('[')[ begin_array ] - >> !elements_ - >> ( ch_p(']')[ end_array ] | eps_p[ &throw_not_array ] ) - ; - - elements_ - = value_ >> *( ',' >> value_ ) - ; - - string_ - = lexeme_d // this causes white space inside a string to be retained - [ - confix_p - ( - '"', - *lex_escape_ch_p, - '"' - ) - ] - ; - - number_ - = strict_real_p[ new_real ] - | int64_p [ new_int ] - | uint64_p [ new_uint64 ] - ; - } - - spirit_namespace::rule< ScannerT > json_, object_, members_, pair_, array_, elements_, value_, string_, number_; - - const spirit_namespace::rule< ScannerT >& start() const { return json_; } - }; - - private: - - Json_grammer& operator=( const Json_grammer& ); // to prevent "assignment operator could not be generated" warning - - Semantic_actions_t& actions_; - }; - - template< class Iter_type, class Value_type > - Iter_type read_range_or_throw( Iter_type begin, Iter_type end, Value_type& value ) - { - Semantic_actions< Value_type, Iter_type > semantic_actions( value ); - - const spirit_namespace::parse_info< Iter_type > info = - spirit_namespace::parse( begin, end, - Json_grammer< Value_type, Iter_type >( semantic_actions ), - spirit_namespace::space_p ); - - if( !info.hit ) - { - assert( false ); // in theory exception should already have been thrown - throw_error( info.stop, "error" ); - } - - return info.stop; - } - - template< class Iter_type, class Value_type > - void add_posn_iter_and_read_range_or_throw( Iter_type begin, Iter_type end, Value_type& value ) - { - typedef spirit_namespace::position_iterator< Iter_type > Posn_iter_t; - - const Posn_iter_t posn_begin( begin, end ); - const Posn_iter_t posn_end( end, end ); - - read_range_or_throw( posn_begin, posn_end, value ); - } - - template< class Iter_type, class Value_type > - bool read_range( Iter_type& begin, Iter_type end, Value_type& value ) - { - try - { - begin = read_range_or_throw( begin, end, value ); - - return true; - } - catch( ... ) - { - return false; - } - } - - template< class String_type, class Value_type > - void read_string_or_throw( const String_type& s, Value_type& value ) - { - add_posn_iter_and_read_range_or_throw( s.begin(), s.end(), value ); - } - - template< class String_type, class Value_type > - bool read_string( const String_type& s, Value_type& value ) - { - typename String_type::const_iterator begin = s.begin(); - - return read_range( begin, s.end(), value ); - } - - template< class Istream_type > - struct Multi_pass_iters - { - typedef typename Istream_type::char_type Char_type; - typedef std::istream_iterator< Char_type, Char_type > istream_iter; - typedef spirit_namespace::multi_pass< istream_iter > Mp_iter; - - Multi_pass_iters( Istream_type& is ) - { - is.unsetf( std::ios::skipws ); - - begin_ = spirit_namespace::make_multi_pass( istream_iter( is ) ); - end_ = spirit_namespace::make_multi_pass( istream_iter() ); - } - - Mp_iter begin_; - Mp_iter end_; - }; - - template< class Istream_type, class Value_type > - bool read_stream( Istream_type& is, Value_type& value ) - { - Multi_pass_iters< Istream_type > mp_iters( is ); - - return read_range( mp_iters.begin_, mp_iters.end_, value ); - } - - template< class Istream_type, class Value_type > - void read_stream_or_throw( Istream_type& is, Value_type& value ) - { - const Multi_pass_iters< Istream_type > mp_iters( is ); - - add_posn_iter_and_read_range_or_throw( mp_iters.begin_, mp_iters.end_, value ); - } -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_stream_reader.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_stream_reader.h deleted file mode 100644 index a9ceeacf..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_stream_reader.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef JSON_SPIRIT_READ_STREAM -#define JSON_SPIRIT_READ_STREAM - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include "json_spirit_reader_template.h" - -namespace json_spirit -{ - // these classes allows you to read multiple top level contiguous values from a stream, - // the normal stream read functions have a bug that prevent multiple top level values - // from being read unless they are separated by spaces - - template< class Istream_type, class Value_type > - class Stream_reader - { - public: - - Stream_reader( Istream_type& is ) - : iters_( is ) - { - } - - bool read_next( Value_type& value ) - { - return read_range( iters_.begin_, iters_.end_, value ); - } - - private: - - typedef Multi_pass_iters< Istream_type > Mp_iters; - - Mp_iters iters_; - }; - - template< class Istream_type, class Value_type > - class Stream_reader_thrower - { - public: - - Stream_reader_thrower( Istream_type& is ) - : iters_( is ) - , posn_begin_( iters_.begin_, iters_.end_ ) - , posn_end_( iters_.end_, iters_.end_ ) - { - } - - void read_next( Value_type& value ) - { - posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value ); - } - - private: - - typedef Multi_pass_iters< Istream_type > Mp_iters; - typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t; - - Mp_iters iters_; - Posn_iter_t posn_begin_, posn_end_; - }; -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_utils.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_utils.h deleted file mode 100644 index 7eb338e7..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_utils.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef JSON_SPIRIT_UTILS -#define JSON_SPIRIT_UTILS - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include "json_spirit_value.h" -#include - -namespace json_spirit -{ - template< class Obj_t, class Map_t > - void obj_to_map( const Obj_t& obj, Map_t& mp_obj ) - { - mp_obj.clear(); - - for( typename Obj_t::const_iterator i = obj.begin(); i != obj.end(); ++i ) - { - mp_obj[ i->name_ ] = i->value_; - } - } - - template< class Obj_t, class Map_t > - void map_to_obj( const Map_t& mp_obj, Obj_t& obj ) - { - obj.clear(); - - for( typename Map_t::const_iterator i = mp_obj.begin(); i != mp_obj.end(); ++i ) - { - obj.push_back( typename Obj_t::value_type( i->first, i->second ) ); - } - } - - typedef std::map< std::string, Value > Mapped_obj; - -#ifndef BOOST_NO_STD_WSTRING - typedef std::map< std::wstring, wValue > wMapped_obj; -#endif - - template< class Object_type, class String_type > - const typename Object_type::value_type::Value_type& find_value( const Object_type& obj, const String_type& name ) - { - for( typename Object_type::const_iterator i = obj.begin(); i != obj.end(); ++i ) - { - if( i->name_ == name ) - { - return i->value_; - } - } - - return Object_type::value_type::Value_type::null; - } -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.cpp b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.cpp deleted file mode 100644 index dd5b50e5..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.cpp +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright (c) 2007 John W Wilkinson - - This source code can be used for any purpose as long as - this comment is retained. */ - -// json spirit version 2.00 - -#include "json_spirit_value.h" diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.h deleted file mode 100644 index e8be3553..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_value.h +++ /dev/null @@ -1,532 +0,0 @@ -#ifndef JSON_SPIRIT_VALUE -#define JSON_SPIRIT_VALUE - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace json_spirit -{ - enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type }; - - template< class Config > // Config determines whether the value uses std::string or std::wstring and - // whether JSON Objects are represented as vectors or maps - class Value_impl - { - public: - - typedef Config Config_type; - typedef typename Config::String_type String_type; - typedef typename Config::Object_type Object; - typedef typename Config::Array_type Array; - typedef typename String_type::const_pointer Const_str_ptr; // eg const char* - - Value_impl(); // creates null value - Value_impl( Const_str_ptr value ); - Value_impl( const String_type& value ); - Value_impl( const Object& value ); - Value_impl( const Array& value ); - Value_impl( bool value ); - Value_impl( int value ); - Value_impl( boost::int64_t value ); - Value_impl( boost::uint64_t value ); - Value_impl( double value ); - - Value_impl( const Value_impl& other ); - - bool operator==( const Value_impl& lhs ) const; - - Value_impl& operator=( const Value_impl& lhs ); - - Value_type type() const; - - bool is_uint64() const; - bool is_null() const; - - const String_type& get_str() const; - const Object& get_obj() const; - const Array& get_array() const; - bool get_bool() const; - int get_int() const; - boost::int64_t get_int64() const; - boost::uint64_t get_uint64() const; - double get_real() const; - - Object& get_obj(); - Array& get_array(); - - template< typename T > T get_value() const; // example usage: int i = value.get_value< int >(); - // or double d = value.get_value< double >(); - - static const Value_impl null; - - private: - - void check_type( const Value_type vtype ) const; - - typedef boost::variant< String_type, - boost::recursive_wrapper< Object >, boost::recursive_wrapper< Array >, - bool, boost::int64_t, double > Variant; - - Value_type type_; - Variant v_; - bool is_uint64_; - }; - - // vector objects - - template< class Config > - struct Pair_impl - { - typedef typename Config::String_type String_type; - typedef typename Config::Value_type Value_type; - - Pair_impl( const String_type& name, const Value_type& value ); - - bool operator==( const Pair_impl& lhs ) const; - - String_type name_; - Value_type value_; - }; - - template< class String > - struct Config_vector - { - typedef String String_type; - typedef Value_impl< Config_vector > Value_type; - typedef Pair_impl < Config_vector > Pair_type; - typedef std::vector< Value_type > Array_type; - typedef std::vector< Pair_type > Object_type; - - static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value ) - { - obj.push_back( Pair_type( name , value ) ); - - return obj.back().value_; - } - - static String_type get_name( const Pair_type& pair ) - { - return pair.name_; - } - - static Value_type get_value( const Pair_type& pair ) - { - return pair.value_; - } - }; - - // typedefs for ASCII - - typedef Config_vector< std::string > Config; - - typedef Config::Value_type Value; - typedef Config::Pair_type Pair; - typedef Config::Object_type Object; - typedef Config::Array_type Array; - - // typedefs for Unicode - -#ifndef BOOST_NO_STD_WSTRING - - typedef Config_vector< std::wstring > wConfig; - - typedef wConfig::Value_type wValue; - typedef wConfig::Pair_type wPair; - typedef wConfig::Object_type wObject; - typedef wConfig::Array_type wArray; -#endif - - // map objects - - template< class String > - struct Config_map - { - typedef String String_type; - typedef Value_impl< Config_map > Value_type; - typedef std::vector< Value_type > Array_type; - typedef std::map< String_type, Value_type > Object_type; - typedef typename Object_type::value_type Pair_type; - - static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value ) - { - return obj[ name ] = value; - } - - static String_type get_name( const Pair_type& pair ) - { - return pair.first; - } - - static Value_type get_value( const Pair_type& pair ) - { - return pair.second; - } - }; - - // typedefs for ASCII - - typedef Config_map< std::string > mConfig; - - typedef mConfig::Value_type mValue; - typedef mConfig::Object_type mObject; - typedef mConfig::Array_type mArray; - - // typedefs for Unicode - -#ifndef BOOST_NO_STD_WSTRING - - typedef Config_map< std::wstring > wmConfig; - - typedef wmConfig::Value_type wmValue; - typedef wmConfig::Object_type wmObject; - typedef wmConfig::Array_type wmArray; - -#endif - - /////////////////////////////////////////////////////////////////////////////////////////////// - // - // implementation - - template< class Config > - const Value_impl< Config > Value_impl< Config >::null; - - template< class Config > - Value_impl< Config >::Value_impl() - : type_( null_type ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( const Const_str_ptr value ) - : type_( str_type ) - , v_( String_type( value ) ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( const String_type& value ) - : type_( str_type ) - , v_( value ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( const Object& value ) - : type_( obj_type ) - , v_( value ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( const Array& value ) - : type_( array_type ) - , v_( value ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( bool value ) - : type_( bool_type ) - , v_( value ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( int value ) - : type_( int_type ) - , v_( static_cast< boost::int64_t >( value ) ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( boost::int64_t value ) - : type_( int_type ) - , v_( value ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( boost::uint64_t value ) - : type_( int_type ) - , v_( static_cast< boost::int64_t >( value ) ) - , is_uint64_( true ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( double value ) - : type_( real_type ) - , v_( value ) - , is_uint64_( false ) - { - } - - template< class Config > - Value_impl< Config >::Value_impl( const Value_impl< Config >& other ) - : type_( other.type() ) - , v_( other.v_ ) - , is_uint64_( other.is_uint64_ ) - { - } - - template< class Config > - Value_impl< Config >& Value_impl< Config >::operator=( const Value_impl& lhs ) - { - Value_impl tmp( lhs ); - - std::swap( type_, tmp.type_ ); - std::swap( v_, tmp.v_ ); - std::swap( is_uint64_, tmp.is_uint64_ ); - - return *this; - } - - template< class Config > - bool Value_impl< Config >::operator==( const Value_impl& lhs ) const - { - if( this == &lhs ) return true; - - if( type() != lhs.type() ) return false; - - return v_ == lhs.v_; - } - - template< class Config > - Value_type Value_impl< Config >::type() const - { - return type_; - } - - template< class Config > - bool Value_impl< Config >::is_uint64() const - { - return is_uint64_; - } - - template< class Config > - bool Value_impl< Config >::is_null() const - { - return type() == null_type; - } - - template< class Config > - void Value_impl< Config >::check_type( const Value_type vtype ) const - { - if( type() != vtype ) - { - std::ostringstream os; - - os << "value type is " << type() << " not " << vtype; - - throw std::runtime_error( os.str() ); - } - } - - template< class Config > - const typename Config::String_type& Value_impl< Config >::get_str() const - { - check_type( str_type ); - - return *boost::get< String_type >( &v_ ); - } - - template< class Config > - const typename Value_impl< Config >::Object& Value_impl< Config >::get_obj() const - { - check_type( obj_type ); - - return *boost::get< Object >( &v_ ); - } - - template< class Config > - const typename Value_impl< Config >::Array& Value_impl< Config >::get_array() const - { - check_type( array_type ); - - return *boost::get< Array >( &v_ ); - } - - template< class Config > - bool Value_impl< Config >::get_bool() const - { - check_type( bool_type ); - - return boost::get< bool >( v_ ); - } - - template< class Config > - int Value_impl< Config >::get_int() const - { - check_type( int_type ); - - return static_cast< int >( get_int64() ); - } - - template< class Config > - boost::int64_t Value_impl< Config >::get_int64() const - { - check_type( int_type ); - - return boost::get< boost::int64_t >( v_ ); - } - - template< class Config > - boost::uint64_t Value_impl< Config >::get_uint64() const - { - check_type( int_type ); - - return static_cast< boost::uint64_t >( get_int64() ); - } - - template< class Config > - double Value_impl< Config >::get_real() const - { - if( type() == int_type ) - { - return is_uint64() ? static_cast< double >( get_uint64() ) - : static_cast< double >( get_int64() ); - } - - check_type( real_type ); - - return boost::get< double >( v_ ); - } - - template< class Config > - typename Value_impl< Config >::Object& Value_impl< Config >::get_obj() - { - check_type( obj_type ); - - return *boost::get< Object >( &v_ ); - } - - template< class Config > - typename Value_impl< Config >::Array& Value_impl< Config >::get_array() - { - check_type( array_type ); - - return *boost::get< Array >( &v_ ); - } - - template< class Config > - Pair_impl< Config >::Pair_impl( const String_type& name, const Value_type& value ) - : name_( name ) - , value_( value ) - { - } - - template< class Config > - bool Pair_impl< Config >::operator==( const Pair_impl< Config >& lhs ) const - { - if( this == &lhs ) return true; - - return ( name_ == lhs.name_ ) && ( value_ == lhs.value_ ); - } - - // converts a C string, ie. 8 bit char array, to a string object - // - template < class String_type > - String_type to_str( const char* c_str ) - { - String_type result; - - for( const char* p = c_str; *p != 0; ++p ) - { - result += *p; - } - - return result; - } - - // - - namespace internal_ - { - template< typename T > - struct Type_to_type - { - }; - - template< class Value > - int get_value( const Value& value, Type_to_type< int > ) - { - return value.get_int(); - } - - template< class Value > - boost::int64_t get_value( const Value& value, Type_to_type< boost::int64_t > ) - { - return value.get_int64(); - } - - template< class Value > - boost::uint64_t get_value( const Value& value, Type_to_type< boost::uint64_t > ) - { - return value.get_uint64(); - } - - template< class Value > - double get_value( const Value& value, Type_to_type< double > ) - { - return value.get_real(); - } - - template< class Value > - typename Value::String_type get_value( const Value& value, Type_to_type< typename Value::String_type > ) - { - return value.get_str(); - } - - template< class Value > - typename Value::Array get_value( const Value& value, Type_to_type< typename Value::Array > ) - { - return value.get_array(); - } - - template< class Value > - typename Value::Object get_value( const Value& value, Type_to_type< typename Value::Object > ) - { - return value.get_obj(); - } - - template< class Value > - bool get_value( const Value& value, Type_to_type< bool > ) - { - return value.get_bool(); - } - } - - template< class Config > - template< typename T > - T Value_impl< Config >::get_value() const - { - return internal_::get_value( *this, internal_::Type_to_type< T >() ); - } -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.cpp b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.cpp deleted file mode 100644 index f3367b68..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#include "json_spirit_writer.h" -#include "json_spirit_writer_template.h" - -void json_spirit::write( const Value& value, std::ostream& os ) -{ - write_stream( value, os, false ); -} - -void json_spirit::write_formatted( const Value& value, std::ostream& os ) -{ - write_stream( value, os, true ); -} - -std::string json_spirit::write( const Value& value ) -{ - return write_string( value, false ); -} - -std::string json_spirit::write_formatted( const Value& value ) -{ - return write_string( value, true ); -} - -#ifndef BOOST_NO_STD_WSTRING - -void json_spirit::write( const wValue& value, std::wostream& os ) -{ - write_stream( value, os, false ); -} - -void json_spirit::write_formatted( const wValue& value, std::wostream& os ) -{ - write_stream( value, os, true ); -} - -std::wstring json_spirit::write( const wValue& value ) -{ - return write_string( value, false ); -} - -std::wstring json_spirit::write_formatted( const wValue& value ) -{ - return write_string( value, true ); -} - -#endif - -void json_spirit::write( const mValue& value, std::ostream& os ) -{ - write_stream( value, os, false ); -} - -void json_spirit::write_formatted( const mValue& value, std::ostream& os ) -{ - write_stream( value, os, true ); -} - -std::string json_spirit::write( const mValue& value ) -{ - return write_string( value, false ); -} - -std::string json_spirit::write_formatted( const mValue& value ) -{ - return write_string( value, true ); -} - -#ifndef BOOST_NO_STD_WSTRING - -void json_spirit::write( const wmValue& value, std::wostream& os ) -{ - write_stream( value, os, false ); -} - -void json_spirit::write_formatted( const wmValue& value, std::wostream& os ) -{ - write_stream( value, os, true ); -} - -std::wstring json_spirit::write( const wmValue& value ) -{ - return write_string( value, false ); -} - -std::wstring json_spirit::write_formatted( const wmValue& value ) -{ - return write_string( value, true ); -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.h deleted file mode 100644 index 1b67b512..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef JSON_SPIRIT_WRITER -#define JSON_SPIRIT_WRITER - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include "json_spirit_value.h" -#include - -namespace json_spirit -{ - // functions to convert JSON Values to text, - // the "formatted" versions add whitespace to format the output nicely - - void write ( const Value& value, std::ostream& os ); - void write_formatted( const Value& value, std::ostream& os ); - std::string write ( const Value& value ); - std::string write_formatted( const Value& value ); - -#ifndef BOOST_NO_STD_WSTRING - - void write ( const wValue& value, std::wostream& os ); - void write_formatted( const wValue& value, std::wostream& os ); - std::wstring write ( const wValue& value ); - std::wstring write_formatted( const wValue& value ); - -#endif - - void write ( const mValue& value, std::ostream& os ); - void write_formatted( const mValue& value, std::ostream& os ); - std::string write ( const mValue& value ); - std::string write_formatted( const mValue& value ); - -#ifndef BOOST_NO_STD_WSTRING - - void write ( const wmValue& value, std::wostream& os ); - void write_formatted( const wmValue& value, std::wostream& os ); - std::wstring write ( const wmValue& value ); - std::wstring write_formatted( const wmValue& value ); - -#endif -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer_template.h b/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer_template.h deleted file mode 100644 index 87b528b9..00000000 --- a/internal/wrappers/features/step_defs_cpp/3rdparty/json_spirit/json_spirit_writer_template.h +++ /dev/null @@ -1,246 +0,0 @@ -#ifndef JSON_SPIRIT_WRITER_TEMPLATE -#define JSON_SPIRIT_WRITER_TEMPLATE - -// Copyright John W. Wilkinson 2007 - 2009. -// Distributed under the MIT License, see accompanying file LICENSE.txt - -// json spirit version 4.03 - -#include "json_spirit_value.h" - -#include -#include -#include -#include - -namespace json_spirit -{ - inline char to_hex_char( unsigned int c ) - { - assert( c <= 0xF ); - - const char ch = static_cast< char >( c ); - - if( ch < 10 ) return '0' + ch; - - return 'A' - 10 + ch; - } - - template< class String_type > - String_type non_printable_to_string( unsigned int c ) - { - typedef typename String_type::value_type Char_type; - - String_type result( 6, '\\' ); - - result[1] = 'u'; - - result[ 5 ] = to_hex_char( c & 0x000F ); c >>= 4; - result[ 4 ] = to_hex_char( c & 0x000F ); c >>= 4; - result[ 3 ] = to_hex_char( c & 0x000F ); c >>= 4; - result[ 2 ] = to_hex_char( c & 0x000F ); - - return result; - } - - template< typename Char_type, class String_type > - bool add_esc_char( Char_type c, String_type& s ) - { - switch( c ) - { - case '"': s += to_str< String_type >( "\\\"" ); return true; - case '\\': s += to_str< String_type >( "\\\\" ); return true; - case '\b': s += to_str< String_type >( "\\b" ); return true; - case '\f': s += to_str< String_type >( "\\f" ); return true; - case '\n': s += to_str< String_type >( "\\n" ); return true; - case '\r': s += to_str< String_type >( "\\r" ); return true; - case '\t': s += to_str< String_type >( "\\t" ); return true; - } - - return false; - } - - template< class String_type > - String_type add_esc_chars( const String_type& s ) - { - typedef typename String_type::const_iterator Iter_type; - typedef typename String_type::value_type Char_type; - - String_type result; - - const Iter_type end( s.end() ); - - for( Iter_type i = s.begin(); i != end; ++i ) - { - const Char_type c( *i ); - - if( add_esc_char( c, result ) ) continue; - - const wint_t unsigned_c( ( c >= 0 ) ? c : 256 + c ); - - if( std::iswprint( unsigned_c ) ) - { - result += c; - } - else - { - result += non_printable_to_string< String_type >( unsigned_c ); - } - } - - return result; - } - - // this class generates the JSON text, - // it keeps track of the indentation level etc. - // - template< class Value_type, class Ostream_type > - class Generator - { - typedef typename Value_type::Config_type Config_type; - typedef typename Config_type::String_type String_type; - typedef typename Config_type::Object_type Object_type; - typedef typename Config_type::Array_type Array_type; - typedef typename String_type::value_type Char_type; - typedef typename Object_type::value_type Obj_member_type; - - public: - - Generator( const Value_type& value, Ostream_type& os, bool pretty ) - : os_( os ) - , indentation_level_( 0 ) - , pretty_( pretty ) - { - output( value ); - } - - private: - - void output( const Value_type& value ) - { - switch( value.type() ) - { - case obj_type: output( value.get_obj() ); break; - case array_type: output( value.get_array() ); break; - case str_type: output( value.get_str() ); break; - case bool_type: output( value.get_bool() ); break; - case int_type: output_int( value ); break; - case real_type: os_ << std::showpoint << std::setprecision( 16 ) - << value.get_real(); break; - case null_type: os_ << "null"; break; - default: assert( false ); - } - } - - void output( const Object_type& obj ) - { - output_array_or_obj( obj, '{', '}' ); - } - - void output( const Array_type& arr ) - { - output_array_or_obj( arr, '[', ']' ); - } - - void output( const Obj_member_type& member ) - { - output( Config_type::get_name( member ) ); space(); - os_ << ':'; space(); - output( Config_type::get_value( member ) ); - } - - void output_int( const Value_type& value ) - { - if( value.is_uint64() ) - { - os_ << value.get_uint64(); - } - else - { - os_ << value.get_int64(); - } - } - - void output( const String_type& s ) - { - os_ << '"' << add_esc_chars( s ) << '"'; - } - - void output( bool b ) - { - os_ << to_str< String_type >( b ? "true" : "false" ); - } - - template< class T > - void output_array_or_obj( const T& t, Char_type start_char, Char_type end_char ) - { - os_ << start_char; new_line(); - - ++indentation_level_; - - for( typename T::const_iterator i = t.begin(); i != t.end(); ++i ) - { - indent(); output( *i ); - - typename T::const_iterator next = i; - - if( ++next != t.end()) - { - os_ << ','; - } - - new_line(); - } - - --indentation_level_; - - indent(); os_ << end_char; - } - - void indent() - { - if( !pretty_ ) return; - - for( int i = 0; i < indentation_level_; ++i ) - { - os_ << " "; - } - } - - void space() - { - if( pretty_ ) os_ << ' '; - } - - void new_line() - { - if( pretty_ ) os_ << '\n'; - } - - Generator& operator=( const Generator& ); // to prevent "assignment operator could not be generated" warning - - Ostream_type& os_; - int indentation_level_; - bool pretty_; - }; - - template< class Value_type, class Ostream_type > - void write_stream( const Value_type& value, Ostream_type& os, bool pretty ) - { - Generator< Value_type, Ostream_type >( value, os, pretty ); - } - - template< class Value_type > - typename Value_type::String_type write_string( const Value_type& value, bool pretty ) - { - typedef typename Value_type::String_type::value_type Char_type; - - std::basic_ostringstream< Char_type > os; - - write_stream( value, os, pretty ); - - return os.str(); - } -} - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt b/internal/wrappers/features/step_defs_cpp/CMakeLists.txt deleted file mode 100644 index 46bd2f6c..00000000 --- a/internal/wrappers/features/step_defs_cpp/CMakeLists.txt +++ /dev/null @@ -1,118 +0,0 @@ -cmake_minimum_required(VERSION 3.0.0) -project(KuzzleSKDTests) - -include(ExternalProject) - -# -# Cucumber CPP -# - -ExternalProject_Add( - project_cucumber_cpp - GIT_REPOSITORY https://github.com/cucumber/cucumber-cpp - INSTALL_COMMAND "" - - CMAKE_CACHE_ARGS - -DCUKE_DISABLE_QT:BOOL=ON - -DCUKE_ENABLE_EXAMPLES:BOOL=OFF - -DCUKE_DISABLE_GTEST:BOOL=ON - -DCUKE_DISABLE_UNIT_TESTS:BOOL=ON - -DCUKE_DISABLE_E2E_TESTS:BOOL=ON -) - -# Library -ExternalProject_Get_Property(project_cucumber_cpp binary_dir) -set(CUCUMBER_CPP_LIBRARY_PATH ${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src/libcucumber-cpp.a) -list( APPEND CUCUMBER_CPP_INCLUDE_PATH "${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src") -set(CUCUMBER_CPP_LIBRARY cucumber-cpp) - - -ExternalProject_Get_property(project_cucumber_cpp SOURCE_DIR) -list(APPEND CUCUMBER_CPP_INCLUDE_PATH "${SOURCE_DIR}/include") - -message("cucumber-cpp: include path = ${CUCUMBER_CPP_INCLUDE_PATH}") -message("cucumber-cpp: library parh = ${CUCUMBER_CPP_LIBRARY_PATH}") - -# Workaround to avoid CMake to discard include path that doesn't exist yet -file(MAKE_DIRECTORY ${binary_dir}/${CMAKE_FIND_SOURCE_PREFIXES}/src) -file(MAKE_DIRECTORY ${SOURCE_DIR}/include) - -add_library(cucumber-cpp STATIC IMPORTED) # or STATIC instead of SHARED -add_dependencies(cucumber-cpp project_cucumber_cpp) -set_target_properties(cucumber-cpp PROPERTIES - IMPORTED_LOCATION ${CUCUMBER_CPP_LIBRARY_PATH} - INTERFACE_INCLUDE_DIRECTORIES - "${CUCUMBER_CPP_INCLUDE_PATH}" - DEPENDS project_cucumber_cpp -) - -# -# JSon Spirit -# - -add_subdirectory(3rdparty/json_spirit) - -# -# Kuzzle SDK -# - -get_filename_component(KUZZLE_SDK_ROOT "${CMAKE_SOURCE_DIR}/../../" ABSOLUTE) -message("Kuzzle SDK root: ${KUZZLE_SDK_ROOT}") - -# -# Boost -# -set(BOOST_MIN_VERSION "1.46") - -set(Boost_USE_STATIC_RUNTIME OFF) -set(CUKE_CORE_BOOST_LIBS thread system regex date_time program_options filesystem) -if(NOT CUKE_DISABLE_BOOST_TEST) - # "An external test runner utility is required to link with dynamic library" (Boost User's Guide) - set(Boost_USE_STATIC_LIBS OFF) - set(CMAKE_CXX_FLAGS "-DBOOST_TEST_DYN_LINK ${CMAKE_CXX_FLAGS}") - find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS unit_test_framework) -endif() - -if(CUKE_USE_STATIC_BOOST) - set(Boost_USE_STATIC_LIBS ON) - find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS ${CUKE_CORE_BOOST_LIBS} REQUIRED) - - if(NOT MSVC) - find_package(Threads) - set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) - endif() -else() - set(CMAKE_CXX_FLAGS "-DBOOST_ALL_DYN_LINK ${CMAKE_CXX_FLAGS}") - set(Boost_USE_STATIC_LIBS OFF) - find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS ${CUKE_CORE_BOOST_LIBS} REQUIRED) -endif() - -include_directories(${Boost_INCLUDE_DIRS}) -set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) - - -if(Boost_UNIT_TEST_FRAMEWORK_FOUND) - set (CMAKE_CXX_STANDARD 11) - - FILE(GLOB SRCFILES *.cpp) - add_executable(KuzzleSDKStepDefs ${SRCFILES}) - add_dependencies(KuzzleSDKStepDefs project_cucumber_cpp) - - - add_library(kuzzlesdk SHARED IMPORTED) # or STATIC instead of SHARED - set_target_properties(kuzzlesdk PROPERTIES - IMPORTED_LOCATION "${KUZZLE_SDK_ROOT}/build/c/libkuzzlesdk.a" - INTERFACE_INCLUDE_DIRECTORIES "${KUZZLE_SDK_ROOT}/build/c" - ) - - add_library(cpp SHARED IMPORTED) # or STATIC instead of SHARED - set_target_properties(cpp PROPERTIES - IMPORTED_LOCATION "${KUZZLE_SDK_ROOT}/build/cpp/libcpp.a" - INTERFACE_INCLUDE_DIRECTORIES "${KUZZLE_SDK_ROOT}/headers" - ) - - target_link_libraries(KuzzleSDKStepDefs cpp kuzzlesdk pthread cucumber-cpp json_spirit ${CUKE_EXTRA_LIBRARIES} ${CUKE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ) -else() - message(FATAL_ERROR) -endif() - diff --git a/internal/wrappers/features/step_defs_cpp/collection-steps.cpp b/internal/wrappers/features/step_defs_cpp/collection-steps.cpp deleted file mode 100644 index 0c750c51..00000000 --- a/internal/wrappers/features/step_defs_cpp/collection-steps.cpp +++ /dev/null @@ -1,217 +0,0 @@ -#include "steps.hpp" - -// Anonymous namespace to handle a linker error -// see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files -namespace { - WHEN("^I create a collection \'([^\"]*)\'$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - try { - ctx->kuzzle->collection->create(ctx->index, collection_id); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^the collection \'([^\"]*)\' should exist$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - BOOST_CHECK(ctx->kuzzle->collection->exists(ctx->index, collection_id) == true); - } - - WHEN("^I check if the collection \'([^\"]*)\' exists$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - ctx->success = ctx->kuzzle->collection->exists(ctx->index, collection_id) ? 1 : 0; - } - - THEN("^the collection should exist$") - { - ScenarioScope ctx; - - BOOST_CHECK(ctx->success == 1); - } - - GIVEN("^it has a collection \'([^\"]*)\'$") - { - REGEX_PARAM(string, collection_name); - - ScenarioScope ctx; - ctx->collection = collection_name; - - K_LOG_D("Creating collection: %s", collection_name.c_str()); - try { - ctx->kuzzle->collection->create(ctx->index, ctx->collection); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I list the collections of \'([^\"]*)\'$") - { - REGEX_PARAM(string, index_name); - - ScenarioScope ctx; - - ctx->content = ctx->kuzzle->collection->list(index_name); - - json_spirit::Value collectionsList; - json_spirit::read(ctx->content, collectionsList); - json_spirit::Value field_value = json_spirit::find_value(collectionsList.get_obj(), "collections"); - - ctx->hits = field_value.get_array().size(); - } - - GIVEN("^the collection has a document with id \'([^\"]*)\'$") - { - REGEX_PARAM(string, document_id); - - ScenarioScope ctx; - - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}", &options); - } - - WHEN("^I truncate the collection \'([^\"]*)\'$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - ctx->kuzzle->collection->truncate(ctx->index, collection_id, &options); - } - - THEN("^the collection \'([^\"]*)\' should be empty$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - search_result *result = ctx->kuzzle->document->search(ctx->index, collection_id, "{}"); - - BOOST_CHECK(result->total == 0); - - kuzzle_free_search_result(result); - } - - WHEN("^I update the mapping of collection \'([^\"]*)\'$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - string mapping = "{\"properties\": {\"gordon\": {\"type\": \"keyword\"}}}"; - - ctx->kuzzle->collection->updateMapping(ctx->index, collection_id, mapping); - } - - THEN("^the mapping of \'([^\"]*)\' should be updated$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - string mapping = ctx->kuzzle->collection->getMapping(ctx->index, collection_id); - - BOOST_CHECK(mapping.find("\"gordon\":{\"type\":\"keyword\"}") != string::npos); - } - - WHEN("^I update the specifications of the collection \'([^\"]*)\'$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - string specifications = "{\"" + ctx->index + "\":{\""+ collection_id +"\":{\"strict\":false}}}"; - - ctx->kuzzle->collection->updateSpecifications(ctx->index, collection_id, specifications); - } - - THEN("^the specifications of \'([^\"]*)\' should be updated$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - string specifications = ctx->kuzzle->collection->getSpecifications(ctx->index, collection_id); - string expected_specifications = "{\"validation\":{\"strict\":false},\"index\":\"" + ctx->index + "\",\"collection\":\"" + collection_id + "\"}"; - - BOOST_CHECK(specifications == expected_specifications); - - ctx->kuzzle->collection->updateSpecifications(ctx->index, collection_id, "{\"" + ctx->index + "\":{\""+ collection_id +"\":{\"strict\":true}}}"); - } - - WHEN("^I validate the specifications of \'([^\"]*)\'$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - string specifications = "{\"" + ctx->index + "\":{\"" + collection_id + "\":{\"strict\":true}}}"; - - ctx->success = ctx->kuzzle->collection->validateSpecifications(specifications) ? 1 : 0; - } - - THEN("^they should be validated$") - { - ScenarioScope ctx; - - BOOST_CHECK(ctx->success == 1); - } - - GIVEN("^has specifications$") - { - ScenarioScope ctx; - - string specifications = "{\"" + ctx->index + "\":{\""+ ctx->collection +"\":{\"strict\":true}}}"; - - ctx->kuzzle->collection->updateSpecifications(ctx->index, ctx->collection, specifications); - } - - WHEN("^I delete the specifications of \'([^\"]*)\'$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - ctx->kuzzle->collection->deleteSpecifications(ctx->index, collection_id); - } - - THEN("^the specifications of \'([^\"]*)\' must not exist$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - - BOOST_CHECK(ctx->kuzzle->collection->getSpecifications(ctx->index, collection_id) == ""); - } - - WHEN("^I create a collection \'([^\"]*)\' with a mapping$") - { - REGEX_PARAM(string, collection_id); - - ScenarioScope ctx; - string mapping = "{\"properties\": {\"gordon\": {\"type\": \"keyword\"}}}"; - - try { - ctx->kuzzle->collection->create(ctx->index, collection_id, &mapping); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } -} diff --git a/internal/wrappers/features/step_defs_cpp/document-steps.cpp b/internal/wrappers/features/step_defs_cpp/document-steps.cpp deleted file mode 100644 index d4a19f46..00000000 --- a/internal/wrappers/features/step_defs_cpp/document-steps.cpp +++ /dev/null @@ -1,389 +0,0 @@ -#include "steps.hpp" - -// Anonymous namespace to handle a linker error -// see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files -namespace { - WHEN("^I create a document with id \'([^\"]*)\'$") { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - ctx->kuzzle->document->create(ctx->index, ctx->collection, document_id, "{\"a\":\"document\"}", &options); - ctx->success = 1; - } catch (KuzzleException e) { - ctx->success = 0; - ctx->error_message = e.getMessage(); - } - } - - THEN("^I get an error with message \'([^\"]*)\'$") { - REGEX_PARAM(std::string, error_message); - - ScenarioScope ctx; - - BOOST_CHECK(ctx->success == 0); - BOOST_CHECK(ctx->error_message == error_message); - } - - THEN("^the document is successfully created$") - { - ScenarioScope ctx; - - BOOST_CHECK(ctx->success == 1); - } - - GIVEN("^the collection doesn't have a document with id \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - ctx->kuzzle->document->delete_(ctx->index, ctx->collection, document_id, &options); - } catch (KuzzleException e) { - ctx->error_message = e.getMessage(); - ctx->success = 0; - } - } - - WHEN("^I createOrReplace a document with id \'([^\"]*)\'$") { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - ctx->kuzzle->document->createOrReplace(ctx->index, ctx->collection, document_id, "{\"a\":\"replaced document\"}", &options); - ctx->document_id = document_id; - ctx->success = 1; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^the document is successfully replaced$") - { - ScenarioScope ctx; - - string document = ctx->kuzzle->document->get(ctx->index, ctx->collection, ctx->document_id); - - BOOST_CHECK(ctx->success == 1); - BOOST_CHECK(document.find("replaced document") != std::string::npos); - } - - WHEN("^I replace a document with id \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - ctx->kuzzle->document->replace(ctx->index, ctx->collection, document_id, "{\"a\":\"replaced document\"}", &options); - ctx->document_id = document_id; - ctx->success = 1; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^the document is successfully deleted$") - { - ScenarioScope ctx; - - BOOST_CHECK(ctx->success == 1); - } - - WHEN("^I update a document with id \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - ctx->kuzzle->document->update(ctx->index, ctx->collection, document_id, "{\"a\":\"updated document\"}", &options); - ctx->document_id = document_id; - ctx->success = 1; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^the document is successfully updated$") - { - ScenarioScope ctx; - - string document = ctx->kuzzle->document->get(ctx->index, ctx->collection, ctx->document_id); - - BOOST_CHECK(ctx->success == 1); - BOOST_CHECK(document.find("updated document") != std::string::npos); - } - - WHEN("^I search a document with id \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - try { - ctx->documents = ctx->kuzzle->document->search(ctx->index, ctx->collection, "{\"query\": {\"bool\": {\"should\":[{\"match\":{\"_id\": \"" + document_id + "\"}}]}}}"); - ctx->success = 1; - } catch (KuzzleException e) { - kuzzle_free_search_result(ctx->documents); - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^the document is (successfully|not) found$") - { - REGEX_PARAM(std::string, search_status); - - ScenarioScope ctx; - - BOOST_CHECK(ctx->success == 1); - - if (search_status == "successfully") - BOOST_CHECK(ctx->documents->total == 1); - else - BOOST_CHECK(ctx->documents->total == 0); - - kuzzle_free_search_result(ctx->documents); - } - - WHEN("^I count how many documents there is in the collection$") - { - ScenarioScope ctx; - - try { - ctx->hits = ctx->kuzzle->document->count(ctx->index, ctx->collection, "{}"); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I delete the documents \\[\'(.*)\', \'(.*)\'\\]$") - { - REGEX_PARAM(std::string, document1_id); - REGEX_PARAM(std::string, document2_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - std::vector document_ids; - document_ids.push_back(document1_id); - document_ids.push_back(document2_id); - - ctx->kuzzle->document->mDelete(ctx->index, ctx->collection, document_ids, &options); - ctx->success = 1; - ctx->partial_exception = 0; - } catch (PartialException e) { - ctx->partial_exception = 1; - ctx->success = 0; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^I must have (\\d+) documents in the collection$") - { - REGEX_PARAM(unsigned int, documents_count); - - ScenarioScope ctx; - - try { - BOOST_CHECK(ctx->kuzzle->document->count(ctx->index, ctx->collection, "{}") == documents_count); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I create the documents \\[\'(.*)\', \'(.*)\'\\]$") - { - REGEX_PARAM(std::string, document1_id); - REGEX_PARAM(std::string, document2_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - string documents = "{\"documents\":[{\"_id\":\"" + document1_id + "\", \"body\":{}}, {\"_id\":\"" + document2_id + "\", \"body\":{}}]}"; - ctx->kuzzle->document->mCreate(ctx->index, ctx->collection, documents, &options); - ctx->success = 1; - ctx->partial_exception = 0; - } catch (PartialException e) { - ctx->partial_exception = 1; - ctx->success = 0; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I replace the documents \\[\'(.*)\', \'(.*)\'\\]$") - { - REGEX_PARAM(std::string, document1_id); - REGEX_PARAM(std::string, document2_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - string documents = "{\"documents\":[{\"_id\":\"" + document1_id + "\", \"body\":{\"a\":\"replaced document\"}}, {\"_id\":\"" + document2_id + "\", \"body\":{\"a\":\"replaced document\"}}]}"; - ctx->kuzzle->document->mReplace(ctx->index, ctx->collection, documents, &options); - ctx->success = 1; - ctx->partial_exception = 0; - } catch (PartialException e) { - ctx->partial_exception = 1; - ctx->success = 0; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^the document \'([^\"]*)\' should be replaced$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - string document = ctx->kuzzle->document->get(ctx->index, ctx->collection, document_id); - - BOOST_CHECK(document.find("replaced document") != std::string::npos); - } - - WHEN("^I update the documents \\[\'(.*)\', \'(.*)\'\\]$") - { - REGEX_PARAM(std::string, document1_id); - REGEX_PARAM(std::string, document2_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - string documents = "{\"documents\":[{\"_id\":\"" + document1_id + "\", \"body\":{\"a\":\"replaced document\"}}, {\"_id\":\"" + document2_id + "\", \"body\":{\"a\":\"replaced document\"}}]}"; - ctx->kuzzle->document->mUpdate(ctx->index, ctx->collection, documents, &options); - ctx->success = 1; - ctx->partial_exception = 0; - } catch (PartialException e) { - ctx->partial_exception = 1; - ctx->success = 0; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^the document \'([^\"]*)\' should be updated$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - string document = ctx->kuzzle->document->get(ctx->index, ctx->collection, document_id); - - BOOST_CHECK(document.find("replaced document") != std::string::npos); - } - - WHEN("^I createOrReplace the documents \\[\'(.*)\', \'(.*)\'\\]$") - { - REGEX_PARAM(std::string, document1_id); - REGEX_PARAM(std::string, document2_id); - - ScenarioScope ctx; - - try { - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - string documents = "{\"documents\":[{\"_id\":\"" + document1_id + "\", \"body\":{\"a\":\"replaced document\"}}, {\"_id\":\"" + document2_id + "\", \"body\":{\"a\":\"replaced document\"}}]}"; - ctx->kuzzle->document->mCreateOrReplace(ctx->index, ctx->collection, documents, &options); - ctx->success = 1; - ctx->partial_exception = 0; - } catch (PartialException e) { - ctx->partial_exception = 1; - ctx->success = 0; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^the document \'([^\"]*)\' should be created$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - string document = ctx->kuzzle->document->get(ctx->index, ctx->collection, document_id); - - BOOST_CHECK(document.find("replaced document") != std::string::npos); - } - - WHEN("^I check if \'([^\"]*)\' exists$") - { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - ctx->success = ctx->kuzzle->document->exists(ctx->index, ctx->collection, document_id) ? 1 : 0; - } - - THEN("^the document should (not )?exist(s)?$") - { - REGEX_PARAM(std::string, existence); - - ScenarioScope ctx; - - if (existence == "not ") - BOOST_CHECK(ctx->success == 0); - else - BOOST_CHECK(ctx->success == 1); - } - - WHEN("^I get documents \\[\'(.*)\', \'(.*)\'\\]$") - { - REGEX_PARAM(std::string, document1_id); - REGEX_PARAM(std::string, document2_id); - - ScenarioScope ctx; - - try { - std::vector document_ids; - document_ids.push_back(document1_id); - document_ids.push_back(document2_id); - - ctx->content = ctx->kuzzle->document->mGet(ctx->index, ctx->collection, document_ids, false); - ctx->success = 1; - } catch (KuzzleException e) { - ctx->success = 0; - } - } - - THEN("^the documents should be retrieved$") - { - ScenarioScope ctx; - - BOOST_CHECK(ctx->success == 1); - BOOST_CHECK(ctx->content != ""); - } -} diff --git a/internal/wrappers/features/step_defs_cpp/index-steps.cpp b/internal/wrappers/features/step_defs_cpp/index-steps.cpp deleted file mode 100644 index e75a03f1..00000000 --- a/internal/wrappers/features/step_defs_cpp/index-steps.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include "steps.hpp" - -// Anonymous namespace to handle a linker error -// see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files -namespace { - - GIVEN("^there is no index called \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, index_name); - ScenarioScope ctx; - - try { - ctx->kuzzle->index->delete_(index_name); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } - } - - GIVEN("^there is an index \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, index_name); - ScenarioScope ctx; - ctx->index = index_name; - - if (!ctx->kuzzle->index->exists(index_name)) { - K_LOG_D("Creating index: %s", index_name.c_str()); - try { - ctx->kuzzle->index->create(index_name); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } - } else { - K_LOG_D("Using existing index: %s", index_name.c_str()); - } - } - - GIVEN("^there is the indexes \'([^\"]*)\' and \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, index_name1); - REGEX_PARAM(std::string, index_name2); - ScenarioScope ctx; - - if (! ctx->kuzzle->index->exists(index_name1)) { - try { - ctx->kuzzle->index->create(index_name1); - } catch(KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } - } else { - K_LOG_D("Using existing index: %s", index_name1.c_str()); - } - - if (! ctx->kuzzle->index->exists(index_name2)) { - try { - ctx->kuzzle->index->create(index_name2); - } catch(KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } - } else { - K_LOG_D("Using existing index: %s", index_name2.c_str()); - } - } - - WHEN("^I delete the indexes \'([^\"]*)\' and \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, index_name1); - REGEX_PARAM(std::string, index_name2); - ScenarioScope ctx; - - std::vector v; - - v.push_back(index_name1); - v.push_back(index_name2); - - try { - ctx->kuzzle->index->mDelete(v); - } catch(KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I create an index called \'([^\"]*)\'$") - { - - REGEX_PARAM(std::string, index_name); - ScenarioScope ctx; - - K_LOG_D("Creating index: %s", index_name.c_str()); - try { - ctx->kuzzle->index->create(index_name); - ctx->index = index_name; - } catch (KuzzleException e) { - ctx->success = false; - K_LOG_E(e.getMessage().c_str()); - } - } - - THEN("^the index should exist$") - { - ScenarioScope ctx; - BOOST_CHECK(ctx->kuzzle->index->exists(ctx->index)); - } - - THEN("^indexes \'([^\"]*)\' and \'([^\"]*)\' don't exist$") - { - REGEX_PARAM(std::string, index_name1); - REGEX_PARAM(std::string, index_name2); - ScenarioScope ctx; - - BOOST_CHECK( - !ctx->kuzzle->index->exists(index_name1) && - !ctx->kuzzle->index->exists(index_name2) - ); - } - - WHEN("^I list indexes$") - { - ScenarioScope ctx; - - ctx->string_array = ctx->kuzzle->index->list(); - } - - THEN("^I get \'([^\"]*)\' and \'([^\"]*)\'$") - { - REGEX_PARAM(std::string, index_name1); - REGEX_PARAM(std::string, index_name2); - - ScenarioScope ctx; - - BOOST_CHECK(std::find(ctx->string_array.begin(), ctx->string_array.end(), index_name1) != ctx->string_array.end()); - BOOST_CHECK(std::find(ctx->string_array.begin(), ctx->string_array.end(), index_name2) != ctx->string_array.end()); - } - -} diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp deleted file mode 100644 index 50b3998e..00000000 --- a/internal/wrappers/features/step_defs_cpp/kuzzle-sdk-steps.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include "steps.hpp" - -// Anonymous namespace to handle a linker error -// see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files -namespace { - BEFORE() { kuz_log_sep(); } - - GIVEN("^I create a user 'useradmin' with password 'testpwd' with id 'useradmin-id'$") { pending(); } - - GIVEN("^I update my user custom data with the pair ([\\w]+):(.+)$") - { - REGEX_PARAM(std::string, fieldname); - REGEX_PARAM(std::string, fieldvalue); - - ScenarioScope ctx; - - string data = "{\"" + fieldname + "\":" + fieldvalue + "}"; - - K_LOG_D("Updating user data with : %s", data.c_str()); - - try { - ctx->kuzzle->auth->updateSelf(data); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - } - } - - THEN("^the response 'content' field contains the pair c:(.+)$") - { - K_LOG_I("Checking user content field"); - REGEX_PARAM(std::string, fieldname); - REGEX_PARAM(std::string, expected_fieldvalue); - - ScenarioScope ctx; - - json_spirit::Value userContentValue; - std::string userContent = ctx->currentUser->content; - json_spirit::read(userContent, userContentValue); - - json_spirit::write_formatted(userContentValue); - - json_spirit::Value fieldvalue = json_spirit::find_value(userContentValue.get_obj(), fieldname); - switch (fieldvalue.type()) { - case json_spirit::str_type: { - std::string s = fieldvalue.get_str(); - K_LOG_D("Field value: \"%s\" of type string", s.c_str()); - BOOST_CHECK("\"" + s + "\"" == expected_fieldvalue); - break; - } - case json_spirit::bool_type: { - auto b = fieldvalue.get_bool(); - string s = b ? "true" : "false"; - K_LOG_D("Field value: \"%s\" of type bool", b ? "true" : "false"); - BOOST_CHECK(s == expected_fieldvalue); - break; - } - case json_spirit::int_type: { - auto i = fieldvalue.get_int(); - K_LOG_D("Field value: %d of type int", i); - string s = std::to_string(i); - BOOST_CHECK(s == expected_fieldvalue); - break; - } - case json_spirit::real_type: { - float f = fieldvalue.get_real(); - K_LOG_D("Field value: %f of type real", f); - float e = std::stof(expected_fieldvalue); - K_LOG_D("Expected value: %f", e); - BOOST_CHECK(f == std::stof(expected_fieldvalue)); - break; - } - // TODO: Add obj test case... - } - - ctx->customUserDataType = fieldvalue.type(); - } - - THEN("^is a string$") - { - ScenarioScope ctx; - BOOST_CHECK(ctx->customUserDataType == json_spirit::str_type); - } - - THEN("^is a number$") - { - ScenarioScope ctx; - BOOST_CHECK(ctx->customUserDataType == json_spirit::int_type || ctx->customUserDataType == json_spirit::real_type); - } - - THEN("^is a bool$") - { - ScenarioScope ctx; - BOOST_CHECK(ctx->customUserDataType == json_spirit::bool_type); - } - - GIVEN("^Kuzzle Server is running$") - { - K_LOG_I("Connecting to Kuzzle on 'localhost:7512'"); - ScenarioScope ctx; - ctx->kuzzle_options = KUZZLE_OPTIONS_DEFAULT; - std::string hostname = "localhost"; - - if (std::getenv("KUZZLE_HOST") != NULL) { - hostname = std::getenv("KUZZLE_HOST"); - } - - try { - ctx->kuzzle = new Kuzzle(hostname, &ctx->kuzzle_options); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - } - char* error = ctx->kuzzle->connect(); - BOOST_CHECK(error == NULL); - } - - THEN("^I get an error$") - { - ScenarioScope ctx; - - BOOST_CHECK(ctx->success == 0); - } - - GIVEN("^there is an user with id '([\\w\\-]+)'$") - { - REGEX_PARAM(std::string, user_id); - ScenarioScope ctx; - ctx->user_id = user_id; - } - - GIVEN("^the user has 'local' credentials with name '([\\w\\-]+)' and password " - "'([\\w\\-]+)'$") - { - REGEX_PARAM(std::string, username); - REGEX_PARAM(std::string, password); - ScenarioScope ctx; - - kuzzle_user_create(ctx->kuzzle, ctx->user_id, username, password); - } - - WHEN("^I log in as '([\\w\\-]+)':'([\\w\\-]+)'$") - { - REGEX_PARAM(std::string, username); - REGEX_PARAM(std::string, password); - ScenarioScope ctx; - - string jwt; - try { - jwt = ctx->kuzzle->auth->login("local", get_login_creds(username, password)); - K_LOG_D("Logged in as '%s'", username.c_str()); - K_LOG_D("JWT is: %s", jwt.c_str()); - } catch (KuzzleException e) { - K_LOG_W(e.getMessage().c_str()); - } - ctx->jwt = jwt; - } - - THEN("^the retrieved JWT is valid$") - { - ScenarioScope ctx; - token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); - BOOST_CHECK(v->valid); - } - - THEN("^the retrieved JWT is invalid$") - { - ScenarioScope ctx; - token_validity* v = ctx->kuzzle->auth->checkToken(ctx->jwt); - BOOST_CHECK(!v->valid); - } - WHEN("^I logout$") { - ScenarioScope ctx; - ctx->kuzzle->auth->logout(); - } - - WHEN("^I get my user info$") - { - ScenarioScope ctx; - - try { - ctx->currentUser = ctx->kuzzle->auth->getCurrentUser(); - } catch (KuzzleException e) { - K_LOG_E(e.getMessage().c_str()); - } - - K_LOG_D("current user = 0x%p", ctx->currentUser); - K_LOG_D("Current user content: %s", ctx->currentUser->content); - - BOOST_CHECK_MESSAGE(ctx->currentUser != NULL, "Failed to retrieve current user"); - } - - THEN("^(the result contains|I shall receive) (\\d+)( hits)?$") - { - REGEX_PARAM(string, unused); - REGEX_PARAM(unsigned int, hits); - - ScenarioScope ctx; - - BOOST_CHECK(hits == ctx->hits); - } - - THEN("^the content should not be null$") - { - ScenarioScope ctx; - - BOOST_CHECK(ctx->content != ""); - } - - THEN("^I (should have|get) (a|no) partial error$") { - REGEX_PARAM(string, unused); - REGEX_PARAM(string, error_presence); - - ScenarioScope ctx; - - if (error_presence == "no") - BOOST_CHECK(ctx->partial_exception == 0); - else - BOOST_CHECK(ctx->partial_exception == 1); - } -} diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp deleted file mode 100644 index 9f87aa26..00000000 --- a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.cpp +++ /dev/null @@ -1,240 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "kuzzle_utils.h" - -using boost::property_tree::ptree; -using boost::property_tree::read_json; -using boost::property_tree::write_json; - -using kuzzleio::Kuzzle; -using kuzzleio::KuzzleException; -using std::cout; -using std::endl; -using std::string; - -using json_spirit::Array; -using json_spirit::Object; -using json_spirit::Pair; -using json_spirit::Value; - -std::string get_login_creds(const std::string &username, - const std::string &password) -{ - // Write json. - ptree pt; - pt.put("username", username); - pt.put("password", password); - std::ostringstream buf; - write_json(buf, pt, false); - return buf.str(); -} - -string get_createUser_body(const std::string &username, - const std::string &password) -{ - // Write json. - - Object body; - Object content; - Object creds; - Object local; - - local.push_back(Pair("username", Value(username))); - local.push_back(Pair("password", Value(password))); - - creds.push_back(Pair("local", Value(local))); - - Array profileIds; - profileIds.push_back("default"); - - content.push_back(json_spirit::Pair("profileIds", Value(profileIds))); - content.push_back(json_spirit::Pair("name", Value(username))); - - body.push_back(Pair("content", Value(content))); - body.push_back(Pair("credentials", Value(creds))); - - std::ostringstream buf; - json_spirit::write_formatted(body, buf); - - return buf.str(); -} - -bool kuzzle_user_exists(Kuzzle *kuzzle, const string &user_id) -{ - bool user_exists = false; - try - { - kuzzle_request req = {0}; - req.controller = "security"; - req.action = "getUser"; - req.id = user_id.c_str(); - kuzzle->query(&req); - user_exists = true; - } - catch (kuzzleio::NotFoundException e) - { - user_exists = false; - } - catch (KuzzleException e) - { - K_LOG_W(e.getMessage().c_str()); - } - return user_exists; -} - -void kuzzle_user_delete(Kuzzle *kuzzle, const string &user_id) -{ - K_LOG_D("Deleting user with ID: '%s'", user_id.c_str()); - try - { - kuzzle_request req = {0}; - req.controller = "security"; - req.action = "deleteUser"; - req.id = user_id.c_str(); - - query_options options = {0}; - options.refresh = const_cast("wait_for"); - options.volatiles = const_cast("{}"); - kuzzle->query( - &req, &options); // TODO: test if we can delete with options - - K_LOG_D("Deleted user \"%s\"", user_id.c_str()); - } - catch (KuzzleException e) - { - K_LOG_E("Failed to delete user \"%s\"", user_id.c_str()); - } -} - -void kuzzle_credentials_delete(Kuzzle *kuzzle, const string &strategy, - const string &user_id) -{ - try - { - kuzzle_request req = {0}; - req.controller = "security"; - req.action = "deleteCredentials"; - req.strategy = "local"; - req.id = user_id.c_str(); - - kuzzle->query(&req); - - K_LOG_D("Deleted '%s' credentials for userId '%s'", strategy.c_str(), - user_id.c_str()); - } - catch (KuzzleException e) - { - K_LOG_E("Failed to delete '%s' credentials for userId '%s'", - strategy.c_str(), user_id.c_str()); - K_LOG_E(e.getMessage().c_str()); - } -} - -void kuzzle_user_create(Kuzzle *kuzzle, const string &user_id, - const string &username, const string &password) -{ - - kuzzle_request req = {0}; - req.controller = "security"; - req.action = "createUser"; - req.strategy = "local"; - req.id = user_id.c_str(); - string body = get_createUser_body(username, password); - req.body = body.c_str(); - - // if (kuzzle_user_exists(kuzzle, user_id.c_str())) - { - K_LOG_W("An user with id: '%s' already exists, deleteting it...", - user_id.c_str()); - kuzzle_credentials_delete(kuzzle, "local", user_id); - kuzzle_user_delete(kuzzle, user_id); - } - - // kuzzle_credentials_delete(kuzzle, "local", user_id); - - K_LOG_D("Creating user with id: '%s' and 'local' creds: %s:%s", - user_id.c_str(), username.c_str(), password.c_str()); - K_LOG_D("Req body: %s", req.body); - try - { - kuzzle_response *resp = kuzzle->query(&req); - K_LOG_D("createUser ended with status: %d", resp->status); - } - catch (KuzzleException e) - { - K_LOG_E("Status (%d): %s", e.status, e.getMessage().c_str()); - if (kuzzle_user_exists(kuzzle, user_id.c_str())) { - K_LOG_W("But user seems to exist anyway?????"); - } - } -} - -void kuz_log_sep() -{ - cout << "\x1b(0\x6c\x1b(B"; - for (int i = 0; i < 79; i++) - { - cout << "\x1b(0\x71\x1b(B"; - } - cout << endl; -} - -void kuz_log_e(const char *filename, int linenumber, const char *fmt...) -{ - va_list args; - va_start(args, fmt); - - cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_RED << "E:"; - cout << basename(filename) << ":" << linenumber << ":"; - vprintf(fmt, args); - std::cout << TXT_COLOR_RESET << std::endl; - - va_end(args); -} - -void kuz_log_w(const char *filename, int linenumber, const char *fmt...) -{ - va_list args; - va_start(args, fmt); - cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_YELLOW << "W:"; - cout << basename(filename) << ":" << linenumber << ":"; - vprintf(fmt, args); - cout << TXT_COLOR_RESET << endl; - - va_end(args); -} - -void kuz_log_d(const char *filename, int linenumber, const char *fmt...) -{ - va_list args; - va_start(args, fmt); - - cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_DEFAULT << "D:"; - cout << basename(filename) << ":" << linenumber << ":"; - vprintf(fmt, args); - cout << TXT_COLOR_RESET << endl; - - va_end(args); -} - -void kuz_log_i(const char *filename, int linenumber, const char *fmt...) -{ - va_list args; - va_start(args, fmt); - - cout << "\x1b(0\x78\x1b(B" << TXT_COLOR_BLUE << "I:"; - cout << basename(filename) << ":" << linenumber << ":"; - vprintf(fmt, args); - cout << TXT_COLOR_RESET << endl; - - va_end(args); -} diff --git a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h b/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h deleted file mode 100644 index d56dc386..00000000 --- a/internal/wrappers/features/step_defs_cpp/kuzzle_utils.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _KUZZLE_UTIL_HPP_ -#define _KUZZLE_UTIL_HPP_ - -#include -#include -#define TXT_COLOR_RESET "\e[0m" - -#define TXT_COLOR_DEFAULT "\e[39m" -#define TXT_COLOR_BLACK "\e[30m" -#define TXT_COLOR_RED "\e[31m" -#define TXT_COLOR_GREEN "\e[32m" -#define TXT_COLOR_YELLOW "\e[33m" -#define TXT_COLOR_BLUE "\e[34m" -#define TXT_COLOR_MAGENTA "\e[35m" -#define TXT_COLOR_CYAN "\e[36m" -#define TXT_COLOR_LIGHTGREY "\e[37m" -#define TXT_COLOR_DARKGREY "\e[90m" - -void kuz_log_sep(); - -void kuz_log_e(const char *filename, int linenumber, const char *fmt...); -void kuz_log_w(const char *filename, int linenumber, const char *fmt...); -void kuz_log_d(const char *filename, int linenumber, const char *fmt...); -void kuz_log_i(const char *filename, int linenumber, const char *fmt...); - -#define K_LOG_D(fmt, ...) \ - do { \ - kuz_log_d(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \ - } while (0) - -#define K_LOG_W(fmt, ...) \ - do { \ - kuz_log_w(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \ - } while (0) - -#define K_LOG_E(fmt, ...) \ - do { \ - kuz_log_e(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \ - } while (0) - -#define K_LOG_I(fmt, ...) \ - do { \ - kuz_log_i(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \ - } while (0) - -std::string get_login_creds(const std::string &username, - const std::string &password); -void kuzzle_user_create(kuzzleio::Kuzzle *kuzzle, const std::string &user_id, - const std::string &username, - const std::string &password); - -#endif diff --git a/internal/wrappers/features/step_defs_cpp/realtime-steps.cpp b/internal/wrappers/features/step_defs_cpp/realtime-steps.cpp deleted file mode 100644 index 74005b20..00000000 --- a/internal/wrappers/features/step_defs_cpp/realtime-steps.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include "steps.hpp" - -#include - -CustomNotificationListener* CustomNotificationListener::_singleton; - -// Anonymous namespace to handle a linker error -// see https://stackoverflow.com/questions/14320148/linker-error-on-cucumber-cpp-when-dealing-with-multiple-feature-files -namespace { - - GIVEN("^I subscribe to \'(.*)\'$") { - REGEX_PARAM(std::string, collection_id); - - ScenarioScope ctx; - - try { - CustomNotificationListener *l = CustomNotificationListener::getSingleton(); - ctx->room_id = ctx->kuzzle->realtime->subscribe(ctx->index, collection_id, "{}", &l->listener); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I create a document in \'([^\"]*)\'$") { - REGEX_PARAM(std::string, collection_id); - - ScenarioScope ctx; - - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - try { - ctx->kuzzle->document->create(ctx->index, ctx->collection, "", "{\"foo\":\"bar\"}", &options); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^I receive a notification$") { - ScenarioScope ctx; - - sleep(1); - BOOST_CHECK(ctx->notif_result != NULL); - ctx->kuzzle->realtime->unsubscribe(ctx->room_id); - - delete ctx->notif_result; - ctx->notif_result = NULL; - } - - GIVEN("^I subscribe to \'([^\"]*)\' with \'(.*)\' as filter$") { - REGEX_PARAM(std::string, collection_id); - REGEX_PARAM(std::string, filter); - - ScenarioScope ctx; - - try { - CustomNotificationListener *l = CustomNotificationListener::getSingleton(); - ctx->kuzzle->realtime->subscribe(ctx->index, collection_id, filter, &l->listener); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I update the document with id \'([^\"]*)\' and content \'([^\"]*)\' = \'([^\"]*)\'$") { - REGEX_PARAM(std::string, document_id); - REGEX_PARAM(std::string, key); - REGEX_PARAM(std::string, value); - - ScenarioScope ctx; - - query_options options = {0}; - options.refresh = const_cast("wait_for"); - - try { - ctx->kuzzle->document->update(ctx->index, ctx->collection, document_id, "{\""+key+"\":\""+value+"\"}", &options); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I delete the document with id \'([^\"]*)\'$") { - REGEX_PARAM(std::string, document_id); - - ScenarioScope ctx; - - try { - ctx->kuzzle->document->delete_(ctx->index, ctx->collection, document_id); - ctx->success = 1; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - WHEN("^I publish a document$") { - ScenarioScope ctx; - - try { - ctx->kuzzle->realtime->publish(ctx->index, ctx->collection, "{}"); - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - GIVEN("^I unsubscribe$") { - ScenarioScope ctx; - - try { - ctx->kuzzle->realtime->unsubscribe(ctx->room_id); - ctx->notif_result = NULL; - } catch (KuzzleException e) { - BOOST_FAIL(e.getMessage()); - } - } - - THEN("^I do not receive a notification$") { - ScenarioScope ctx; - - BOOST_CHECK(ctx->notif_result == NULL); - } -} diff --git a/internal/wrappers/features/step_defs_cpp/steps.hpp b/internal/wrappers/features/step_defs_cpp/steps.hpp deleted file mode 100644 index aa876bd6..00000000 --- a/internal/wrappers/features/step_defs_cpp/steps.hpp +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _STEPS_HPP_ -#define _STEPS_HPP_ - -#include -#define EXPECT_EQ BOOST_CHECK_EQUAL -#include -#include -#include -#include - -#include "auth.hpp" -#include "collection.hpp" -#include "document.hpp" -#include "index.hpp" -#include "realtime.hpp" -#include "kuzzle.hpp" - -#include "kuzzle_utils.h" - -#include "json_spirit/json_spirit.h" - -using cucumber::ScenarioScope; - -using namespace kuzzleio; -using std::cout; -using std::endl; -using std::string; - -struct KuzzleCtx { - Kuzzle* kuzzle = NULL; - options kuzzle_options; - - string user_id; - string index; - string collection; - string jwt; - string document_id; - search_result *documents; - - string room_id; - - kuzzle_user* currentUser = NULL; - json_spirit::Value_type customUserDataType = json_spirit::null_type; - - // 1 mean success, 0 failure and -1 is base state - int success = -1; - string error_message; - int hits = -1; - string content; - // 1 mean yes, 0 no and -1 is base state - int partial_exception = -1; - std::vector string_array; - - notification_result *notif_result = NULL; -}; - -class CustomNotificationListener { - private: - CustomNotificationListener() { - listener = [](const kuzzleio::notification_result* res) { - ScenarioScope ctx; - ctx->notif_result = const_cast(res); - }; - }; - static CustomNotificationListener* _singleton; - public: - NotificationListener listener; - static CustomNotificationListener* getSingleton() { - if (!_singleton) { - _singleton = new CustomNotificationListener(); - } - return _singleton; - } -}; - -#endif diff --git a/internal/wrappers/headers/auth.hpp b/internal/wrappers/headers/auth.hpp deleted file mode 100644 index 8733e9dc..00000000 --- a/internal/wrappers/headers/auth.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _AUTH_HPP -#define _AUTH_HPP - -#include "exceptions.hpp" -#include "core.hpp" - -namespace kuzzleio { - - class Kuzzle; - - class Auth { - auth *_auth; - Auth(); - - public: - Kuzzle *_kuzzle; - - Auth(Kuzzle *kuzzle); - Auth(Kuzzle *kuzzle, auth *auth); - virtual ~Auth(); - token_validity* checkToken(const std::string& token); - std::string createMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options=nullptr); - bool credentialsExist(const std::string& strategy, query_options *options=nullptr); - void deleteMyCredentials(const std::string& strategy, query_options *options=nullptr); - kuzzle_user* getCurrentUser(); - std::string getMyCredentials(const std::string& strategy, query_options *options=nullptr); - user_right* getMyRights(query_options *options=nullptr); - std::vector getStrategies(query_options *options=nullptr); - std::string login(const std::string& strategy, const std::string& credentials, int expiresIn); - std::string login(const std::string& strategy, const std::string& credentials); - void logout() noexcept; - void setJwt(const std::string& jwt) noexcept; - std::string updateMyCredentials(const std::string& strategy, const std::string& credentials, query_options *options=nullptr); - kuzzle_user* updateSelf(const std::string& content, query_options* options=nullptr); - bool validateMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options=nullptr); - }; -} - -#endif diff --git a/internal/wrappers/headers/collection.hpp b/internal/wrappers/headers/collection.hpp deleted file mode 100644 index 5b6e773a..00000000 --- a/internal/wrappers/headers/collection.hpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _COLLECTION_HPP_ -#define _COLLECTION_HPP_ - -#include -#include -#include "core.hpp" -#include "exceptions.hpp" - -namespace kuzzleio { - class Kuzzle; - class Collection { - collection* _collection; - Collection(); - - public: - Collection(Kuzzle* kuzzle); - Collection(Kuzzle* kuzzle, collection *collection); - virtual ~Collection(); - void create(const std::string& index, const std::string& collection, const std::string* body=nullptr, query_options *options=nullptr); - bool exists(const std::string& index, const std::string& collection, query_options *options=nullptr); - std::string list(const std::string& index, query_options *options=nullptr); - void truncate(const std::string& index, const std::string& collection, query_options *options=nullptr); - std::string getMapping(const std::string& index, const std::string& collection, query_options *options=nullptr); - void updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - std::string getSpecifications(const std::string& index, const std::string& collection, query_options *options=nullptr); - search_result* searchSpecifications(query_options *options=nullptr); - std::string updateSpecifications(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - bool validateSpecifications(const std::string& body, query_options *options=nullptr); - void deleteSpecifications(const std::string& index, const std::string& collection, query_options *options=nullptr); - }; -} - -#endif diff --git a/internal/wrappers/headers/core.hpp b/internal/wrappers/headers/core.hpp deleted file mode 100644 index 8492db9c..00000000 --- a/internal/wrappers/headers/core.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _CORE_HPP_ -#define _CORE_HPP_ - -extern "C" { - #define _Complex - #include - - #include "kuzzle.h" - #include "kuzzlesdk.h" -} - -#endif diff --git a/internal/wrappers/headers/document.hpp b/internal/wrappers/headers/document.hpp deleted file mode 100644 index af1d3146..00000000 --- a/internal/wrappers/headers/document.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _DOCUMENT_HPP_ -#define _DOCUMENT_HPP_ - -#include "exceptions.hpp" -#include "core.hpp" - -namespace kuzzleio { - - class Document { - document* _document; - Document(); - - public: - Document(Kuzzle* kuzzle); - Document(Kuzzle* kuzzle, document *document); - virtual ~Document(); - int count(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - bool exists(const std::string& index, const std::string& collection, const std::string& id, query_options *options=nullptr); - std::string create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=nullptr); - std::string createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=nullptr); - std::string delete_(const std::string& index, const std::string& collection, const std::string& id, query_options *options=nullptr); - std::vector deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - std::string get(const std::string& index, const std::string& collection, const std::string& id, query_options *options=nullptr); - std::string replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=nullptr); - std::string update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options=nullptr); - bool validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - search_result* search(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - std::string mCreate(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - std::string mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - std::vector mDelete(const std::string& index, const std::string& collection, const std::vector& ids, query_options *options=nullptr); - std::string mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options=nullptr); - std::string mReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - std::string mUpdate(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - }; -} - -#endif diff --git a/internal/wrappers/headers/event_emitter.hpp b/internal/wrappers/headers/event_emitter.hpp deleted file mode 100644 index 29923daf..00000000 --- a/internal/wrappers/headers/event_emitter.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _EVENT_EMITTER_HPP_ -#define _EVENT_EMITTER_HPP_ - -#include -#include "kuzzle.hpp" - -typedef const std::function EventListener; - -namespace kuzzleio { - - class KuzzleEventEmitter { - public: - virtual KuzzleEventEmitter* addListener(Event e, EventListener* listener) = 0; - virtual KuzzleEventEmitter* removeListener(Event e, EventListener* listener) = 0; - virtual KuzzleEventEmitter* removeAllListeners(Event e) = 0; - virtual KuzzleEventEmitter* once(Event e, EventListener* listener) = 0; - virtual int listenerCount(Event e) = 0; - }; -} - -#endif diff --git a/internal/wrappers/headers/exceptions.hpp b/internal/wrappers/headers/exceptions.hpp deleted file mode 100644 index 9e222805..00000000 --- a/internal/wrappers/headers/exceptions.hpp +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _EXCEPTIONS_HPP_ -#define _EXCEPTIONS_HPP_ - -#include -#include -#include -#include - -#define PARTIAL_EXCEPTION 206 -#define BAD_REQUEST_EXCEPTION 400 -#define UNAUTHORIZED_EXCEPTION 401 -#define FORBIDDEN_EXCEPTION 403 -#define NOT_FOUND_EXCEPTION 404 -#define PRECONDITION_EXCEPTION 412 -#define SIZE_LIMIT_EXCEPTION 413 -#define INTERNAL_EXCEPTION 500 -#define SERVICE_UNAVAILABLE_EXCEPTION 503 -#define GATEWAY_TIMEOUT_EXCEPTION 504 - -namespace kuzzleio { - - struct KuzzleException : std::runtime_error { - int status; - - KuzzleException(int status, const std::string& message); - KuzzleException(const std::string& message) - : KuzzleException(500, message) {}; - KuzzleException(const KuzzleException& ke) : status(ke.status), std::runtime_error(ke.getMessage()) {}; - - virtual ~KuzzleException() throw() {}; - std::string getMessage() const; - }; - - struct BadRequestException : KuzzleException { - BadRequestException(const std::string& message="Bad Request Exception") - : KuzzleException(BAD_REQUEST_EXCEPTION, message) {}; - BadRequestException(const BadRequestException& bre) : KuzzleException(bre.status, bre.getMessage()) {} - }; - struct ForbiddenException: KuzzleException { - ForbiddenException(const std::string& message="Forbidden Exception") - : KuzzleException(FORBIDDEN_EXCEPTION, message) {}; - ForbiddenException(const ForbiddenException& fe) : KuzzleException(fe.status, fe.getMessage()) {} - }; - struct GatewayTimeoutException: KuzzleException { - GatewayTimeoutException(const std::string& message="Gateway Timeout Exception") - : KuzzleException(GATEWAY_TIMEOUT_EXCEPTION, message) {}; - GatewayTimeoutException(const GatewayTimeoutException& gte) : KuzzleException(gte.status, gte.getMessage()) {} - }; - struct InternalException: KuzzleException { - InternalException(const std::string& message="Internal Exception") - : KuzzleException(INTERNAL_EXCEPTION, message) {}; - InternalException(const InternalException& ie) : KuzzleException(ie.status, ie.getMessage()) {} - }; - struct NotFoundException: KuzzleException { - NotFoundException(const std::string& message="Not Found Exception") - : KuzzleException(NOT_FOUND_EXCEPTION, message) {}; - NotFoundException(const NotFoundException& nfe) : KuzzleException(nfe.status, nfe.getMessage()) {} - }; - struct PartialException: KuzzleException { - PartialException(const std::string& message="Partial Exception") - : KuzzleException(PARTIAL_EXCEPTION, message) {}; - PartialException(const PartialException& pe) : KuzzleException(pe.status, pe.getMessage()) {} - }; - struct PreconditionException: KuzzleException { - PreconditionException(const std::string& message="Precondition Exception") - : KuzzleException(PRECONDITION_EXCEPTION, message) {}; - PreconditionException(const PreconditionException& pe) : KuzzleException(pe.status, pe.getMessage()) {} - }; - struct ServiceUnavailableException: KuzzleException { - ServiceUnavailableException(const std::string& message="Service Unavailable Exception") - : KuzzleException(SERVICE_UNAVAILABLE_EXCEPTION, message) {}; - ServiceUnavailableException(const ServiceUnavailableException& sue) : KuzzleException(sue.status, sue.getMessage()) {} - }; - struct SizeLimitException: KuzzleException { - SizeLimitException(const std::string& message="Size Limit Exception") - : KuzzleException(SIZE_LIMIT_EXCEPTION, message) {}; - SizeLimitException(const SizeLimitException& sle) : KuzzleException(sle.status, sle.getMessage()) {} - }; - struct UnauthorizedException : KuzzleException { - UnauthorizedException(const std::string& message="Unauthorized Exception") - : KuzzleException(UNAUTHORIZED_EXCEPTION, message) {} - UnauthorizedException(const UnauthorizedException& ue) : KuzzleException(ue.status, ue.getMessage()) {} - }; - - template - void throwExceptionFromStatus(T *result) { - const std::string error = std::string(result->error); - delete(result->error); - if (result->stack) { - free(const_cast(result->stack)); - } - - switch(result->status) { - case PARTIAL_EXCEPTION: - delete(result); - throw PartialException(error); - break; - case BAD_REQUEST_EXCEPTION: - delete(result); - throw BadRequestException(error); - break; - case UNAUTHORIZED_EXCEPTION: - delete(result); - throw UnauthorizedException(error); - break; - case FORBIDDEN_EXCEPTION: - delete(result); - throw ForbiddenException(error); - break; - case NOT_FOUND_EXCEPTION: - delete(result); - throw NotFoundException(error); - break; - case PRECONDITION_EXCEPTION: - delete(result); - throw PreconditionException(error); - break; - case SIZE_LIMIT_EXCEPTION: - delete(result); - throw SizeLimitException(error); - break; - case INTERNAL_EXCEPTION: - delete(result); - throw InternalException(error); - break; - case SERVICE_UNAVAILABLE_EXCEPTION: - delete(result); - throw ServiceUnavailableException(error); - break; - case GATEWAY_TIMEOUT_EXCEPTION: - delete(result); - throw GatewayTimeoutException(error); - break; - default: - delete(result); - throw KuzzleException(500, error); - } - } -} - -#endif diff --git a/internal/wrappers/headers/index.hpp b/internal/wrappers/headers/index.hpp deleted file mode 100644 index fb385fc4..00000000 --- a/internal/wrappers/headers/index.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _KUZZLE_INDEX_HPP -#define _KUZZLE_INDEX_HPP -#include -#include -#include "exceptions.hpp" -#include "core.hpp" - -namespace kuzzleio { - class Kuzzle; - class Index { - kuzzle_index *_index; - Index(); - - public: - Index(Kuzzle* kuzzle); - Index(Kuzzle* kuzzle, kuzzle_index *index); - virtual ~Index(); - void create(const std::string& index, query_options *options=nullptr); - void delete_(const std::string& index, query_options *options=nullptr); - std::vector mDelete(const std::vector& indexes, query_options *options=nullptr); - bool exists(const std::string& index, query_options *options=nullptr); - void refresh(const std::string& index, query_options *options=nullptr); - void refreshInternal(query_options *options=nullptr); - void setAutoRefresh(const std::string& index, bool autoRefresh, query_options *options=nullptr); - bool getAutoRefresh(const std::string& index, query_options *options=nullptr); - std::vector list(query_options *options=nullptr); - }; -} - -#endif diff --git a/internal/wrappers/headers/kuzzle.hpp b/internal/wrappers/headers/kuzzle.hpp deleted file mode 100644 index aad1123d..00000000 --- a/internal/wrappers/headers/kuzzle.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _KUZZLE_HPP_ -#define _KUZZLE_HPP_ - -#include "exceptions.hpp" -#include "core.hpp" -#include "event_emitter.hpp" -#include -#include -#include -#include -#include - -namespace kuzzleio { - class Collection; - class Document; - class Auth; - class Index; - class Server; - class Realtime; - - class Kuzzle : public KuzzleEventEmitter { - private: - std::map _listener_instances; - - public: - kuzzle *_kuzzle; - Auth *auth; - Index *index; - Server *server; - Collection *collection; - Document *document; - Realtime *realtime; - - Kuzzle(const std::string& host, options *options=nullptr); - virtual ~Kuzzle(); - - char* connect() noexcept; - - std::string getJwt() noexcept; - void disconnect() noexcept; - kuzzle_response* query(kuzzle_request* query, query_options* options=nullptr); - Kuzzle* playQueue() noexcept; - Kuzzle* setAutoReplay(bool autoReplay) noexcept; - Kuzzle* startQueuing() noexcept; - Kuzzle* stopQueuing() noexcept; - Kuzzle* flushQueue() noexcept; - std::string getVolatile() noexcept; - Kuzzle* setVolatile(const std::string& volatiles) noexcept; - std::map getListeners() noexcept; - void emitEvent(Event& event, const std::string& body) noexcept; - - virtual KuzzleEventEmitter* addListener(Event event, EventListener* listener) override; - virtual KuzzleEventEmitter* removeListener(Event event, EventListener* listener) override; - virtual KuzzleEventEmitter* removeAllListeners(Event event) override; - virtual KuzzleEventEmitter* once(Event event, EventListener* listener) override; - virtual int listenerCount(Event event) override; - - }; -} - -#endif diff --git a/internal/wrappers/headers/kuzzlesdk.h b/internal/wrappers/headers/kuzzlesdk.h deleted file mode 100644 index b765a0b0..00000000 --- a/internal/wrappers/headers/kuzzlesdk.h +++ /dev/null @@ -1,668 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _KUZZLESDK_H_ -#define _KUZZLESDK_H_ - -#include -#include -#include -#include -#include - -enum Mode {AUTO, MANUAL}; -//options passed to the Kuzzle() fct - -#define KUZZLE_OPTIONS_DEFAULT { \ - .queue_ttl = 120000, \ - .queue_max_size = 500, \ - .offline_mode = MANUAL, \ - .auto_queue = false, \ - .auto_reconnect = true, \ - .auto_replay = false, \ - .auto_resubscribe = true, \ - .reconnection_delay = 1000, \ - .replay_interval = 10, \ - .refresh = NULL \ -} - -enum Event { - CONNECTED, - DISCARDED, - DISCONNECTED, - LOGIN_ATTEMPT, - NETWORK_ERROR, - OFFLINE_QUEUE_POP, - OFFLINE_QUEUE_PUSH, - QUERY_ERROR, - RECONNECTED, - JWT_EXPIRED, - ERROR -}; - -enum is_action_allowed { - ALLOWED, - CONDITIONNAL, - DENIED -}; - - -# ifdef __cplusplus -namespace kuzzleio { -# endif - -//query object used by query() -typedef struct { - char *query; - unsigned long long timestamp; - char *request_id; -} query_object; - -typedef struct { - query_object **queries; - size_t queries_length; -} offline_queue; - -typedef void (*kuzzle_event_listener)(int, char*, void*); - -//define a request -typedef struct { - const char *request_id; - const char *controller; - const char *action; - const char *index; - const char *collection; - const char *body; - const char *id; - long from; - long size; - const char *scroll; - const char *scroll_id; - const char *strategy; - unsigned long long expires_in; - const char *volatiles; - const char *scope; - const char *state; - const char *user; - long start; - long stop; - long end; - unsigned char bit; - const char *member; - const char *member1; - const char *member2; - char **members; - size_t members_length; - double lon; - double lat; - double distance; - const char *unit; - const char *options; - const char **keys; - size_t keys_length; - long cursor; - long offset; - const char *field; - const char **fields; - size_t fields_length; - const char *subcommand; - const char *pattern; - long idx; - const char *min; - const char *max; - const char *limit; - unsigned long count; - const char *match; -} kuzzle_request; - -typedef offline_queue* (*kuzzle_offline_queue_loader)(void); -typedef bool (*kuzzle_queue_filter)(const char*); - -typedef struct { - void *instance; - kuzzle_queue_filter filter; - kuzzle_offline_queue_loader loader; -} kuzzle; - -typedef struct { - void *instance; - kuzzle* k; -} realtime; - -typedef struct { - const char *type_; - int from; - int size; - const char *scroll; -} search_options; - -typedef struct auth { - void *instance; - kuzzle *k; -} auth; - -typedef struct { - void *instance; - kuzzle *k; -} kuzzle_index; - -typedef struct { - void *instance; - kuzzle* k; -} server; - -typedef struct { - const char *room; - const char *channel; - int status; - const char *error; - const char *stack; -} subscribe_result; - -//options passed to room constructor -typedef struct { - const char *scope; - const char *state; - const char *user; - bool subscribe_to_self; - const char *volatiles; -} room_options; - -typedef struct { - void *instance; - const char *filters; - room_options *options; -} room; - -typedef struct { - room *result; - int status; - const char *error; - const char *stack; -} room_result; - -typedef void (callback)(char* notification); - -//options passed to query() -typedef struct { - bool queuable; - bool withdist; - bool withcoord; - long from; - long size; - const char *scroll; - const char *scroll_id; - const char *refresh; - const char *if_exist; - int retry_on_conflict; - const char *volatiles; -} query_options; - -typedef struct { - unsigned queue_ttl; - unsigned long queue_max_size; - enum Mode offline_mode; - bool auto_queue; - bool auto_reconnect; - bool auto_replay; - bool auto_resubscribe; - unsigned long reconnection_delay; - unsigned long replay_interval; - const char *refresh; -} options; - -//meta of a document -typedef struct { - const char *author; - unsigned long long created_at; - unsigned long long updated_at; - const char *updater; - bool active; - unsigned long long deleted_at; -} meta; - -/* === Security === */ - -typedef char *controllers; - -typedef struct { - const char *index; - char **collections; - size_t collections_length; -} policy_restriction; - -typedef struct { - const char *role_id; - policy_restriction *restricted_to; - size_t restricted_to_length; -} policy; - -typedef struct { - const char *id; - policy *policies; - size_t policies_length; - kuzzle *k; -} profile; - -typedef struct { - const char *id; - const char *controllers; - kuzzle *k; -} role; - -// kuzzle user -typedef struct { - const char *id; - const char *content; - char **profile_ids; - size_t profile_ids_length; - kuzzle *k; -} kuzzle_user; - -// user content passed to user constructor -typedef struct { - const char *content; - char **profile_ids; - size_t profile_ids_length; -} user_data; - -/* === Dedicated response structures === */ - -typedef struct { - int failed; - int successful; - int total; -} shards; - -typedef struct { - void *instance; - kuzzle *k; -} collection; - -typedef struct { - void *instance; - kuzzle *k; -} document; - -typedef struct { - const char *id; - meta *m; - const char *content; - int count; -} notification_content; - -typedef struct notification_result { - const char *request_id; - notification_content *result; - const char *volatiles; - const char *index; - const char *collection; - const char *controller; - const char *action; - const char *protocol; - const char *scope; - const char *state; - const char *user; - const char *n_type; - const char *room_id; - unsigned long long timestamp; - int status; - const char *error; - const char *stack; -} notification_result; - -typedef struct profile_result { - profile *p; - int status; - const char *error; - const char *stack; -} profile_result; - -typedef struct profiles_result { - profile *profiles; - size_t profiles_length; - int status; - const char *error; - const char *stack; -} profiles_result; - -typedef struct role_result { - role *r; - int status; - const char *error; - const char *stack; -} role_result; - -typedef struct roles_result { - role *roles; - size_t roles_length; - int status; - const char *error; - const char *stack; -} roles_result; - -typedef struct { - const char *controller; - const char *action; - const char *index; - const char *collection; - const char *value; -} user_right; - -typedef struct user_rights_result { - user_right *result; - size_t user_rights_length; - int status; - const char *error; - const char *stack; -} user_rights_result; - -typedef struct user_result { - kuzzle_user *result; - int status; - const char *error; - const char *stack; -} user_result; - -//statistics -typedef struct { - const char* completed_requests; - const char* connections; - const char* failed_requests; - const char* ongoing_requests; - unsigned long long timestamp; -} statistics; - -typedef struct statistics_result { - statistics* result; - int status; - const char *error; - const char *stack; -} statistics_result; - -typedef struct all_statistics_result { - statistics* result; - size_t result_length; - int status; - const char *error; - const char *stack; -} all_statistics_result; - -// ms.geopos -typedef struct geopos_result { - double (*result)[2]; - size_t result_length; - int status; - const char *error; - const char *stack; -} geopos_result; - -// ms.geopoint -typedef struct point { - float lat; - float lon; - const char *name; -} point; - -// ms.msHashField -typedef struct ms_hash_field { - const char *field; - const char *value; -} ms_hash_field; - -// ms.keyValue -typedef struct ms_key_value { - const char *key; - const char *value; -} ms_key_value; - -// ms.sortedSet -typedef struct ms_sorted_set { - float score; - const char *member; -} ms_sorted_set; - -//check_token -typedef struct token_validity { - bool valid; - const char *state; - unsigned long long expires_at; - int status; - const char *error; - const char *stack; -} token_validity; - -/* === Generic response structures === */ - -// raw Kuzzle response -typedef struct { - const char *request_id; - const char *result; - const char *volatiles; - const char *index; - const char *collection; - const char *controller; - const char *action; - const char *room_id; - const char *channel; - int status; - const char *error; - const char *stack; -} kuzzle_response; - -//any void result -typedef struct error_result { - int status; - const char *error; - const char *stack; -} error_result; - -//any json result -typedef struct json_result { - const char *result; - int status; - const char *error; - const char *stack; -} json_result; - -//any array of char result -typedef struct json_array_result { - char **result; - size_t result_length; - int status; - const char *error; - const char *stack; -} json_array_result; - -//any boolean result -typedef struct bool_result { - bool result; - int status; - const char *error; - const char *stack; -} bool_result; - -//any integer result -typedef struct int_result { - long long result; - int status; - const char *error; - const char *stack; -} int_result; - -typedef struct date_result { - long long result; - int status; - const char *error; - const char *stack; -} date_result; - -//any double result -typedef struct double_result { - double result; - int status; - const char *error; - const char *stack; -} double_result; - -//any array of integers result -typedef struct int_array_result { - long long *result; - size_t result_length; - int status; - const char *error; - const char *stack; -} int_array_result; - -// any string result -typedef struct string_result { - const char *result; - int status; - const char *error; - const char *stack; -} string_result; - -//any array of strings result -typedef struct string_array_result { - char **result; - size_t result_length; - int status; - const char *error; - const char *stack; -} string_array_result; - -typedef struct { - profile *hits; - size_t hits_length; - unsigned total; - const char *scroll_id; -} profile_search; - -typedef struct { - role *hits; - size_t hits_length; - unsigned total; -} role_search; - -typedef struct { - kuzzle_user *hits; - size_t hits_length; - unsigned total; - const char *scroll_id; -} user_search; - -//any delete* function -typedef struct ack_result { - bool acknowledged; - bool shards_acknowledged; - int status; - const char *error; - const char *stack; -} ack_result; - -typedef struct shards_result { - shards *result; - int status; - const char *error; - const char *stack; -} shards_result; - -typedef struct { - bool strict; - const char *fields; - const char *validators; -} specification; - -typedef struct { - specification *validation; - const char *index; - const char *collection; -} specification_entry; - -typedef struct specification_result { - specification *result; - int status; - const char *error; - const char *stack; -} specification_result; - -typedef struct search_result { - const char *documents; - unsigned fetched; - unsigned total; - const char *aggregations; - const char *filters; - query_options *options; - const char *collection; - int status; - const char *error; - const char *stack; -} search_result; - -typedef struct search_profiles_result { - profile_search *result; - int status; - const char *error; - const char *stack; -} search_profiles_result; - -typedef struct search_roles_result { - role_search *result; - int status; - const char *error; - const char *stack; -} search_roles_result; - -typedef struct search_users_result { - user_search *result; - int status; - const char *error; - const char *stack; -} search_users_result; - -typedef struct { - specification_entry *hits; - size_t hits_length; - unsigned total; - const char *scroll_id; -} specification_search; - -typedef struct specification_search_result { - specification_search *result; - int status; - const char *error; - const char *stack; -} specification_search_result; - -typedef struct { - bool persisted; - const char *name; -} collection_entry; - -typedef struct collection_entry_result { - collection_entry* result; - size_t result_length; - int status; - const char *error; - const char *stack; -} collection_entry_result; - -typedef void (*kuzzle_notification_listener)(notification_result*, void*); -typedef void (*kuzzle_subscribe_listener)(room_result*, void*); - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/internal/wrappers/headers/realtime.hpp b/internal/wrappers/headers/realtime.hpp deleted file mode 100644 index 0e2f2eb6..00000000 --- a/internal/wrappers/headers/realtime.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _KUZZLE_REALTIME_HPP -#define _KUZZLE_REALTIME_HPP - -#include "exceptions.hpp" -#include "core.hpp" -#include -#include - -typedef std::function NotificationListener; - -namespace kuzzleio { - - class Kuzzle; - - class Realtime { - realtime *_realtime; - std::map _listener_instances; - Realtime(); - - public: - Realtime(Kuzzle* kuzzle); - Realtime(Kuzzle* kuzzle, realtime* realtime); - virtual ~Realtime(); - int count(const std::string& index, const std::string& collection, const std::string& roomId, query_options *options=nullptr); - std::string list(const std::string& index, const std::string& collection, query_options *options=nullptr); - void publish(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - std::string subscribe(const std::string& index, const std::string& collection, const std::string& body, NotificationListener* cb, room_options* options=nullptr); - void unsubscribe(const std::string& roomId, query_options *options=nullptr); - bool validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options=nullptr); - - NotificationListener* getListener(const std::string& roomId); - }; -} - -#endif diff --git a/internal/wrappers/headers/sdk_wrappers_internal.h b/internal/wrappers/headers/sdk_wrappers_internal.h deleted file mode 100644 index 5589754f..00000000 --- a/internal/wrappers/headers/sdk_wrappers_internal.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef __SDK_WRAPPERS_INTERNAL -#define __SDK_WRAPPERS_INTERNAL - -# ifdef __cplusplus -using namespace kuzzleio; -# endif - -typedef char *char_ptr; -typedef policy *policy_ptr; -typedef policy_restriction *policy_restriction_ptr; -typedef query_object *query_object_ptr; - -// used by memory_storage.geopos -typedef double geopos_arr[2]; - -static void set_errno(int err) { - errno = err; -} - -static void kuzzle_notify(kuzzle_notification_listener f, notification_result* res, void* data) { - f(res, data); -} - -static void kuzzle_trigger_event(int event, kuzzle_event_listener f, char* res, void* data) { - f(event, res, data); -} - -static void room_on_subscribe(kuzzle_subscribe_listener f, room_result* res, void* data) { - f(res, data); -} - -static bool kuzzle_filter_query(kuzzle_queue_filter f, const char *rq) { - return f(rq); -} - -#endif diff --git a/internal/wrappers/headers/server.hpp b/internal/wrappers/headers/server.hpp deleted file mode 100644 index 3253b4d8..00000000 --- a/internal/wrappers/headers/server.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015-2018 Kuzzle -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef _KUZZLE_SERVER_HPP -#define _KUZZLE_SERVER_HPP - -#include "exceptions.hpp" -#include "core.hpp" - -namespace kuzzleio { - class Server { - server *_server; - Server(); - - public: - Server(Kuzzle* kuzzle); - Server(Kuzzle *kuzzle, server *server); - virtual ~Server(); - bool adminExists(query_options *options); - std::string getAllStats(query_options* options=nullptr); - std::string getStats(time_t start, time_t end, query_options* options=nullptr); - std::string getLastStats(query_options* options=nullptr); - std::string getConfig(query_options* options=nullptr); - std::string info(query_options* options=nullptr); - long long now(query_options* options=nullptr); - }; -} - -#endif diff --git a/internal/wrappers/templates/android/core.i b/internal/wrappers/templates/android/core.i deleted file mode 100644 index 5eaea904..00000000 --- a/internal/wrappers/templates/android/core.i +++ /dev/null @@ -1,107 +0,0 @@ -%rename(TokenValidity) token_validity; -%rename(AckResponse) ack_response; -%rename(queueTTL) queue_ttl; -%rename(Options, match="class") options; -%rename(QueryOptions) query_options; -%rename(JsonObject) json_object; -%rename(JsonResult) json_result; -%rename(LoginResult) login_result; -%rename(BoolResult) bool_result; -%rename(Statistics) statistics; -%rename(AllStatisticsResult) all_statistics_result; -%rename(StatisticsResult) statistics_result; -%rename(CollectionsList) collection_entry; -%rename(CollectionsListResult) collection_entry_result; -%rename(StringArrayResult) string_array_result; -%rename(KuzzleResponse) kuzzle_response; -%rename(KuzzleRequest) kuzzle_request; -%rename(ShardsResult) shards_result; -%rename(DateResult) date_result; -%rename(UserData) user_data; -%rename(KuzzleUser, match="class") kuzzle_user; -%rename(RoomOptions) room_options; -%rename(SearchFilters) search_filters; -%rename(SearchResult) search_result; -%rename(NotificationResult) notification_result; -%rename(NotificationContent) notification_content; -%rename(SubscribeToSelf) subscribe_to_self; - -%rename(delete) delete_; - -%ignore *::error; -%ignore *::status; -%ignore *::stack; - -%{ -#include "collection.cpp" -#include "auth.cpp" -#include "index.cpp" -#include "server.cpp" -#include "document.cpp" -%} - -%ignore getListener; -%ignore getListeners; - -%include "../java/std_function.i" -%std_function(NotificationListener, void, onMessage, const kuzzleio::notification_result*); -%std_function(EventListener, void, trigger, const std::string); - -%{ -#include "kuzzle.cpp" -#include "realtime.cpp" -%} - -%include "../java/exceptions.i" -%include "std_string.i" -%include "typemap.i" -%include "json_wrap/kuzzle.i" -%include "json_wrap/listeners.i" -%include "json_wrap/document.i" -%include "json_wrap/realtime.i" -%include "json_wrap/server.i" -%include "json_wrap/collection.i" -%include "json_wrap/auth.i" - -%include "kcore.i" - -%include "std_vector.i" - -typedef long long time_t; - -%template(StringVector) std::vector; - -%typemap(out) const StringVector& %{ - return $1; -%} - -%pragma(java) jniclasscode=%{ - static { - try { - System.loadLibrary("kuzzle-wrapper-android"); - } catch (Exception e) { - System.err.println("Native code library failed to load. \n"); - e.printStackTrace(); - System.exit(1); - } - } -%} - -%extend kuzzleio::options { - options() { - options *o = kuzzle_new_options(); - return o; - } - - ~options() { - free($self); - } -} - -%include "kuzzle.cpp" -%include "collection.cpp" -%include "document.cpp" -%include "realtime.cpp" -%include "auth.cpp" -%include "index.cpp" -%include "server.cpp" diff --git a/internal/wrappers/templates/android/json_wrap/auth.i b/internal/wrappers/templates/android/json_wrap/auth.i deleted file mode 100644 index a7ca9792..00000000 --- a/internal/wrappers/templates/android/json_wrap/auth.i +++ /dev/null @@ -1,135 +0,0 @@ -%javamethodmodifiers kuzzleio::Auth::createMyCredentials(const std::string& strategy, const std::string& credentials, query_options* options) "private"; -%javamethodmodifiers kuzzleio::Auth::createMyCredentials(const std::string& strategy, const std::string& credentials) "private"; -%rename (_getMyCredentials) kuzzleio::Auth::getMyCredentials(const std::string& strategy, query_options *options); -%rename (_getMyCredentials) kuzzleio::Auth::getMyCredentials(const std::string& strategy); -%javamethodmodifiers kuzzleio::Auth::getMyCredentials(const std::string& strategy, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Auth::getMyCredentials(const std::string& strategy) "private"; -%javamethodmodifiers kuzzleio::Auth::login(const std::string& strategy, const std::string& credentials, int expiresIn) "private"; -%javamethodmodifiers kuzzleio::Auth::login(const std::string& strategy, const std::string& credentials) "private"; -%rename (_updateMyCredentials) kuzzleio::Auth::updateMyCredentials(const std::string& strategy, const std::string& credentials, query_options *options); -%rename (_updateMyCredentials) kuzzleio::Auth::updateMyCredentials(const std::string& strategy, const std::string& credentials); -%javamethodmodifiers kuzzleio::Auth::updateMyCredentials(const std::string& strategy, const std::string& credentials, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Auth::updateMyCredentials(const std::string& strategy, const std::string& credentials) "private"; -%javamethodmodifiers kuzzleio::Auth::updateSelf(const std::string& content, query_options* options) "private"; -%javamethodmodifiers kuzzleio::Auth::updateSelf(const std::string& content) "private"; -%javamethodmodifiers kuzzleio::Auth::validateMyCredentials(const std::string& strategy, const std::string& credentials, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Auth::validateMyCredentials(const std::string& strategy, const std::string& credentials) "private"; - -%typemap(javaimports) kuzzleio::Auth %{ -import android.webkit.WebView; -import android.webkit.WebViewClient; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URI; -%} -%typemap(javacode) kuzzleio::Auth %{ - public org.json.JSONObject createMyCredentials(String strategy, org.json.JSONObject credentials, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = createMyCredentials(strategy, credentials.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject createMyCredentials(String strategy, org.json.JSONObject credentials) throws org.json.JSONException, KuzzleException { - return createMyCredentials(strategy, credentials, null); - } - - public org.json.JSONObject getMyCredentials(String strategy, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _getMyCredentials(strategy, options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject getMyCredentials(String strategy) throws org.json.JSONException, KuzzleException { - return getMyCredentials(strategy, null); - } - - public String login(String strategy, org.json.JSONObject credentials, int expiresIn) throws org.json.JSONException, KuzzleException { - return login(strategy, credentials.toString(), expiresIn); - } - - public String login(String strategy, org.json.JSONObject credentials) throws org.json.JSONException, KuzzleException { - return login(strategy, credentials.toString()); - } - - public org.json.JSONObject updateMyCredentials(String strategy, org.json.JSONObject credentials, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _updateMyCredentials(strategy, credentials.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject updateMyCredentials(String strategy, org.json.JSONObject credentials) throws org.json.JSONException, KuzzleException { - return updateMyCredentials(strategy, credentials, null); - } - - public KuzzleUser updateSelf(org.json.JSONObject content, QueryOptions options) throws org.json.JSONException, KuzzleException { - return updateSelf(content.toString(), options); - } - - public KuzzleUser updateSelf(org.json.JSONObject content) throws org.json.JSONException, KuzzleException { - return updateSelf(content, null); - } - - public boolean validateMyCredentials(String strategy, org.json.JSONObject credentials, QueryOptions options) throws org.json.JSONException, KuzzleException { - return validateMyCredentials(strategy, credentials.toString(), options); - } - - public boolean validateMyCredentials(String strategy, org.json.JSONObject credentials) throws org.json.JSONException, KuzzleException { - return validateMyCredentials(strategy, credentials, null); - } - - /** - * WebViewClient to forward kuzzle's jwt token after an OAuth authentication - */ - protected class KuzzleWebViewClient extends WebViewClient { - @Override - public boolean shouldOverrideUrlLoading(WebView view, final String url) { - if (url.contains("code=")) { - new Thread(new Runnable() { - @Override - public void run() { - try { - HttpURLConnection conn = (HttpURLConnection) URI.create(url).toURL().openConnection(); - conn.setRequestMethod("GET"); - conn.setUseCaches(false); - - BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); - StringBuilder sb = new StringBuilder(); - String line; - while ((line = br.readLine()) != null) { - sb.append(line); - } - br.close(); - - org.json.JSONObject response = new org.json.JSONObject(sb.toString()); - if (response.isNull("error")) { - Auth.this.setJwt(response.getString("jwt")); - } else { - Auth.this.get_kuzzle().emitEvent(Event.LOGIN_ATTEMPT, new org.json.JSONObject() - .put("success", false) - .put("error", response.getJSONObject("error"))); - } - } catch (org.json.JSONException | IOException e) { - e.printStackTrace(); - } - } - }).start(); - } else { - view.loadUrl(url); - } - return true; - } - } - - /** - * Gets kuzzle web view client. - * - * @return the kuzzle web view client - */ - public KuzzleWebViewClient getKuzzleWebViewClient() { - return new KuzzleWebViewClient(); - } -%} - - diff --git a/internal/wrappers/templates/android/json_wrap/collection.i b/internal/wrappers/templates/android/json_wrap/collection.i deleted file mode 100644 index f126c91b..00000000 --- a/internal/wrappers/templates/android/json_wrap/collection.i +++ /dev/null @@ -1,89 +0,0 @@ -%javamethodmodifiers kuzzleio::Collection::create(const std::string& index, const std::string& collection, const std::string* body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Collection::create(const std::string& index, const std::string& collection, const std::string* body) "private"; -%rename (_list) kuzzleio::Collection::list(const std::string& index, query_options *options); -%rename (_list) kuzzleio::Collection::list(const std::string& index); -%javamethodmodifiers kuzzleio::Collection::list(const std::string& index, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Collection::list(const std::string& index) "private"; -%rename (_getMapping) kuzzleio::Collection::getMapping(const std::string& index, const std::string& collection, query_options *options); -%rename (_getMapping) kuzzleio::Collection::getMapping(const std::string& index, const std::string& collection); -%javamethodmodifiers kuzzleio::Collection::getMapping(const std::string& index, const std::string& collection, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Collection::getMapping(const std::string& index, const std::string& collection) "private"; -%javamethodmodifiers kuzzleio::Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Collection::updateMapping(const std::string& index, const std::string& collection, const std::string& body) "private"; -%rename (_getSpecifications) kuzzleio::Collection::getSpecifications(const std::string& index, const std::string& collection, query_options *options); -%rename (_getSpecifications) kuzzleio::Collection::getSpecifications(const std::string& index, const std::string& collection); -%javamethodmodifiers kuzzleio::Collection::getSpecifications(const std::string& index, const std::string& collection, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Collection::getSpecifications(const std::string& index, const std::string& collection) "private"; -%rename (_updateSpecifications) kuzzleio::Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body, query_options *options); -%rename (_updateSpecifications) kuzzleio::Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body); -%javamethodmodifiers kuzzleio::Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Collection::updateSpecifications(const std::string& index, const std::string& collection, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Collection::validateSpecifications(const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Collection::validateSpecifications(const std::string& body) "private"; - -%typemap(javacode) kuzzleio::Collection %{ - public void create(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - create(index, collection, body.toString(), options); - } - - public void create(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - create(index, collection, body, null); - } - - public org.json.JSONObject list(String index, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _list(index, options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject list(String index) throws org.json.JSONException, KuzzleException { - return list(index, null); - } - - public org.json.JSONObject getMapping(String index, String collection, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res =_getMapping(index, collection, options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject getMapping(String index, String collection) throws org.json.JSONException, KuzzleException { - return getMapping(index, collection, null); - } - - public void updateMapping(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - updateMapping(index, collection, body.toString(), options); - } - - public void updateMapping(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - updateMapping(index, collection, body, null); - } - - public org.json.JSONObject getSpecifications(String index, String collection, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _getSpecifications(index, collection, options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject getSpecifications(String index, String collection) throws org.json.JSONException, KuzzleException { - return getSpecifications(index, collection, null); - } - - public org.json.JSONObject updateSpecifications(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _updateSpecifications(index, collection, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject updateSpecifications(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return updateSpecifications(index, collection, body, null); - } - - public boolean validateSpecifications(org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - return validateSpecifications(body.toString(), options); - } - - public boolean validateSpecifications(org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return validateSpecifications(body, null); - } - -%} diff --git a/internal/wrappers/templates/android/json_wrap/document.i b/internal/wrappers/templates/android/json_wrap/document.i deleted file mode 100644 index 08cf4432..00000000 --- a/internal/wrappers/templates/android/json_wrap/document.i +++ /dev/null @@ -1,168 +0,0 @@ -%javamethodmodifiers kuzzleio::Document::count(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::count(const std::string& index, const std::string& collection, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::createOrReplace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::deleteByQuery(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::deleteByQuery(const std::string& index, const std::string& collection, const std::string& body) "private"; -%rename (_get) kuzzleio::Document::get(const std::string& index, const std::string& collection, const std::string& id, query_options *options); -%rename (_get) kuzzleio::Document::get(const std::string& index, const std::string& collection, const std::string& id); -%javamethodmodifiers kuzzleio::Document::get(const std::string& index, const std::string& collection, const std::string& id, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::get(const std::string& index, const std::string& collection, const std::string& id) "private"; -%javamethodmodifiers kuzzleio::Document::replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::replace(const std::string& index, const std::string& collection, const std::string& id, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::update(const std::string& index, const std::string& collection, const std::string& id, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::validate(const std::string& index, const std::string& collection, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::search(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::search(const std::string& index, const std::string& collection, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::mCreate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::mCreate(const std::string& index, const std::string& collection, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::mCreateOrReplace(const std::string& index, const std::string& collection, const std::string& body) "private"; -%rename (_mGet) kuzzleio::Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options); -%rename (_mGet) kuzzleio::Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash); -%javamethodmodifiers kuzzleio::Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::mGet(const std::string& index, const std::string& collection, const std::vector& ids, bool includeTrash) "private"; -%javamethodmodifiers kuzzleio::Document::mReplace(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::mReplace(const std::string& index, const std::string& collection, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Document::mUpdate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Document::mUpdate(const std::string& index, const std::string& collection, const std::string& body) "private"; - -%typemap(javacode) kuzzleio::Document %{ - - public int count(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - return count(index, collection, body.toString(), options); - } - - public int count(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return count(index, collection, body, null); - } - - public org.json.JSONObject create(String index, String collection, String id, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = create(index, collection, id, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject create(String index, String collection, String id, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return create(index, collection, id, body, null); - } - - public org.json.JSONObject createOrReplace(String index, String collection, String id, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = createOrReplace(index, collection, id, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject createOrReplace(String index, String collection, String id, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return createOrReplace(index, collection, id, body, null); - } - - public StringVector deleteByQuery(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - return deleteByQuery(index, collection, body.toString(), options); - } - - public StringVector deleteByQuery(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return deleteByQuery(index, collection, body, null); - } - - public org.json.JSONObject get(String index, String collection, String id, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _get(index, collection, id, options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject get(String index, String collection, String id) throws org.json.JSONException, KuzzleException { - return get(index, collection, id, null); - } - - public org.json.JSONObject replace(String index, String collection, String id, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = replace(index, collection, id, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject replace(String index, String collection, String id, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return replace(index, collection, id, body, null); - } - - public org.json.JSONObject update(String index, String collection, String id, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = update(index, collection, id, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject update(String index, String collection, String id, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return update(index, collection, id, body, null); - } - - public boolean validate(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - return validate(index, collection, body.toString(), options); - } - - public boolean validate(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return validate(index, collection, body, null); - } - - public SearchResult search(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - return search(index, collection, body.toString(), options); - } - - public SearchResult search(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return search(index, collection, body, null); - } - - public org.json.JSONObject mCreate(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = mCreate(index, collection, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject mCreate(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return mCreate(index, collection, body, null); - } - - public org.json.JSONObject mCreateOrReplace(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = mCreateOrReplace(index, collection, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject mCreateOrReplace(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return mCreateOrReplace(index, collection, body, null); - } - - public org.json.JSONObject mGet(String index, String collection, StringVector ids, boolean includeTrash, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _mGet(index, collection, ids, includeTrash, options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject mGet(String index, String collection, StringVector ids, boolean includeTrash) throws org.json.JSONException, KuzzleException { - return mGet(index, collection, ids, includeTrash, null); - } - - public org.json.JSONObject mReplace(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = mReplace(index, collection, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject mReplace(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return mReplace(index, collection, body, null); - } - - public org.json.JSONObject mUpdate(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = mUpdate(index, collection, body.toString(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject mUpdate(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return mUpdate(index, collection, body, null); - } - -%} diff --git a/internal/wrappers/templates/android/json_wrap/kuzzle.i b/internal/wrappers/templates/android/json_wrap/kuzzle.i deleted file mode 100644 index 58d83d02..00000000 --- a/internal/wrappers/templates/android/json_wrap/kuzzle.i +++ /dev/null @@ -1,7 +0,0 @@ -%rename (_emitEvent) kuzzleio::Kuzzle::emitEvent(Event& event, const std::string& body); - -%typemap(javacode) kuzzleio::Kuzzle %{ - public void emitEvent(Event event, org.json.JSONObject body) throws org.json.JSONException { - _emitEvent(event, body.toString()); - } -%} \ No newline at end of file diff --git a/internal/wrappers/templates/android/json_wrap/listeners.i b/internal/wrappers/templates/android/json_wrap/listeners.i deleted file mode 100644 index aaf32760..00000000 --- a/internal/wrappers/templates/android/json_wrap/listeners.i +++ /dev/null @@ -1,48 +0,0 @@ -%define TYPEMAP_DIRECTOR_INPUT(JNI, CppType, JavaType, JNITypeFrom, JNITypeTo) - %typemap(jni) CppType JNI - %typemap(jtype) CppType JavaType - %typemap(jstype) CppType JavaType - %typemap(javain) CppType "$javainput" - %typemap(in) CppType {} - %typemap(javadirectorin) CppType "$jniinput"; - %typemap(directorin, descriptor="L"JNITypeTo";", noblock=1) CppType { - if ($input) { - const jclass clazz = JCALL1(FindClass, jenv, JNITypeTo); - jmethodID methodID = jenv->GetMethodID(clazz, "", "(L"JNITypeFrom";)V"); - jobject a = jenv->NewObject(clazz, methodID, $input); - if (!a) return $null; - $input = a; - } else { - $input = NULL; - } - Swig::LocalRefGuard $1_refguard(jenv, $input); - } - %apply CppType { CppType }; -%enddef - - -/********************************************/ -/* EventListener */ -/********************************************/ - -TYPEMAP_DIRECTOR_INPUT("jobject", const std::string& jsonResponse, "org.json.JSONObject", "java/lang/String", "org/json/JSONObject") - - -/********************************************/ -/* NotificationListener */ -/********************************************/ - -%ignore kuzzleio::Realtime::getListener(const std::string& roomId); -%typemap(jni) char* kuzzleio::notification_content::content "jstring" -%typemap(jstype) char* kuzzleio::notification_content::content "org.json.JSONObject" - -%typemap(javaout) char* kuzzleio::notification_content::content { - org.json.JSONObject res = null; - try { - res = new org.json.JSONObject($jnicall); - } catch (org.json.JSONException e) { - throw new RuntimeException(e); - } - - return res; - } \ No newline at end of file diff --git a/internal/wrappers/templates/android/json_wrap/realtime.i b/internal/wrappers/templates/android/json_wrap/realtime.i deleted file mode 100644 index 8a020f2d..00000000 --- a/internal/wrappers/templates/android/json_wrap/realtime.i +++ /dev/null @@ -1,47 +0,0 @@ -%rename (_list) kuzzleio::Realtime::list(const std::string& index, const std::string& collection, query_options *options); -%rename (_list) kuzzleio::Realtime::list(const std::string& index, const std::string& collection); -%javamethodmodifiers kuzzleio::Realtime::list(const std::string& index, const std::string& collection, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Realtime::list(const std::string& index, const std::string& collection) "private"; -%javamethodmodifiers kuzzleio::Realtime::publish(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Realtime::publish(const std::string& index, const std::string& collection, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Realtime::subscribe(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Realtime::subscribe(const std::string& index, const std::string& collection, const std::string& body) "private"; -%javamethodmodifiers kuzzleio::Realtime::validate(const std::string& index, const std::string& collection, const std::string& body, query_options *options) "private"; -%javamethodmodifiers kuzzleio::Realtime::validate(const std::string& index, const std::string& collection, const std::string& body) "private"; - -%typemap(javacode) kuzzleio::Realtime %{ - - public org.json.JSONObject list(String index, String collection, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _list(index, collection, options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject list(String index, String collection) throws org.json.JSONException, KuzzleException { - return list(index, collection, null); - } - - public void publish(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - publish(index, collection, body.toString(), options); - } - - public void publish(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - publish(index, collection, body, null); - } - - public String subscribe(String index, String collection, org.json.JSONObject body, NotificationListener cb, RoomOptions options) throws org.json.JSONException, KuzzleException { - return subscribe(index, collection, body.toString(), cb, options); - } - - public String subscribe(String index, String collection, org.json.JSONObject body, NotificationListener cb) throws org.json.JSONException, KuzzleException { - return subscribe(index, collection, body, cb, null); - } - - public boolean validate(String index, String collection, org.json.JSONObject body, QueryOptions options) throws org.json.JSONException, KuzzleException { - return validate(index, collection, body.toString(), options); - } - - public boolean validate(String index, String collection, org.json.JSONObject body) throws org.json.JSONException, KuzzleException { - return validate(index, collection, body, null); - } -%} \ No newline at end of file diff --git a/internal/wrappers/templates/android/json_wrap/server.i b/internal/wrappers/templates/android/json_wrap/server.i deleted file mode 100644 index f6431bec..00000000 --- a/internal/wrappers/templates/android/json_wrap/server.i +++ /dev/null @@ -1,97 +0,0 @@ -%rename (_getAllStats) kuzzleio::Server::getAllStats(query_options *options); -%rename (_getAllStats) kuzzleio::Server::getAllStats(); -%javamethodmodifiers kuzzleio::Server::getAllStats(query_options *options) "private"; -%javamethodmodifiers kuzzleio::Server::getAllStats() "private"; -%rename (_getStats) kuzzleio::Server::getStats(time_t start, time_t end, query_options* options); -%rename (_getStats) kuzzleio::Server::getAllStats(time_t start, time_t end); -%javamethodmodifiers kuzzleio::Server::getStats(time_t start, time_t end, query_options* options) "private"; -%javamethodmodifiers kuzzleio::Server::getStats(time_t start, time_t end) "private"; -%rename (_getLastStats) kuzzleio::Server::getLastStats(query_options *options); -%rename (_getLastStats) kuzzleio::Server::getLastStats(); -%javamethodmodifiers kuzzleio::Server::getLastStats(query_options *options) "private"; -%javamethodmodifiers kuzzleio::Server::getLastStats() "private"; -%rename (_getConfig) kuzzleio::Server::getConfig(query_options *options); -%rename (_getConfig) kuzzleio::Server::getConfig(); -%javamethodmodifiers kuzzleio::Server::getConfig(query_options *options) "private"; -%javamethodmodifiers kuzzleio::Server::getConfig() "private"; -%rename (_info) kuzzleio::Server::info(query_options *options); -%rename (_info) kuzzleio::Server::info(); -%javamethodmodifiers kuzzleio::Server::info(query_options *options) "private"; -%javamethodmodifiers kuzzleio::Server::info() "private"; -%rename (_now) kuzzleio::Server::now(query_options*); -%rename (_now) kuzzleio::Server::now(); -%javamethodmodifiers kuzzleio::Server::now(query_options* options) "private"; -%javamethodmodifiers kuzzleio::Server::now() "private"; - -%typemap(javacode) kuzzleio::Server %{ - public org.json.JSONObject getAllStats(QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _getAllStats(options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject getAllStats() throws org.json.JSONException, KuzzleException { - return getAllStats(null); - } - - public org.json.JSONObject getStats(java.util.Date start, java.util.Date end, QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _getStats(start.getTime(), end.getTime(), options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject getStats(java.util.Date start, java.util.Date end) throws org.json.JSONException, KuzzleException { - return getStats(start, end, null); - } - - public org.json.JSONObject getLastStats(QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _getLastStats(options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject getLastStats() throws org.json.JSONException, KuzzleException { - return getLastStats(null); - } - - public org.json.JSONObject getConfig(QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _getConfig(options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject getConfig() throws org.json.JSONException, KuzzleException { - return getConfig(null); - } - - public org.json.JSONObject info(QueryOptions options) throws org.json.JSONException, KuzzleException { - String res = _info(options); - - return new org.json.JSONObject(res); - } - - public org.json.JSONObject info() throws org.json.JSONException, KuzzleException { - return info(null); - } - - /** - * {@link #now(QueryOptions)} - */ - public java.util.Date now() { - long res = _now(); - - return new java.util.Date(res); - } - - /** - * Returns the current Kuzzle UTC timestamp - * - * @param options - Request options - * @return a Date - */ - public java.util.Date now(QueryOptions options) { - long res = _now(options); - - return new java.util.Date(res); - } -%} \ No newline at end of file diff --git a/internal/wrappers/templates/android/kcore.i b/internal/wrappers/templates/android/kcore.i deleted file mode 100644 index 8cc40fe6..00000000 --- a/internal/wrappers/templates/android/kcore.i +++ /dev/null @@ -1,30 +0,0 @@ -/* File : kcore.i */ - -%module(directors="1") kuzzlesdk -%{ -#include "exceptions.hpp" -#include "event_emitter.hpp" -#include "kuzzle.hpp" -#include "collection.hpp" -#include "index.hpp" -#include "server.hpp" -#include "document.hpp" -#include "realtime.hpp" -#include "auth.hpp" -#include -%} - -%define _Complex -%enddef - -%include "kuzzlesdk.h" -%include "kuzzle.h" -%include "exceptions.hpp" -%include "event_emitter.hpp" -%include "kuzzle.hpp" -%include "collection.hpp" -%include "index.hpp" -%include "server.hpp" -%include "document.hpp" -%include "realtime.hpp" -%include "auth.hpp" diff --git a/internal/wrappers/templates/android/typemap.i b/internal/wrappers/templates/android/typemap.i deleted file mode 100644 index 95255358..00000000 --- a/internal/wrappers/templates/android/typemap.i +++ /dev/null @@ -1,35 +0,0 @@ -%include - -%typemap(jni) std::string* "jobject" -%typemap(jtype) std::string* "java.lang.String" -%typemap(jstype) std::string* "java.lang.String" -%typemap(javain) std::string* "$javainput" -%typemap(in) std::string * (std::string strTemp) { - jobject oInput = $input; - if (oInput != NULL) { - jstring sInput = static_cast( oInput ); - - const char * $1_pstr = (const char *)jenv->GetStringUTFChars(sInput, 0); - if (!$1_pstr) return $null; - strTemp.assign( $1_pstr ); - jenv->ReleaseStringUTFChars( sInput, $1_pstr); - $1 = &strTemp; - } else { - $1 = NULL; - } -} -%apply std::string * { std::string* }; - - -%typemap(jni) Event& "jobject" -%typemap(jtype) Event& "Event" -%typemap(jstype) Event& "Event" -%typemap(javain) Event& "$javainput" -%typemap(in) Event& (Event tmp) { - jmethodID swigValueMethod = jenv->GetMethodID(jenv->GetObjectClass($input), "swigValue", "()I"); - jint swigValue = jenv->CallIntMethod($input, swigValueMethod, 0); - - Event e = (Event)swigValue; - $1 = &e; -} -%apply Event& event { Event& event }; diff --git a/internal/wrappers/templates/csharp/core.i b/internal/wrappers/templates/csharp/core.i deleted file mode 100644 index 7e7f8a7b..00000000 --- a/internal/wrappers/templates/csharp/core.i +++ /dev/null @@ -1,77 +0,0 @@ -%rename(TokenValidity) token_validity; -%rename(AckResponse) ack_response; -%rename(queueTTL) queue_ttl; -%rename(Options, match="class") options; -%rename(QueryOptions) query_options; -%rename(JsonObject) json_object; -%rename(JsonResult) json_result; -%rename(LoginResult) login_result; -%rename(BoolResult) bool_result; -%rename(Statistics) statistics; -%rename(AllStatisticsResult) all_statistics_result; -%rename(StatisticsResult) statistics_result; -%rename(CollectionsList) collection_entry; -%rename(CollectionsListResult) collection_entry_result; -%rename(StringArrayResult) string_array_result; -%rename(KuzzleResponse) kuzzle_response; -%rename(KuzzleRequest) kuzzle_request; -%rename(ShardsResult) shards_result; -%rename(DateResult) date_result; -%rename(UserData) user_data; -%rename(User, match="class") user; -%rename(RoomOptions) room_options; -%rename(SearchFilters) search_filters; -%rename(SearchResult) search_result; -%rename(NotificationResult) notification_result; -%rename(NotificationContent) notification_content; -%rename(SubscribeToSelf) subscribe_to_self; -%rename(Mapping, match="class") mapping; - -%rename(_auth, match="class") auth; -%rename(_kuzzle, match="class") kuzzle; -%rename(_realtime, match="class") realtime; -%rename(_collection, match="class") collection; -%rename(_document, match="class") document; -%rename(_server, match="class") server; - -%ignore *::error; -%ignore *::status; -%ignore *::stack; - -%feature("director") NotificationListener; -%feature("director") EventListener; -%feature("director") SubscribeListener; - -%{ -#include "kuzzle.cpp" -#include "collection.cpp" -#include "auth.cpp" -#include "index.cpp" -#include "server.cpp" -#include "document.cpp" -#include "realtime.cpp" - -#define SWIG_FILE_WITH_INIT -%} - -%include "stl.i" -%include "kcore.i" - -%extend options { - options() { - options *o = kuzzle_new_options(); - return o; - } - - ~options() { - free($self); - } -} - -%include "kuzzle.cpp" -%include "collection.cpp" -%include "document.cpp" -%include "realtime.cpp" -%include "auth.cpp" -%include "index.cpp" -%include "server.cpp" diff --git a/internal/wrappers/templates/csharp/kcore.i b/internal/wrappers/templates/csharp/kcore.i deleted file mode 100644 index 2b88794b..00000000 --- a/internal/wrappers/templates/csharp/kcore.i +++ /dev/null @@ -1,32 +0,0 @@ -/* File : kcore.i */ - -%module(directors="1") kuzzlesdk -%{ -#include "listeners.hpp" -#include "exceptions.hpp" -#include "event_emitter.hpp" -#include "kuzzle.hpp" -#include "collection.hpp" -#include "index.hpp" -#include "server.hpp" -#include "document.hpp" -#include "realtime.hpp" -#include "auth.hpp" -#include -%} - -%define _Complex -%enddef - -%include "kuzzlesdk.h" -%include "kuzzle.h" -%include "listeners.hpp" -%include "exceptions.hpp" -%include "event_emitter.hpp" -%include "kuzzle.hpp" -%include "collection.hpp" -%include "index.hpp" -%include "server.hpp" -%include "document.hpp" -%include "realtime.hpp" -%include "auth.hpp" diff --git a/internal/wrappers/templates/csharp/test.cs b/internal/wrappers/templates/csharp/test.cs deleted file mode 100644 index 054280f3..00000000 --- a/internal/wrappers/templates/csharp/test.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using Kuzzleio; - -public class Example -{ - public static Kuzzle k; - - public static void Main() - { - k = new Kuzzle("localhost", null); - k.server.now(); - } -} \ No newline at end of file diff --git a/internal/wrappers/templates/java/common.i b/internal/wrappers/templates/java/common.i deleted file mode 100644 index 7e8e30e2..00000000 --- a/internal/wrappers/templates/java/common.i +++ /dev/null @@ -1,125 +0,0 @@ -%rename(TokenValidity) token_validity; -%rename(AckResponse) ack_response; -%rename(queueTTL) queue_ttl; -%rename(Options, match="class") options; -%rename(QueryOptions) query_options; -%rename(JsonObject) json_object; -%rename(JsonResult) json_result; -%rename(LoginResult) login_result; -%rename(BoolResult) bool_result; -%rename(Statistics) statistics; -%rename(AllStatisticsResult) all_statistics_result; -%rename(StatisticsResult) statistics_result; -%rename(CollectionsList) collection_entry; -%rename(CollectionsListResult) collection_entry_result; -%rename(StringArrayResult) string_array_result; -%rename(KuzzleResponse) kuzzle_response; -%rename(KuzzleRequest) kuzzle_request; -%rename(ShardsResult) shards_result; -%rename(DateResult) date_result; -%rename(UserData) user_data; -%rename(User, match="class") kuzzle_user; -%rename(RoomOptions) room_options; -%rename(SearchFilters) search_filters; -%rename(SearchResult) search_result; -%rename(NotificationResult) notification_result; -%rename(NotificationContent) notification_content; -%rename(SubscribeToSelf) subscribe_to_self; - -%rename(TokenValidity) token_validity; -%rename(AckResponse) ack_response; -%rename(queueTTL) queue_ttl; -%rename(Options, match="class") options; -%rename(QueryOptions) query_options; -%rename(JsonObject) json_object; -%rename(JsonResult) json_result; -%rename(LoginResult) login_result; -%rename(BoolResult) bool_result; -%rename(Statistics) statistics; -%rename(AllStatisticsResult) all_statistics_result; -%rename(StatisticsResult) statistics_result; -%rename(CollectionsList) collection_entry; -%rename(CollectionsListResult) collection_entry_result; -%rename(StringArrayResult) string_array_result; -%rename(KuzzleResponse) kuzzle_response; -%rename(KuzzleRequest) kuzzle_request; -%rename(ShardsResult) shards_result; -%rename(DateResult) date_result; -%rename(UserData) user_data; -%rename(User, match="class") user; -%rename(RoomOptions) room_options; -%rename(SearchFilters) search_filters; -%rename(SearchResult) search_result; -%rename(NotificationResult) notification_result; -%rename(NotificationContent) notification_content; -%rename(SubscribeToSelf) subscribe_to_self; - -// struct options -%rename(queueMaxSize) queue_max_size; -%rename(offlineMode) offline_mode; -%rename(autoQueue) auto_queue; -%rename(autoReconnect) auto_reconnect; -%rename(autoReplay) auto_replay; -%rename(autoReplay) auto_replay; -%rename(autoResubscribe) auto_resubscribe; -%rename(reconnectionDelay) reconnection_delay; -%rename(replayInterval) replay_interval; - -// struct query_options -%rename(scrollId) scroll_id; -%rename(ifExist) if_exist; -%rename(retryOnConflict) retry_on_conflict; - -// struct kuzzle_request -%rename(membersLength) members_length; -%rename(keysLength) keys_length; -%rename(fieldsLength) fields_length; - -// struct role -%rename(profileIds) profile_ids; -%rename(profileIdsLength) profile_ids_length; - -// struct notification_result -%rename(nType) n_type; -%rename(roomId) room_id; - -// struct statistics -%rename(completedRequests) completed_requests; -%rename(failedRequests) failed_requests; -%rename(ongoingRequests) ongoing_requests; - -// struct token_validity -%rename(expiresAt) expires_at; - -// struct kuzzle_response -%rename(requestId) request_id; -%rename(roomId) room_id; - -%rename(delete) delete_; - -%ignore *::error; -%ignore *::stack; - - -%include "std_string.i" - - -%{ -#include "collection.cpp" -#include "auth.cpp" -#include "index.cpp" -#include "server.cpp" -#include "document.cpp" -%} - -%ignore getListener; -%ignore getListeners; - -%include "std_function.i" -%std_function(NotificationListener, void, onMessage, const kuzzleio::notification_result*); -%std_function(EventListener, void, trigger, const std::string); - -%{ -#include "kuzzle.cpp" -#include "realtime.cpp" -%} diff --git a/internal/wrappers/templates/java/core.i b/internal/wrappers/templates/java/core.i deleted file mode 100644 index 9a21c08d..00000000 --- a/internal/wrappers/templates/java/core.i +++ /dev/null @@ -1,74 +0,0 @@ -%include "common.i" - -%include "exceptions.i" -%include "std_string.i" -%include "typemap.i" -%include "kcore.i" - -%include "std_vector.i" - -%include "javadoc/kuzzle.i" -%include "javadoc/document.i" -%include "javadoc/room.i" -%include "javadoc/collection.i" - -typedef long long time_t; - -%template(StringVector) std::vector; - -%typemap(out) const StringVector& %{ - return $1; -%} - -%pragma(java) jniclasscode=%{ - static { - try { - System.loadLibrary("kuzzle-wrapper-java"); - } catch (UnsatisfiedLinkError e) { - try { - java.io.InputStream inputStream = kuzzlesdk.class.getResourceAsStream("/libkuzzle-wrapper-java.so"); - java.nio.file.Path path = java.nio.file.FileSystems.getDefault().getPath("").toAbsolutePath(); - String sharedObject = path.toString() + "/libs/libkuzzle-wrapper-java.so"; - - try { - java.io.File folder = new java.io.File(path.toString() + "/libs/"); - folder.mkdir(); - } catch(Exception ee) {} - - java.io.OutputStream outputStream = new java.io.FileOutputStream(new java.io.File(sharedObject)); - - int read = 0; - byte[] bytes = new byte[1024]; - - while ((read = inputStream.read(bytes)) != -1) { - outputStream.write(bytes, 0, read); - } - - System.load(path.toString() + "/libs/libkuzzle-wrapper-java.so"); - } catch (Exception ex) { - System.err.println("Native code library failed to load. \n"); - ex.printStackTrace(); - System.exit(1); - } - } - } -%} - -%extend kuzzleio::options { - options() { - options *o = kuzzle_new_options(); - return o; - } - - ~options() { - free($self); - } -} - -%include "kuzzle.cpp" -%include "collection.cpp" -%include "document.cpp" -%include "realtime.cpp" -%include "auth.cpp" -%include "index.cpp" -%include "server.cpp" diff --git a/internal/wrappers/templates/java/exceptions.i b/internal/wrappers/templates/java/exceptions.i deleted file mode 100644 index 4b40de4c..00000000 --- a/internal/wrappers/templates/java/exceptions.i +++ /dev/null @@ -1,31 +0,0 @@ -%define CATCH(cppException, JNIException) - catch (cppException &e) { - jclass clazz = jenv->FindClass(JNIException); - jenv->ThrowNew(clazz, e.what()); - return $null; - } -%enddef - -%javaexception("io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, - io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, - io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, - io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, - io.kuzzle.sdk.SizeLimitException, io.kuzzle.sdk.UnauthorizedException, - io.kuzzle.sdk.KuzzleException") { - try { - $action - } CATCH (kuzzleio::BadRequestException, "io/kuzzle/sdk/BadRequestException") - CATCH (kuzzleio::ForbiddenException, "io/kuzzle/sdk/ForbiddenException") - CATCH (kuzzleio::GatewayTimeoutException, "io/kuzzle/sdk/GatewayTimeoutException") - CATCH (kuzzleio::InternalException, "io/kuzzle/sdk/InternalException") - CATCH (kuzzleio::NotFoundException, "io/kuzzle/sdk/NotFoundException") - CATCH (kuzzleio::PartialException, "io/kuzzle/sdk/PartialException") - CATCH (kuzzleio::PreconditionException, "io/kuzzle/sdk/PreconditionException") - CATCH (kuzzleio::ServiceUnavailableException, "io/kuzzle/sdk/ServiceUnavailableException") - CATCH (kuzzleio::SizeLimitException, "io/kuzzle/sdk/SizeLimitException") - CATCH (kuzzleio::UnauthorizedException, "io/kuzzle/sdk/UnauthorizedException") - CATCH (kuzzleio::KuzzleException, "io/kuzzle/sdk/KuzzleException") -} - - -%typemap(javabase) kuzzleio::KuzzleException "java.lang.RuntimeException"; diff --git a/internal/wrappers/templates/java/javadoc/collection.i b/internal/wrappers/templates/java/javadoc/collection.i deleted file mode 100644 index 274027d3..00000000 --- a/internal/wrappers/templates/java/javadoc/collection.i +++ /dev/null @@ -1,261 +0,0 @@ -%typemap(javaimports) kuzzleio::Collection " -/* The type Collection. */" - -%javamethodmodifiers kuzzleio::Collection::Collection(Kuzzle *kuzzle, const std::string& collection, const std::string& index) " - /** - * Constructor - * - * @param kuzzle Kuzzle instance - * @param collection Data collection name - * @param index Parent data index name - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::count(search_filters* filters, query_options* options) " - /** - * Returns the number of documents matching the provided set of filters. - * There is a small delay between documents creation and their existence in our search layer, - * usually a couple of seconds. - * That means that a document that was just been created won’t be returned by this function - * - * @param filters Search filters - * @param options Request options - * @returns the number of documents - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::count(search_filters* filters) " - /** - * {@link #count(SearchFilters filters, QueryOptions options)} - */ - public"; - - -%javamethodmodifiers kuzzleio::Collection::deleteDocument(const std::string& id, query_options* options) " - /** - * Delete a single document - * - * @param id Document unique identifier - * @param options Request options - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::deleteDocument(const std::string& id) " - /** - * {@link #deleteDocument(String id, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::fetchDocument(const std::string& id, query_options* options) " - /** - * Fetch a document from Kuzzle - * - * @param id Document unique identifier - * @param options Request options - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::fetchDocument(const std::string& id) " - /** - * {@link #fetchDocument(String id, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mCreateDocument(std::vector& documents, query_options* options) " - /** - * Create multiple documents - * - * @param documents List of Document objects to create - * @param options Request options - * @return a list of all document created - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mCreateDocument(std::vector& documents) " - /** - * {@link #mCreateDocument(DocumentVector documents, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mCreateOrReplaceDocument(std::vector& documents, query_options* options) " - /** - * Create or replace multiple documents - * - * @param documents Array of Document objects to create or replace - * @param options Request options - * @return a list of all created or updated documents - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mCreateOrReplaceDocument(std::vector& documents) " - /** - * {@link #mCreateOrReplaceDocument(DocumentVector documents, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mDeleteDocument(std::vector& ids, query_options* options) " - /** - * Delete multiple documents using their unique IDs - * - * @param ids Array of document IDs to delete - * @param options Request options - * @return a list of all deleted ids's documents - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mDeleteDocument(std::vector& ids) " - /** - * {@link #mDeleteDocument(StringVector ids, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mGetDocument(std::vector& ids, query_options* options) " - /** - * Fetch multiple documents - * - * @param ids Array of document IDs to get - * @param options Request options - * @return a list of Documents - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mGetDocument(std::vector& ids) " - /** - * {@link #mGetDocument(StringVector ids, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mReplaceDocument(std::vector& documents, query_options* options) " - /** - * Replace multiple documents - * - * @param documents Array of Document objects to replace - * @param options Request options - * @return a list of all updated documents - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mReplaceDocument(std::vector& documents) " - /** - * {@link #mReplaceDocument(DocumentVector documents, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mUpdateDocument(std::vector& documents, query_options* options) " - /** - * Update multiple documents - * - * @param documents Array of Document objects to replace - * @param options Request options - * @return a list of all updated documents - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::mUpdateDocument(std::vector& documents) " - /** - * {@link #mUpdateDocument(DocumentVector documents, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::publishMessage(json_object* content, query_options* options) " - /** - * Publish a real-time message - * - * @param content Content to publish - * @param options Request options - * @return boolean - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::publishMessage(json_object* content) " - /** - * {@link #publishMessage(JsonObject content, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::replaceDocument(const std::string& id, Document* document, query_options* options) " - /** - * Replace an existing document with a new one. - * - * @param id Document unique identifier - * @param document New document - * @param options Request options - * @return the document - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::replaceDocument(const std::string& id, Document* document) " - /** - * {@link #replaceDocument(String id, Document document, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::scroll(const std::string& id, query_options* options) " - /** - * Gets the next page of results from a previous search or scroll request - * - * @param id Scroll unique identifier - * @param options Request options - * @returns a SearchResult - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::scroll(const std::string& id) " - /** - * {@link #scroll(String id, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::search(search_filters* filters, query_options* options) " - /** - * Executes a search on the data collection. - * /!\ There is a small delay between documents creation and their existence in our search layer, - * usually a couple of seconds. - * That means that a document that was just been created won’t be returned by this function. - * - * @param filters Search filters to apply - * @param options Request options - * @returns a SearchResult - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::search(search_filters* filters) " - /** - * {@link #search(SearchFilters filters, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::subscribe(search_filters* filters, NotificationListener *listener, room_options* options) " - /** - * Subscribes to this data collection with a set of Kuzzle DSL filters. - * - * @param filters Subscription filters - * @param options Request options - * @param listener Response callback listener - * @return an object with a onDone() callback triggered when the subscription is active - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::subscribe(search_filters* filters, NotificationListener *listener) " - /** - * {@link #subscribe(SearchFilters filters, NotificationListener listeners)} - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::updateDocument(const std::string& id, Document *document, query_options* options) " - /** - * Update parts of a document - * - * @param id Document unique identifier - * @param content Document content to update - * @param options Request options - * @return the document - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::updateDocument(const std::string& id, Document *document) " - /** - * {@link #updateDocument(String id, Document document)} - */ - public"; diff --git a/internal/wrappers/templates/java/javadoc/document.i b/internal/wrappers/templates/java/javadoc/document.i deleted file mode 100644 index b1340c97..00000000 --- a/internal/wrappers/templates/java/javadoc/document.i +++ /dev/null @@ -1,170 +0,0 @@ -%typemap(javaimports) kuzzleio::Document " -/* The type Document. */" - -%javamethodmodifiers kuzzleio::Document::Document(Collection *collection, const std::string& id, json_object* content) " - /** - * Kuzzle handles documents either as real-time messages or as stored documents. - * Document is the object representation of one of these documents. - * - * @param collection - An instantiated Collection object - * @param id - Unique document identifier - * @param content - The content of the document - */ - public"; - -%javamethodmodifiers kuzzleio::Document::Document(Collection *collection, const std::string& id) " - /** - * Kuzzle handles documents either as real-time messages or as stored documents. - * Document is the object representation of one of these documents. - * - * @param collection - An instantiated Collection object - * @param id - Unique document identifier - */ - public"; - -%javamethodmodifiers kuzzleio::Document::Document(Collection *collection) " - /** - * Kuzzle handles documents either as real-time messages or as stored documents. - * Document is the object representation of one of these documents. - * - * @param collection - An instantiated Collection object - */ - public"; - - -%javamethodmodifiers kuzzleio::Document::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body="", query_options *options) " - /** - * Create a new document in kuzzle - * - * @param index the index where to create the document - * @param collection the collection where to create the document - * @param id the document id - * @param body the content of the document - * @param options Request options - * @return document id - */ - public"; - -%javamethodmodifiers kuzzleio::Collection::create(const std::string& index, const std::string& collection, const std::string& id, const std::string& body="") " - /** - * {@link #create(String index, String collection, String id, String body, QueryOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Document::delete_(query_options *) " - /** - * Delete this document from Kuzzle - * - * @param options - Request options - * @return string - id of the deleted document - */ - public"; - -%javamethodmodifiers kuzzleio::Document::delete_() " - /** - * {@link #delete_(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Document::exists(query_options *) " - /** - * Ask Kuzzle if this document exists - * - * @param options - Request options - * @return bool - */ - public"; - -%javamethodmodifiers kuzzleio::Document::exists() " - /** - * {@link #exists(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Document::publish(query_options *) " - /** - * Sends the content of this document as a real-time message. - * - * @param options - Request options - * @return bool - */ - public"; - -%javamethodmodifiers kuzzleio::Document::publish() " - /** - * {@link #publish(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Document::refresh(query_options* options) " - /** - * Gets a refreshed copy of this document from Kuzzle - * - * @param options - Request options - * @return Document - refreshed document - */ - public"; - -%javamethodmodifiers kuzzleio::Document::refresh() " - /** - * {@link #refresh(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Document::save(query_options* options) " - /** - * Saves this document into Kuzzle. - * If this is a new document, this function will create it in Kuzzle and the id property will be made available. - * Otherwise, this method will replace the latest version of this document in Kuzzle by the current content of this object. - * - * @param options - Request options - * @return Document - saved document - */ - public"; - -%javamethodmodifiers kuzzleio::Document::save() " - /** - * {@link #save(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Document::setContent(json_object* content, bool replace) " - /** - * Sets this document content - * - * @param content - New content for this document - * @param replace - true: replace the current content, false (default): update/append it - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Document::setContent(json_object* content) " - /** - * {@link #setContent(JsonObject, boolean)} - */ - public"; - -%javamethodmodifiers kuzzleio::Document::getContent() " - /** - * Document content getter - * - * @return current document content - */ - public"; - -%javamethodmodifiers kuzzleio::Document::subscribe(NotificationListener* listener, room_options* options) " - /** - * Subscribe to changes occuring on this document. - * Throws an error if this document has not yet been created in Kuzzle. - * - * @param options - Room object constructor options - * @param listener - Response callback listener - * @return a Room - */ - public"; - -%javamethodmodifiers kuzzleio::Document::subscribe(NotificationListener* cb) " - /** - * {@link #subscribe(NotificationListener listener, room_options options)} - */ - public"; diff --git a/internal/wrappers/templates/java/javadoc/kuzzle.i b/internal/wrappers/templates/java/javadoc/kuzzle.i deleted file mode 100644 index ef77b959..00000000 --- a/internal/wrappers/templates/java/javadoc/kuzzle.i +++ /dev/null @@ -1,541 +0,0 @@ -%typemap(javaimports) kuzzleio::Kuzzle " -/* The type Kuzzle. */" - -%javamethodmodifiers kuzzleio::Kuzzle::Kuzzle(const std::string&) " - /** - * Constructor - * - * @param host - Target Kuzzle host name or IP address - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::Kuzzle(const std::string&, options*) " - /** - * Constructor - * - * @param host - Target Kuzzle host name or IP address - * @param options - Request options - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::checkToken(const std::string& token) " - /** - * Check an authentication token validity - * - * @param token - Token to check (JWT) - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a TokenValidity object - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::connect() " - /** - * Connects to a Kuzzle instance using the provided host and port. - * - * @return a string which represent an error or null - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::createIndex(const std::string&, query_options*) " - /** - * Create a new data index - * - * @param index - index name to create - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a BoolResult object - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::createIndex(const std::string&) " - /** - * {@link #createIndex(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::createMyCredentials(const std::string&, json_object*, query_options*) " - /** - * Create credentials of the specified strategy for the current user. - * - * @param strategy - impacted strategy name - * @param credentials - credentials to create - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a JsonResult object - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::createMyCredentials(const std::string&, json_object*) " - /** - * {@link #createIndex(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::deleteMyCredentials(const std::string&, query_options*) " - /** - * Delete credentials of the specified strategy for the current user. - * - * @param strategy- Name of the strategy to remove - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a BoolResult object - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::deleteMyCredentials(const std::string&) " - /** - * {@link #deleteMyCredentials(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getMyCredentials(const std::string& strategy, query_options *options) " - /** - * Get credential information of the specified strategy for the current user. - * - * @param strategy - Strategy name to get - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a JsonResult - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getMyCredentials(const std::string& strategy) " - /** - * {@link #getMyCredentials(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::updateMyCredentials(const std::string& strategy, json_object* credentials, query_options *options) " - /** - * Update credentials of the specified strategy for the current user. - * - * @param strategy - Strategy name to update - * @param credentials - Updated credentials content - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a JsonResult - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::updateMyCredentials(const std::string& strategy, json_object* credentials) " - /** - * {@link #updateMyCredentials(String, JsonObject, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::validateMyCredentials(const std::string& strategy, json_object* credentials, query_options* options) " - /** - * Validate credentials of the specified strategy for the current user. - * - * @param strategy - Strategy name to validate - * @param credentials - Credentials content - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a Bool result - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::validateMyCredentials(const std::string& strategy, json_object* credentials) " - /** - * {@link #validateMyCredentials(String, JsonObject, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::logout() " - /** - * Logout method - * - * @param listener - Response callback listener - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::login(const std::string&, json_object*, int) " - /** - * Log-in Strategy name to use for the authentication - * - * @param strategy - Strategy name to use for the authentication - * @param credentials - Login credentials - * @param expiresIn - Token expiration delay - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return StringResult - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::login(const std::string&, json_object*) " - /** - * Log-in Strategy name to use for the authentication - * - * @param strategy - Strategy name to use for the authentication - * @param credentials - Login credentials - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::login(const std::string&) " - /** - * Log-in Strategy name to use for the authentication - * - * @param strategy - Strategy name to use for the authentication - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::login(const std::string&) " - /** - * Get all Kuzzle usage statistics frames - * - * @param options - Request options - * @param listener - Response callback listener - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getAllStatistics(query_options*) " - /** - * Get all Kuzzle usage statistics frames - * - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a AllStatisticsResult - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getAllStatistics() " - /** - * {@link #getAllStatistics(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getStatistics(unsigned long, query_options*) " - /** - * Get Kuzzle usage statistics - * - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a StatisticsResult - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getStatistics(unsigned long) " - /** - * {@link #getStatistics(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getAutoRefresh(const std::string&, query_options*) " - /** - * Gets the autoRefresh value for the provided data index name - * - * @param index - Data index name - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getAutoRefresh(const std::string&) " - /** - * {@link #getAutoRefresh(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getAutoRefresh() " - /** - * {@link #getAutoRefresh(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getJwt() " - /** - * Authentication token getter - * - * @return a string which is the jwt - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getMyRights(query_options*) " - /** - * Gets the rights array for the currently logged user. - * - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a JsonResult - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getMyRights() " - /** - * {@link #getMyRights(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getServerInfo(query_options*) " - /** - * Gets server info. - * - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * #return a JsonResult - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getServerInfo() " - /** - * {@link #getServerInfo(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::listCollections(const std::string&, query_options*) " - /** - * List data collections - * - * @param index - Parent data index name - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a CollectionListResult - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::listCollections(const std::string&) " - /** - * {@link #listCollections(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::listCollections() " - /** - * {@link #listCollections(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::listIndexes(query_options*) " - /** - * List data indexes - * - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::listIndexes() " - /** - * {@link #listIndexes(QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::disconnect() " - /** - * Disconnect from Kuzzle and invalidate this instance. - * Does not fire a disconnected event. - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::logout() " - /** - * Logout method - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::removeListener(enum Event) " - /** - * Removes a listener from an event. - * - * @param event - Event name - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::query(kuzzle_request*, query_options*) " - /** - * This is a low-level method, exposed to allow advanced SDK users to bypass high-level methods. - * Base method used to send queries to Kuzzle - * - * @param query - Query content - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return a KuzzleResponse - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::query(kuzzle_request*) " - /** - * {@link #query(KuzzleRequest, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::refreshIndex(const std::string& index, query_options* options) " - /** - * Forces the default data index to refresh on each modification - * - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::refreshIndex(const std::string& index) " - /** - * {@link #refreshIndex(String, QueryOptions)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::removeListener(enum Event) " - /** - * Removes a listener from an event. - * - * @param event - Event name - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::playQueue() " - /** - * Replays the requests queued during offline mode. - * Works only if the SDK is not in a disconnected state, and if the autoReplay option is set to false. - * - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::setAutoReplay(bool autoReplay) " - /** - * autoReplay option setter - * - * @param autoReplay - New autoReplay option value - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::setJwt(const std::string& jwt) " - /** - * Set a new JWT and trigger the 'loginAttempt' event. - * - * @param jwt - New authentication JSON Web Token - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::startQueuing() " - /** - * Starts the requests queuing. Works only during offline mode, and if the autoQueue option is set to false. - * - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::stopQueuing() " - /** - * Stops the requests queuing. Works only during offline mode, and if the autoQueue option is set to false. - * - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::unsetJwt() " - /** - * Unset the authentication token and cancel all subscriptions - * - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::updateSelf(user_data* content, query_options* options) " - /** - * Update the currently authenticated user informations - * - * @param content - Current user infos to update - * @param options - Request options - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - * @return updated user - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::updateSelf(user_data* content) " - /** - * {@link #updateSelf(UserData, Options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::whoAmI() " - /** - * Retrieves current user information - * - * @param listener - Response callback listener - * @throws io.kuzzle.sdk.BadRequestException, io.kuzzle.sdk.ForbiddenException, io.kuzzle.sdk.GatewayTimeoutException, io.kuzzle.sdk.InternalException, io.kuzzle.sdk.NotFoundException, io.kuzzle.sdk.PartialException, io.kuzzle.sdk.PreconditionException, io.kuzzle.sdk.ServiceUnavailableException, io.kuzzle.sdk.UnauthorizedException - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::flushQueue() " - /** - * Empties the offline queue without replaying it. - * - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::getVolatile() " - /** - * Global volatile data getter - * - * @return Global volatile data - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::setVolatile(json_object* volatiles) " - /** - * Global volatile data setter - * - * @param volatiles - New global volatile data content - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::addListener(Event event, EventListener* listener) " - /** - * Adds a listener to a Kuzzle global event. When an event is triggered, - * listeners are called in the order of their insertion. - * - * @param event - Name of the global event to subscribe to - * @param listener - Response callback listener - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::removeListener(Event event, EventListener* listener) " - /** - * Removes a listener from an event. - * - * @param event - Event name - * @param listener - Response callback listener - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::removeAllListeners(Event event) " - /** - * Removes all listeners, either from all events - * - * @param event - Event name - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Kuzzle::once(Event event, EventListener* listener) " - /** - * Adds a one time listener to an event. - * The next time the event is triggered, the listener is removed and then invoked. - * - * @param event - Event name - * @param listener - Response callback listener - * @return this - */ - public"; - - %javamethodmodifiers kuzzleio::Kuzzle::listenerCount(Event event) " - /** - * Returns the number of callbacks who listen to an event. - * - * @param event - Event name - * @return this - */ - public"; diff --git a/internal/wrappers/templates/java/javadoc/room.i b/internal/wrappers/templates/java/javadoc/room.i deleted file mode 100644 index 82da9d64..00000000 --- a/internal/wrappers/templates/java/javadoc/room.i +++ /dev/null @@ -1,59 +0,0 @@ -%typemap(javaimports) kuzzleio::Room " -/* The type Room. */" - -%javamethodmodifiers kuzzleio::Room::Room(Collection *collection, json_object* filters, room_options* options) " - /** - * The Room object is the result of a subscription request, allowing to manipulate the subscription itself. - * - * @param collection - An instantiated Collection object - * @param filters - Subscription filters - * @param options - Subscription options - */ - public"; - -%javamethodmodifiers kuzzleio::Room::Room(Collection *collection, json_object* filters) " - /** - * {@link #Room(Collection collection, JsonObject filters, RoomOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Room::Room(Collection *collection) " - /** - * {@link #Room(Collection collection, JsonObject filters, RoomOptions options)} - */ - public"; - -%javamethodmodifiers kuzzleio::Room::count() " - /** - * Returns the number of other subscriptions on that room. - * - * @returns the number of subscription - */ - public"; - -%javamethodmodifiers kuzzleio::Room::onDone(SubscribeListener* listener) " - /** - * Calls the provided callback when the subscription finishes. - * - * @params SubscribeListener - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Room::subscribe(NotificationListener* listener) " - /** - * Subscribes using the filters provided at the object creation. - * - * @params NotificationListener - * @return this - */ - public"; - -%javamethodmodifiers kuzzleio::Room::unsubscribe() " - /** - * Subscribes using the filters provided at the object creation. - * - * @params Cancels the current subscription. - * @return this - */ - public"; \ No newline at end of file diff --git a/internal/wrappers/templates/java/kcore.i b/internal/wrappers/templates/java/kcore.i deleted file mode 100644 index 8cc40fe6..00000000 --- a/internal/wrappers/templates/java/kcore.i +++ /dev/null @@ -1,30 +0,0 @@ -/* File : kcore.i */ - -%module(directors="1") kuzzlesdk -%{ -#include "exceptions.hpp" -#include "event_emitter.hpp" -#include "kuzzle.hpp" -#include "collection.hpp" -#include "index.hpp" -#include "server.hpp" -#include "document.hpp" -#include "realtime.hpp" -#include "auth.hpp" -#include -%} - -%define _Complex -%enddef - -%include "kuzzlesdk.h" -%include "kuzzle.h" -%include "exceptions.hpp" -%include "event_emitter.hpp" -%include "kuzzle.hpp" -%include "collection.hpp" -%include "index.hpp" -%include "server.hpp" -%include "document.hpp" -%include "realtime.hpp" -%include "auth.hpp" diff --git a/internal/wrappers/templates/java/std_function.i b/internal/wrappers/templates/java/std_function.i deleted file mode 100644 index f613d289..00000000 --- a/internal/wrappers/templates/java/std_function.i +++ /dev/null @@ -1,97 +0,0 @@ -%{ - #include -%} - -#define param(num,type) $typemap(jstype,type) arg ## num -#define unpack(num,type) arg##num -#define lvalref(num,type) type&& arg##num -#define forward(num,type) std::forward(arg##num) - -// Iterate over MACRO Variadic -// https://stackoverflow.com/questions/1872220/is-it-possible-to-iterate-over-arguments-in-variadic-macros/11994395#11994395 -#define FE_0(...) -#define FE_1(action,a1) action(0,a1) -#define FE_2(action,a1,a2) action(0,a1), action(1,a2) -#define FE_3(action,a1,a2,a3) action(0,a1), action(1,a2), action(2,a3) -#define FE_4(action,a1,a2,a3,a4) action(0,a1), action(1,a2), action(2,a3), action(3,a4) -#define FE_5(action,a1,a2,a3,a4,a5) action(0,a1), action(1,a2), action(2,a3), action(3,a4), action(4,a5) - -#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME -%define FOR_EACH(action,...) - GET_MACRO(__VA_ARGS__, FE_5, FE_4, FE_3, FE_2, FE_1, FE_0)(action,__VA_ARGS__) -%enddef - -%define %std_function(Name, Ret, AbstractMethodName, ...) - -%feature("director") Name##Impl; -%typemap(javaclassmodifiers) Name##Impl "abstract class"; - -%{ - struct Name##Impl { - virtual ~Name##Impl() {} - virtual Ret AbstractMethodName(__VA_ARGS__) = 0; - }; -%} - -%javamethodmodifiers Name##Impl::AbstractMethodName "abstract protected"; -%typemap(javaout) Ret Name##Impl::AbstractMethodName ";" - -%typemap(javaclassmodifiers) std::function "public abstract class" -%javamethodmodifiers std::function::operator() "public abstract" -%typemap(javaout) Ret std::function::operator() ";" - -struct Name##Impl { - virtual ~Name##Impl(); -protected: - virtual Ret AbstractMethodName(__VA_ARGS__) = 0; -}; - -%typemap(maybereturn) SWIGTYPE "return "; -%typemap(maybereturn) void ""; - -%typemap(javain) std::function, std::function* "$javaclassname.getCPtr($javaclassname.makeNative($javainput))" -%typemap(javacode) std::function %{ - public Name() { - wrapper = new Name##Impl(){ - public $typemap(jstype, Ret) AbstractMethodName(FOR_EACH(param, __VA_ARGS__)) { - $typemap(maybereturn, Ret)Name.this.AbstractMethodName(FOR_EACH(unpack, __VA_ARGS__)); - } - }; - proxy = new $javaclassname(wrapper){ - public $typemap(jstype, Ret) AbstractMethodName(FOR_EACH(param, __VA_ARGS__)) { - $typemap(maybereturn, Ret)Name.this.AbstractMethodName(FOR_EACH(unpack, __VA_ARGS__)); - } - }; - } - - static $javaclassname makeNative($javaclassname in) { - if (null == in.wrapper) return in; - return in.proxy; - } - - private Name##Impl wrapper; - private $javaclassname proxy; -%} - -%rename(Name) std::function; -%rename(AbstractMethodName) std::function::operator(); - -namespace std { - struct function { - function(const std::function&); - - Ret operator()(__VA_ARGS__) const; - - function(Ret(*const)(__VA_ARGS__)); - - %extend { - function(Name##Impl *in) { - return new std::function([=](FOR_EACH(lvalref,__VA_ARGS__)){ - return in->AbstractMethodName(FOR_EACH(forward,__VA_ARGS__)); - }); - } - } - }; -} - -%enddef \ No newline at end of file diff --git a/internal/wrappers/templates/java/typemap.i b/internal/wrappers/templates/java/typemap.i deleted file mode 100644 index ce568c42..00000000 --- a/internal/wrappers/templates/java/typemap.i +++ /dev/null @@ -1,48 +0,0 @@ -%rename (_now) kuzzleio::Server::now(query_options*); -%rename (_now) kuzzleio::Server::now(); - -%javamethodmodifiers kuzzleio::Server::now(query_options* options) "private"; -%javamethodmodifiers kuzzleio::Server::now() "private"; -%typemap(javacode) kuzzleio::Server %{ - /** - * {@link #now(QueryOptions)} - * @return java.util.Date - */ - public java.util.Date now() { - long res = _now(); - - return new java.util.Date(res); - } - - /** - * Returns the current Kuzzle UTC timestamp - * - * @param options - Request options - * @return a DateResult - */ - public java.util.Date now(QueryOptions options) { - long res = _now(options); - - return new java.util.Date(res); - } -%} - -%typemap(jni) std::string* "jobject" -%typemap(jtype) std::string* "java.lang.String" -%typemap(jstype) std::string* "java.lang.String" -%typemap(javain) std::string* "$javainput" -%typemap(in) std::string * (std::string strTemp) { - jobject oInput = $input; - if (oInput != NULL) { - jstring sInput = static_cast( oInput ); - - const char * $1_pstr = (const char *)jenv->GetStringUTFChars(sInput, 0); - if (!$1_pstr) return $null; - strTemp.assign( $1_pstr ); - jenv->ReleaseStringUTFChars( sInput, $1_pstr); - $1 = &strTemp; - } else { - $1 = NULL; - } -} -%apply std::string * { std::string* }; diff --git a/internal/wrappers/templates/python/core.i b/internal/wrappers/templates/python/core.i deleted file mode 100644 index ac04f8d9..00000000 --- a/internal/wrappers/templates/python/core.i +++ /dev/null @@ -1,69 +0,0 @@ -%rename(TokenValidity) token_validity; -%rename(AckResponse) ack_response; -%rename(queueTTL) queue_ttl; -%rename(Options, match="class") options; -%rename(QueryOptions) query_options; -%rename(JsonObject) json_object; -%rename(JsonResult) json_result; -%rename(LoginResult) login_result; -%rename(BoolResult) bool_result; -%rename(Statistics) statistics; -%rename(AllStatisticsResult) all_statistics_result; -%rename(StatisticsResult) statistics_result; -%rename(CollectionsList) collection_entry; -%rename(CollectionsListResult) collection_entry_result; -%rename(StringArrayResult) string_array_result; -%rename(KuzzleResponse) kuzzle_response; -%rename(KuzzleRequest) kuzzle_request; -%rename(ShardsResult) shards_result; -%rename(DateResult) date_result; -%rename(UserData) user_data; -%rename(User, match="class") user; -%rename(RoomOptions) room_options; -%rename(SearchFilters) search_filters; -%rename(SearchResult) search_result; -%rename(NotificationResult) notification_result; -%rename(NotificationContent) notification_content; -%rename(SubscribeToSelf) subscribe_to_self; - -%ignore *::error; -%ignore *::status; -%ignore *::stack; - -%feature("director") NotificationListener; -%feature("director") EventListener; -%feature("director") SubscribeListener; - -%{ -#include "kuzzle.cpp" -#include "collection.cpp" -#include "auth.cpp" -#include "index.cpp" -#include "server.cpp" -#include "document.cpp" -#include "realtime.cpp" - -#define SWIG_FILE_WITH_INIT -%} - -%include "stl.i" -%include "kcore.i" - -%extend options { - options() { - options *o = kuzzle_new_options(); - return o; - } - - ~options() { - free($self); - } -} - -%include "kuzzle.cpp" -%include "collection.cpp" -%include "document.cpp" -%include "realtime.cpp" -%include "auth.cpp" -%include "index.cpp" -%include "server.cpp" diff --git a/internal/wrappers/templates/python/kcore.i b/internal/wrappers/templates/python/kcore.i deleted file mode 100644 index 2b88794b..00000000 --- a/internal/wrappers/templates/python/kcore.i +++ /dev/null @@ -1,32 +0,0 @@ -/* File : kcore.i */ - -%module(directors="1") kuzzlesdk -%{ -#include "listeners.hpp" -#include "exceptions.hpp" -#include "event_emitter.hpp" -#include "kuzzle.hpp" -#include "collection.hpp" -#include "index.hpp" -#include "server.hpp" -#include "document.hpp" -#include "realtime.hpp" -#include "auth.hpp" -#include -%} - -%define _Complex -%enddef - -%include "kuzzlesdk.h" -%include "kuzzle.h" -%include "listeners.hpp" -%include "exceptions.hpp" -%include "event_emitter.hpp" -%include "kuzzle.hpp" -%include "collection.hpp" -%include "index.hpp" -%include "server.hpp" -%include "document.hpp" -%include "realtime.hpp" -%include "auth.hpp" diff --git a/internal/wrappers/templates/python/setup.py b/internal/wrappers/templates/python/setup.py deleted file mode 100644 index 3de4f3a6..00000000 --- a/internal/wrappers/templates/python/setup.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -""" -setup.py file for SWIG example -""" - -import os -from distutils.core import setup, Extension - -cwd = os.path.dirname(os.path.realpath(__file__)) -kuzzle_module = Extension('_kcore', - sources=[ cwd + '/kcore_wrap.cxx' ], - swig_opts=['-c++', '-py3'] - ) - -setup (name = 'kcore', - version = '1.0', - author = "Kuzzle", - description = """Kuzzle sdk""", - ext_modules = [kuzzle_module], - py_modules = ["kcore"], - ) diff --git a/internal/wrappers/templates/python/test.py b/internal/wrappers/templates/python/test.py deleted file mode 100644 index 5d817a26..00000000 --- a/internal/wrappers/templates/python/test.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python - -import kcore -from kcore import Kuzzle - -kuzzle = Kuzzle("localhost") - -print(kuzzle) -print(kuzzle.server.now()) \ No newline at end of file From 24f912e94a978082ecd62595d4a05981c54ce240 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 28 Sep 2018 10:59:57 +0200 Subject: [PATCH 319/363] remove ci dependencies --- .ci/setup_and_test.sh | 10 --- .codepipeline/builds/amd64.yml | 14 ---- .codepipeline/builds/android.yml | 9 --- .codepipeline/builds/armv7.yml | 9 --- .codepipeline/builds/i386.yml | 14 ---- .codepipeline/deploys/amd64.yml | 9 --- .codepipeline/deploys/i386.yml | 9 --- .codepipeline/docker-compose.yml | 29 ------- .codepipeline/snapshots/amd64.yml | 10 --- .codepipeline/snapshots/snapshots.sh | 86 --------------------- .codepipeline/start_kuzzle.sh | 12 --- .codepipeline/tests/amd64.yml | 14 ---- .codepipeline/tests/golang.yml | 18 ----- .codepipeline/tests/i386.yml | 14 ---- .travis.yml | 57 ++------------ README.md | 109 --------------------------- 16 files changed, 7 insertions(+), 416 deletions(-) delete mode 100755 .ci/setup_and_test.sh delete mode 100644 .codepipeline/builds/amd64.yml delete mode 100644 .codepipeline/builds/android.yml delete mode 100644 .codepipeline/builds/armv7.yml delete mode 100644 .codepipeline/builds/i386.yml delete mode 100644 .codepipeline/deploys/amd64.yml delete mode 100644 .codepipeline/deploys/i386.yml delete mode 100644 .codepipeline/docker-compose.yml delete mode 100644 .codepipeline/snapshots/amd64.yml delete mode 100644 .codepipeline/snapshots/snapshots.sh delete mode 100644 .codepipeline/start_kuzzle.sh delete mode 100644 .codepipeline/tests/amd64.yml delete mode 100644 .codepipeline/tests/golang.yml delete mode 100644 .codepipeline/tests/i386.yml diff --git a/.ci/setup_and_test.sh b/.ci/setup_and_test.sh deleted file mode 100755 index 93135dc6..00000000 --- a/.ci/setup_and_test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -set -e - -mkdir -p /root/go/src/github.com/kuzzleio/sdk-go -cp -fr /mnt/* /root/go/src/github.com/kuzzleio/sdk-go/ -cd /root/go/src/github.com/kuzzleio/sdk-go/ -go get ./... -./test.sh -cp -fr /root/go/src/github.com/kuzzleio/sdk-go/.cover /mnt/ -cd /mnt diff --git a/.codepipeline/builds/amd64.yml b/.codepipeline/builds/amd64.yml deleted file mode 100644 index 882700ca..00000000 --- a/.codepipeline/builds/amd64.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/sdk-cross:amd64 - build: - commands: - - docker run -a stdout -a stderr --net host --rm --privileged --name build-machine -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /build.sh -artifacts: - files: - - '**/*' - - '.codepipeline/*' - base-directory: '${CODEBUILD_SRC_DIR}' diff --git a/.codepipeline/builds/android.yml b/.codepipeline/builds/android.yml deleted file mode 100644 index e71d372b..00000000 --- a/.codepipeline/builds/android.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/sdk-cross:android-x86 - build: - commands: - - docker run -a stdout -a stderr --net host --rm --privileged --name build-machine -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:android-x86 /build.sh diff --git a/.codepipeline/builds/armv7.yml b/.codepipeline/builds/armv7.yml deleted file mode 100644 index 5fd330f1..00000000 --- a/.codepipeline/builds/armv7.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/sdk-cross:builder-armv7 - build: - commands: - - docker run --rm --name build-machine -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:armv7-builder /build.sh diff --git a/.codepipeline/builds/i386.yml b/.codepipeline/builds/i386.yml deleted file mode 100644 index 088005c9..00000000 --- a/.codepipeline/builds/i386.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/sdk-cross:i386 - build: - commands: - - docker run -a stdout -a stderr --net host --rm --privileged --name build-machine -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:i386 /build.sh -artifacts: - files: - - '**/*' - - '.codepipeline/*' - base-directory: '${CODEBUILD_SRC_DIR}' diff --git a/.codepipeline/deploys/amd64.yml b/.codepipeline/deploys/amd64.yml deleted file mode 100644 index 0518e806..00000000 --- a/.codepipeline/deploys/amd64.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/sdk-cross:amd64 - build: - commands: - - docker run -a stdout -a stderr --privileged --rm --net host --name deploy-machine -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /deploy.sh diff --git a/.codepipeline/deploys/i386.yml b/.codepipeline/deploys/i386.yml deleted file mode 100644 index 6f01c20b..00000000 --- a/.codepipeline/deploys/i386.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/sdk-cross:i386 - build: - commands: - - docker run -a stdout -a stderr --privileged --rm --net host --name deploy-machine -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:i386 /deploy.sh diff --git a/.codepipeline/docker-compose.yml b/.codepipeline/docker-compose.yml deleted file mode 100644 index 4e8befb8..00000000 --- a/.codepipeline/docker-compose.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '2' - -services: - kuzzle: - image: kuzzleio/kuzzle - ports: - - "7512:7512" - cap_add: - - SYS_PTRACE - depends_on: - - redis - - elasticsearch - container_name: kuzzle - environment: - - kuzzle_services__db__client__host=http://elasticsearch:9200 - - kuzzle_services__internalCache__node__host=redis - - kuzzle_services__memoryStorage__node__host=redis - - NODE_ENV=production - - redis: - image: redis:3.2 - - elasticsearch: - image: kuzzleio/elasticsearch:5.4.1 - ulimits: - nofile: 65536 - environment: - - cluster.name=kuzzle - - "ES_JAVA_OPTS=-Xms256m -Xmx256m" diff --git a/.codepipeline/snapshots/amd64.yml b/.codepipeline/snapshots/amd64.yml deleted file mode 100644 index 689bb035..00000000 --- a/.codepipeline/snapshots/amd64.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - apt update && apt install figlet - build: - commands: - - bash .codepipeline/snapshots/snapshots.sh - - aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTION_ID --paths "/*" diff --git a/.codepipeline/snapshots/snapshots.sh b/.codepipeline/snapshots/snapshots.sh deleted file mode 100644 index 8f1b190e..00000000 --- a/.codepipeline/snapshots/snapshots.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash - -set -e - -dirs=(java cpp c) - - -function snap_java() { - cd internal/wrappers/build/java/build/libs - newname="kuzzlesdk-java.jar" - s3_dest="s3://$AWS_S3_BUCKET/sdk/$dest_dir$pr_name/$newname" - mv kuzzlesdk-1.0.0.jar $newname - - if [[ $TRAVIS_PULL_REQUEST -ne false ]]; then - aws s3 cp $newname $s3_dest --expires "$(date -d '+2 weeks' --utc +'%Y-%m-%dT%H:%M:%SZ')" - else - aws s3 cp $newname $s3_dest - fi - - cd - -} - -function snap_c() { - cd internal/wrappers/build/c - newname="libkuzzlesdk-c.so" - s3_dest="s3://$AWS_S3_BUCKET/sdk/$dest_dir$pr_name/kuzzlesdk-c.tar.gz" - mv libkuzzlesdk.so $newname - mkdir lib include - cp ../../headers/*.h include - cp $newname lib/ - tar cfz kuzzlesdk-c.tar.gz lib include - - if [[ $TRAVIS_PULL_REQUEST -ne false ]]; then - aws s3 cp kuzzlesdk-c.tar.gz $s3_dest --expires "$(date -d '+2 weeks' --utc +'%Y-%m-%dT%H:%M:%SZ')" - else - aws s3 cp kuzzlesdk-c.tar.gz $s3_dest - fi - - cd - -} - -function snap_cpp() { - cd internal/wrappers/build/cpp - newname="libkuzzlesdk.so" - s3_dest="s3://$AWS_S3_BUCKET/sdk/$dest_dir$pr_name/kuzzlesdk-cpp.tar.gz" - mv libcpp.so $newname - mkdir lib include - cp ../../headers/* include - cp $newname lib/ - tar cfz kuzzlesdk-cpp.tar.gz lib include - - if [[ $TRAVIS_PULL_REQUEST -ne false ]]; then - aws s3 cp kuzzlesdk-cpp.tar.gz $s3_dest --expires "$(date -d '+2 weeks' --utc +'%Y-%m-%dT%H:%M:%SZ')" - else - aws s3 cp kuzzlesdk-cpp.tar.gz $s3_dest - fi - - cd - -} - - -if [[ -z $TRAVIS_PULL_REQUEST ]]; then - export dest_dir="nightly" -else - pr_num="$(echo $TRAVIS_PULL_REQUEST_BRANCH | cut -d- -f2)" - dir_name="KZL-$pr_num" - export pr_name="/$dir_name" - export dest_dir="snapshots" -fi - -for dir in ${dirs[@]}; do - echo -e "\n----------------------------------------------------------------\n" - figlet "$dir SDK Snapshot" - echo -e "\n----------------------------------------------------------------\n" - - - snap_$dir - - if [[ $? -ne 0 ]]; then - exit 1 - fi -done - -if [[ $? -eq 0 ]]; then - aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTION_ID --paths "/*" -fi diff --git a/.codepipeline/start_kuzzle.sh b/.codepipeline/start_kuzzle.sh deleted file mode 100644 index f50fa847..00000000 --- a/.codepipeline/start_kuzzle.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -e -# Download and launch custom Kuzzle stack - -docker-compose -f .codepipeline/docker-compose.yml up -d - -printf 'Waiting for Kuzzle stack to be up and running' - -until $(curl --output /dev/null --silent --head --fail http://localhost:7512); do - printf '.' - sleep 5 -done diff --git a/.codepipeline/tests/amd64.yml b/.codepipeline/tests/amd64.yml deleted file mode 100644 index 990fdfe3..00000000 --- a/.codepipeline/tests/amd64.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/sdk-cross:amd64 - - sysctl -w vm.max_map_count=262144 - - bash .codepipeline/start_kuzzle.sh - build: - commands: - - docker run -a stdout -a stderr --privileged --rm --network codepipeline_default --link kuzzle --name test-machine -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /test.sh - post_build: - commands: - - docker kill codepipeline_elasticsearch_1 codepipeline_redis_1 kuzzle diff --git a/.codepipeline/tests/golang.yml b/.codepipeline/tests/golang.yml deleted file mode 100644 index 46320eb0..00000000 --- a/.codepipeline/tests/golang.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - cp -fr ./* /go/src/github.com/kuzzleio/sdk-go/ - - cd /go/src/github.com/kuzzleio/sdk-go - - go get ./... - build: - commands: - - gofmt -l . - - gofmt -l ./internal/wrappers - - for d in $(go list ./... | grep -v vendor); do go test -timeout 1m -covermode=count "$d"; done -artifacts: - files: - - '**/*' - - '.codepipeline/*' - base-directory: '${CODEBUILD_SRC_DIR}' diff --git a/.codepipeline/tests/i386.yml b/.codepipeline/tests/i386.yml deleted file mode 100644 index a5b83fc8..00000000 --- a/.codepipeline/tests/i386.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 0.2 - -phases: - install: - commands: - - docker pull kuzzleio/sdk-cross:i386 - - sysctl -w vm.max_map_count=262144 - - bash .codepipeline/start_kuzzle.sh - build: - commands: - - docker run -a stdout -a stderr --privileged --rm --network codepipeline_default --link kuzzle --name test-machine -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:i386 /test.sh - post_build: - commands: - - docker kill codepipeline_elasticsearch_1 codepipeline_redis_1 kuzzle diff --git a/.travis.yml b/.travis.yml index 546a9a99..8828f362 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,55 +1,12 @@ os: linux dist: trusty -language: minimal -sudo: required +language: go +go: + - 1.10 -services: - - docker +install: + - go get ./... -after_success: - - bash <(curl -s https://codecov.io/bash) - -matrix: - include: -# --------------------------------------------- -# AMD64: Build and Test -# --------------------------------------------- - - env: - - ARCH="amd64" - - script: - # Build - - docker run --rm -it -v "$(pwd)":/mnt kuzzleio/sdk-cross:golang ./.ci/setup_and_test.sh - -# --------------------------------------------- -# I386: Build and Test -# --------------------------------------------- - - env: - - ARCH="i386" - - script: - # Build - - docker run --rm -it -v "$(pwd)":/mnt kuzzleio/sdk-cross:golang-i386 ./.ci/setup_and_test.sh - -# --------------------------------------------- -# ARMV7: Build and Test -# --------------------------------------------- - - env: - - ARCH="armhf" - - script: - # Build - - docker run --rm --privileged multiarch/qemu-user-static:register - - docker run --rm -it -v "$(pwd)":/mnt kuzzleio/sdk-cross:armhf-golang-runner taskset -c 1 ./.ci/setup_and_test.sh - -# --------------------------------------------- -# ARMV8: Build and Test -# --------------------------------------------- - - env: - - ARCH="aarch64" - - script: - # Build - - docker run --rm --privileged multiarch/qemu-user-static:register - - docker run --rm -it -v "$(pwd)":/mnt kuzzleio/sdk-cross:aarch64-golang-runner taskset -c 1 ./.ci/setup_and_test.sh +script: + - ./test.sh \ No newline at end of file diff --git a/README.md b/README.md index 285d394f..609cc21a 100644 --- a/README.md +++ b/README.md @@ -61,115 +61,6 @@ You can also get html coverage by running ```sh ./test.sh --html ``` -### e2e tests - -#### JAVA - -```sh -cd internal/wrappers -make java -cd features/java -gradle cucumber -``` - -#### C++ - -```sh -make cpp -cd internal/wrappers -./build_cpp_tests.sh̀ -./_build_cpp_tests/KuzzleSDKStepDefs > /dev/null & -cucumber -``` - - - -## Wrappers - -### Dependencies - -Before generating the wrappers you will need to install: - -- You will need a g++ compatible C++11 -- [swig](www.swig.org) -- [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) (don't forget to set your JAVA_HOME environment variable) -- Python You will need to install python-dev to compile the python SDK - -### Generate - -## JAVA - -```sh -make java -``` - -You will find the final jars files in `internal/wrappers/build/java/build/libs` - -## CPP - -```sh -make cpp -``` -You will find the final .so file in `internal/wrappers/build/cpp` - -## Python -```sh -make python -``` -You will find the final .so file in `internal/wrappers/build/python` - -## CSHARP - -### Build on Windows - -#### Prerequisites -- Visual Studio 2017 -- Windows SDK -- Go - https://golang.org/doc/install -- Mono (x64) - https://www.mono-project.com/download/stable/ -- Make (GNU - Windows) - http://gnuwin32.sourceforge.net/packages/make.htm -- MinGW (x64 - Posix) - https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/ - -#### Compiling Csharp -- Add Go/Mono/Make/MinGW intallation directory to PATH -- Run Visual Studio developper command line tool -- Execute `make csharp` - -## All at once - -You can generate all sdk's at once by typing - -```sh -make all -``` - -## Generate wrappers and launch e2e tests using Docker - -You can use Docker to simplify wrappers generation and testing - -### Build - -In project root, use: - -```bash -$ docker run --rm -it -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /build.sh -``` - -This command will build all wrappers using our Docker Image - -### Testing - -E2E tests need a running Kuzzle instance so run the script: - -```bash -$ sh .codepipeline/start_kuzzle.sh -``` - -Now run tests using Docker: - -```bash -$ docker run --rm -it --network codepipeline_default --link kuzzle -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /test.sh -``` ## License From 61bf831ab5bad09b2eb8d6ce2e66dde7acd142a3 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 28 Sep 2018 11:02:26 +0200 Subject: [PATCH 320/363] update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8828f362..e7622c77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ language: go go: - 1.10 -install: - - go get ./... +before_install: + - go get -u ./... script: - ./test.sh \ No newline at end of file From 71fa3abeccf1e0ea84dfd4bacb1c84a015207652 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 28 Sep 2018 11:31:19 +0200 Subject: [PATCH 321/363] fix ci --- .ci/setup_and_test.sh | 10 ++++++++ .travis.yml | 57 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 7 deletions(-) create mode 100755 .ci/setup_and_test.sh diff --git a/.ci/setup_and_test.sh b/.ci/setup_and_test.sh new file mode 100755 index 00000000..ee884b87 --- /dev/null +++ b/.ci/setup_and_test.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -e + +mkdir -p /root/go/src/github.com/kuzzleio/sdk-go +cp -fr /mnt/* /root/go/src/github.com/kuzzleio/sdk-go/ +cd /root/go/src/github.com/kuzzleio/sdk-go/ +go get ./... +./test.sh +cp -fr /root/go/src/github.com/kuzzleio/sdk-go/.cover /mnt/ +cd /mnt \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index e7622c77..ab77ab98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,55 @@ os: linux dist: trusty -language: go -go: - - 1.10 +language: minimal +sudo: required -before_install: - - go get -u ./... +services: + - docker -script: - - ./test.sh \ No newline at end of file +after_success: + - bash <(curl -s https://codecov.io/bash) + +matrix: + include: +# --------------------------------------------- +# AMD64: Build and Test +# --------------------------------------------- + - env: + - ARCH="amd64" + + script: + # Build + - docker run --rm -it -v "$(pwd)":/mnt kuzzleio/sdk-cross:golang ./.ci/setup_and_test.sh + +# --------------------------------------------- +# I386: Build and Test +# --------------------------------------------- + - env: + - ARCH="i386" + + script: + # Build + - docker run --rm -it -v "$(pwd)":/mnt kuzzleio/sdk-cross:golang-i386 ./.ci/setup_and_test.sh + +# --------------------------------------------- +# ARMV7: Build and Test +# --------------------------------------------- + - env: + - ARCH="armhf" + + script: + # Build + - docker run --rm --privileged multiarch/qemu-user-static:register + - docker run --rm -it -v "$(pwd)":/mnt kuzzleio/sdk-cross:armhf-golang-runner taskset -c 1 ./.ci/setup_and_test.sh + +# --------------------------------------------- +# ARMV8: Build and Test +# --------------------------------------------- + - env: + - ARCH="aarch64" + + script: + # Build + - docker run --rm --privileged multiarch/qemu-user-static:register + - docker run --rm -it -v "$(pwd)":/mnt kuzzleio/sdk-cross:aarch64-golang-runner taskset -c 1 ./.ci/setup_and_test.sh \ No newline at end of file From 3af0037ea1230a4b14d038bf30dff5c53551e7b2 Mon Sep 17 00:00:00 2001 From: jenow Date: Fri, 28 Sep 2018 11:46:22 +0200 Subject: [PATCH 322/363] stop linting internal/wrappers --- test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test.sh b/test.sh index 4a297305..52616fde 100755 --- a/test.sh +++ b/test.sh @@ -37,7 +37,6 @@ linter_check() { cd "$dir" linter_check . -linter_check ./internal/wrappers generate_cover_data show_cover_report func From a8a94532bf09c244426a6eeac2bac1aa14233d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Tue, 2 Oct 2018 17:05:55 +0200 Subject: [PATCH 323/363] document.mCreatexx - take an array of documents --- document/mCreate.go | 10 +++++++--- document/mCreateOrReplace.go | 10 +++++++--- document/mCreateOrReplace_test.go | 2 +- document/mCreate_test.go | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/document/mCreate.go b/document/mCreate.go index 13da8ecd..1732c01c 100644 --- a/document/mCreate.go +++ b/document/mCreate.go @@ -21,7 +21,7 @@ import ( ) // MCreate creates the provided documents. -func (d *Document) MCreate(index string, collection string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { +func (d *Document) MCreate(index string, collection string, documents json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Document.MCreate: index required", 400) } @@ -30,18 +30,22 @@ func (d *Document) MCreate(index string, collection string, body json.RawMessage return nil, types.NewError("Document.MCreate: collection required", 400) } - if body == nil { + if documents == nil { return nil, types.NewError("Document.MCreate: body required", 400) } ch := make(chan *types.KuzzleResponse) + type body struct { + Documents json.RawMessage `json:"documents"` + } + query := &types.KuzzleRequest{ Index: index, Collection: collection, Controller: "document", Action: "mCreate", - Body: body, + Body: &body{documents}, } go d.Kuzzle.Query(query, options, ch) diff --git a/document/mCreateOrReplace.go b/document/mCreateOrReplace.go index ea134e6f..4ddfa295 100644 --- a/document/mCreateOrReplace.go +++ b/document/mCreateOrReplace.go @@ -21,7 +21,7 @@ import ( ) // MCreateOrReplace creates or replaces the provided documents. -func (d *Document) MCreateOrReplace(index string, collection string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { +func (d *Document) MCreateOrReplace(index string, collection string, documents json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Document.MCreateOrReplace: index required", 400) } @@ -30,18 +30,22 @@ func (d *Document) MCreateOrReplace(index string, collection string, body json.R return nil, types.NewError("Document.MCreateOrReplace: collection required", 400) } - if body == nil { + if documents == nil { return nil, types.NewError("Document.MCreateOrReplace: body required", 400) } ch := make(chan *types.KuzzleResponse) + type body struct { + Documents json.RawMessage `json:"documents"` + } + query := &types.KuzzleRequest{ Index: index, Collection: collection, Controller: "document", Action: "mCreateOrReplace", - Body: body, + Body: &body{documents}, } go d.Kuzzle.Query(query, options, ch) diff --git a/document/mCreateOrReplace_test.go b/document/mCreateOrReplace_test.go index a6ff7c74..3e874506 100644 --- a/document/mCreateOrReplace_test.go +++ b/document/mCreateOrReplace_test.go @@ -110,6 +110,6 @@ func TestMCreateOrReplaceDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreateOrReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MCreateOrReplace("index", "collection", json.RawMessage(`["foo","bar"]`), nil) assert.Nil(t, err) } diff --git a/document/mCreate_test.go b/document/mCreate_test.go index 2a62f296..853b2eeb 100644 --- a/document/mCreate_test.go +++ b/document/mCreate_test.go @@ -110,6 +110,6 @@ func TestMCreateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MCreate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MCreate("index", "collection", json.RawMessage(`["foo", "bar"]`), nil) assert.Nil(t, err) } From 6258dfdf51dd4ee4acf18d0c9a90eaab8de56471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Tue, 2 Oct 2018 17:18:28 +0200 Subject: [PATCH 324/363] fix-body-as-string --- document/deleteByQuery.go | 10 +++++----- document/deleteByQuery_test.go | 10 +++++----- realtime/validate.go | 4 ++-- realtime/validate_test.go | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go index 8e183502..5db6a19b 100644 --- a/document/deleteByQuery.go +++ b/document/deleteByQuery.go @@ -21,17 +21,17 @@ import ( ) // DeleteByQuery deletes all the documents from Kuzzle that match the given filter or query. -func (d *Document) DeleteByQuery(index string, collection string, body string, options types.QueryOptions) ([]string, error) { +func (d *Document) DeleteByQuery(index string, collection string, body json.RawMessage, options types.QueryOptions) ([]string, error) { if index == "" { - return nil, types.NewError("Document.MCreate: index required", 400) + return nil, types.NewError("Document.DeleteByQuery: index required", 400) } if collection == "" { - return nil, types.NewError("Document.MCreate: collection required", 400) + return nil, types.NewError("Document.DeleteByQuery: collection required", 400) } - if body == "" { - return nil, types.NewError("Document.MCreate: body required", 400) + if body == nil { + return nil, types.NewError("Document.DeleteByQuery: body required", 400) } ch := make(chan *types.KuzzleResponse) diff --git a/document/deleteByQuery_test.go b/document/deleteByQuery_test.go index 1a666d8f..031a211e 100644 --- a/document/deleteByQuery_test.go +++ b/document/deleteByQuery_test.go @@ -29,7 +29,7 @@ func TestDeleteByQueryIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.DeleteByQuery("", "collection", "body", nil) + _, err := d.DeleteByQuery("", "collection", json.RawMessage(`{"foo": "bar"}`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestDeleteByQueryCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.DeleteByQuery("index", "", "body", nil) + _, err := d.DeleteByQuery("index", "", json.RawMessage(`{"foo": "bar"}`), nil) assert.NotNil(t, err) } @@ -45,7 +45,7 @@ func TestDeleteByQueryBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.DeleteByQuery("index", "collection", "", nil) + _, err := d.DeleteByQuery("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestDeleteByQueryDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.DeleteByQuery("index", "collection", "body", nil) + _, err := d.DeleteByQuery("index", "collection", json.RawMessage(`{"foo": "bar"}`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } @@ -85,6 +85,6 @@ func TestDeleteByQueryDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.DeleteByQuery("index", "collection", "body", nil) + _, err := d.DeleteByQuery("index", "collection", json.RawMessage(`{"foo": "bar"}`), nil) assert.Nil(t, err) } diff --git a/realtime/validate.go b/realtime/validate.go index e4e6c05a..1df9fb1d 100644 --- a/realtime/validate.go +++ b/realtime/validate.go @@ -21,8 +21,8 @@ import ( ) // Validate validates data against existing validation rules -func (r *Realtime) Validate(index string, collection string, body string, options types.QueryOptions) (bool, error) { - if (index == "" || collection == "") || body == "" { +func (r *Realtime) Validate(index string, collection string, body json.RawMessage, options types.QueryOptions) (bool, error) { + if index == "" || collection == "" || body == nil { return false, types.NewError("Realtime.Validate: index, collection and body required", 400) } diff --git a/realtime/validate_test.go b/realtime/validate_test.go index 0c37c55a..a1514239 100644 --- a/realtime/validate_test.go +++ b/realtime/validate_test.go @@ -29,7 +29,7 @@ func TestValidateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - _, err := nr.Validate("", "collection", "body", nil) + _, err := nr.Validate("", "collection", json.RawMessage(`{"foo": "bar"}`), nil) assert.NotNil(t, err) } @@ -38,7 +38,7 @@ func TestValidateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - _, err := nr.Validate("index", "", "body", nil) + _, err := nr.Validate("index", "", json.RawMessage(`{"foo": "bar"}`), nil) assert.NotNil(t, err) } @@ -47,7 +47,7 @@ func TestValidateBodyNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - _, err := nr.Validate("index", "collection", "", nil) + _, err := nr.Validate("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -61,7 +61,7 @@ func TestValidateError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nr := realtime.NewRealtime(k) - _, err := nr.Validate("index", "collection", "body", nil) + _, err := nr.Validate("index", "collection", json.RawMessage(`{"foo": "bar"}`), nil) assert.NotNil(t, err) } @@ -87,7 +87,7 @@ func TestValidate(t *testing.T) { nr := realtime.NewRealtime(k) - res, err := nr.Validate("index", "collection", "body", nil) + res, err := nr.Validate("index", "collection", json.RawMessage(`{"foo": "bar"}`), nil) assert.Nil(t, err) assert.Equal(t, true, res) } From e55003550137e62585f47eabe264bc1a5462cda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Wed, 3 Oct 2018 15:52:42 +0200 Subject: [PATCH 325/363] document.mReplace|Update - take an array of documents for input --- document/mReplace.go | 10 +++++++--- document/mReplace_test.go | 8 ++++---- document/mUpdate.go | 10 +++++++--- document/mUpdate_test.go | 8 ++++---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/document/mReplace.go b/document/mReplace.go index 24e80724..b6628055 100644 --- a/document/mReplace.go +++ b/document/mReplace.go @@ -21,7 +21,7 @@ import ( ) // MReplace replaces multiple documents at once. -func (d *Document) MReplace(index string, collection string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { +func (d *Document) MReplace(index string, collection string, documents json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Document.MReplace: index required", 400) } @@ -30,18 +30,22 @@ func (d *Document) MReplace(index string, collection string, body json.RawMessag return nil, types.NewError("Document.MReplace: collection required", 400) } - if body == nil { + if documents == nil { return nil, types.NewError("Document.MReplace: body required", 400) } ch := make(chan *types.KuzzleResponse) + type body struct { + Documents json.RawMessage `json:"documents"` + } + query := &types.KuzzleRequest{ Collection: collection, Index: index, Controller: "document", Action: "mReplace", - Body: body, + Body: &body{documents}, } go d.Kuzzle.Query(query, options, ch) diff --git a/document/mReplace_test.go b/document/mReplace_test.go index 33df1660..bcf12e2b 100644 --- a/document/mReplace_test.go +++ b/document/mReplace_test.go @@ -29,7 +29,7 @@ func TestMReplaceIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MReplace("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MReplace("", "collection", json.RawMessage(`["foo", "bar"]`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMReplaceCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MReplace("index", "", json.RawMessage(`["foo", "bar"]`), nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMReplaceDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MReplace("index", "collection", json.RawMessage(`["foo", "bar"]`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } @@ -111,6 +111,6 @@ func TestMReplaceDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MReplace("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MReplace("index", "collection", json.RawMessage(`["foo", "bar"]`), nil) assert.Nil(t, err) } diff --git a/document/mUpdate.go b/document/mUpdate.go index 1dd53fbc..3853eadd 100644 --- a/document/mUpdate.go +++ b/document/mUpdate.go @@ -21,7 +21,7 @@ import ( ) // MUpdate updates multiple documents at once -func (d *Document) MUpdate(index string, collection string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { +func (d *Document) MUpdate(index string, collection string, documents json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Document.MUpdate: index required", 400) } @@ -30,18 +30,22 @@ func (d *Document) MUpdate(index string, collection string, body json.RawMessage return nil, types.NewError("Document.MUpdate: collection required", 400) } - if body == nil { + if documents == nil { return nil, types.NewError("Document.MUpdate: body required", 400) } ch := make(chan *types.KuzzleResponse) + type body struct { + Documents json.RawMessage `json:"documents"` + } + query := &types.KuzzleRequest{ Collection: collection, Index: index, Controller: "document", Action: "mUpdate", - Body: body, + Body: &body{documents}, } go d.Kuzzle.Query(query, options, ch) diff --git a/document/mUpdate_test.go b/document/mUpdate_test.go index 590ffc08..deb5be41 100644 --- a/document/mUpdate_test.go +++ b/document/mUpdate_test.go @@ -29,7 +29,7 @@ func TestMUpdateIndexNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MUpdate("", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MUpdate("", "collection", json.RawMessage(`["foo", "bar"]`), nil) assert.NotNil(t, err) } @@ -37,7 +37,7 @@ func TestMUpdateCollectionNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MUpdate("index", "", json.RawMessage(`["foo", "bar"]`), nil) assert.NotNil(t, err) } @@ -58,7 +58,7 @@ func TestMUpdateDocumentError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MUpdate("index", "collection", json.RawMessage(`["foo", "bar"]`), nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } @@ -111,6 +111,6 @@ func TestMUpdateDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.MUpdate("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + _, err := d.MUpdate("index", "collection", json.RawMessage(`["foo", "bar"]`), nil) assert.Nil(t, err) } From 588ee97711a264da4805b9ca77634b255edb2c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Thu, 4 Oct 2018 22:38:49 +0200 Subject: [PATCH 326/363] add includeTrash to query options (#209) * add includeTrash to query options * move includeTrash option to required actions only --- document/count.go | 4 ++ document/get.go | 3 ++ document/mGet.go | 10 +++-- document/mGet_test.go | 10 ++--- document/search.go | 3 ++ types/kuzzle_request.go | 89 +++++++++++++++++++++-------------------- types/query_options.go | 12 ++++++ 7 files changed, 78 insertions(+), 53 deletions(-) diff --git a/document/count.go b/document/count.go index 057c7f9b..cfc2c1fe 100644 --- a/document/count.go +++ b/document/count.go @@ -47,6 +47,10 @@ func (d *Document) Count(index string, collection string, body json.RawMessage, Action: "count", Body: body, } + if options != nil { + query.IncludeTrash = options.IncludeTrash() + } + go d.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/document/get.go b/document/get.go index 8fbdf870..4618b2f0 100644 --- a/document/get.go +++ b/document/get.go @@ -43,6 +43,9 @@ func (d *Document) Get(index string, collection string, _id string, options type Action: "get", Id: _id, } + if options != nil { + query.IncludeTrash = options.IncludeTrash() + } go d.Kuzzle.Query(query, options, ch) diff --git a/document/mGet.go b/document/mGet.go index 1972f404..b221e7df 100644 --- a/document/mGet.go +++ b/document/mGet.go @@ -21,7 +21,7 @@ import ( ) // MGet fetches multiple documents at once -func (d *Document) MGet(index string, collection string, ids []string, includeTrash bool, options types.QueryOptions) (json.RawMessage, error) { +func (d *Document) MGet(index string, collection string, ids []string, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Document.MGet: index required", 400) } @@ -37,8 +37,7 @@ func (d *Document) MGet(index string, collection string, ids []string, includeTr ch := make(chan *types.KuzzleResponse) type body struct { - Ids []string `json:"ids"` - IncludeTrash bool `json:"includeTrash"` + Ids []string `json:"ids"` } query := &types.KuzzleRequest{ @@ -46,7 +45,10 @@ func (d *Document) MGet(index string, collection string, ids []string, includeTr Collection: collection, Controller: "document", Action: "mGet", - Body: &body{Ids: ids, IncludeTrash: includeTrash}, + Body: &body{ids}, + } + if options != nil { + query.IncludeTrash = options.IncludeTrash() } go d.Kuzzle.Query(query, options, ch) diff --git a/document/mGet_test.go b/document/mGet_test.go index 3ef55e56..d7486d23 100644 --- a/document/mGet_test.go +++ b/document/mGet_test.go @@ -30,7 +30,7 @@ func TestMGetIndexNull(t *testing.T) { d := document.NewDocument(k) var ids []string ids = append(ids, "id1") - _, err := d.MGet("", "collection", ids, true, nil) + _, err := d.MGet("", "collection", ids, nil) assert.NotNil(t, err) } @@ -39,7 +39,7 @@ func TestMGetCollectionNull(t *testing.T) { d := document.NewDocument(k) var ids []string ids = append(ids, "id1") - _, err := d.MGet("index", "", ids, true, nil) + _, err := d.MGet("index", "", ids, nil) assert.NotNil(t, err) } @@ -47,7 +47,7 @@ func TestMGetIdsNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) d := document.NewDocument(k) var ids []string - _, err := d.MGet("index", "collection", ids, true, nil) + _, err := d.MGet("index", "collection", ids, nil) assert.NotNil(t, err) } @@ -61,7 +61,7 @@ func TestMGetDocumentError(t *testing.T) { d := document.NewDocument(k) var ids []string ids = append(ids, "id1") - _, err := d.MGet("index", "collection", ids, true, nil) + _, err := d.MGet("index", "collection", ids, nil) assert.NotNil(t, err) assert.Equal(t, "Unit test error", err.(types.KuzzleError).Message) } @@ -115,6 +115,6 @@ func TestMGetDocument(t *testing.T) { d := document.NewDocument(k) var ids []string ids = append(ids, "id1") - _, err := d.MGet("index", "collection", ids, true, nil) + _, err := d.MGet("index", "collection", ids, nil) assert.Nil(t, err) } diff --git a/document/search.go b/document/search.go index 5d74e220..9b74f78d 100644 --- a/document/search.go +++ b/document/search.go @@ -43,6 +43,9 @@ func (d *Document) Search(index string, collection string, body json.RawMessage, Action: "search", Body: body, } + if options != nil { + query.IncludeTrash = options.IncludeTrash() + } go d.Kuzzle.Query(query, options, ch) diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index 784e7886..b062ebfe 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -17,50 +17,51 @@ package types import "encoding/json" type KuzzleRequest struct { - RequestId string `json:"requestId,omitempty"` - Controller string `json:"controller,omitempty"` - Action string `json:"action,omitempty"` - Index string `json:"index,omitempty"` - Collection string `json:"collection,omitempty"` - Body interface{} `json:"body"` - Id string `json:"_id,omitempty"` - From int `json:"from"` - Size int `json:"size"` - Scroll string `json:"scroll,omitempty"` - ScrollId string `json:"scrollId,omitempty"` - Strategy string `json:"strategy,omitempty"` - ExpiresIn int `json:"expiresIn,omitempty"` - Volatile VolatileData `json:"volatile"` - Scope string `json:"scope"` - State string `json:"state"` - Users string `json:"users"` - Start int `json:"start,omitempty"` - Stop int `json:"stop,omitempty"` - End int `json:"end,omitempty"` - Bit int `json:"bit,omitempty"` - Member string `json:"member,omitempty"` - Member1 string `json:"member1,omitempty"` - Member2 string `json:"member2,omitempty"` - Members []string `json:"members,omitempty"` - Lon float64 `json:"lon,omitempty"` - Lat float64 `json:"lat,omitempty"` - Distance float64 `json:"distance,omitempty"` - Unit string `json:"unit,omitempty"` - Options []interface{} `json:"options,omitempty"` - Keys []string `json:"keys,omitempty"` - Cursor int `json:"cursor,omitempty"` - Offset int `json:"offset,omitempty"` - Field string `json:"field,omitempty"` - Fields []string `json:"fields,omitempty"` - Subcommand string `json:"subcommand,omitempty"` - Pattern string `json:"pattern,omitempty"` - Idx int `json:"idx, omitempty"` - Min string `json:"min,omitempty"` - Max string `json:"max,omitempty"` - Limit string `json:"limit,omitempty"` - Count int `json:"count,omitempty"` - Match string `json:"match,omitempty"` - Reset bool `json:"reset,omitempty"` + RequestId string `json:"requestId,omitempty"` + Controller string `json:"controller,omitempty"` + Action string `json:"action,omitempty"` + Index string `json:"index,omitempty"` + Collection string `json:"collection,omitempty"` + Body interface{} `json:"body"` + Id string `json:"_id,omitempty"` + From int `json:"from"` + Size int `json:"size"` + Scroll string `json:"scroll,omitempty"` + ScrollId string `json:"scrollId,omitempty"` + Strategy string `json:"strategy,omitempty"` + ExpiresIn int `json:"expiresIn,omitempty"` + Volatile VolatileData `json:"volatile"` + Scope string `json:"scope"` + State string `json:"state"` + Users string `json:"users"` + Start int `json:"start,omitempty"` + Stop int `json:"stop,omitempty"` + End int `json:"end,omitempty"` + Bit int `json:"bit,omitempty"` + Member string `json:"member,omitempty"` + Member1 string `json:"member1,omitempty"` + Member2 string `json:"member2,omitempty"` + Members []string `json:"members,omitempty"` + Lon float64 `json:"lon,omitempty"` + Lat float64 `json:"lat,omitempty"` + Distance float64 `json:"distance,omitempty"` + Unit string `json:"unit,omitempty"` + Options []interface{} `json:"options,omitempty"` + Keys []string `json:"keys,omitempty"` + Cursor int `json:"cursor,omitempty"` + Offset int `json:"offset,omitempty"` + Field string `json:"field,omitempty"` + Fields []string `json:"fields,omitempty"` + Subcommand string `json:"subcommand,omitempty"` + Pattern string `json:"pattern,omitempty"` + Idx int `json:"idx, omitempty"` + Min string `json:"min,omitempty"` + Max string `json:"max,omitempty"` + Limit string `json:"limit,omitempty"` + Count int `json:"count,omitempty"` + Match string `json:"match,omitempty"` + Reset bool `json:"reset,omitempty"` + IncludeTrash bool `json:"includeTrash,omitempty"` } type SubscribeQuery struct { diff --git a/types/query_options.go b/types/query_options.go index b1866400..51e5d817 100644 --- a/types/query_options.go +++ b/types/query_options.go @@ -32,6 +32,8 @@ type QueryOptions interface { SetRefresh(string) *queryOptions IfExist() string SetIfExist(string) *queryOptions + IncludeTrash() bool + SetIncludeTrash(bool) *queryOptions RetryOnConflict() int SetRetryOnConflict(int) *queryOptions Start() int @@ -91,6 +93,7 @@ type queryOptions struct { volatile VolatileData refresh string ifExist string + includeTrash bool retryOnConflict int start int end int @@ -190,6 +193,15 @@ func (qo *queryOptions) SetIfExist(ifExist string) *queryOptions { return qo } +func (qo *queryOptions) IncludeTrash() bool { + return qo.includeTrash +} + +func (qo *queryOptions) SetIncludeTrash(includeTrash bool) *queryOptions { + qo.includeTrash = includeTrash + return qo +} + func (qo queryOptions) RetryOnConflict() int { return qo.retryOnConflict } From 5aadbd2e8b5938114eae7d769ed3e86c128edbef Mon Sep 17 00:00:00 2001 From: Adrien Maret Date: Tue, 9 Oct 2018 12:12:24 +0200 Subject: [PATCH 327/363] Update validatespecification signature to take index and collection (#211) --- collection/update_specifications.go | 22 ++++++++++++----- collection/validate_specifications.go | 28 ++++++++++++++++++---- collection/validate_specifications_test.go | 10 ++++---- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/collection/update_specifications.go b/collection/update_specifications.go index cb7d8896..2c526994 100644 --- a/collection/update_specifications.go +++ b/collection/update_specifications.go @@ -16,12 +16,13 @@ package collection import ( "encoding/json" + "fmt" "github.com/kuzzleio/sdk-go/types" ) // UpdateSpecifications updates the current specifications of this collection. -func (dc *Collection) UpdateSpecifications(index string, collection string, body json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { +func (dc *Collection) UpdateSpecifications(index string, collection string, specifications json.RawMessage, options types.QueryOptions) (json.RawMessage, error) { if index == "" { return nil, types.NewError("Collection.UpdateSpecifications: index required", 400) } @@ -30,19 +31,28 @@ func (dc *Collection) UpdateSpecifications(index string, collection string, body return nil, types.NewError("Collection.UpdateSpecifications: collection required", 400) } - if body == nil { - return nil, types.NewError("Collection.UpdateSpecifications: body required", 400) + if specifications == nil { + return nil, types.NewError("Collection.UpdateSpecifications: specifications required", 400) } ch := make(chan *types.KuzzleResponse) + body := make(map[string]map[string]json.RawMessage) + body[index] = make(map[string]json.RawMessage) + body[index][collection] = specifications + + jsonBody, err := json.Marshal(body) + + if err != nil { + return nil, types.NewError(fmt.Sprintf("Unable to construct body: %s\n", err.Error()), 500) + } + query := &types.KuzzleRequest{ - Collection: collection, - Index: index, Controller: "collection", Action: "updateSpecifications", - Body: body, + Body: jsonBody, } + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go index 964a27c1..1d1bb090 100644 --- a/collection/validate_specifications.go +++ b/collection/validate_specifications.go @@ -16,23 +16,43 @@ package collection import ( "encoding/json" + "fmt" "github.com/kuzzleio/sdk-go/types" ) // ValidateSpecifications validates the provided specifications. -func (dc *Collection) ValidateSpecifications(body json.RawMessage, options types.QueryOptions) (*types.ValidationResponse, error) { - if body == nil { - return nil, types.NewError("Collection.ValidateSpecifications: body required", 400) +func (dc *Collection) ValidateSpecifications(index string, collection string, specifications json.RawMessage, options types.QueryOptions) (*types.ValidationResponse, error) { + if index == "" { + return nil, types.NewError("Collection.ValidateSpecifications: index required", 400) + } + + if collection == "" { + return nil, types.NewError("Collection.ValidateSpecifications: collection required", 400) + } + + if specifications == nil { + return nil, types.NewError("Collection.ValidateSpecifications: specifications required", 400) } ch := make(chan *types.KuzzleResponse) + body := make(map[string]map[string]json.RawMessage) + body[index] = make(map[string]json.RawMessage) + body[index][collection] = specifications + + jsonBody, err := json.Marshal(body) + + if err != nil { + return nil, types.NewError(fmt.Sprintf("Unable to construct body: %s\n", err.Error()), 500) + } + query := &types.KuzzleRequest{ Controller: "collection", Action: "validateSpecifications", - Body: body, + Body: jsonBody, } + go dc.Kuzzle.Query(query, options, ch) res := <-ch diff --git a/collection/validate_specifications_test.go b/collection/validate_specifications_test.go index 27d703e4..7efc32ea 100644 --- a/collection/validate_specifications_test.go +++ b/collection/validate_specifications_test.go @@ -28,10 +28,10 @@ import ( "github.com/stretchr/testify/assert" ) -func TestValidateSpecificationsBodyNull(t *testing.T) { +func TestValidateSpecificationsSpecificationsNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications(nil, nil) + _, err := nc.ValidateSpecifications("index", "collection", nil, nil) assert.NotNil(t, err) } @@ -44,7 +44,7 @@ func TestValidateSpecificationsError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - _, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) + _, err := nc.ValidateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.NotNil(t, err) } @@ -62,7 +62,7 @@ func TestValidateSpecifications(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - vr, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) + vr, err := nc.ValidateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) assert.Nil(t, err) assert.NotNil(t, vr) assert.Equal(t, true, vr.Valid) @@ -73,7 +73,7 @@ func ExampleCollection_ValidateSpecifications() { k, _ := kuzzle.NewKuzzle(c, nil) nc := collection.NewCollection(k) - res, err := nc.ValidateSpecifications(json.RawMessage(`{"body": "body"}`), nil) + res, err := nc.ValidateSpecifications("index", "collection", json.RawMessage(`{"body": "body"}`), nil) if err != nil { fmt.Println(err.Error()) From a7a1a2737c218f9a0554fe3726d763d65b372590 Mon Sep 17 00:00:00 2001 From: Alexandre Bouthinon Date: Tue, 9 Oct 2018 22:00:03 +0200 Subject: [PATCH 328/363] [bugfix] Fix all bugs introduced by force merge --- collection/update_specifications.go | 2 +- collection/validate_specifications.go | 2 +- types/validation_response.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/collection/update_specifications.go b/collection/update_specifications.go index 2c526994..8b97e319 100644 --- a/collection/update_specifications.go +++ b/collection/update_specifications.go @@ -50,7 +50,7 @@ func (dc *Collection) UpdateSpecifications(index string, collection string, spec query := &types.KuzzleRequest{ Controller: "collection", Action: "updateSpecifications", - Body: jsonBody, + Body: json.RawMessage(jsonBody), } go dc.Kuzzle.Query(query, options, ch) diff --git a/collection/validate_specifications.go b/collection/validate_specifications.go index 1d1bb090..0bcefdc7 100644 --- a/collection/validate_specifications.go +++ b/collection/validate_specifications.go @@ -50,7 +50,7 @@ func (dc *Collection) ValidateSpecifications(index string, collection string, sp query := &types.KuzzleRequest{ Controller: "collection", Action: "validateSpecifications", - Body: jsonBody, + Body: json.RawMessage(jsonBody), } go dc.Kuzzle.Query(query, options, ch) diff --git a/types/validation_response.go b/types/validation_response.go index c76f1a3b..0bd085be 100644 --- a/types/validation_response.go +++ b/types/validation_response.go @@ -21,9 +21,9 @@ import ( // ValidationResponse contains a validation response type ValidationResponse struct { - Valid bool - Details []string - Description string + Valid bool `json:"valid"` + Details []string `json:"details"` + Description string `json:"description"` } func NewValidationResponse(validationResponse json.RawMessage) (*ValidationResponse, error) { From d5961e5ab58221f80e7fab73d3fbe200a1d89353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Wed, 10 Oct 2018 14:08:38 +0200 Subject: [PATCH 329/363] replace connection by protocol (#212) * replace connection by protocol * add protocol package * fix * fix lint errors --- auth/checkToken_test.go | 2 +- auth/createMyCredentials_test.go | 2 +- auth/credentialsExist_test.go | 2 +- auth/deleteMyCredentials_test.go | 2 +- auth/getCurrentUser_test.go | 2 +- auth/getMyCredentials_test.go | 2 +- auth/getMyRights_test.go | 2 +- auth/getStrategies_test.go | 2 +- auth/login_test.go | 2 +- auth/logout_test.go | 2 +- auth/update_my_credentials_test.go | 2 +- auth/update_self_test.go | 2 +- auth/validate_my_credentials_test.go | 2 +- index/create_test.go | 2 +- index/delete_test.go | 2 +- index/exists_test.go | 2 +- index/getAutoRefresh_test.go | 2 +- index/mDelete_test.go | 2 +- index/refreshInternal_test.go | 2 +- index/refresh_test.go | 2 +- index/setAutoRefresh_test.go | 2 +- internal/mock_connection.go | 10 +++++----- kuzzle/disconnect_test.go | 2 +- kuzzle/kuzzle.go | 14 +++++++------- kuzzle/kuzzle_test.go | 2 +- kuzzle/query_test.go | 2 +- kuzzle/queue_test.go | 2 +- ms/append_test.go | 2 +- ms/bitcount_test.go | 2 +- ms/bitop_test.go | 2 +- ms/bitpos_test.go | 2 +- ms/dbsize_test.go | 2 +- ms/decr_test.go | 2 +- ms/decrby_test.go | 2 +- ms/del_test.go | 2 +- ms/exists_test.go | 2 +- ms/expire_test.go | 2 +- ms/expireat_test.go | 2 +- ms/flushdb_test.go | 2 +- ms/geoadd_test.go | 2 +- ms/geodist_test.go | 2 +- ms/geohash_test.go | 2 +- ms/geopos_test.go | 2 +- ms/georadius_test.go | 2 +- ms/georadiusbymember_test.go | 2 +- ms/get_test.go | 2 +- ms/getbit_test.go | 2 +- ms/getrange_test.go | 2 +- ms/getset_test.go | 2 +- ms/hdel_test.go | 2 +- ms/hexists_test.go | 2 +- ms/hget_test.go | 2 +- ms/hgetall_test.go | 2 +- ms/hincrby_test.go | 2 +- ms/hincrbyfloat_test.go | 2 +- ms/hkeys_test.go | 2 +- ms/hlen_test.go | 2 +- ms/hmget_test.go | 2 +- ms/hmset_test.go | 2 +- ms/hscan_test.go | 2 +- ms/hset_test.go | 2 +- ms/hsetnx_test.go | 2 +- ms/hstrlen_test.go | 2 +- ms/hvals_test.go | 2 +- ms/incr_test.go | 2 +- ms/incrby_test.go | 2 +- ms/incrbyfloat_test.go | 2 +- ms/keys_test.go | 2 +- ms/lindex_test.go | 2 +- ms/linsert_test.go | 2 +- ms/llen_test.go | 2 +- ms/lpop_test.go | 2 +- ms/lpush_test.go | 2 +- ms/lpushx_test.go | 2 +- ms/lrange_test.go | 2 +- ms/lrem_test.go | 2 +- ms/lset_test.go | 2 +- ms/ltrim_test.go | 2 +- ms/mget_test.go | 2 +- ms/mset_test.go | 2 +- ms/msetnx_test.go | 2 +- ms/object_test.go | 2 +- ms/persist_test.go | 2 +- ms/pexpire_test.go | 2 +- ms/pexpireat_test.go | 2 +- ms/pfadd_test.go | 2 +- ms/pfcount_test.go | 2 +- ms/pfmerge_test.go | 2 +- ms/ping_test.go | 2 +- ms/psetex_test.go | 2 +- ms/pttl_test.go | 2 +- ms/randomkey_test.go | 2 +- ms/rename_test.go | 2 +- ms/renamenx_test.go | 2 +- ms/rpop_test.go | 2 +- ms/rpoplpush_test.go | 2 +- ms/rpush_test.go | 2 +- ms/rpushx_test.go | 2 +- ms/sadd_test.go | 2 +- ms/scan_test.go | 2 +- ms/scard_test.go | 2 +- ms/sdiff_test.go | 2 +- ms/sdiffstore_test.go | 2 +- ms/set_test.go | 2 +- ms/setex_test.go | 2 +- ms/setnx_test.go | 2 +- ms/sinter_test.go | 2 +- ms/sinterstore_test.go | 2 +- ms/sismember_test.go | 2 +- ms/smembers_test.go | 2 +- ms/smove_test.go | 2 +- ms/sort_test.go | 2 +- ms/spop_test.go | 2 +- ms/srandmember_test.go | 2 +- ms/srem_test.go | 2 +- ms/sscan_test.go | 2 +- ms/strlen_test.go | 2 +- ms/sunion_test.go | 2 +- ms/sunionstore_test.go | 2 +- ms/time_test.go | 2 +- ms/touch_test.go | 2 +- ms/ttl_test.go | 2 +- ms/type_test.go | 2 +- ms/zadd_test.go | 2 +- ms/zcard_test.go | 2 +- ms/zcount_test.go | 2 +- ms/zincrby_test.go | 2 +- ms/zinterstore_test.go | 2 +- ms/zlexcount_test.go | 2 +- ms/zrange_test.go | 2 +- ms/zrangebylex_test.go | 2 +- ms/zrangebyscore_test.go | 2 +- ms/zrank_test.go | 2 +- ms/zrem_test.go | 2 +- ms/zremrangebylex_test.go | 2 +- ms/zremrangebyrank_test.go | 2 +- ms/zremrangebyscore_test.go | 2 +- ms/zrevrange_test.go | 2 +- ms/zrevrangebylex_test.go | 2 +- ms/zrevrangebyscore_test.go | 2 +- ms/zrevrank_test.go | 2 +- ms/zscan_test.go | 2 +- ms/zscore_test.go | 2 +- ms/zunionstore_test.go | 2 +- .../connection.go => protocol/protocol.go | 6 +++--- .../websocket/web_socket.go | 18 +++++++++--------- .../websocket/web_socket_test.go | 0 security/getAllCredentialFields_test.go | 2 +- security/getCredentialFields_test.go | 2 +- security/getProfile_test.go | 2 +- security/getRole_test.go | 2 +- security/getUser_test.go | 2 +- security/mGetProfiles_test.go | 2 +- security/mGetRoles_test.go | 2 +- security/searchProfiles_test.go | 2 +- security/searchRoles_test.go | 2 +- security/searchUsers_test.go | 2 +- security/updateCredentials_test.go | 2 +- security/validateCredentials_test.go | 2 +- server/adminExists_test.go | 2 +- server/getAllStats_test.go | 2 +- server/getConfig_test.go | 2 +- server/getLastStats_test.go | 2 +- server/getStats_test.go | 2 +- server/info_test.go | 2 +- server/now_test.go | 2 +- test.sh | 2 +- 167 files changed, 186 insertions(+), 186 deletions(-) rename connection/connection.go => protocol/protocol.go (93%) rename {connection => protocol}/websocket/web_socket.go (96%) rename {connection => protocol}/websocket/web_socket_test.go (100%) diff --git a/auth/checkToken_test.go b/auth/checkToken_test.go index 767c36e4..6340f3d8 100644 --- a/auth/checkToken_test.go +++ b/auth/checkToken_test.go @@ -19,9 +19,9 @@ import ( "testing" "github.com/kuzzleio/sdk-go/auth" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/createMyCredentials_test.go b/auth/createMyCredentials_test.go index 14e4cc7d..a3d821dc 100644 --- a/auth/createMyCredentials_test.go +++ b/auth/createMyCredentials_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/credentialsExist_test.go b/auth/credentialsExist_test.go index 5767aa64..c8759f8a 100644 --- a/auth/credentialsExist_test.go +++ b/auth/credentialsExist_test.go @@ -18,9 +18,9 @@ import ( "encoding/json" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/deleteMyCredentials_test.go b/auth/deleteMyCredentials_test.go index 3ddb1bcc..fd9ce1d3 100644 --- a/auth/deleteMyCredentials_test.go +++ b/auth/deleteMyCredentials_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/getCurrentUser_test.go b/auth/getCurrentUser_test.go index b8dc943c..9977a541 100644 --- a/auth/getCurrentUser_test.go +++ b/auth/getCurrentUser_test.go @@ -20,9 +20,9 @@ import ( "testing" "github.com/kuzzleio/sdk-go/auth" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/getMyCredentials_test.go b/auth/getMyCredentials_test.go index 0990c6fe..c2c1b3f0 100644 --- a/auth/getMyCredentials_test.go +++ b/auth/getMyCredentials_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/getMyRights_test.go b/auth/getMyRights_test.go index 7abfe2fd..1f1ff1da 100644 --- a/auth/getMyRights_test.go +++ b/auth/getMyRights_test.go @@ -20,9 +20,9 @@ import ( "log" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/getStrategies_test.go b/auth/getStrategies_test.go index 6388d35f..4b613965 100644 --- a/auth/getStrategies_test.go +++ b/auth/getStrategies_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/login_test.go b/auth/login_test.go index fc4732a8..bd1b241d 100644 --- a/auth/login_test.go +++ b/auth/login_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/logout_test.go b/auth/logout_test.go index 028bccf9..f2f3430e 100644 --- a/auth/logout_test.go +++ b/auth/logout_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/update_my_credentials_test.go b/auth/update_my_credentials_test.go index 585fcd62..6024d8d0 100644 --- a/auth/update_my_credentials_test.go +++ b/auth/update_my_credentials_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/update_self_test.go b/auth/update_self_test.go index c89f5c52..8f3a5b01 100644 --- a/auth/update_self_test.go +++ b/auth/update_self_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/auth/validate_my_credentials_test.go b/auth/validate_my_credentials_test.go index 64c65727..42041cef 100644 --- a/auth/validate_my_credentials_test.go +++ b/auth/validate_my_credentials_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/index/create_test.go b/index/create_test.go index 57205daf..8c00c252 100644 --- a/index/create_test.go +++ b/index/create_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/index/delete_test.go b/index/delete_test.go index d8ae1eff..fbb27145 100644 --- a/index/delete_test.go +++ b/index/delete_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/index/exists_test.go b/index/exists_test.go index 7b5e3e05..60a3b94a 100644 --- a/index/exists_test.go +++ b/index/exists_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/index/getAutoRefresh_test.go b/index/getAutoRefresh_test.go index 4177df21..315fc65f 100644 --- a/index/getAutoRefresh_test.go +++ b/index/getAutoRefresh_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/index/mDelete_test.go b/index/mDelete_test.go index 14e97a62..557168b7 100644 --- a/index/mDelete_test.go +++ b/index/mDelete_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/index/refreshInternal_test.go b/index/refreshInternal_test.go index e9d957fd..3e9f11fd 100644 --- a/index/refreshInternal_test.go +++ b/index/refreshInternal_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/index/refresh_test.go b/index/refresh_test.go index d51be19c..f4be8bd5 100644 --- a/index/refresh_test.go +++ b/index/refresh_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/index/setAutoRefresh_test.go b/index/setAutoRefresh_test.go index 515617df..03bb84cf 100644 --- a/index/setAutoRefresh_test.go +++ b/index/setAutoRefresh_test.go @@ -19,10 +19,10 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/internal/mock_connection.go b/internal/mock_connection.go index 80ca831e..d1678b07 100644 --- a/internal/mock_connection.go +++ b/internal/mock_connection.go @@ -18,7 +18,7 @@ import ( "encoding/json" "time" - "github.com/kuzzleio/sdk-go/connection" + "github.com/kuzzleio/sdk-go/protocol" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/mock" ) @@ -145,7 +145,7 @@ func (c *MockedConnection) OfflineQueue() []*types.QueryObject { return offlineQueue } -func (c *MockedConnection) OfflineQueueLoader() connection.OfflineQueueLoader { +func (c *MockedConnection) OfflineQueueLoader() protocol.OfflineQueueLoader { return nil } @@ -153,7 +153,7 @@ func (c *MockedConnection) Port() int { return 0 } -func (c *MockedConnection) QueueFilter() connection.QueueFilter { +func (c *MockedConnection) QueueFilter() protocol.QueueFilter { return nil } @@ -183,10 +183,10 @@ func (c *MockedConnection) SetAutoQueue(v bool) { func (c *MockedConnection) SetAutoReplay(v bool) { } -func (c *MockedConnection) SetOfflineQueueLoader(v connection.OfflineQueueLoader) { +func (c *MockedConnection) SetOfflineQueueLoader(v protocol.OfflineQueueLoader) { } -func (c *MockedConnection) SetQueueFilter(v connection.QueueFilter) { +func (c *MockedConnection) SetQueueFilter(v protocol.QueueFilter) { } func (c *MockedConnection) SetQueueMaxSize(v int) { diff --git a/kuzzle/disconnect_test.go b/kuzzle/disconnect_test.go index 34006a16..985e531a 100644 --- a/kuzzle/disconnect_test.go +++ b/kuzzle/disconnect_test.go @@ -16,8 +16,8 @@ package kuzzle_test import ( "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" ) func ExampleKuzzle_Disconnect() { diff --git a/kuzzle/kuzzle.go b/kuzzle/kuzzle.go index 875d8b73..7077ca4e 100644 --- a/kuzzle/kuzzle.go +++ b/kuzzle/kuzzle.go @@ -21,11 +21,11 @@ import ( "github.com/kuzzleio/sdk-go/auth" "github.com/kuzzleio/sdk-go/collection" - "github.com/kuzzleio/sdk-go/connection" "github.com/kuzzleio/sdk-go/document" "github.com/kuzzleio/sdk-go/event" "github.com/kuzzleio/sdk-go/index" "github.com/kuzzleio/sdk-go/ms" + "github.com/kuzzleio/sdk-go/protocol" "github.com/kuzzleio/sdk-go/realtime" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/server" @@ -35,7 +35,7 @@ import ( const version = "1.0.0" type Kuzzle struct { - socket connection.Connection + socket protocol.Protocol wasConnected bool lastUrl string @@ -57,7 +57,7 @@ type Kuzzle struct { } // NewKuzzle is the Kuzzle constructor -func NewKuzzle(c connection.Connection, options types.Options) (*Kuzzle, error) { +func NewKuzzle(c protocol.Protocol, options types.Options) (*Kuzzle, error) { if c == nil { return nil, types.NewError("Connection is nil") } @@ -183,7 +183,7 @@ func (k *Kuzzle) OfflineQueue() []*types.QueryObject { } // OfflineQueueLoader returns the Kuzzle socket OfflineQueueLoader field value -func (k *Kuzzle) OfflineQueueLoader() connection.OfflineQueueLoader { +func (k *Kuzzle) OfflineQueueLoader() protocol.OfflineQueueLoader { return k.socket.OfflineQueueLoader() } @@ -193,7 +193,7 @@ func (k *Kuzzle) Port() int { } // QueueFilter returns the Kuzzle socket QueueFilter field value -func (k *Kuzzle) QueueFilter() connection.QueueFilter { +func (k *Kuzzle) QueueFilter() protocol.QueueFilter { return k.socket.QueueFilter() } @@ -233,12 +233,12 @@ func (k *Kuzzle) SetAutoReplay(v bool) { } // SetOfflineQueueLoader sets the Kuzzle socket OfflineQueueLoader field with given value -func (k *Kuzzle) SetOfflineQueueLoader(v connection.OfflineQueueLoader) { +func (k *Kuzzle) SetOfflineQueueLoader(v protocol.OfflineQueueLoader) { k.socket.SetOfflineQueueLoader(v) } // SetQueueFilter sets the Kuzzle socket QueueFilter field with given value -func (k *Kuzzle) SetQueueFilter(v connection.QueueFilter) { +func (k *Kuzzle) SetQueueFilter(v protocol.QueueFilter) { k.socket.SetQueueFilter(v) } diff --git a/kuzzle/kuzzle_test.go b/kuzzle/kuzzle_test.go index cc5c3da0..550b6c50 100644 --- a/kuzzle/kuzzle_test.go +++ b/kuzzle/kuzzle_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/kuzzle/query_test.go b/kuzzle/query_test.go index 795daa09..bd3f188e 100644 --- a/kuzzle/query_test.go +++ b/kuzzle/query_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/kuzzle/queue_test.go b/kuzzle/queue_test.go index 315a62ff..07ea47a8 100644 --- a/kuzzle/queue_test.go +++ b/kuzzle/queue_test.go @@ -15,9 +15,9 @@ package kuzzle_test import ( - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/append_test.go b/ms/append_test.go index 8f3abc15..6d947e8c 100755 --- a/ms/append_test.go +++ b/ms/append_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/bitcount_test.go b/ms/bitcount_test.go index 1782653c..94537861 100755 --- a/ms/bitcount_test.go +++ b/ms/bitcount_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/bitop_test.go b/ms/bitop_test.go index 00bf4658..5c14fb5f 100755 --- a/ms/bitop_test.go +++ b/ms/bitop_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/bitpos_test.go b/ms/bitpos_test.go index 740872c8..b33c4f09 100755 --- a/ms/bitpos_test.go +++ b/ms/bitpos_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/dbsize_test.go b/ms/dbsize_test.go index 22de6d36..b5e2e7bc 100755 --- a/ms/dbsize_test.go +++ b/ms/dbsize_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/decr_test.go b/ms/decr_test.go index ebbc0643..6cd84117 100755 --- a/ms/decr_test.go +++ b/ms/decr_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/decrby_test.go b/ms/decrby_test.go index d1ca6005..6b7a8641 100755 --- a/ms/decrby_test.go +++ b/ms/decrby_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/del_test.go b/ms/del_test.go index 894b1297..e1683ecf 100755 --- a/ms/del_test.go +++ b/ms/del_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/exists_test.go b/ms/exists_test.go index ab3bf06f..fb8ac412 100755 --- a/ms/exists_test.go +++ b/ms/exists_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/expire_test.go b/ms/expire_test.go index 3651ca17..93cf8c67 100755 --- a/ms/expire_test.go +++ b/ms/expire_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/expireat_test.go b/ms/expireat_test.go index 742a0d82..84343c44 100755 --- a/ms/expireat_test.go +++ b/ms/expireat_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/flushdb_test.go b/ms/flushdb_test.go index 797f6237..d1236ea2 100755 --- a/ms/flushdb_test.go +++ b/ms/flushdb_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/geoadd_test.go b/ms/geoadd_test.go index 6223b0e7..11a16113 100755 --- a/ms/geoadd_test.go +++ b/ms/geoadd_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/geodist_test.go b/ms/geodist_test.go index 4bbb7723..80af2fbc 100755 --- a/ms/geodist_test.go +++ b/ms/geodist_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/geohash_test.go b/ms/geohash_test.go index 883cf7ef..047d239f 100755 --- a/ms/geohash_test.go +++ b/ms/geohash_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/geopos_test.go b/ms/geopos_test.go index 43f6696e..ac12a945 100755 --- a/ms/geopos_test.go +++ b/ms/geopos_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/georadius_test.go b/ms/georadius_test.go index c7ede63a..cc7aece0 100755 --- a/ms/georadius_test.go +++ b/ms/georadius_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/georadiusbymember_test.go b/ms/georadiusbymember_test.go index ba95c6dc..c77ef2b2 100755 --- a/ms/georadiusbymember_test.go +++ b/ms/georadiusbymember_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/get_test.go b/ms/get_test.go index f9c51712..90ed8411 100755 --- a/ms/get_test.go +++ b/ms/get_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/getbit_test.go b/ms/getbit_test.go index e73f2e0b..fcbcdaa5 100755 --- a/ms/getbit_test.go +++ b/ms/getbit_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/getrange_test.go b/ms/getrange_test.go index 38f87d4e..ec57663e 100755 --- a/ms/getrange_test.go +++ b/ms/getrange_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/getset_test.go b/ms/getset_test.go index 6c2818b2..c8abca14 100755 --- a/ms/getset_test.go +++ b/ms/getset_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hdel_test.go b/ms/hdel_test.go index af61b6fe..e584f2c1 100755 --- a/ms/hdel_test.go +++ b/ms/hdel_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hexists_test.go b/ms/hexists_test.go index f1ade893..7ddfba4a 100755 --- a/ms/hexists_test.go +++ b/ms/hexists_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hget_test.go b/ms/hget_test.go index 39429b94..bc859f84 100755 --- a/ms/hget_test.go +++ b/ms/hget_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hgetall_test.go b/ms/hgetall_test.go index 1fcc8dba..7c186e05 100755 --- a/ms/hgetall_test.go +++ b/ms/hgetall_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hincrby_test.go b/ms/hincrby_test.go index c410953e..9fd3a983 100755 --- a/ms/hincrby_test.go +++ b/ms/hincrby_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hincrbyfloat_test.go b/ms/hincrbyfloat_test.go index 296ff06e..8072b366 100755 --- a/ms/hincrbyfloat_test.go +++ b/ms/hincrbyfloat_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hkeys_test.go b/ms/hkeys_test.go index bc28e4c3..a9453491 100755 --- a/ms/hkeys_test.go +++ b/ms/hkeys_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hlen_test.go b/ms/hlen_test.go index 8130b09b..79e665c0 100755 --- a/ms/hlen_test.go +++ b/ms/hlen_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hmget_test.go b/ms/hmget_test.go index 362173f4..d9bb777f 100755 --- a/ms/hmget_test.go +++ b/ms/hmget_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hmset_test.go b/ms/hmset_test.go index 2aa83c5e..90cfcd62 100755 --- a/ms/hmset_test.go +++ b/ms/hmset_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/hscan_test.go b/ms/hscan_test.go index e64d61e4..80651e3d 100755 --- a/ms/hscan_test.go +++ b/ms/hscan_test.go @@ -17,10 +17,10 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" MemoryStorage "github.com/kuzzleio/sdk-go/ms" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hset_test.go b/ms/hset_test.go index 346d3316..594b7861 100755 --- a/ms/hset_test.go +++ b/ms/hset_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hsetnx_test.go b/ms/hsetnx_test.go index 295b112a..cdece667 100755 --- a/ms/hsetnx_test.go +++ b/ms/hsetnx_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hstrlen_test.go b/ms/hstrlen_test.go index a58b318b..0048e22b 100755 --- a/ms/hstrlen_test.go +++ b/ms/hstrlen_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/hvals_test.go b/ms/hvals_test.go index 5e38161c..0c4f726a 100755 --- a/ms/hvals_test.go +++ b/ms/hvals_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/incr_test.go b/ms/incr_test.go index 96077a71..b60921ea 100755 --- a/ms/incr_test.go +++ b/ms/incr_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/incrby_test.go b/ms/incrby_test.go index 0cbb3f8e..e0b1a614 100755 --- a/ms/incrby_test.go +++ b/ms/incrby_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/incrbyfloat_test.go b/ms/incrbyfloat_test.go index 49bc3752..965abc69 100755 --- a/ms/incrbyfloat_test.go +++ b/ms/incrbyfloat_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/keys_test.go b/ms/keys_test.go index d8876740..7430eab3 100755 --- a/ms/keys_test.go +++ b/ms/keys_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/lindex_test.go b/ms/lindex_test.go index b0eab5f5..960f871a 100755 --- a/ms/lindex_test.go +++ b/ms/lindex_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/linsert_test.go b/ms/linsert_test.go index 026c52c5..7cf97ad9 100755 --- a/ms/linsert_test.go +++ b/ms/linsert_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/llen_test.go b/ms/llen_test.go index d46a89a9..1fb53acb 100755 --- a/ms/llen_test.go +++ b/ms/llen_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/lpop_test.go b/ms/lpop_test.go index 90995050..a32d7ef5 100755 --- a/ms/lpop_test.go +++ b/ms/lpop_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/lpush_test.go b/ms/lpush_test.go index bfb2dbca..9c487171 100755 --- a/ms/lpush_test.go +++ b/ms/lpush_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/lpushx_test.go b/ms/lpushx_test.go index b3020121..53ff98a9 100755 --- a/ms/lpushx_test.go +++ b/ms/lpushx_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/lrange_test.go b/ms/lrange_test.go index 4502c296..4ea2d660 100755 --- a/ms/lrange_test.go +++ b/ms/lrange_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/lrem_test.go b/ms/lrem_test.go index 00dbb907..7bb40a35 100755 --- a/ms/lrem_test.go +++ b/ms/lrem_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/lset_test.go b/ms/lset_test.go index b10a6ce1..fa1bfad1 100755 --- a/ms/lset_test.go +++ b/ms/lset_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/ltrim_test.go b/ms/ltrim_test.go index 007faf5f..08ecee51 100755 --- a/ms/ltrim_test.go +++ b/ms/ltrim_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/mget_test.go b/ms/mget_test.go index 8e751506..266d3e98 100755 --- a/ms/mget_test.go +++ b/ms/mget_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/mset_test.go b/ms/mset_test.go index 4f35fa1d..273f4f8a 100755 --- a/ms/mset_test.go +++ b/ms/mset_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/msetnx_test.go b/ms/msetnx_test.go index f2538e9b..fc71b173 100755 --- a/ms/msetnx_test.go +++ b/ms/msetnx_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/object_test.go b/ms/object_test.go index e4f0a451..12a470a3 100755 --- a/ms/object_test.go +++ b/ms/object_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/persist_test.go b/ms/persist_test.go index fb92fd86..23f89a3c 100755 --- a/ms/persist_test.go +++ b/ms/persist_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/pexpire_test.go b/ms/pexpire_test.go index 8109a26a..da022b22 100755 --- a/ms/pexpire_test.go +++ b/ms/pexpire_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/pexpireat_test.go b/ms/pexpireat_test.go index c4e5542b..5a0fedc4 100755 --- a/ms/pexpireat_test.go +++ b/ms/pexpireat_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/pfadd_test.go b/ms/pfadd_test.go index b2bd8e38..22a93a9b 100755 --- a/ms/pfadd_test.go +++ b/ms/pfadd_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/pfcount_test.go b/ms/pfcount_test.go index 210a6541..752c4ee8 100755 --- a/ms/pfcount_test.go +++ b/ms/pfcount_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/pfmerge_test.go b/ms/pfmerge_test.go index 0a1f7931..53547b2e 100755 --- a/ms/pfmerge_test.go +++ b/ms/pfmerge_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/ping_test.go b/ms/ping_test.go index 6e0aebdf..90b5c4c4 100755 --- a/ms/ping_test.go +++ b/ms/ping_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/psetex_test.go b/ms/psetex_test.go index cb1f29a7..4cf8eff4 100755 --- a/ms/psetex_test.go +++ b/ms/psetex_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/pttl_test.go b/ms/pttl_test.go index 2b0b2e77..02b4e2e3 100755 --- a/ms/pttl_test.go +++ b/ms/pttl_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/randomkey_test.go b/ms/randomkey_test.go index 1fd2d832..ebbc3db1 100755 --- a/ms/randomkey_test.go +++ b/ms/randomkey_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/rename_test.go b/ms/rename_test.go index 4410ed13..4b178214 100755 --- a/ms/rename_test.go +++ b/ms/rename_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/renamenx_test.go b/ms/renamenx_test.go index cfeb32bc..5b1c87f7 100755 --- a/ms/renamenx_test.go +++ b/ms/renamenx_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/rpop_test.go b/ms/rpop_test.go index ec52c1ce..0e77be65 100755 --- a/ms/rpop_test.go +++ b/ms/rpop_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/rpoplpush_test.go b/ms/rpoplpush_test.go index 55b46609..e7daafff 100755 --- a/ms/rpoplpush_test.go +++ b/ms/rpoplpush_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/rpush_test.go b/ms/rpush_test.go index a0aa481e..fe24ac6a 100755 --- a/ms/rpush_test.go +++ b/ms/rpush_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/rpushx_test.go b/ms/rpushx_test.go index 6a08ea3f..bf88549f 100755 --- a/ms/rpushx_test.go +++ b/ms/rpushx_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sadd_test.go b/ms/sadd_test.go index cfe029ca..972e4ec6 100755 --- a/ms/sadd_test.go +++ b/ms/sadd_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/scan_test.go b/ms/scan_test.go index 69048770..11d54fcd 100755 --- a/ms/scan_test.go +++ b/ms/scan_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/scard_test.go b/ms/scard_test.go index dc2e341d..4c4035e2 100755 --- a/ms/scard_test.go +++ b/ms/scard_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sdiff_test.go b/ms/sdiff_test.go index eb030216..aeea5e92 100755 --- a/ms/sdiff_test.go +++ b/ms/sdiff_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sdiffstore_test.go b/ms/sdiffstore_test.go index 1c1afc3c..4f8f320c 100755 --- a/ms/sdiffstore_test.go +++ b/ms/sdiffstore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/set_test.go b/ms/set_test.go index b18328b2..471b11ab 100755 --- a/ms/set_test.go +++ b/ms/set_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/setex_test.go b/ms/setex_test.go index 06fb0cce..f14d1200 100755 --- a/ms/setex_test.go +++ b/ms/setex_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/ms/setnx_test.go b/ms/setnx_test.go index 38891e99..f62b2e4b 100755 --- a/ms/setnx_test.go +++ b/ms/setnx_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sinter_test.go b/ms/sinter_test.go index d81fc948..946e72ad 100755 --- a/ms/sinter_test.go +++ b/ms/sinter_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sinterstore_test.go b/ms/sinterstore_test.go index 83bc5c50..d06af3a4 100755 --- a/ms/sinterstore_test.go +++ b/ms/sinterstore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sismember_test.go b/ms/sismember_test.go index 690af850..c8ee86b9 100755 --- a/ms/sismember_test.go +++ b/ms/sismember_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/smembers_test.go b/ms/smembers_test.go index 97ea3de2..6c7f9720 100755 --- a/ms/smembers_test.go +++ b/ms/smembers_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/smove_test.go b/ms/smove_test.go index f7b5a0a1..b5032535 100755 --- a/ms/smove_test.go +++ b/ms/smove_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sort_test.go b/ms/sort_test.go index 81ec01bc..df03d7ed 100755 --- a/ms/sort_test.go +++ b/ms/sort_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/spop_test.go b/ms/spop_test.go index 8e26c8d2..4cc41140 100755 --- a/ms/spop_test.go +++ b/ms/spop_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/srandmember_test.go b/ms/srandmember_test.go index eb54c54e..ec947f23 100755 --- a/ms/srandmember_test.go +++ b/ms/srandmember_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/srem_test.go b/ms/srem_test.go index ddde65f0..4989a9e8 100755 --- a/ms/srem_test.go +++ b/ms/srem_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sscan_test.go b/ms/sscan_test.go index 0f0c84e2..ed5b203a 100755 --- a/ms/sscan_test.go +++ b/ms/sscan_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/strlen_test.go b/ms/strlen_test.go index 25503541..beaa77c1 100755 --- a/ms/strlen_test.go +++ b/ms/strlen_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sunion_test.go b/ms/sunion_test.go index c0fed246..d47ff264 100755 --- a/ms/sunion_test.go +++ b/ms/sunion_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/sunionstore_test.go b/ms/sunionstore_test.go index a364d4d7..826a1b88 100755 --- a/ms/sunionstore_test.go +++ b/ms/sunionstore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/time_test.go b/ms/time_test.go index 99c10303..9e199a4b 100755 --- a/ms/time_test.go +++ b/ms/time_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/touch_test.go b/ms/touch_test.go index d2025e78..7b343b27 100755 --- a/ms/touch_test.go +++ b/ms/touch_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/ttl_test.go b/ms/ttl_test.go index a91154bd..48640d61 100755 --- a/ms/ttl_test.go +++ b/ms/ttl_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/type_test.go b/ms/type_test.go index 88456631..5b47db4c 100755 --- a/ms/type_test.go +++ b/ms/type_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zadd_test.go b/ms/zadd_test.go index bf29690d..5288ea32 100755 --- a/ms/zadd_test.go +++ b/ms/zadd_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zcard_test.go b/ms/zcard_test.go index b0bc29f6..ef544885 100755 --- a/ms/zcard_test.go +++ b/ms/zcard_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zcount_test.go b/ms/zcount_test.go index c5164426..3fe9ecf2 100755 --- a/ms/zcount_test.go +++ b/ms/zcount_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zincrby_test.go b/ms/zincrby_test.go index 8f1787b9..3e550d49 100755 --- a/ms/zincrby_test.go +++ b/ms/zincrby_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zinterstore_test.go b/ms/zinterstore_test.go index 1bd1f6eb..4f1313d7 100755 --- a/ms/zinterstore_test.go +++ b/ms/zinterstore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zlexcount_test.go b/ms/zlexcount_test.go index e38ce658..cda321e7 100755 --- a/ms/zlexcount_test.go +++ b/ms/zlexcount_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrange_test.go b/ms/zrange_test.go index 1b9c4c03..81a53e49 100755 --- a/ms/zrange_test.go +++ b/ms/zrange_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrangebylex_test.go b/ms/zrangebylex_test.go index 88d97a46..7e0d1a29 100755 --- a/ms/zrangebylex_test.go +++ b/ms/zrangebylex_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrangebyscore_test.go b/ms/zrangebyscore_test.go index 048361ac..e20423da 100755 --- a/ms/zrangebyscore_test.go +++ b/ms/zrangebyscore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrank_test.go b/ms/zrank_test.go index 2099747f..b86694f0 100755 --- a/ms/zrank_test.go +++ b/ms/zrank_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrem_test.go b/ms/zrem_test.go index 5aed2d56..3dbbf2ce 100755 --- a/ms/zrem_test.go +++ b/ms/zrem_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zremrangebylex_test.go b/ms/zremrangebylex_test.go index 2688d093..41017ddb 100755 --- a/ms/zremrangebylex_test.go +++ b/ms/zremrangebylex_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zremrangebyrank_test.go b/ms/zremrangebyrank_test.go index 8ffd0e9a..99fffc86 100755 --- a/ms/zremrangebyrank_test.go +++ b/ms/zremrangebyrank_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zremrangebyscore_test.go b/ms/zremrangebyscore_test.go index 0b099568..7a98d490 100755 --- a/ms/zremrangebyscore_test.go +++ b/ms/zremrangebyscore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrevrange_test.go b/ms/zrevrange_test.go index b4261965..20171902 100755 --- a/ms/zrevrange_test.go +++ b/ms/zrevrange_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrevrangebylex_test.go b/ms/zrevrangebylex_test.go index bbd15d13..5ee1c801 100755 --- a/ms/zrevrangebylex_test.go +++ b/ms/zrevrangebylex_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrevrangebyscore_test.go b/ms/zrevrangebyscore_test.go index 41603912..557f361b 100755 --- a/ms/zrevrangebyscore_test.go +++ b/ms/zrevrangebyscore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zrevrank_test.go b/ms/zrevrank_test.go index d29809f8..a7b4df53 100755 --- a/ms/zrevrank_test.go +++ b/ms/zrevrank_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zscan_test.go b/ms/zscan_test.go index 712041ad..92cb9245 100755 --- a/ms/zscan_test.go +++ b/ms/zscan_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zscore_test.go b/ms/zscore_test.go index a84f6def..cbd72171 100755 --- a/ms/zscore_test.go +++ b/ms/zscore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/ms/zunionstore_test.go b/ms/zunionstore_test.go index b5c904f1..6d313b18 100755 --- a/ms/zunionstore_test.go +++ b/ms/zunionstore_test.go @@ -17,9 +17,9 @@ package ms_test import ( "encoding/json" "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" "testing" diff --git a/connection/connection.go b/protocol/protocol.go similarity index 93% rename from connection/connection.go rename to protocol/protocol.go index af8181f7..510dd480 100644 --- a/connection/connection.go +++ b/protocol/protocol.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package connection +package protocol import ( "encoding/json" @@ -21,8 +21,8 @@ import ( "github.com/kuzzleio/sdk-go/types" ) -// Connection provides functions to manage many connection type (websocket...) -type Connection interface { +// Protocol provides functions to manage many connection type (websocket...) +type Protocol interface { AddListener(event int, channel chan<- interface{}) RemoveListener(event int, channel chan<- interface{}) RemoveAllListeners(event int) diff --git a/connection/websocket/web_socket.go b/protocol/websocket/web_socket.go similarity index 96% rename from connection/websocket/web_socket.go rename to protocol/websocket/web_socket.go index ca701a76..9efaaa68 100644 --- a/connection/websocket/web_socket.go +++ b/protocol/websocket/web_socket.go @@ -22,8 +22,8 @@ import ( "time" "github.com/gorilla/websocket" - "github.com/kuzzleio/sdk-go/connection" "github.com/kuzzleio/sdk-go/event" + "github.com/kuzzleio/sdk-go/protocol" "github.com/kuzzleio/sdk-go/state" "github.com/kuzzleio/sdk-go/types" ) @@ -67,9 +67,9 @@ type webSocket struct { autoResubscribe bool host string offlineQueue []*types.QueryObject - offlineQueueLoader connection.OfflineQueueLoader + offlineQueueLoader protocol.OfflineQueueLoader port int - queueFilter connection.QueueFilter + queueFilter protocol.QueueFilter queueMaxSize int queueTTL time.Duration reconnectionDelay time.Duration @@ -77,10 +77,10 @@ type webSocket struct { ssl bool } -var defaultQueueFilter connection.QueueFilter +var defaultQueueFilter protocol.QueueFilter // NewWebSocket instanciates a new webSocket connection object -func NewWebSocket(host string, options types.Options) connection.Connection { +func NewWebSocket(host string, options types.Options) protocol.Protocol { defaultQueueFilter = func([]byte) bool { return true } @@ -569,7 +569,7 @@ func (ws *webSocket) OfflineQueue() []*types.QueryObject { return ws.offlineQueue } -func (ws *webSocket) OfflineQueueLoader() connection.OfflineQueueLoader { +func (ws *webSocket) OfflineQueueLoader() protocol.OfflineQueueLoader { return ws.offlineQueueLoader } @@ -577,7 +577,7 @@ func (ws *webSocket) Port() int { return ws.port } -func (ws *webSocket) QueueFilter() connection.QueueFilter { +func (ws *webSocket) QueueFilter() protocol.QueueFilter { return ws.queueFilter } @@ -609,11 +609,11 @@ func (ws *webSocket) SetAutoReplay(v bool) { ws.autoReplay = v } -func (ws *webSocket) SetOfflineQueueLoader(v connection.OfflineQueueLoader) { +func (ws *webSocket) SetOfflineQueueLoader(v protocol.OfflineQueueLoader) { ws.offlineQueueLoader = v } -func (ws *webSocket) SetQueueFilter(v connection.QueueFilter) { +func (ws *webSocket) SetQueueFilter(v protocol.QueueFilter) { if v == nil { ws.queueFilter = defaultQueueFilter } else { diff --git a/connection/websocket/web_socket_test.go b/protocol/websocket/web_socket_test.go similarity index 100% rename from connection/websocket/web_socket_test.go rename to protocol/websocket/web_socket_test.go diff --git a/security/getAllCredentialFields_test.go b/security/getAllCredentialFields_test.go index a7e8b52d..c43cae46 100644 --- a/security/getAllCredentialFields_test.go +++ b/security/getAllCredentialFields_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/getCredentialFields_test.go b/security/getCredentialFields_test.go index 8344cca5..5731a556 100644 --- a/security/getCredentialFields_test.go +++ b/security/getCredentialFields_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/getProfile_test.go b/security/getProfile_test.go index f4d8e89f..e34bc43d 100644 --- a/security/getProfile_test.go +++ b/security/getProfile_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/getRole_test.go b/security/getRole_test.go index cb8b901b..1d8789d7 100644 --- a/security/getRole_test.go +++ b/security/getRole_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/security" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" diff --git a/security/getUser_test.go b/security/getUser_test.go index 7a0f2218..93e0781b 100644 --- a/security/getUser_test.go +++ b/security/getUser_test.go @@ -20,9 +20,9 @@ import ( "encoding/json" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/mGetProfiles_test.go b/security/mGetProfiles_test.go index 973e8918..2f2e6111 100644 --- a/security/mGetProfiles_test.go +++ b/security/mGetProfiles_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/mGetRoles_test.go b/security/mGetRoles_test.go index 67748928..e00bf815 100644 --- a/security/mGetRoles_test.go +++ b/security/mGetRoles_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/searchProfiles_test.go b/security/searchProfiles_test.go index a9f2504d..5876d568 100644 --- a/security/searchProfiles_test.go +++ b/security/searchProfiles_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/searchRoles_test.go b/security/searchRoles_test.go index 257411cd..da5ee6fe 100644 --- a/security/searchRoles_test.go +++ b/security/searchRoles_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/searchUsers_test.go b/security/searchUsers_test.go index d52118f4..27e7bf18 100644 --- a/security/searchUsers_test.go +++ b/security/searchUsers_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/updateCredentials_test.go b/security/updateCredentials_test.go index 463e1f09..738c40d7 100644 --- a/security/updateCredentials_test.go +++ b/security/updateCredentials_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/security/validateCredentials_test.go b/security/validateCredentials_test.go index b651c0d0..a179fa98 100644 --- a/security/validateCredentials_test.go +++ b/security/validateCredentials_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/server/adminExists_test.go b/server/adminExists_test.go index 64133d5e..90162820 100644 --- a/server/adminExists_test.go +++ b/server/adminExists_test.go @@ -18,9 +18,9 @@ import ( "encoding/json" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/server/getAllStats_test.go b/server/getAllStats_test.go index 90e7176e..744f9822 100644 --- a/server/getAllStats_test.go +++ b/server/getAllStats_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/server/getConfig_test.go b/server/getConfig_test.go index 1ba73257..12199f11 100644 --- a/server/getConfig_test.go +++ b/server/getConfig_test.go @@ -18,9 +18,9 @@ import ( "encoding/json" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/server/getLastStats_test.go b/server/getLastStats_test.go index eea03013..aeaa6fa0 100644 --- a/server/getLastStats_test.go +++ b/server/getLastStats_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/server/getStats_test.go b/server/getStats_test.go index fb298c37..ccd88676 100644 --- a/server/getStats_test.go +++ b/server/getStats_test.go @@ -20,9 +20,9 @@ import ( "testing" "time" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/server/info_test.go b/server/info_test.go index 773a6fc9..f5ebf712 100644 --- a/server/info_test.go +++ b/server/info_test.go @@ -18,9 +18,9 @@ import ( "encoding/json" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/server/now_test.go b/server/now_test.go index 0589d5c3..20725b05 100644 --- a/server/now_test.go +++ b/server/now_test.go @@ -19,9 +19,9 @@ import ( "fmt" "testing" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" "github.com/kuzzleio/sdk-go/types" "github.com/stretchr/testify/assert" ) diff --git a/test.sh b/test.sh index 52616fde..9e292ba6 100755 --- a/test.sh +++ b/test.sh @@ -5,7 +5,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" workdir=$dir/.cover profile="$workdir/cover.out" mode=count -dirs=(kuzzle connection/websocket collection security ms realtime index server auth document) +dirs=(kuzzle protocol/websocket collection security ms realtime index server auth document) timeout=${TIMEOUT:=1m} generate_cover_data() { From 3f3597e5bfa3f292bff4f47268611dcb4e840557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Wed, 10 Oct 2018 14:17:15 +0200 Subject: [PATCH 330/363] document.DeleteByQuery - return the array of ids (#213) --- document/deleteByQuery.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/document/deleteByQuery.go b/document/deleteByQuery.go index 5db6a19b..6bd927b3 100644 --- a/document/deleteByQuery.go +++ b/document/deleteByQuery.go @@ -16,6 +16,7 @@ package document import ( "encoding/json" + "fmt" "github.com/kuzzleio/sdk-go/types" ) @@ -52,9 +53,13 @@ func (d *Document) DeleteByQuery(index string, collection string, body json.RawM return nil, res.Error } - var deleted []string - json.Unmarshal(res.Result, &deleted) - - return deleted, nil + var deleted struct { + Ids []string `json:"ids"` + } + err := json.Unmarshal(res.Result, &deleted) + if err != nil { + return nil, types.NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), res.Result), 500) + } + return deleted.Ids, nil } From e7a29e5c6fc7a2ea53d68caf22b0e44be8eb04b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Wed, 10 Oct 2018 14:18:56 +0200 Subject: [PATCH 331/363] readme - provide full sample (#214) --- README.md | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 609cc21a..52391365 100644 --- a/README.md +++ b/README.md @@ -29,23 +29,29 @@ go get github.com/kuzzleio/sdk-go ## Basic usage ````go -func main() { - conn := websocket.NewWebSocket("localhost:7512", nil) - k, _ := kuzzle.NewKuzzle(conn, nil) +package main - res, err := k.GetAllStatistics(nil) +import ( + "fmt" - if err != nil { - fmt.Println(err.Error()) - return - } + "github.com/kuzzleio/sdk-go/connection/websocket" + "github.com/kuzzleio/sdk-go/kuzzle" +) - for _, stat := range res { - fmt.Println(stat.Timestamp, stat.FailedRequests, stat.Connections, stat.CompletedRequests, stat.OngoingRequests) - } -} +func main() { + conn := websocket.NewWebSocket("localhost", nil) + k, _ := kuzzle.NewKuzzle(conn, nil) + k.Connect() + res, err := k.Server.GetAllStats(nil) + if err != nil { + fmt.Println(err.Error()) + return + } + + fmt.Println(string(res)) +} ```` ## Running Tests From 7f2c960cb76ea86514c655890a0ad4894a6c5e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Blondel?= Date: Wed, 17 Oct 2018 06:46:00 +0200 Subject: [PATCH 332/363] Make websocket public (#216) * make websocket public * update unit tests --- protocol/websocket/web_socket.go | 97 ++++++++++++++------------- protocol/websocket/web_socket_test.go | 12 ++-- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/protocol/websocket/web_socket.go b/protocol/websocket/web_socket.go index 9efaaa68..53f9ee17 100644 --- a/protocol/websocket/web_socket.go +++ b/protocol/websocket/web_socket.go @@ -42,7 +42,7 @@ type subscription struct { subscribeToSelf bool } -type webSocket struct { +type WebSocket struct { ws *websocket.Conn mu *sync.Mutex queuing bool @@ -93,7 +93,7 @@ func NewWebSocket(host string, options types.Options) protocol.Protocol { opts = options } - ws := &webSocket{ + ws := &WebSocket{ mu: &sync.Mutex{}, queueTTL: opts.QueueTTL(), offlineQueue: []*types.QueryObject{}, @@ -131,7 +131,7 @@ func NewWebSocket(host string, options types.Options) protocol.Protocol { } //Connect connects to a kuzzle instance -func (ws *webSocket) Connect() (bool, error) { +func (ws *WebSocket) Connect() (bool, error) { if ws.state != state.Offline { return false, nil } @@ -217,7 +217,7 @@ func (ws *webSocket) Connect() (bool, error) { return ws.wasConnected, err } -func (ws *webSocket) Send(query []byte, options types.QueryOptions, responseChannel chan<- *types.KuzzleResponse, requestId string) error { +func (ws *WebSocket) Send(query []byte, options types.QueryOptions, responseChannel chan<- *types.KuzzleResponse, requestId string) error { queuable := options == nil || options.Queuable() queuable = queuable && ws.queueFilter(query) @@ -247,14 +247,15 @@ func (ws *webSocket) Send(query []byte, options types.QueryOptions, responseChan return nil } -func (ws *webSocket) discardRequest(responseChannel chan<- *types.KuzzleResponse, query []byte) { +func (ws *WebSocket) discardRequest(responseChannel chan<- *types.KuzzleResponse, query []byte) { if responseChannel != nil { responseChannel <- &types.KuzzleResponse{Status: 400, Error: types.NewError("Unable to execute request: not connected to a Kuzzle server.\nDiscarded request: "+string(query), 400)} } } // Clean up the queue, ensuring the queryTTL and queryMaxSize properties are respected -func (ws *webSocket) cleanQueue() { +// Clean up the queue, ensuring the queryTTL and queryMaxSize properties are respected +func (ws *WebSocket) cleanQueue() { now := time.Now() now = now.Add(-ws.queueTTL * time.Millisecond) @@ -288,7 +289,7 @@ func (ws *webSocket) cleanQueue() { } } -func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage, subscribeToSelf bool, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { +func (ws *WebSocket) RegisterSub(channel, roomID string, filters json.RawMessage, subscribeToSelf bool, notifChan chan<- types.KuzzleNotification, onReconnectChannel chan<- interface{}) { subs, found := ws.subscriptions.Load(channel) if !found { @@ -307,7 +308,7 @@ func (ws *webSocket) RegisterSub(channel, roomID string, filters json.RawMessage ws.subscriptions.Store(channel, subs) } -func (ws *webSocket) UnregisterSub(roomID string) { +func (ws *WebSocket) UnregisterSub(roomID string) { ws.subscriptions.Range(func(k, v interface{}) bool { for k, sub := range v.(map[string]subscription) { if sub.roomID == roomID { @@ -320,7 +321,7 @@ func (ws *webSocket) UnregisterSub(roomID string) { }) } -func (ws *webSocket) CancelSubs() { +func (ws *WebSocket) CancelSubs() { ws.subscriptions.Range(func(roomId, s interface{}) bool { for _, sub := range s.(map[string]subscription) { if sub.notificationChannel != nil { @@ -332,7 +333,7 @@ func (ws *webSocket) CancelSubs() { }) } -func (ws *webSocket) listen() { +func (ws *WebSocket) listen() { for { msg := <-ws.listenChan @@ -371,7 +372,7 @@ func (ws *webSocket) listen() { } // Adds a listener to a Kuzzle global event. When an event is fired, listeners are called in the order of their insertion. -func (ws *webSocket) AddListener(event int, channel chan<- interface{}) { +func (ws *WebSocket) AddListener(event int, channel chan<- interface{}) { if ws.eventListeners[event] == nil { ws.eventListeners[event] = make(map[chan<- interface{}]bool) } @@ -379,7 +380,7 @@ func (ws *webSocket) AddListener(event int, channel chan<- interface{}) { } // Removes all listeners, either from all events and close channels -func (ws *webSocket) RemoveAllListeners(event int) { +func (ws *WebSocket) RemoveAllListeners(event int) { for k := range ws.eventListeners { if event == k || event == -1 { delete(ws.eventListeners, k) @@ -394,24 +395,24 @@ func (ws *webSocket) RemoveAllListeners(event int) { } // Removes a listener from an event. -func (ws *webSocket) RemoveListener(event int, c chan<- interface{}) { +func (ws *WebSocket) RemoveListener(event int, c chan<- interface{}) { delete(ws.eventListeners[event], c) delete(ws.eventListenersOnce[event], c) } -func (ws *webSocket) Once(event int, channel chan<- interface{}) { +func (ws *WebSocket) Once(event int, channel chan<- interface{}) { if ws.eventListenersOnce[event] == nil { ws.eventListenersOnce[event] = make(map[chan<- interface{}]bool) } ws.eventListenersOnce[event][channel] = true } -func (ws *webSocket) ListenerCount(event int) int { +func (ws *WebSocket) ListenerCount(event int) int { return len(ws.eventListenersOnce[event]) + len(ws.eventListeners[event]) } // Emit an event to all registered listeners -func (ws *webSocket) EmitEvent(event int, arg interface{}) { +func (ws *WebSocket) EmitEvent(event int, arg interface{}) { for c := range ws.eventListeners[event] { c <- arg } @@ -422,31 +423,31 @@ func (ws *webSocket) EmitEvent(event int, arg interface{}) { } } -func (ws *webSocket) StartQueuing() { +func (ws *WebSocket) StartQueuing() { if ws.state == state.Offline && !ws.autoQueue { ws.queuing = true } } -func (ws *webSocket) StopQueuing() { +func (ws *WebSocket) StopQueuing() { if ws.state == state.Offline && !ws.autoQueue { ws.queuing = false } } -func (ws *webSocket) ClearQueue() { +func (ws *WebSocket) ClearQueue() { ws.offlineQueue = nil } // PlayQueue replays the requests queued during offline mode. Works only if the SDK is not in a disconnected state, and if the autoReplay option is set to false. -func (ws *webSocket) PlayQueue() { +func (ws *WebSocket) PlayQueue() { if ws.state != state.Offline && !ws.autoReplay { ws.cleanQueue() ws.dequeue() } } -func (ws *webSocket) mergeOfflineQueueWithLoader() error { +func (ws *WebSocket) mergeOfflineQueueWithLoader() error { type query struct { requestId string `json:"requestId"` controller string `json:"controller"` @@ -475,7 +476,7 @@ func (ws *webSocket) mergeOfflineQueueWithLoader() error { return nil } -func (ws *webSocket) dequeue() error { +func (ws *WebSocket) dequeue() error { if ws.offlineQueueLoader != nil { err := ws.mergeOfflineQueueWithLoader() if err != nil { @@ -497,7 +498,7 @@ func (ws *webSocket) dequeue() error { return nil } -func (ws *webSocket) emitRequest(query *types.QueryObject) error { +func (ws *WebSocket) emitRequest(query *types.QueryObject) error { now := time.Now() now = now.Add(-MAX_EMIT_TIMEOUT * time.Second) @@ -521,7 +522,7 @@ func (ws *webSocket) emitRequest(query *types.QueryObject) error { return nil } -func (ws *webSocket) Close() error { +func (ws *WebSocket) Close() error { ws.stopRetryingToConnect = true ws.ws.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")) ws.state = state.Disconnected @@ -529,7 +530,7 @@ func (ws *webSocket) Close() error { return ws.ws.Close() } -func (ws *webSocket) isValidState() bool { +func (ws *WebSocket) isValidState() bool { switch ws.state { case state.Initializing, state.Ready, state.Disconnected, state.Error, state.Offline: return true @@ -537,83 +538,83 @@ func (ws *webSocket) isValidState() bool { return false } -func (ws *webSocket) State() int { +func (ws *WebSocket) State() int { return ws.state } -func (ws *webSocket) RequestHistory() map[string]time.Time { +func (ws *WebSocket) RequestHistory() map[string]time.Time { return ws.requestHistory } -func (ws *webSocket) AutoQueue() bool { +func (ws *WebSocket) AutoQueue() bool { return ws.autoQueue } -func (ws *webSocket) AutoReconnect() bool { +func (ws *WebSocket) AutoReconnect() bool { return ws.autoReconnect } -func (ws *webSocket) AutoResubscribe() bool { +func (ws *WebSocket) AutoResubscribe() bool { return ws.autoResubscribe } -func (ws *webSocket) AutoReplay() bool { +func (ws *WebSocket) AutoReplay() bool { return ws.autoReplay } -func (ws *webSocket) Host() string { +func (ws *WebSocket) Host() string { return ws.host } -func (ws *webSocket) OfflineQueue() []*types.QueryObject { +func (ws *WebSocket) OfflineQueue() []*types.QueryObject { return ws.offlineQueue } -func (ws *webSocket) OfflineQueueLoader() protocol.OfflineQueueLoader { +func (ws *WebSocket) OfflineQueueLoader() protocol.OfflineQueueLoader { return ws.offlineQueueLoader } -func (ws *webSocket) Port() int { +func (ws *WebSocket) Port() int { return ws.port } -func (ws *webSocket) QueueFilter() protocol.QueueFilter { +func (ws *WebSocket) QueueFilter() protocol.QueueFilter { return ws.queueFilter } -func (ws *webSocket) QueueMaxSize() int { +func (ws *WebSocket) QueueMaxSize() int { return ws.queueMaxSize } -func (ws *webSocket) QueueTTL() time.Duration { +func (ws *WebSocket) QueueTTL() time.Duration { return ws.queueTTL } -func (ws *webSocket) ReplayInterval() time.Duration { +func (ws *WebSocket) ReplayInterval() time.Duration { return ws.replayInterval } -func (ws *webSocket) ReconnectionDelay() time.Duration { +func (ws *WebSocket) ReconnectionDelay() time.Duration { return ws.reconnectionDelay } -func (ws *webSocket) SslConnection() bool { +func (ws *WebSocket) SslConnection() bool { return ws.ssl } -func (ws *webSocket) SetAutoQueue(v bool) { +func (ws *WebSocket) SetAutoQueue(v bool) { ws.autoQueue = v } -func (ws *webSocket) SetAutoReplay(v bool) { +func (ws *WebSocket) SetAutoReplay(v bool) { ws.autoReplay = v } -func (ws *webSocket) SetOfflineQueueLoader(v protocol.OfflineQueueLoader) { +func (ws *WebSocket) SetOfflineQueueLoader(v protocol.OfflineQueueLoader) { ws.offlineQueueLoader = v } -func (ws *webSocket) SetQueueFilter(v protocol.QueueFilter) { +func (ws *WebSocket) SetQueueFilter(v protocol.QueueFilter) { if v == nil { ws.queueFilter = defaultQueueFilter } else { @@ -621,14 +622,14 @@ func (ws *webSocket) SetQueueFilter(v protocol.QueueFilter) { } } -func (ws *webSocket) SetQueueMaxSize(v int) { +func (ws *WebSocket) SetQueueMaxSize(v int) { ws.queueMaxSize = v } -func (ws *webSocket) SetQueueTTL(v time.Duration) { +func (ws *WebSocket) SetQueueTTL(v time.Duration) { ws.queueTTL = v } -func (ws *webSocket) SetReplayInterval(v time.Duration) { +func (ws *WebSocket) SetReplayInterval(v time.Duration) { ws.replayInterval = v } diff --git a/protocol/websocket/web_socket_test.go b/protocol/websocket/web_socket_test.go index 53bf4b8e..a3f254ed 100644 --- a/protocol/websocket/web_socket_test.go +++ b/protocol/websocket/web_socket_test.go @@ -22,7 +22,7 @@ import ( ) func TestAddListener(t *testing.T) { - c := webSocket{eventListeners: make(map[int]map[chan<- interface{}]bool)} + c := WebSocket{eventListeners: make(map[int]map[chan<- interface{}]bool)} c.Connect() c.AddListener(event.LoginAttempt, nil) c.AddListener(event.Disconnected, nil) @@ -30,7 +30,7 @@ func TestAddListener(t *testing.T) { } func TestOnce(t *testing.T) { - c := webSocket{eventListenersOnce: make(map[int]map[chan<- interface{}]bool)} + c := WebSocket{eventListenersOnce: make(map[int]map[chan<- interface{}]bool)} listener := make(chan interface{}) go func() { <-listener @@ -42,7 +42,7 @@ func TestOnce(t *testing.T) { } func TestRemoveAllListeners(t *testing.T) { - c := webSocket{ + c := WebSocket{ eventListeners: make(map[int]map[chan<- interface{}]bool), eventListenersOnce: make(map[int]map[chan<- interface{}]bool), } @@ -66,7 +66,7 @@ func TestRemoveAllListeners(t *testing.T) { } func TestRemoveListener(t *testing.T) { - c := webSocket{eventListeners: make(map[int]map[chan<- interface{}]bool)} + c := WebSocket{eventListeners: make(map[int]map[chan<- interface{}]bool)} listener := make(chan interface{}) c.AddListener(event.LoginAttempt, listener) @@ -83,7 +83,7 @@ func TestRemoveListener(t *testing.T) { } func TestListenerCount(t *testing.T) { - c := webSocket{ + c := WebSocket{ eventListeners: make(map[int]map[chan<- interface{}]bool), eventListenersOnce: make(map[int]map[chan<- interface{}]bool), } @@ -102,7 +102,7 @@ func TestListenerCount(t *testing.T) { } func TestEmitEvent(t *testing.T) { - c := webSocket{ + c := WebSocket{ eventListeners: make(map[int]map[chan<- interface{}]bool), eventListenersOnce: make(map[int]map[chan<- interface{}]bool), } From d5a771cd272ff763dfa6d91da8358cf191640908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Tue, 23 Oct 2018 13:01:58 +0200 Subject: [PATCH 333/363] fixes #KZL-695 - SearchResult.Fetched (#217) --- document/search_test.go | 7 +++++-- types/search_result.go | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/document/search_test.go b/document/search_test.go index 5cfad12c..b71e4449 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -77,7 +77,8 @@ func TestSearchDocument(t *testing.T) { return &types.KuzzleResponse{Result: []byte(` { - "hits": ["id1", "id2"] + "hits": ["id1", "id2"], + "total": 42 }`), } }, @@ -85,6 +86,8 @@ func TestSearchDocument(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) d := document.NewDocument(k) - _, err := d.Search("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) + response, err := d.Search("index", "collection", json.RawMessage(`{"foo":"bar"}`), nil) assert.Nil(t, err) + assert.Equal(t, 2, response.Fetched) + assert.Equal(t, 42, response.Total) } diff --git a/types/search_result.go b/types/search_result.go index fb019094..8cd9b635 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -46,12 +46,15 @@ func NewSearchResult(collection string, filters json.RawMessage, options QueryOp return nil, NewError(fmt.Sprintf("Unable to parse response: %s\n%s", err.Error(), raw.Result), 500) } + var docs []interface{} + json.Unmarshal(parsed.Documents, &docs) + sr := &SearchResult{ Collection: collection, Filters: filters, Documents: parsed.Documents, Total: parsed.Total, - Fetched: len(parsed.Documents), + Fetched: len(docs), Aggregations: parsed.Aggregations, Options: NewQueryOptions(), } From 3d1d0753d8920e1ae410f6f44185e69e9d8254e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Wed, 24 Oct 2018 15:02:29 +0200 Subject: [PATCH 334/363] [kzl-642] implement searchResult.next --- README.md | 2 +- collection/search_specifications.go | 10 +- document/search.go | 4 +- security/profile.go | 6 - security/profileSearchResult.go | 66 ++++++++++ security/role.go | 5 - security/roleSearchResult.go | 65 ++++++++++ security/searchProfiles.go | 16 ++- security/searchProfiles_test.go | 4 +- security/searchRoles.go | 16 ++- security/searchUsers.go | 17 ++- security/user.go | 6 - security/userSearchResult.go | 65 ++++++++++ types/kuzzle_request.go | 1 + types/search_result.go | 192 +++++++++++++++++++++++++--- 15 files changed, 425 insertions(+), 50 deletions(-) create mode 100644 security/profileSearchResult.go create mode 100644 security/roleSearchResult.go create mode 100644 security/userSearchResult.go diff --git a/README.md b/README.md index 52391365..7edff681 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ package main import ( "fmt" - "github.com/kuzzleio/sdk-go/connection/websocket" "github.com/kuzzleio/sdk-go/kuzzle" + "github.com/kuzzleio/sdk-go/protocol/websocket" ) func main() { diff --git a/collection/search_specifications.go b/collection/search_specifications.go index f426896b..6b0db7fa 100644 --- a/collection/search_specifications.go +++ b/collection/search_specifications.go @@ -15,8 +15,6 @@ package collection import ( - "encoding/json" - "github.com/kuzzleio/sdk-go/types" ) @@ -37,8 +35,10 @@ func (dc *Collection) SearchSpecifications(options types.QueryOptions) (*types.S return nil, res.Error } - specifications := &types.SearchResult{} - json.Unmarshal(res.Result, &specifications) + sr, err := types.NewSearchResult(dc.Kuzzle, "scrollSpecifications", query, options, res) + if err != nil { + return nil, err + } - return specifications, nil + return sr, nil } diff --git a/document/search.go b/document/search.go index 9b74f78d..c2861c32 100644 --- a/document/search.go +++ b/document/search.go @@ -45,6 +45,8 @@ func (d *Document) Search(index string, collection string, body json.RawMessage, } if options != nil { query.IncludeTrash = options.IncludeTrash() + query.From = options.From() + query.Size = options.Size() } go d.Kuzzle.Query(query, options, ch) @@ -55,7 +57,7 @@ func (d *Document) Search(index string, collection string, body json.RawMessage, return nil, res.Error } - sr, err := types.NewSearchResult(collection, body, options, res) + sr, err := types.NewSearchResult(d.Kuzzle, "scroll", query, options, res) if err != nil { return nil, err diff --git a/security/profile.go b/security/profile.go index a6fbc99a..9c816ab3 100644 --- a/security/profile.go +++ b/security/profile.go @@ -23,12 +23,6 @@ type Profile struct { Policies []*types.Policy } -type ProfileSearchResult struct { - Hits []*Profile - Total int `json:"total"` - ScrollId string `json:"scrollId"` -} - func NewProfile(id string, policies []*types.Policy) *Profile { return &Profile{ Id: id, diff --git a/security/profileSearchResult.go b/security/profileSearchResult.go new file mode 100644 index 00000000..106d1a20 --- /dev/null +++ b/security/profileSearchResult.go @@ -0,0 +1,66 @@ +// Copyright 2015-2018 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +type ProfileSearchResult struct { + Aggregations json.RawMessage `json:"aggregations"` + Hits []*Profile + Total int `json:"total"` + Fetched int + ScrollId string `json:"scrollId"` + kuzzle types.IKuzzle + request *types.KuzzleRequest + response *types.KuzzleResponse + options types.QueryOptions + scrollAction string +} + +// Next returns the next page of profiles +func (psr *ProfileSearchResult) Next() (*ProfileSearchResult, error) { + sr, err := types.NewSearchResult(psr.kuzzle, "scrollProfiles", psr.request, psr.options, psr.response) + if err != nil { + return nil, err + } + + nsr, err := sr.Next() + + if err != nil { + return nil, err + } + + npsr := &ProfileSearchResult{ + Aggregations: nsr.Aggregations, + Total: nsr.Total, + Fetched: nsr.Fetched, + ScrollId: nsr.ScrollId, + kuzzle: psr.kuzzle, + request: psr.request, + response: psr.response, + options: psr.options, + } + err = json.Unmarshal(nsr.Hits, npsr.Hits) + + if err != nil { + return nil, err + } + + return npsr, nil +} diff --git a/security/role.go b/security/role.go index 1c9ac973..07ce4b1e 100644 --- a/security/role.go +++ b/security/role.go @@ -23,11 +23,6 @@ type Role struct { Controllers map[string]*types.Controller } -type RoleSearchResult struct { - Hits []*Role - Total int -} - func NewRole(id string, controllers *types.Controllers) *Role { r := &Role{ Id: id, diff --git a/security/roleSearchResult.go b/security/roleSearchResult.go new file mode 100644 index 00000000..b89e7bda --- /dev/null +++ b/security/roleSearchResult.go @@ -0,0 +1,65 @@ +// Copyright 2015-2018 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +type RoleSearchResult struct { + Aggregations json.RawMessage `json:"aggregations"` + Hits []*Role + Total int `json:"total"` + Fetched int + ScrollId string `json:"scrollId"` + kuzzle types.IKuzzle + request *types.KuzzleRequest + response *types.KuzzleResponse + options types.QueryOptions +} + +// Next returns the next page of roles +func (rsr *RoleSearchResult) Next() (*RoleSearchResult, error) { + sr, err := types.NewSearchResult(rsr.kuzzle, "scrollRoles", rsr.request, rsr.options, rsr.response) + if err != nil { + return nil, err + } + + nsr, err := sr.Next() + + if err != nil { + return nil, err + } + + nrsr := &RoleSearchResult{ + Aggregations: nsr.Aggregations, + Total: nsr.Total, + Fetched: nsr.Fetched, + ScrollId: nsr.ScrollId, + kuzzle: rsr.kuzzle, + request: rsr.request, + response: rsr.response, + options: rsr.options, + } + err = json.Unmarshal(nsr.Hits, nsr.Hits) + + if err != nil { + return nil, err + } + + return nrsr, nil +} diff --git a/security/searchProfiles.go b/security/searchProfiles.go index cfb95b06..2b9b950d 100644 --- a/security/searchProfiles.go +++ b/security/searchProfiles.go @@ -50,9 +50,21 @@ func (s *Security) SearchProfiles(body json.RawMessage, options types.QueryOptio jsonSearchResult := &jsonProfileSearchResult{} json.Unmarshal(res.Result, jsonSearchResult) + sr, err := types.NewSearchResult(s.Kuzzle, "scrollProfiles", query, options, res) + + if err != nil { + return nil, err + } + searchResult := &ProfileSearchResult{ - ScrollId: jsonSearchResult.ScrollId, - Total: jsonSearchResult.Total, + Aggregations: sr.Aggregations, + Total: sr.Total, + Fetched: sr.Fetched, + ScrollId: sr.ScrollId, + kuzzle: s.Kuzzle, + request: query, + response: res, + options: options, } for _, j := range jsonSearchResult.Hits { p := j.jsonProfileToProfile() diff --git a/security/searchProfiles_test.go b/security/searchProfiles_test.go index 5876d568..e7fad30b 100644 --- a/security/searchProfiles_test.go +++ b/security/searchProfiles_test.go @@ -93,7 +93,7 @@ func TestSearchProfileWithScroll(t *testing.T) { "hits": [ {"_id": "profile42", "_source": {"policies": [{"roleId": "admin"}]}} ], - "scrollId": "f00b4r" + "_scroll_id": "f00b4r" }`)} }, } @@ -110,6 +110,6 @@ func TestSearchProfileWithScroll(t *testing.T) { assert.Equal(t, []*types.Policy{ {RoleId: "admin"}, }, res.Hits[0].Policies) - assert.Equal(t, "f00b4r", res.ScrollId) assert.Equal(t, "profile42", res.Hits[0].Id) + assert.Equal(t, "f00b4r", res.ScrollId) } diff --git a/security/searchRoles.go b/security/searchRoles.go index fa66f4f0..448e351e 100644 --- a/security/searchRoles.go +++ b/security/searchRoles.go @@ -20,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// SearchRoles returns the roles matching the given query func (s *Security) SearchRoles(body json.RawMessage, options types.QueryOptions) (*RoleSearchResult, error) { ch := make(chan *types.KuzzleResponse) @@ -49,8 +50,21 @@ func (s *Security) SearchRoles(body json.RawMessage, options types.QueryOptions) jsonSearchResult := &jsonRoleSearchResult{} json.Unmarshal(res.Result, jsonSearchResult) + sr, err := types.NewSearchResult(s.Kuzzle, "scrollRoles", query, options, res) + + if err != nil { + return nil, err + } + searchResult := &RoleSearchResult{ - Total: jsonSearchResult.Total, + Aggregations: sr.Aggregations, + Total: sr.Total, + Fetched: sr.Fetched, + ScrollId: sr.ScrollId, + kuzzle: s.Kuzzle, + request: query, + response: res, + options: options, } for _, j := range jsonSearchResult.Hits { r := j.jsonRoleToRole() diff --git a/security/searchUsers.go b/security/searchUsers.go index 326aa1f2..58c14501 100644 --- a/security/searchUsers.go +++ b/security/searchUsers.go @@ -20,6 +20,7 @@ import ( "github.com/kuzzleio/sdk-go/types" ) +// SearchUsers retrieves the users matching the given query func (s *Security) SearchUsers(body json.RawMessage, options types.QueryOptions) (*UserSearchResult, error) { ch := make(chan *types.KuzzleResponse) @@ -50,9 +51,21 @@ func (s *Security) SearchUsers(body json.RawMessage, options types.QueryOptions) jsonSearchResult := &jsonUserSearchResult{} json.Unmarshal(res.Result, jsonSearchResult) + sr, err := types.NewSearchResult(s.Kuzzle, "scrollUsers", query, options, res) + + if err != nil { + return nil, err + } + searchResult := &UserSearchResult{ - Total: jsonSearchResult.Total, - ScrollId: jsonSearchResult.ScrollId, + Aggregations: sr.Aggregations, + Total: sr.Total, + Fetched: sr.Fetched, + ScrollId: sr.ScrollId, + kuzzle: s.Kuzzle, + request: query, + response: res, + options: options, } for _, j := range jsonSearchResult.Hits { diff --git a/security/user.go b/security/user.go index 062135f1..9f079fd6 100644 --- a/security/user.go +++ b/security/user.go @@ -24,12 +24,6 @@ type User struct { ProfileIds []string } -type UserSearchResult struct { - Hits []*User - Total int - ScrollId string -} - func NewUser(id string, content *types.UserData) *User { u := &User{ Id: id, diff --git a/security/userSearchResult.go b/security/userSearchResult.go new file mode 100644 index 00000000..44ca0141 --- /dev/null +++ b/security/userSearchResult.go @@ -0,0 +1,65 @@ +// Copyright 2015-2018 Kuzzle +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "encoding/json" + + "github.com/kuzzleio/sdk-go/types" +) + +type UserSearchResult struct { + Aggregations json.RawMessage `json:"aggregations"` + Hits []*User + Total int `json:"total"` + Fetched int + ScrollId string `json:"scrollId"` + kuzzle types.IKuzzle + request *types.KuzzleRequest + response *types.KuzzleResponse + options types.QueryOptions +} + +// Next returns the next page of roles +func (usr *UserSearchResult) Next() (*UserSearchResult, error) { + sr, err := types.NewSearchResult(usr.kuzzle, "scrollUsers", usr.request, usr.options, usr.response) + if err != nil { + return nil, err + } + + nsr, err := sr.Next() + + if err != nil { + return nil, err + } + + nusr := &UserSearchResult{ + Aggregations: nsr.Aggregations, + Total: nsr.Total, + Fetched: nsr.Fetched, + ScrollId: nsr.ScrollId, + kuzzle: usr.kuzzle, + request: usr.request, + response: usr.response, + options: usr.options, + } + err = json.Unmarshal(nsr.Hits, nsr.Hits) + + if err != nil { + return nil, err + } + + return nusr, nil +} diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index b062ebfe..aed8ee86 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -62,6 +62,7 @@ type KuzzleRequest struct { Match string `json:"match,omitempty"` Reset bool `json:"reset,omitempty"` IncludeTrash bool `json:"includeTrash,omitempty"` + SearchAfter []interface{} `json:"search_after,omitempty"` } type SubscribeQuery struct { diff --git a/types/search_result.go b/types/search_result.go index 8cd9b635..ddaa446e 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -17,25 +17,29 @@ package types import ( "encoding/json" "fmt" + "strings" ) // SearchResult is a search result representation type SearchResult struct { - Collection string - Documents json.RawMessage + Aggregations json.RawMessage + Hits json.RawMessage Total int Fetched int - Aggregations json.RawMessage - Options QueryOptions - Filters json.RawMessage + ScrollId string + kuzzle IKuzzle + request *KuzzleRequest + response *KuzzleResponse + options QueryOptions + scrollAction string } // NewSearchResult Search Result constructor -func NewSearchResult(collection string, filters json.RawMessage, options QueryOptions, raw *KuzzleResponse) (*SearchResult, error) { +func NewSearchResult(kuzzle IKuzzle, scrollAction string, request *KuzzleRequest, options QueryOptions, raw *KuzzleResponse) (*SearchResult, error) { type ParseSearchResult struct { - Documents json.RawMessage `json:"hits"` + Hits json.RawMessage `json:"hits"` Total int `json:"total"` - ScrollID string `json:"_scroll_id"` + ScrollId string `json:"_scroll_id"` Aggregations json.RawMessage `json:"aggregations"` } @@ -47,22 +51,172 @@ func NewSearchResult(collection string, filters json.RawMessage, options QueryOp } var docs []interface{} - json.Unmarshal(parsed.Documents, &docs) + json.Unmarshal(parsed.Hits, &docs) sr := &SearchResult{ - Collection: collection, - Filters: filters, - Documents: parsed.Documents, - Total: parsed.Total, - Fetched: len(docs), Aggregations: parsed.Aggregations, - Options: NewQueryOptions(), + Hits: parsed.Hits, + Fetched: len(docs), + Total: parsed.Total, + ScrollId: parsed.ScrollId, + kuzzle: kuzzle, + request: request, + response: raw, + options: NewQueryOptions(), + scrollAction: scrollAction, } - if options != nil { - sr.Options.SetFrom(options.From()) - sr.Options.SetSize(options.Size()) - } + sr.options = options return sr, nil } + +// Next page result +func (sr *SearchResult) Next() (*SearchResult, error) { + if sr.Fetched >= sr.Total { + return nil, nil + } + + var pb struct { + Sort []map[string]string `json:"sort"` + } + j, _ := json.Marshal(sr.request.Body) + json.Unmarshal(j, &pb) + + if sr.ScrollId != "" { + query := &KuzzleRequest{ + Controller: sr.request.Controller, + Action: sr.scrollAction, + } + + options := sr.options + options.SetScrollId(sr.ScrollId) + + ch := make(chan *KuzzleResponse) + go sr.kuzzle.Query(query, sr.options, ch) + res := <-ch + + nsr, err := NewSearchResult(sr.kuzzle, sr.scrollAction, query, options, res) + + if err != nil { + return nil, err + } + + nsr.Fetched += sr.Fetched + + return nsr, nil + } else if pb.Sort != nil && sr.request.Size > 0 { + query := sr.request + query.RequestId = "" + query.SearchAfter = make([]interface{}, 0) + + type Parsed struct { + Hits []map[string]interface{} `json:"hits"` + } + var parsed Parsed + json.Unmarshal(sr.response.Result, &parsed) + + last := make(map[string]interface{}) + if len(parsed.Hits) > 0 { + last = parsed.Hits[len(parsed.Hits)-1] + } + + searchAfter := make([]interface{}, 0) + for _, v := range pb.Sort { + for key := range v { + searchAfter = append(searchAfter, getDeepField(key, last, 0)) + } + } + + var body map[string]interface{} + jbody, ok := sr.request.Body.(json.RawMessage) + if ok { + json.Unmarshal(jbody, &body) + body["search_after"] = searchAfter + query.Body = body + } + mbody, ok := sr.request.Body.(map[string]interface{}) + if ok { + mbody["search_after"] = searchAfter + query.Body = mbody + } + + options := sr.options + + ch := make(chan *KuzzleResponse) + go sr.kuzzle.Query(query, sr.options, ch) + res := <-ch + + nsr, err := NewSearchResult(sr.kuzzle, sr.scrollAction, query, options, res) + + if err != nil { + return nil, err + } + + nsr.Fetched += sr.Fetched + + return nsr, nil + } else if sr.request.Size > 0 { + if sr.request.From >= sr.Total { + return nil, nil + } + + query := sr.request + query.RequestId = "" + query.From = sr.Fetched + options := sr.options + options.SetFrom(sr.Fetched) + + ch := make(chan *KuzzleResponse) + go sr.kuzzle.Query(query, options, ch) + res := <-ch + + nsr, err := NewSearchResult(sr.kuzzle, sr.scrollAction, query, options, res) + + if err != nil { + return nil, err + } + + nsr.Fetched += sr.Fetched + + return nsr, nil + } + + return nil, NewError("Unable to retrieve next results from search: missing scrollId, from/sort, or from/size parameters") +} + +func getDeepField(key string, s map[string]interface{}, depth int) interface{} { + if depth == 0 && key == "_uid" { + key = "_id" + } + if depth == 0 && key != "_id" && key != "_score" { + key = "_source." + key + } + + if s[key] != nil { + str, ok := s[key].(string) + if ok { + return str + } + i, ok := s[key].(int) + if ok { + return i + } + f, ok := s[key].(float64) + if ok { + return f + } + } + + keys := strings.Split(key, ".") + if len(keys) == 1 { + return nil + } + + m, ok := s[keys[0]].(map[string]interface{}) + if ok { + return getDeepField(strings.Join(keys[1:], "."), m, depth+1) + } + + return nil +} From dfedb37194796cd356120d8655bb2c0ea8d9383d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Thu, 25 Oct 2018 09:56:43 +0200 Subject: [PATCH 335/363] [kzl-642] unit tests --- collection/search_specifications_test.go | 54 ++++++++ document/search_test.go | 158 +++++++++++++++++++++++ security/profileSearchResult.go | 7 +- security/roleSearchResult.go | 7 +- security/searchProfiles_test.go | 41 ++++++ security/searchRoles_test.go | 80 ++++++++++++ security/searchUsers_test.go | 103 ++++++++++----- security/userSearchResult.go | 7 +- types/kuzzle_request.go | 1 - types/search_result.go | 8 +- 10 files changed, 432 insertions(+), 34 deletions(-) diff --git a/collection/search_specifications_test.go b/collection/search_specifications_test.go index 0fd1c22c..3105faaf 100644 --- a/collection/search_specifications_test.go +++ b/collection/search_specifications_test.go @@ -84,6 +84,60 @@ func TestSearchSpecifications(t *testing.T) { assert.Nil(t, err) } +func TestSearchSpecificationsNext(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": [ + { + "_id": "id1", + "_source": "specification1" + }, + { + "_id": "id1", + "_source": "specification1" + } + ], + "total": 42 + }`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + options := types.NewQueryOptions() + options.SetFrom(0) + options.SetSize(2) + + sr, err := k.Security.SearchUsers(json.RawMessage(`{}`), options) + assert.Nil(t, err) + assert.NotNil(t, sr) + + c.MockSend = func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + assert.Equal(t, 2, options.From()) + assert.Equal(t, 2, options.Size()) + + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": [ + { + "_id": "id3", + "_source": "specification3" + }, + { + "_id": "id4", + "_source": "specification4" + } + ], + "total": 42 + }`)} + } + + nsr, err := sr.Next() + assert.Nil(t, err) + assert.NotNil(t, nsr) + assert.Equal(t, 42, nsr.Total) + assert.Equal(t, 4, nsr.Fetched) +} + func ExampleCollection_SearchSpecifications() { c := &internal.MockedConnection{} k, _ := kuzzle.NewKuzzle(c, nil) diff --git a/document/search_test.go b/document/search_test.go index b71e4449..a38801d2 100644 --- a/document/search_test.go +++ b/document/search_test.go @@ -91,3 +91,161 @@ func TestSearchDocument(t *testing.T) { assert.Equal(t, 2, response.Fetched) assert.Equal(t, 42, response.Total) } + +func TestSearchDocumentNextFromSize(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": ["id1", "id2"], + "total": 42 + }`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + options := types.NewQueryOptions() + options.SetFrom(0) + options.SetSize(2) + + sr, err := k.Document.Search("index", "collection", json.RawMessage(`{}`), options) + assert.Nil(t, err) + assert.Equal(t, 42, sr.Total) + assert.Equal(t, 2, sr.Fetched) + + c.MockSend = func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, 2, parsedQuery.From) + assert.Equal(t, 2, parsedQuery.Size) + + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": ["id3"] + }`)} + } + + nsr, err := sr.Next() + assert.Nil(t, err) + assert.Equal(t, 3, nsr.Fetched) +} + +func TestSearchDocumentNextEnd(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": ["id1", "id2"], + "total": 2 + }`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + options := types.NewQueryOptions() + options.SetFrom(0) + options.SetSize(2) + + sr, err := k.Document.Search("index", "collection", json.RawMessage(`{}`), options) + assert.Nil(t, err) + + nsr, err := sr.Next() + + assert.Nil(t, err) + assert.Nil(t, nsr) +} + +func TestSearchDocumentNextSort(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": [ + { + "_id": "id1", + "_source": { + "foo": { + "bar": 3 + } + } + }, + { + "_id": "id2", + "_source": { + "foo": { + "bar": 12 + } + } + } + ], + "total": 42 + }`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + options := types.NewQueryOptions() + options.SetSize(2) + + sr, err := k.Document.Search("index", "collection", json.RawMessage(`{ + "sort":[ + {"_uid": "asc"}, + { "foo.bar": "desc" } + ] + }`), options) + assert.Nil(t, err) + + c.MockSend = func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, []interface{}{"id2", float64(12)}, parsedQuery.Body.(map[string]interface{})["search_after"]) + + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": ["id3", "id4"], + "total": 42 + }`)} + } + + nsr, err := sr.Next() + assert.Nil(t, err) + assert.Equal(t, 4, nsr.Fetched) + assert.NotNil(t, nsr) +} + +func TestSearchDocumentNextScroll(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": ["id1", "id2"], + "total": 42, + "_scroll_id": "scroll_id" + }`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + options := types.NewQueryOptions() + options.SetScroll("1m") + + sr, err := k.Document.Search("index", "collection", json.RawMessage(`{}`), options) + assert.Nil(t, err) + assert.Equal(t, "scroll_id", sr.ScrollId) + + c.MockSend = func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "1m", options.Scroll()) + assert.Equal(t, "scroll_id", options.ScrollId()) + assert.Equal(t, "scroll", parsedQuery.Action) + + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": ["id3", "id4"], + "total": 42, + "_scroll_id": "new_scroll" + }`)} + } + + nsr, err := sr.Next() + assert.Nil(t, err) + assert.Equal(t, 4, nsr.Fetched) + assert.Equal(t, "new_scroll", nsr.ScrollId) +} diff --git a/security/profileSearchResult.go b/security/profileSearchResult.go index 106d1a20..cf953951 100644 --- a/security/profileSearchResult.go +++ b/security/profileSearchResult.go @@ -56,11 +56,16 @@ func (psr *ProfileSearchResult) Next() (*ProfileSearchResult, error) { response: psr.response, options: psr.options, } - err = json.Unmarshal(nsr.Hits, npsr.Hits) + var jprofiles []jsonProfile + err = json.Unmarshal(nsr.Hits, &jprofiles) if err != nil { return nil, err } + for _, jprofile := range jprofiles { + npsr.Hits = append(npsr.Hits, jprofile.jsonProfileToProfile()) + } + return npsr, nil } diff --git a/security/roleSearchResult.go b/security/roleSearchResult.go index b89e7bda..a9a0eb95 100644 --- a/security/roleSearchResult.go +++ b/security/roleSearchResult.go @@ -55,11 +55,16 @@ func (rsr *RoleSearchResult) Next() (*RoleSearchResult, error) { response: rsr.response, options: rsr.options, } - err = json.Unmarshal(nsr.Hits, nsr.Hits) + var jroles []jsonRole + err = json.Unmarshal(nsr.Hits, &jroles) if err != nil { return nil, err } + for _, jrole := range jroles { + nrsr.Hits = append(nrsr.Hits, jrole.jsonRoleToRole()) + } + return nrsr, nil } diff --git a/security/searchProfiles_test.go b/security/searchProfiles_test.go index e7fad30b..e7c70e0b 100644 --- a/security/searchProfiles_test.go +++ b/security/searchProfiles_test.go @@ -19,6 +19,8 @@ import ( "fmt" "testing" + "github.com/kuzzleio/sdk-go/security" + "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/protocol/websocket" @@ -112,4 +114,43 @@ func TestSearchProfileWithScroll(t *testing.T) { }, res.Hits[0].Policies) assert.Equal(t, "profile42", res.Hits[0].Id) assert.Equal(t, "f00b4r", res.ScrollId) + + c.MockSend = func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "1m", options.Scroll()) + assert.Equal(t, "f00b4r", options.ScrollId()) + + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": [ + { + "_id": "id3", + "_source": { + "policies": [ + {"roleId": "admin"} + ] + } + }, + { + "_id": "id4", + "_source": { + "policies": [ + {"roleId": "demo"} + ] + } + } + ], + "_scroll_id": "new_scroll" + }`)} + } + + nsr, err := res.Next() + assert.Nil(t, err) + assert.NotNil(t, nsr) + assert.Equal(t, 3, nsr.Fetched) + + p := security.NewProfile("id", nil) + assert.IsType(t, p, nsr.Hits[0]) + assert.Equal(t, 2, len(nsr.Hits)) } diff --git a/security/searchRoles_test.go b/security/searchRoles_test.go index da5ee6fe..730828cb 100644 --- a/security/searchRoles_test.go +++ b/security/searchRoles_test.go @@ -19,6 +19,8 @@ import ( "fmt" "testing" + "github.com/kuzzleio/sdk-go/security" + "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/protocol/websocket" @@ -116,3 +118,81 @@ func TestSearchWithOptions(t *testing.T) { assert.Equal(t, 1, len(res.Hits)) assert.Equal(t, res.Hits[0].Controllers["*"].Actions["*"], true) } + +func TestSearchRolesNext(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": [ + { + "_id": "admin", + "_source": { + "controllers": { + "*": { + "actions": { + "*": true + } + } + } + } + }, + { + "_id": "administrator", + "_source": { + "controllers": { + "*": { + "actions": { + "*": true + } + } + } + } + } + + ], + "total": 42 + }`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + options := types.NewQueryOptions() + options.SetFrom(0) + options.SetSize(2) + + sr, err := k.Security.SearchRoles(json.RawMessage(`{}`), options) + assert.Nil(t, err) + assert.NotNil(t, sr) + assert.Equal(t, 2, len(sr.Hits)) + + c.MockSend = func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + assert.Equal(t, 2, options.From()) + assert.Equal(t, 2, options.Size()) + + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": [ + { + "_id": "none", + "_source": { + "controllers": { + "*": { + "actions": { + "*": false + } + } + } + } + } + ], + "total": 42 + }`)} + } + + nsr, err := sr.Next() + assert.Nil(t, err) + assert.NotNil(t, nsr) + + assert.Equal(t, 1, len(nsr.Hits)) + r := security.NewRole("id", nil) + assert.IsType(t, r, nsr.Hits[0]) +} diff --git a/security/searchUsers_test.go b/security/searchUsers_test.go index 27e7bf18..2d010bfb 100644 --- a/security/searchUsers_test.go +++ b/security/searchUsers_test.go @@ -19,6 +19,8 @@ import ( "fmt" "testing" + "github.com/kuzzleio/sdk-go/security" + "github.com/kuzzleio/sdk-go/internal" "github.com/kuzzleio/sdk-go/kuzzle" "github.com/kuzzleio/sdk-go/protocol/websocket" @@ -64,6 +66,78 @@ func TestSearchUsers(t *testing.T) { assert.Equal(t, map[string]interface{}{"foo": "bar"}, res.Hits[0].Content) } +func TestSearchUsersNext(t *testing.T) { + c := &internal.MockedConnection{ + MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": [ + { + "_id": "id1", + "_source": { + "profileIds": [ "admin", "other" ], + "foo": "bar" + } + }, + { + "_id": "id2", + "_source": { + "profileIds": [ "default" ], + "foo": "baz" + } + } + ], + "total": 42, + "_scroll_id": "scroll_id" + }`)} + }, + } + k, _ := kuzzle.NewKuzzle(c, nil) + + options := types.NewQueryOptions() + options.SetScroll("1m") + + sr, err := k.Security.SearchUsers(json.RawMessage(`{}`), options) + assert.Nil(t, err) + assert.NotNil(t, sr) + + c.MockSend = func(query []byte, options types.QueryOptions) *types.KuzzleResponse { + parsedQuery := &types.KuzzleRequest{} + json.Unmarshal(query, parsedQuery) + + assert.Equal(t, "1m", options.Scroll()) + assert.Equal(t, "scroll_id", options.ScrollId()) + + return &types.KuzzleResponse{Result: json.RawMessage(`{ + "hits": [ + { + "_id": "id3", + "_source": { + "profileIds": [ "admin", "other" ], + "foo": "bar" + } + }, + { + "_id": "id4", + "_source": { + "profileIds": [ "default" ], + "foo": "baz" + } + } + ], + "total": 42, + "_scroll_id": "new_scroll" + }`)} + } + + nsr, err := sr.Next() + assert.Nil(t, err) + assert.NotNil(t, nsr) + assert.Equal(t, 4, nsr.Fetched) + + u := security.NewUser("id", nil) + assert.IsType(t, u, nsr.Hits[1]) +} + func ExampleSearchUsers() { c := websocket.NewWebSocket("localhost:7512", nil) k, _ := kuzzle.NewKuzzle(c, nil) @@ -76,32 +150,3 @@ func ExampleSearchUsers() { fmt.Println(res.Hits[0].Id, res.Hits[0].Content) } - -func TestSearchUsersWithScroll(t *testing.T) { - c := &internal.MockedConnection{ - MockSend: func(query []byte, options types.QueryOptions) *types.KuzzleResponse { - parsedQuery := &types.KuzzleRequest{} - json.Unmarshal(query, parsedQuery) - - assert.Equal(t, "security", parsedQuery.Controller) - assert.Equal(t, "searchUsers", parsedQuery.Action) - assert.Equal(t, "1m", parsedQuery.Scroll) - - return &types.KuzzleResponse{Result: []byte(`{ - "total": 42, - "hits": [ - {"_id": "user42", "_source": {"profileIds": ["admin", "other"}, "foo": "bar"} - ], - "scrollId": "f00b4r" - }`)} - }, - } - k, _ := kuzzle.NewKuzzle(c, nil) - - opts := types.NewQueryOptions() - opts.SetFrom(2) - opts.SetSize(4) - opts.SetScroll("1m") - - k.Security.SearchUsers(nil, opts) -} diff --git a/security/userSearchResult.go b/security/userSearchResult.go index 44ca0141..91306512 100644 --- a/security/userSearchResult.go +++ b/security/userSearchResult.go @@ -55,11 +55,16 @@ func (usr *UserSearchResult) Next() (*UserSearchResult, error) { response: usr.response, options: usr.options, } - err = json.Unmarshal(nsr.Hits, nsr.Hits) + var jusers []jsonUser + err = json.Unmarshal(nsr.Hits, &jusers) if err != nil { return nil, err } + for _, juser := range jusers { + nusr.Hits = append(nusr.Hits, juser.jsonUserToUser()) + } + return nusr, nil } diff --git a/types/kuzzle_request.go b/types/kuzzle_request.go index aed8ee86..b062ebfe 100644 --- a/types/kuzzle_request.go +++ b/types/kuzzle_request.go @@ -62,7 +62,6 @@ type KuzzleRequest struct { Match string `json:"match,omitempty"` Reset bool `json:"reset,omitempty"` IncludeTrash bool `json:"includeTrash,omitempty"` - SearchAfter []interface{} `json:"search_after,omitempty"` } type SubscribeQuery struct { diff --git a/types/search_result.go b/types/search_result.go index ddaa446e..3e35e3ce 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -84,6 +84,8 @@ func (sr *SearchResult) Next() (*SearchResult, error) { json.Unmarshal(j, &pb) if sr.ScrollId != "" { + // scroll + query := &KuzzleRequest{ Controller: sr.request.Controller, Action: sr.scrollAction, @@ -106,9 +108,10 @@ func (sr *SearchResult) Next() (*SearchResult, error) { return nsr, nil } else if pb.Sort != nil && sr.request.Size > 0 { + // search_after + query := sr.request query.RequestId = "" - query.SearchAfter = make([]interface{}, 0) type Parsed struct { Hits []map[string]interface{} `json:"hits"` @@ -140,6 +143,7 @@ func (sr *SearchResult) Next() (*SearchResult, error) { mbody["search_after"] = searchAfter query.Body = mbody } + fmt.Println(searchAfter) options := sr.options @@ -157,6 +161,8 @@ func (sr *SearchResult) Next() (*SearchResult, error) { return nsr, nil } else if sr.request.Size > 0 { + // from/size + if sr.request.From >= sr.Total { return nil, nil } From 1f8b04dd42878247a2a2db38fe3949d49b4dc349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Vidis?= Date: Mon, 29 Oct 2018 10:49:02 +0100 Subject: [PATCH 336/363] [kuz-642] Add missing properties for cgo --- security/profileSearchResult.go | 13 ++++++++++++- security/roleSearchResult.go | 12 ++++++++++++ security/userSearchResult.go | 12 ++++++++++++ types/search_result.go | 20 ++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/security/profileSearchResult.go b/security/profileSearchResult.go index cf953951..9710018b 100644 --- a/security/profileSearchResult.go +++ b/security/profileSearchResult.go @@ -30,7 +30,18 @@ type ProfileSearchResult struct { request *types.KuzzleRequest response *types.KuzzleResponse options types.QueryOptions - scrollAction string +} + +func (sr *ProfileSearchResult) Request() *types.KuzzleRequest { + return sr.request +} + +func (sr *ProfileSearchResult) Response() *types.KuzzleResponse { + return sr.response +} + +func (sr *ProfileSearchResult) Options() types.QueryOptions { + return sr.options } // Next returns the next page of profiles diff --git a/security/roleSearchResult.go b/security/roleSearchResult.go index a9a0eb95..bcd9f8e5 100644 --- a/security/roleSearchResult.go +++ b/security/roleSearchResult.go @@ -32,6 +32,18 @@ type RoleSearchResult struct { options types.QueryOptions } +func (sr *RoleSearchResult) Request() *types.KuzzleRequest { + return sr.request +} + +func (sr *RoleSearchResult) Response() *types.KuzzleResponse { + return sr.response +} + +func (sr *RoleSearchResult) Options() types.QueryOptions { + return sr.options +} + // Next returns the next page of roles func (rsr *RoleSearchResult) Next() (*RoleSearchResult, error) { sr, err := types.NewSearchResult(rsr.kuzzle, "scrollRoles", rsr.request, rsr.options, rsr.response) diff --git a/security/userSearchResult.go b/security/userSearchResult.go index 91306512..0544b86b 100644 --- a/security/userSearchResult.go +++ b/security/userSearchResult.go @@ -32,6 +32,18 @@ type UserSearchResult struct { options types.QueryOptions } +func (sr *UserSearchResult) Request() *types.KuzzleRequest { + return sr.request +} + +func (sr *UserSearchResult) Response() *types.KuzzleResponse { + return sr.response +} + +func (sr *UserSearchResult) Options() types.QueryOptions { + return sr.options +} + // Next returns the next page of roles func (usr *UserSearchResult) Next() (*UserSearchResult, error) { sr, err := types.NewSearchResult(usr.kuzzle, "scrollUsers", usr.request, usr.options, usr.response) diff --git a/types/search_result.go b/types/search_result.go index 3e35e3ce..952c2adb 100644 --- a/types/search_result.go +++ b/types/search_result.go @@ -71,6 +71,26 @@ func NewSearchResult(kuzzle IKuzzle, scrollAction string, request *KuzzleRequest return sr, nil } +func (sr *SearchResult) Kuzzle() IKuzzle { + return sr.kuzzle +} + +func (sr *SearchResult) Request() *KuzzleRequest { + return sr.request +} + +func (sr *SearchResult) Response() *KuzzleResponse { + return sr.response +} + +func (sr *SearchResult) Options() QueryOptions { + return sr.options +} + +func (sr *SearchResult) ScrollAction() string { + return sr.scrollAction +} + // Next page result func (sr *SearchResult) Next() (*SearchResult, error) { if sr.Fetched >= sr.Total { From dd906c49c23f2091f775d3d775f027ed96dccbb6 Mon Sep 17 00:00:00 2001 From: Adrien Maret Date: Mon, 29 Oct 2018 17:04:51 +0100 Subject: [PATCH 337/363] Fix realtime count arguments (#219) --- realtime/count.go | 8 +++----- realtime/count_test.go | 24 +++--------------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/realtime/count.go b/realtime/count.go index 6f830ca6..53cec658 100644 --- a/realtime/count.go +++ b/realtime/count.go @@ -21,16 +21,14 @@ import ( ) // Count returns the number of other subscriptions on that room. -func (r *Realtime) Count(index, collection, roomID string, options types.QueryOptions) (int, error) { - if index == "" || collection == "" || roomID == "" { - return -1, types.NewError("Realtime.Count: index, collection and roomID required", 400) +func (r *Realtime) Count(roomID string, options types.QueryOptions) (int, error) { + if roomID == "" { + return -1, types.NewError("Realtime.Count: roomID required", 400) } query := &types.KuzzleRequest{ Controller: "realtime", Action: "count", - Index: index, - Collection: collection, Body: struct { RoomID string `json:"roomID"` }{roomID}, diff --git a/realtime/count_test.go b/realtime/count_test.go index 0b14d5d4..998a9128 100644 --- a/realtime/count_test.go +++ b/realtime/count_test.go @@ -26,29 +26,11 @@ import ( "github.com/stretchr/testify/assert" ) -func TestCountIndexNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - nr := realtime.NewRealtime(k) - - _, err := nr.Count("", "collection", "roomID", nil) - - assert.NotNil(t, err) -} - -func TestCountCollectionNull(t *testing.T) { - k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) - nr := realtime.NewRealtime(k) - - _, err := nr.Count("index", "", "roomID", nil) - - assert.NotNil(t, err) -} - func TestCountRoomIDNull(t *testing.T) { k, _ := kuzzle.NewKuzzle(&internal.MockedConnection{}, nil) nr := realtime.NewRealtime(k) - _, err := nr.Count("index", "collection", "", nil) + _, err := nr.Count("", nil) assert.NotNil(t, err) } @@ -62,7 +44,7 @@ func TestCountError(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) realTime := realtime.NewRealtime(k) - _, err := realTime.Count("index", "collection", "42", nil) + _, err := realTime.Count("42", nil) assert.NotNil(t, err) } @@ -81,6 +63,6 @@ func TestCount(t *testing.T) { k, _ := kuzzle.NewKuzzle(c, nil) realTime := realtime.NewRealtime(k) - res, _ := realTime.Count("index", "collection", "42", nil) + res, _ := realTime.Count("42", nil) assert.Equal(t, 10, res) } From e5f91768e24c4e306eee74c47f273c7d783c9ac8 Mon Sep 17 00:00:00 2001 From: Adrien Maret Date: Tue, 30 Oct 2018 10:01:37 +0100 Subject: [PATCH 338/363] Remove realtime deprecated methods (#220) * Remove realtime deprecated methods * add pr link in template * nit --- .github/pull_request_template.md | 4 ++ realtime/list.go | 47 ---------------- realtime/list_test.go | 93 -------------------------------- realtime/validate.go | 54 ------------------- realtime/validate_test.go | 93 -------------------------------- 5 files changed, 4 insertions(+), 287 deletions(-) delete mode 100644 realtime/list.go delete mode 100644 realtime/list_test.go delete mode 100644 realtime/validate.go delete mode 100644 realtime/validate_test.go diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 31936ac2..ad1bb24e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -19,6 +19,10 @@ List any dependencies that are required for this change. --> + + ### How should this be manually tested?