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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 /// @brief This class provides information of each plugin installed for JAVA.
25 package org.iotivity.service.ppm;
27 import java.util.HashMap;
28 import java.util.Iterator;
30 import java.util.Map.Entry;
31 import java.util.Vector;
35 private Map<String, String> m_attributeMap;
36 private Vector<String> m_supportedType;
39 * Constructor for Plugin.
43 m_attributeMap = new HashMap<String, String>();
44 m_supportedType = new Vector<String>();
48 * Constructor for Plugin(Overlading).
50 * @param Plugin's name and id Strings.
52 public Plugin(String name, String id) {
54 setValue("Name", name);
59 * Get unique ID of the plugin.
61 * @return unique id String of the plugin. if ID is not exist, it return "".
63 public String getID() {
64 Iterator<Entry<String, String>> m_iterator = m_attributeMap.entrySet()
67 while (m_iterator.hasNext()) {
68 Entry<String, String> entryMap = m_iterator.next();
69 if (entryMap.getKey().equals("Id"))
70 return entryMap.getValue();
76 * Get version of the plugin.
78 * @return version information String of the plugin. if Version is not
79 * exist, it return "".
81 public String getVersion() {
82 Iterator<Entry<String, String>> m_iterator = m_attributeMap.entrySet()
85 while (m_iterator.hasNext()) {
86 Entry<String, String> entryMap = m_iterator.next();
87 if (entryMap.getKey().equals("Version"))
88 return entryMap.getValue();
94 * Get name of the plugin.
96 * @return name String of the plugin. if Name is not exist, it return "".
98 public String getName() {
99 Iterator<Entry<String, String>> m_iterator = m_attributeMap.entrySet()
102 while (m_iterator.hasNext()) {
103 Entry<String, String> entryMap = m_iterator.next();
104 if (entryMap.getKey().equals("Name"))
105 return entryMap.getValue();
111 * Get provider name of the plugin.
113 * @return provider name of the plugin. if ProviderName is not exist, it
116 public String getProviderName() {
117 Iterator<Entry<String, String>> m_iterator = m_attributeMap.entrySet()
120 while (m_iterator.hasNext()) {
121 Entry<String, String> entryMap = m_iterator.next();
122 if (entryMap.getKey().equals("Provider"))
123 return entryMap.getValue();
129 * Get value for the attributes.
132 * String to get value.
133 * @return value String of the attribute. if "attribute" is not exist, it
136 public String getValueByAttribute(String attribute) {
137 Iterator<Entry<String, String>> m_iterator = m_attributeMap.entrySet()
140 while (m_iterator.hasNext()) {
141 Entry<String, String> entryMap = m_iterator.next();
142 if (entryMap.getKey().equals(attribute))
143 return entryMap.getValue();
149 * Set key, value. key is attribute name.
157 public void setValue(String key, String value) {
158 m_attributeMap.put(key, value);