MICO Platform
 All Classes Namespaces Functions Variables Friends
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
mico::persistence::PersistenceService Class Reference

Main service for accessing the MICO persistence API. More...

#include <PersistenceService.hpp>

Public Member Functions

 PersistenceService (std::string serverAddress)
 Initialise persistence service with the address of a server running the standard installation of the MICO platform with Marmotta at port 8080 under context /marmotta, RabbitMQ at port 5672, and an HDFS server, all with login/password mico/mico.
 
 PersistenceService (std::string serverAddress, int marmottaPort, std::string user, std::string password)
 Initialise persistence service with the address of a server running the standard installation of the MICO platform with Marmotta at port 8080 under context /marmotta, RabbitMQ at port 5672, and an HDFS server, all with login/password mico/mico.
 
 PersistenceService (std::string marmottaServerUrl, std::string contentDirectory)
 Initialise an instance of the PersistenceService using the Marmotta server with the given URL as backend. More...
 
PersistenceMetadatagetMetadata ()
 Get a handle on the overall metadata storage of the persistence service. More...
 
std::shared_ptr< model::ItemcreateItem ()
 Create a new content item with a random URI and return it. More...
 
std::shared_ptr< model::ItemgetItem (const mico::persistence::model::URI &id)
 Return the item with the given URI if it exists. More...
 
void deleteItem (const mico::persistence::model::URI &id)
 Delete the content item with the given URI. More...
 
std::vector< std::shared_ptr
< model::Item > > 
getItems ()
 Get all items of the persistence service connection Notice that this implementation might be rather slow since it fetches all items first and then creates new ItemMMM object out of it. More...
 
jnipp::LocalRef
< jnipp::com::github::anno4j::Anno4j > 
getAnno4j ()
 Return an iterator over all currently available content items. More...
 
std::string getStoragePrefix ()
 
std::string getContentDirectory ()
 
std::string unmaskContentLocation (const std::string &maskedURL)
 
void checkJavaExceptionThrow ()
 
void checkJavaExceptionThrow (std::vector< std::string > exceptionNames)
 
bool checkJavaExceptionNoThrow (std::string &msg)
 
bool checkJavaExceptionNoThrow (std::vector< std::string > exceptionNames, std::string &msg)
 

Static Public Member Functions

static JavaVM * getJVM ()
 

Static Public Attributes

static JavaVM * m_sJvm = nullptr
 

Detailed Description

Main service for accessing the MICO persistence API.

The persistence service can be used for managing ContentItems stored in the peristence API of the MICO platform. Services working with ContentItems should only use instances of this class for accessing the persistence API.

Constructor & Destructor Documentation

mico::persistence::PersistenceService::PersistenceService ( std::string  marmottaServerUrl,
std::string  contentDirectory 
)

Initialise an instance of the PersistenceService using the Marmotta server with the given URL as backend.

Parameters
marmottaServerUrlthe URL of the Apache Marmotta server, e.g. http://localhost:8080/marmotta

Member Function Documentation

std::shared_ptr< model::Item > mico::persistence::PersistenceService::createItem ( )

Create a new content item with a random URI and return it.

Create a new item with a random URI and return it.

The content item should be suitable for reading and updating and write all updates to the underlying low-level persistence layer.

Returns
a handle to the newly created ContentItem

The item should be suitable for reading and updating and write all updates to the underlying low-level persistence layer.

Returns
a handle to the newly created Item
void mico::persistence::PersistenceService::deleteItem ( const mico::persistence::model::URI id)

Delete the content item with the given URI.

If the content item does not exist, do nothing.

jnipp::LocalRef< Anno4j > mico::persistence::PersistenceService::getAnno4j ( )

Return an iterator over all currently available content items.

Returns
iterable Return the end iterator for checking when iteration has completed.
iterable
std::shared_ptr< model::Item > mico::persistence::PersistenceService::getItem ( const mico::persistence::model::URI id)

Return the item with the given URI if it exists.

The item should be suitable for reading and updating and write all updates to the underlying low-level persistence layer.

Returns
A handle to the Item with the given URI, or null if it does not exist
std::vector< std::shared_ptr< model::Item > > mico::persistence::PersistenceService::getItems ( )

Get all items of the persistence service connection Notice that this implementation might be rather slow since it fetches all items first and then creates new ItemMMM object out of it.

Returns
A std::vector<Item>
PersistenceMetadata& mico::persistence::PersistenceService::getMetadata ( )
inline

Get a handle on the overall metadata storage of the persistence service.

This can e.g. be used for querying about existing content items.

Returns

The documentation for this class was generated from the following files: