+ if (checkResourceRegistered(EXAMPLE_BUNDLE_ID, EXAMPLE_RESOURCE_URI)
+ && g_bSampleBundleStarted)
+ {
+ g_pResourceContainer->removeResourceConfig(EXAMPLE_BUNDLE_ID, EXAMPLE_RESOURCE_URI);
+ }
+ else
+ {
+ std::cout << "Sample Bundle is not started." << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "Container is not started." << std::endl;
+ }
+}
+
+void printBundleList(std::list< std::unique_ptr< RCSBundleInfo > > &list)
+{
+ std::cout << std::endl;
+ for (auto &bundleinfo : list)
+ {
+ std::cout << "-- " << bundleinfo->getID() << std::endl;
+ }
+ std::cout << std::endl;
+}
+
+void ListBundles()
+{
+ std::list< std::unique_ptr< RCSBundleInfo > > bundles;
+
+ if (g_pResourceContainer && g_bContainerStarted)
+ {
+ bundles = g_pResourceContainer->listBundles();
+ printBundleList(bundles);
+ }
+ else
+ {
+ std::cout << "Container is not started." << std::endl;
+ }
+}
+
+void printResourceList(std::list< std::string > &list)
+{
+ std::cout << std::endl;
+ for (auto &bundleResource : list)
+ {
+ std::cout << "-- " << bundleResource << std::endl;
+ }
+ std::cout << std::endl;
+}
+
+void ListResources(std::string bundleId)
+{
+ std::list< std::string > resources;
+
+ if (g_pResourceContainer && g_bContainerStarted)
+ {
+ if (checkBundleRegistered(bundleId))
+ {
+ resources = g_pResourceContainer->listBundleResources(bundleId);
+ printResourceList(resources);
+ }
+ }
+ else
+ {
+ std::cout << "Container is not started." << std::endl;
+ }
+}
+
+void ExecuteCommand(APPMenu menu)
+{
+ switch (menu)
+ {
+ case APPMenu::START_RC:
+ {
+ std::string filePath;
+ std::cout << "Type Configuration File Path (Press \'0\' to start with example): ";
+
+ if ((filePath = processUserStringInput()).compare("0") == 0)
+ {
+ getCurrentPath(&filePath);
+ filePath.append(EXAMPLE_CONFIG_PATH);
+ }
+
+ StartContainer(filePath);
+ }
+ break;
+ case APPMenu::STOP_RC:
+ StopContainer();
+ break;
+ case APPMenu::ADD_SAMPLE_BUNDLE:
+ AddSampleBundle();
+ break;
+ case APPMenu::START_SAMPLE_BUNDLE:
+ StartSampleBundle();
+ break;
+ case APPMenu::STOP_SAMPLE_BUNDLE:
+ StopSampleBundle();
+ break;
+ case APPMenu::REMOVE_SAMPLE_BUNDLE:
+ RemoveSampleBundle();
+ break;
+ case APPMenu::ADD_SAMPLE_RESOURCE:
+ AddSampleBundleResource();
+ break;
+ case APPMenu::REMOVE_SAMPLE_RESOURCE:
+ RemoveSampleBundleResource();
+ break;
+ case APPMenu::LIST_BUNDLES:
+ ListBundles();
+ break;
+ case APPMenu::LIST_RESOURCES:
+ {
+ std::string bundleId;
+ std::cout <<
+ "Type Bundle Id to get Resource List (Press \'0\' to get example resource list): ";
+
+ if ((bundleId = processUserStringInput()).compare("0") == 0)
+ {
+ bundleId = EXAMPLE_BUNDLE_ID;
+ }
+
+ ListResources(bundleId);
+ }
+ break;
+ case APPMenu::EXIT:
+ throw CloseApp();
+ break;
+ }
+}
+
+int main()
+{
+ g_pResourceContainer = RCSResourceContainer::getInstance();
+
+ while (true)
+ {
+ try
+ {
+ displayMenu();
+ ExecuteCommand((APPMenu)processUserInput(APPMenu::START_RC, APPMenu::EXIT));
+ }
+ catch (const std::exception &e)
+ {
+ std::cout << e.what() << std::endl;
+ }
+ catch (const CloseApp &)
+ {
+ break;
+ }
+ }
+
+ if (g_bContainerStarted)
+ {
+ g_pResourceContainer->stopContainer();