1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #include "TestBundleActivator.h"
23 TestBundleActivator *bundle;
25 TestBundleActivator::TestBundleActivator()
27 m_pResourceContainer = nullptr;
28 m_pTestResource = nullptr;
31 TestBundleActivator::~TestBundleActivator()
33 m_pResourceContainer = nullptr;
34 m_pTestResource = nullptr;
37 void TestBundleActivator::activateBundle(ResourceContainerBundleAPI *resourceContainer,
40 std::cout << "TestBundleActivator::activateBundle .. " << std::endl;
41 m_pResourceContainer = resourceContainer;
42 m_bundleId = bundleId;
45 void TestBundleActivator::deactivateBundle()
47 std::cout << "TestBundleActivator::deactivateBundle .. " << std::endl;
48 m_pResourceContainer = nullptr;
51 void TestBundleActivator::createResource(resourceInfo resourceInfo)
53 std::cout << "TestBundleActivator::createResource .. " << std::endl;
55 m_pTestResource = std::make_shared< TestBundleResource >();
57 m_pTestResource->m_bundleId = m_bundleId;
58 m_pTestResource->m_uri = resourceInfo.uri;
59 m_pTestResource->m_resourceType = resourceInfo.resourceType;
61 m_pResourceContainer->registerResource(m_pTestResource);
64 void TestBundleActivator::destroyResource(BundleResource::Ptr pBundleResource)
66 std::cout << "TestBundleActivator::destroyResource .. " << std::endl;
68 m_pResourceContainer->unregisterResource(pBundleResource);
71 extern "C" void test_externalActivateBundle(ResourceContainerBundleAPI *resourceContainer,
74 bundle = new TestBundleActivator();
75 bundle->activateBundle(resourceContainer, bundleId);
78 extern "C" void test_externalDeactivateBundle()
80 bundle->deactivateBundle();
84 extern "C" void test_externalCreateResource(resourceInfo resourceInfo)
86 bundle->createResource(resourceInfo);
89 extern "C" void test_externalDestroyResource(BundleResource::Ptr pBundleResource)
91 bundle->destroyResource(pBundleResource);