* @return void
*/
virtual void activateBundle(ResourceContainerBundleAPI *resourceContainer,
- std::string bundleId) { };
+ std::string bundleId) = 0;
/**
* Deactivate the Bundle to stop working and destroy bundle resources
*
* @return void
*/
- virtual void deactivateBundle() { };
+ virtual void deactivateBundle() = 0;
/**
* Create Bundle Resource instance and register the resource in the container
#include "RCSResourceContainer.h"
#include "RCSBundleInfo.h"
-#include "oc_logger.hpp"
#include <iostream>
+#include <string.h>
using namespace std;
using namespace OIC::Service;
-using OC::oc_log_stream;
#define MAX_PATH 2048
-/* Another way to create a context: */
-auto info_logger = []() -> boost::iostreams::stream<OC::oc_log_stream> &
-{
- static OC::oc_log_stream ols(oc_make_ostream_logger);
- static boost::iostreams::stream<OC::oc_log_stream> os(ols);
- return os;
-};
-
void getCurrentPath(std::string *pPath)
{
char buffer[MAX_PATH];
int main()
{
- info_logger()->set_module("ContainerTest");
- info_logger()->set_level(OC_LOG_INFO);
-
- info_logger() << "Starting container test." << std::flush;
+ cout << "Starting container test." << endl;
std::string strConfigPath;
getCurrentPath(&strConfigPath);
bundleParams["libraryPath"] = ".";
std::string activator = "org.iotivity.bundle.hue.HueBundleActivator";
container->addBundle("oic.bundle.hueJavaSample2", "/hueJava",
- "../../../../../../service/resource-container/" \
- "examples/HueJavaSampleBundle/hue/target/hue-0.1-jar-with-dependencies.jar",
- activator,
- bundleParams);
+ "../../../../../../service/resource-container/" \
+ "examples/HueJavaSampleBundle/hue/target/hue-0.1-jar-with-dependencies.jar",
+ activator,
+ bundleParams);
bundles = container->listBundles();
cout << "\t>>> bundle list size : " << bundles.size() << endl;
~ResourceContainerTestSimulator()
{
- if (remoteResource != nullptr && remoteResource->isCaching())
+ try
{
- remoteResource->stopCaching();
+ if (remoteResource != nullptr && remoteResource->isCaching())
+ {
+ remoteResource->stopCaching();
+ }
+ if (remoteResource != nullptr && remoteResource->isMonitoring())
+ {
+ remoteResource->stopMonitoring();
+ }
}
- if (remoteResource != nullptr && remoteResource->isMonitoring())
+ catch (RCSInvalidParameterException &e)
{
- remoteResource->stopMonitoring();
+ std::cout << "exception : " << e.what() << std::endl;
}
}
std::weak_ptr<ResourceContainerTestSimulator>(shared_from_this())));
mutexForDiscovery.lock();
}
- catch (std::exception &e)
+ catch (RCSInvalidParameterException &e)
{
std::cout << "exception : " << e.what() << std::endl;
}