1 #ifndef ASSETANNO4CPP_HPP
2 #define ASSETANNO4CPP_HPP 1
5 #include "PersistenceService.hpp"
6 #include "URLStream.hpp"
10 namespace persistence {
17 jnipp::GlobalRef<jnipp::eu::mico::platform::anno4j::model::AssetMMM> m_assetMMM;
19 std::string m_jnippErrorMessage;
23 : m_persistenceService(persistenceService),
28 jnipp::Env::Scope scope(PersistenceService::m_sJvm);
30 jnipp::LocalRef<jnipp::org::openrdf::model::impl::URIImpl> juri =
31 jnipp::org::openrdf::model::impl::URIImpl::construct( m_assetMMM->getLocation() );
37 jnipp::Env::Scope scope(PersistenceService::m_sJvm);
39 jnipp::LocalRef<jnipp::org::openrdf::model::URI> jAssetURI =
40 ((jnipp::Ref<jnipp::org::openrdf::repository::object::RDFObject>)m_assetMMM)->getResource();
42 m_persistenceService.checkJavaExceptionNoThrow(m_jnippErrorMessage);
43 assert((jobject)jAssetURI);
48 std::string getFormat() {
49 jnipp::Env::Scope scope(PersistenceService::m_sJvm);
50 return m_assetMMM->getFormat()->std_str();
53 void setFormat(std::string format) {
54 jnipp::Env::Scope scope(PersistenceService::m_sJvm);
55 jnipp::LocalRef<JavaLangString> jformat = JavaLangString::create(format);
56 m_assetMMM->setFormat(jformat);
60 jnipp::Env::Scope scope(PersistenceService::m_sJvm);
61 LOG_DEBUG(
"new output stream connection to %s.bin", this->
getLocation().stringValue().c_str());
62 return new mico::io::url_ostream( m_persistenceService.unmaskContentLocation(this->getLocation().stringValue()) +
".bin");
66 jnipp::Env::Scope scope(PersistenceService::m_sJvm);
67 LOG_DEBUG(
"new input stream connection to %s.bin", this->
getLocation().stringValue().c_str());
68 return new mico::io::url_istream( m_persistenceService.unmaskContentLocation(this->getLocation().stringValue()) +
".bin");
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
Definition: http_client.cpp:23
mico::persistence::model::URI getURI()
getURI Retrieves the unique identifcation URI for this asset
Definition: AssetAnno4cpp.hpp:36
Main service for accessing the MICO persistence API.
Definition: PersistenceService.hpp:51
Definition: AssetAnno4cpp.hpp:13
Main type for opening an output stream to an URL for writing.
Definition: URLStream.hpp:67
std::ostream * getOutputStream()
Return a new output stream for writing to the content.
Definition: AssetAnno4cpp.hpp:59
mico::persistence::model::URI getLocation()
getLocation Retrieves the storage location of this asset (should be suffixed by .bin) ...
Definition: AssetAnno4cpp.hpp:27
std::istream * getInputStream()
Return a new input stream for reading the content.
Definition: AssetAnno4cpp.hpp:65
A URI.
Definition: Uri.hpp:22
Main type for opening an input stream to an URL for reading.
Definition: URLStream.hpp:82