bbfmodels 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bbfmodels/__init__.py +16 -0
- bbfmodels/cli.py +79 -0
- bbfmodels/codec.py +232 -0
- bbfmodels/ir.py +327 -0
- bbfmodels/parser.py +533 -0
- bbfmodels/py.typed +0 -0
- bbfmodels/schema.py +152 -0
- bbfmodels/sources.py +79 -0
- bbfmodels/tree.py +200 -0
- bbfmodels-0.1.0.dist-info/METADATA +79 -0
- bbfmodels-0.1.0.dist-info/RECORD +15 -0
- bbfmodels-0.1.0.dist-info/WHEEL +4 -0
- bbfmodels-0.1.0.dist-info/entry_points.txt +2 -0
- bbfmodels-0.1.0.dist-info/licenses/LICENSE +201 -0
- bbfmodels-0.1.0.dist-info/licenses/NOTICE +2 -0
bbfmodels/sources.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Fetch published data model documents from the Forum.
|
|
2
|
+
|
|
3
|
+
The Forum serves every published flattened document from two static sites,
|
|
4
|
+
one per protocol. A file is named
|
|
5
|
+
``tr-<number>-<issue>-<amendment>-<corrigendum>[-cwmp|-usp]-full.xml`` and
|
|
6
|
+
never changes once published, so a downloaded copy is kept in a local cache
|
|
7
|
+
and reused.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import re
|
|
14
|
+
import urllib.request
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
SITES = {
|
|
18
|
+
"cwmp": "https://cwmp-data-models.broadband-forum.org/",
|
|
19
|
+
"usp": "https://usp-data-models.broadband-forum.org/",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# The documents the test suite and the shipped models are generated from.
|
|
23
|
+
# Moving one is a deliberate change: the generated output moves with it.
|
|
24
|
+
CORE = (
|
|
25
|
+
"tr-098-1-8-0-full.xml",
|
|
26
|
+
"tr-104-1-1-0-full.xml",
|
|
27
|
+
"tr-104-2-0-2-cwmp-full.xml",
|
|
28
|
+
"tr-104-2-0-2-usp-full.xml",
|
|
29
|
+
"tr-135-1-4-1-cwmp-full.xml",
|
|
30
|
+
"tr-135-1-4-1-usp-full.xml",
|
|
31
|
+
"tr-140-1-3-1-cwmp-full.xml",
|
|
32
|
+
"tr-140-1-3-1-usp-full.xml",
|
|
33
|
+
"tr-157-1-3-0-full.xml",
|
|
34
|
+
"tr-181-2-21-0-cwmp-full.xml",
|
|
35
|
+
"tr-181-2-21-0-usp-full.xml",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
_FILE = re.compile(r"^tr-\d+-\d+-\d+-\d+(?:-(cwmp|usp))?-full\.xml$")
|
|
39
|
+
_HREF = re.compile(r'href="(tr-\d+-\d+-\d+-\d+(?:-(?:cwmp|usp))?-full\.xml)"')
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def cache_dir() -> Path:
|
|
43
|
+
"""Where fetched documents live: ``$BBFMODELS_CACHE``, else the XDG cache."""
|
|
44
|
+
env = os.environ.get("BBFMODELS_CACHE")
|
|
45
|
+
if env:
|
|
46
|
+
return Path(env)
|
|
47
|
+
xdg = os.environ.get("XDG_CACHE_HOME") or str(Path.home() / ".cache")
|
|
48
|
+
return Path(xdg) / "bbfmodels"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def site_for(name: str) -> str:
|
|
52
|
+
"""The site a document is published on, from its name."""
|
|
53
|
+
m = _FILE.match(name)
|
|
54
|
+
if not m:
|
|
55
|
+
raise ValueError(f"{name!r} is not a published document name")
|
|
56
|
+
# Documents without a protocol suffix predate USP and live on the CWMP site.
|
|
57
|
+
return SITES["usp"] if m.group(1) == "usp" else SITES["cwmp"]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def available(protocol: str) -> list[str]:
|
|
61
|
+
"""Every flattened document the Forum lists for a protocol."""
|
|
62
|
+
with urllib.request.urlopen(SITES[protocol], timeout=30) as resp:
|
|
63
|
+
index = resp.read().decode("utf-8", errors="replace")
|
|
64
|
+
return sorted(set(_HREF.findall(index)))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def fetch(name: str, into: Path | None = None) -> Path:
|
|
68
|
+
"""Return the local copy of a document, downloading it if needed."""
|
|
69
|
+
target = (into or cache_dir()) / name
|
|
70
|
+
if target.exists():
|
|
71
|
+
return target
|
|
72
|
+
url = site_for(name) + name
|
|
73
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
74
|
+
with urllib.request.urlopen(url, timeout=60) as resp:
|
|
75
|
+
data = resp.read()
|
|
76
|
+
tmp = target.with_suffix(".part")
|
|
77
|
+
tmp.write_bytes(data)
|
|
78
|
+
tmp.replace(target)
|
|
79
|
+
return target
|
bbfmodels/tree.py
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"""A data tree: the values of one device, held against a schema.
|
|
2
|
+
|
|
3
|
+
The wire shape of CWMP and USP is a flat list of path and text pairs with
|
|
4
|
+
instance numbers inside the paths. ``Tree.from_flat`` arranges those into
|
|
5
|
+
objects, tables and instances using the schema, decodes values on demand,
|
|
6
|
+
and ``flatten`` writes them back out. Paths the schema does not define are
|
|
7
|
+
kept where they belong and come back out unchanged, so a tree built from a
|
|
8
|
+
device's values is never lossy.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from collections.abc import Iterator, Mapping
|
|
14
|
+
|
|
15
|
+
from bbfmodels import codec
|
|
16
|
+
from bbfmodels.ir import Object, Parameter
|
|
17
|
+
from bbfmodels.schema import Schema, UnknownPath
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Node:
|
|
21
|
+
"""One object instance: its parameter texts, child objects and tables."""
|
|
22
|
+
|
|
23
|
+
def __init__(self, path: str, obj: Object | None) -> None:
|
|
24
|
+
self.path = path
|
|
25
|
+
self.object = obj
|
|
26
|
+
self.raw: dict[str, str] = {}
|
|
27
|
+
# Child objects and tables by name, in the order they were first seen,
|
|
28
|
+
# so a tree flattens in the order it was built from.
|
|
29
|
+
self.members: dict[str, Node | Table] = {}
|
|
30
|
+
|
|
31
|
+
def __repr__(self) -> str:
|
|
32
|
+
return f"Node({self.path!r})"
|
|
33
|
+
|
|
34
|
+
def __getitem__(self, name: str) -> Node | Table:
|
|
35
|
+
return self.members[name]
|
|
36
|
+
|
|
37
|
+
def __contains__(self, name: str) -> bool:
|
|
38
|
+
return name in self.raw or name in self.members
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def children(self) -> dict[str, Node]:
|
|
42
|
+
return {n: m for n, m in self.members.items() if isinstance(m, Node)}
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def tables(self) -> dict[str, Table]:
|
|
46
|
+
return {n: m for n, m in self.members.items() if isinstance(m, Table)}
|
|
47
|
+
|
|
48
|
+
def parameter(self, name: str) -> Parameter | None:
|
|
49
|
+
return self.object.parameters.get(name) if self.object else None
|
|
50
|
+
|
|
51
|
+
def text(self, name: str) -> str:
|
|
52
|
+
"""The wire text of a parameter, exactly as given."""
|
|
53
|
+
return self.raw[name]
|
|
54
|
+
|
|
55
|
+
def value(self, name: str) -> codec.Value:
|
|
56
|
+
"""The decoded value of a parameter; text when the schema has no syntax for it."""
|
|
57
|
+
text = self.raw[name]
|
|
58
|
+
param = self.parameter(name)
|
|
59
|
+
return codec.decode(param.syntax, text) if param else text
|
|
60
|
+
|
|
61
|
+
def get(self, name: str, default: codec.Value | None = None) -> codec.Value | None:
|
|
62
|
+
return self.value(name) if name in self.raw else default
|
|
63
|
+
|
|
64
|
+
def set(self, name: str, value: codec.Value) -> None:
|
|
65
|
+
"""Store a value, encoding it for the parameter's syntax.
|
|
66
|
+
|
|
67
|
+
An unknown parameter takes text only. Values are not validated here;
|
|
68
|
+
``Tree.problems`` reports violations of the schema's facets.
|
|
69
|
+
"""
|
|
70
|
+
param = self.parameter(name)
|
|
71
|
+
if param is None:
|
|
72
|
+
if not isinstance(value, str):
|
|
73
|
+
raise codec.CodecError(f"{self.path}{name} is not in the schema; give text")
|
|
74
|
+
self.raw[name] = value
|
|
75
|
+
else:
|
|
76
|
+
self.raw[name] = codec.encode(param.syntax, value)
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def unknown_parameters(self) -> list[str]:
|
|
80
|
+
return [n for n in self.raw if self.parameter(n) is None]
|
|
81
|
+
|
|
82
|
+
def walk(self) -> Iterator[Node]:
|
|
83
|
+
yield self
|
|
84
|
+
for member in self.members.values():
|
|
85
|
+
if isinstance(member, Node):
|
|
86
|
+
yield from member.walk()
|
|
87
|
+
else:
|
|
88
|
+
for instance in member.values():
|
|
89
|
+
yield from instance.walk()
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class Table(dict[int, Node]):
|
|
93
|
+
"""The instances of a multi-instance object, by instance number."""
|
|
94
|
+
|
|
95
|
+
def __init__(self, path: str, obj: Object | None) -> None:
|
|
96
|
+
super().__init__()
|
|
97
|
+
self.path = path
|
|
98
|
+
self.object = obj
|
|
99
|
+
|
|
100
|
+
def __repr__(self) -> str:
|
|
101
|
+
return f"Table({self.path!r}, {sorted(self)})"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class Tree:
|
|
105
|
+
def __init__(self, schema: Schema) -> None:
|
|
106
|
+
self.schema = schema
|
|
107
|
+
self.roots: dict[str, Node] = {}
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def from_flat(cls, schema: Schema, values: Mapping[str, str]) -> Tree:
|
|
111
|
+
tree = cls(schema)
|
|
112
|
+
for path, text in values.items():
|
|
113
|
+
tree.set_text(path, text)
|
|
114
|
+
return tree
|
|
115
|
+
|
|
116
|
+
def __getitem__(self, root: str) -> Node:
|
|
117
|
+
return self.roots[root.rstrip(".")]
|
|
118
|
+
|
|
119
|
+
def node(self, object_path: str, create: bool = False) -> Node:
|
|
120
|
+
"""The node for a data path ending in ``.``, created on the way if asked."""
|
|
121
|
+
segments = object_path.rstrip(".").split(".")
|
|
122
|
+
root_name = segments[0]
|
|
123
|
+
if root_name not in self.roots:
|
|
124
|
+
if not create:
|
|
125
|
+
raise KeyError(object_path)
|
|
126
|
+
self.roots[root_name] = Node(root_name + ".", self._object(root_name + "."))
|
|
127
|
+
node = self.roots[root_name]
|
|
128
|
+
path = root_name + "."
|
|
129
|
+
i = 1
|
|
130
|
+
while i < len(segments):
|
|
131
|
+
seg = segments[i]
|
|
132
|
+
table_path = path + seg + ".{i}."
|
|
133
|
+
is_table = (i + 1 < len(segments) and segments[i + 1].isdigit()) and (
|
|
134
|
+
table_path in self.schema.objects or path + seg + "." not in self.schema.objects
|
|
135
|
+
)
|
|
136
|
+
if is_table:
|
|
137
|
+
number = int(segments[i + 1])
|
|
138
|
+
table = node.members.get(seg)
|
|
139
|
+
if not isinstance(table, Table):
|
|
140
|
+
if table is not None or not create:
|
|
141
|
+
raise KeyError(object_path)
|
|
142
|
+
table = node.members[seg] = Table(table_path, self._object(table_path))
|
|
143
|
+
instance_path = f"{path}{seg}.{number}."
|
|
144
|
+
instance = table.get(number)
|
|
145
|
+
if instance is None:
|
|
146
|
+
if not create:
|
|
147
|
+
raise KeyError(object_path)
|
|
148
|
+
instance = table[number] = Node(instance_path, table.object)
|
|
149
|
+
node, path = instance, instance_path
|
|
150
|
+
i += 2
|
|
151
|
+
else:
|
|
152
|
+
child_path = path + seg + "."
|
|
153
|
+
child = node.members.get(seg)
|
|
154
|
+
if not isinstance(child, Node):
|
|
155
|
+
if child is not None or not create:
|
|
156
|
+
raise KeyError(object_path)
|
|
157
|
+
child = node.members[seg] = Node(child_path, self._object(child_path))
|
|
158
|
+
node, path = child, child_path
|
|
159
|
+
i += 1
|
|
160
|
+
return node
|
|
161
|
+
|
|
162
|
+
def _object(self, data_path: str) -> Object | None:
|
|
163
|
+
try:
|
|
164
|
+
return self.schema.resolve(data_path).object
|
|
165
|
+
except UnknownPath:
|
|
166
|
+
return None
|
|
167
|
+
|
|
168
|
+
def set_text(self, path: str, text: str) -> None:
|
|
169
|
+
object_path, _, name = path.rpartition(".")
|
|
170
|
+
self.node(object_path + ".", create=True).raw[name] = text
|
|
171
|
+
|
|
172
|
+
def set(self, path: str, value: codec.Value) -> None:
|
|
173
|
+
object_path, _, name = path.rpartition(".")
|
|
174
|
+
self.node(object_path + ".", create=True).set(name, value)
|
|
175
|
+
|
|
176
|
+
def text(self, path: str) -> str:
|
|
177
|
+
object_path, _, name = path.rpartition(".")
|
|
178
|
+
return self.node(object_path + ".").text(name)
|
|
179
|
+
|
|
180
|
+
def value(self, path: str) -> codec.Value:
|
|
181
|
+
object_path, _, name = path.rpartition(".")
|
|
182
|
+
return self.node(object_path + ".").value(name)
|
|
183
|
+
|
|
184
|
+
def nodes(self) -> Iterator[Node]:
|
|
185
|
+
for root in self.roots.values():
|
|
186
|
+
yield from root.walk()
|
|
187
|
+
|
|
188
|
+
def flatten(self) -> dict[str, str]:
|
|
189
|
+
"""Every parameter as path and wire text, in tree order."""
|
|
190
|
+
return {node.path + name: text for node in self.nodes() for name, text in node.raw.items()}
|
|
191
|
+
|
|
192
|
+
def problems(self) -> list[tuple[str, str]]:
|
|
193
|
+
"""Every facet violation in the tree, as path and message."""
|
|
194
|
+
found: list[tuple[str, str]] = []
|
|
195
|
+
for node in self.nodes():
|
|
196
|
+
for name, text in node.raw.items():
|
|
197
|
+
param = node.parameter(name)
|
|
198
|
+
if param is not None:
|
|
199
|
+
found.extend((node.path + name, p) for p in codec.problems(param.syntax, text))
|
|
200
|
+
return found
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bbfmodels
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Typed models and schema tooling for Broadband Forum data models (TR-181, TR-098, TR-104 and more), generated from the published XML
|
|
5
|
+
Project-URL: Homepage, https://github.com/ispx-limited/bbfmodels
|
|
6
|
+
Project-URL: Documentation, https://docs.bbfmodels.ispx.co/
|
|
7
|
+
Project-URL: Changelog, https://docs.bbfmodels.ispx.co/changelog/
|
|
8
|
+
Author: ISPX LIMITED
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Keywords: broadband-forum,cwmp,data-model,tr-069,tr-098,tr-181,tr-369,usp
|
|
13
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Telecommunications Industry
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: System :: Networking
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: pydantic>=2.14
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# bbfmodels
|
|
27
|
+
|
|
28
|
+
Typed models and schema tooling for Broadband Forum data models (TR-181,
|
|
29
|
+
TR-098, TR-104 and the rest), generated from the XML the Forum publishes.
|
|
30
|
+
|
|
31
|
+
The Forum defines what a broadband gateway exposes to its management system
|
|
32
|
+
as XML in the TR-106 schema: thousands of objects and parameters, their types,
|
|
33
|
+
ranges, enumerations, writability and multi-instance tables. Everyone who
|
|
34
|
+
builds against those models, an ACS, a USP controller, a device simulator, an
|
|
35
|
+
integration script, re-derives the same facts from the same XML and hand-types
|
|
36
|
+
the same parameter paths as strings. bbfmodels does it once:
|
|
37
|
+
|
|
38
|
+
- A parser that reads the published XML into a normalised intermediate
|
|
39
|
+
representation, published as JSON with its own schema.
|
|
40
|
+
- A Python runtime that works from that representation: resolve a path,
|
|
41
|
+
validate a value against the model's constraints, convert between the flat
|
|
42
|
+
path and value lists that CWMP and USP carry on the wire and a typed tree.
|
|
43
|
+
- Generated typed bindings: pydantic models for Python first, JSON Schema and
|
|
44
|
+
TypeScript from the same representation, Go when there is a consumer.
|
|
45
|
+
|
|
46
|
+
Names stay as the Forum wrote them. `Device.WiFi.SSID.{i}.SSID` is a table of
|
|
47
|
+
`SSID` entries indexed by instance number, and the attribute is `SSID`, not
|
|
48
|
+
`ssid`.
|
|
49
|
+
|
|
50
|
+
## Status
|
|
51
|
+
|
|
52
|
+
Pre-release. The parser, the intermediate representation and the runtime
|
|
53
|
+
are in place: `bbfmodels fetch` downloads the Forum's published documents,
|
|
54
|
+
`bbfmodels ir` turns one into JSON, and the `Schema` and `Tree` classes
|
|
55
|
+
resolve paths, hold a device's values and validate them. Generated Python
|
|
56
|
+
models come next. Until the first release there is no package on PyPI.
|
|
57
|
+
|
|
58
|
+
The design decisions behind the code are in `context/decisions/`, indexed in
|
|
59
|
+
`context/README.md`. Read them before changing the parser or the IR.
|
|
60
|
+
|
|
61
|
+
## Development
|
|
62
|
+
|
|
63
|
+
Prerequisites: git and [uv](https://docs.astral.sh/uv/). The pinned Python is
|
|
64
|
+
installed by uv.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
scripts/bootstrap.sh
|
|
68
|
+
make test
|
|
69
|
+
make lint
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`make help` lists the rest. Documentation is built from `docs/` with
|
|
73
|
+
`make docs` and published at https://docs.bbfmodels.ispx.co/.
|
|
74
|
+
|
|
75
|
+
## Licence
|
|
76
|
+
|
|
77
|
+
Apache-2.0, copyright ISPX LIMITED. The Broadband Forum publishes its data
|
|
78
|
+
models under the BSD 3-clause licence; output derived from them carries the
|
|
79
|
+
Forum's notice.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
bbfmodels/__init__.py,sha256=zVBow6BV3ehd7KEHHWqEZNVIRMJjcQlqctMcFmiImBA,611
|
|
2
|
+
bbfmodels/cli.py,sha256=7nzDPxyO8Gl1qPOwJPvvPzQ3ob3_Rh1LqD4oRbWwxW0,2548
|
|
3
|
+
bbfmodels/codec.py,sha256=TE2k_kE4mj5QOcX9bH7-EBlp7InmF_lAN4C5_9MWdjw,8933
|
|
4
|
+
bbfmodels/ir.py,sha256=IGpkupWqryiWNQGj53XlAIKFFbqk_WuiXpim1-A515w,9680
|
|
5
|
+
bbfmodels/parser.py,sha256=UQmWs3N7gPYio-ZyzLrSbUisRzM_O_oJ-48jLaIbl_E,18631
|
|
6
|
+
bbfmodels/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
bbfmodels/schema.py,sha256=vM5rKsg3lQSZEvsCxWiClGtmT62EU13bp0me1r5gNM4,5778
|
|
8
|
+
bbfmodels/sources.py,sha256=tQCkh_ppv1Zm54xBfMjyK4o3w9ese2SNTMk3fQf6Aro,2673
|
|
9
|
+
bbfmodels/tree.py,sha256=aeJjmFn0X29SfNY5C6C6FK4YFAHzN_eR0FwtdUzqzJs,7763
|
|
10
|
+
bbfmodels-0.1.0.dist-info/METADATA,sha256=RuDtg9B599Sl8900_m7u9vONEwQzp5oY0Fn0_WKoFBw,3349
|
|
11
|
+
bbfmodels-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
12
|
+
bbfmodels-0.1.0.dist-info/entry_points.txt,sha256=CZnzcwSGF9L4i7o_Iv7OL1IRORCbCRRieJKn86SDhsg,49
|
|
13
|
+
bbfmodels-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
14
|
+
bbfmodels-0.1.0.dist-info/licenses/NOTICE,sha256=DBJsIc1s93frQB3YqrJtxxTdXWJVxtDqGdS2QPA7Rm4,38
|
|
15
|
+
bbfmodels-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|