Adding JsonSchema parser implementation for simulator and Updating Raml Parser.
[platform/upstream/iotivity.git] / service / simulator / ramlparser / raml / model / RamlResource.h
1 /******************************************************************\r
2  *\r
3  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
4  *\r
5  *\r
6  *\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  *\r
19  ******************************************************************/\r
20 \r
21 #ifndef RESOURCE_H\r
22 #define RESOURCE_H\r
23 \r
24 #include <map>\r
25 #include <list>\r
26 #include <string>\r
27 #include "UriParameter.h"\r
28 #include "ActionType.h"\r
29 #include "Action.h"\r
30 #include "Utils.h"\r
31 #include "IncludeResolver.h"\r
32 \r
33 namespace RAML\r
34 {\r
35     class RamlResource\r
36     {\r
37         public:\r
38             virtual std::string getDisplayName() const;\r
39             virtual void setDisplayName(const std::string &displayName);\r
40 \r
41             virtual std::string getDescription() const;\r
42             virtual void setDescription(const std::string &description);\r
43 \r
44             virtual std::string getParentUri() const;\r
45             virtual void setParentUri(const std::string &parentUri);\r
46 \r
47             virtual std::string getRelativeUri() const;\r
48             virtual void setRelativeUri(const std::string &relativeUri);\r
49 \r
50             virtual std::map<std::string, UriParameterPtr> const &getUriParameters() const;\r
51             virtual void setUriParameter(const std::string &paramName, const UriParameterPtr &uriParameter);\r
52 \r
53             virtual std::map<std::string, UriParameterPtr > const &getBaseUriParameters() const;\r
54             virtual void setBaseUriParameter(const std::string &paramName,\r
55                                              const UriParameterPtr &baseUriParameter);\r
56 \r
57             virtual ActionPtr getAction(ActionType actionType);\r
58             virtual std::map<ActionType , ActionPtr> const &getActions() const;\r
59             virtual void setAction(const ActionType &actiontype , const ActionPtr &action );\r
60 \r
61             virtual std::map<std::string, std::shared_ptr<RamlResource> > const &getResources() const;\r
62             virtual void setResource(const std::string &resourceName,\r
63                                      const std::shared_ptr<RamlResource> &resources);\r
64 \r
65             virtual std::list<std::string> const &getTraits() const;\r
66             virtual void setTrait(const std::string &trait);\r
67 \r
68             virtual std::string getResourceType() const;\r
69             virtual void setResourceType(const std::string &type);\r
70 \r
71             virtual std::string getResourceUri() const;\r
72             RamlResource(): m_includeResolver(NULL) {}\r
73             RamlResource(const std::string resourceKey, const YAML::Node &yamlNode ,\r
74                          const IncludeResolverPtr &includeResolver,\r
75                          const std::string &parentUri) : m_includeResolver(includeResolver)\r
76             {\r
77                 readResource(resourceKey, yamlNode, parentUri);\r
78             }\r
79         private:\r
80             void readResource(const std::string resourceKey, const YAML::Node &yamlNode,\r
81                               const std::string &parentUri);\r
82         private:\r
83             std::string m_displayName;\r
84             std::string m_description;\r
85             std::string m_relativeUri;\r
86             std::map<std::string, UriParameterPtr> m_uriParameters;\r
87             std::map<std::string, UriParameterPtr > m_baseUriParameters;\r
88             std::map<ActionType , ActionPtr> m_actions;\r
89             std::list<std::string> m_traits;\r
90             std::string m_resourceType;\r
91             std::string m_parentUri;\r
92             std::map<std::string, std::shared_ptr<RamlResource> > m_resources;\r
93             IncludeResolverPtr m_includeResolver;\r
94     };\r
95 \r
96     typedef std::shared_ptr<RamlResource> RamlResourcePtr;\r
97 }\r
98 #endif\r