PyOSLC
20 |An OSLC adapter implemented on Python.
21 |22 |
For showing the REST API implementation for the OSLC adapter click the next button.
23 | OSLC API 24 | {% block button_home %}{% endblock %} 25 |├── tests ├── __init__.py ├── unit │ ├── __init__.py │ └── test_resource.py ├── functional │ ├── __init__.py │ ├── test_web.py │ ├── test_jazz_gc.py │ ├── oslc.py │ └── test_rm.py └── conftest.py ├── app ├── api │ ├── __init__.py │ ├── oauth │ │ ├── __init__.py │ │ ├── oslc_oauth.py │ │ └── pyoslc_app.py │ └── adapter │ │ ├── dialogs │ │ ├── __init__.py │ │ ├── templates │ │ │ └── dialogs │ │ │ │ ├── base.html │ │ │ │ ├── smallpreview.html │ │ │ │ ├── largepreview.html │ │ │ │ ├── creator.html │ │ │ │ └── selector.html │ │ ├── static │ │ │ ├── css │ │ │ │ ├── adaptor.css.lost │ │ │ │ └── adaptor.css │ │ │ ├── js │ │ │ │ └── preview.js │ │ │ └── delegatedUI.js │ │ └── routes.py │ │ ├── mappings │ │ ├── __init__.py │ │ └── specification.py │ │ ├── namespaces │ │ ├── __init__.py │ │ ├── config │ │ │ ├── __init__.py │ │ │ └── routes.py │ │ ├── rm │ │ │ ├── __init__.py │ │ │ ├── parsers.py │ │ │ ├── models.py │ │ │ └── csv_requirement_repository.py │ │ └── business.py │ │ ├── resources │ │ ├── __init__.py │ │ ├── repository.py │ │ └── resource_service.py │ │ ├── services │ │ ├── __init__.py │ │ ├── factories.py │ │ ├── specification.py │ │ └── providers.py │ │ ├── static │ │ ├── pyicon16.ico │ │ ├── pyicon24.ico │ │ ├── pyicon32.ico │ │ ├── pyicon72.ico │ │ └── delegatedUI.js │ │ ├── vocabulary.py │ │ ├── exceptions.py │ │ ├── oslc.py │ │ ├── manager.py │ │ ├── forms.py │ │ └── __init__.py ├── web │ ├── __init__.py │ ├── routes.py │ └── templates │ │ ├── web │ │ ├── index.html │ │ ├── requirement_list.html │ │ └── requirement.html │ │ └── base.html ├── wsgi.py ├── config.py └── __init__.py ├── pyoslc ├── rest │ ├── __init__.py │ └── resource.py ├── resources │ ├── __init__.py │ ├── domains │ │ ├── __init__.py │ │ └── qm.py │ ├── jazz.py │ └── factories.py ├── serializers │ ├── __init__.py │ ├── configxml.py │ └── jazzxml.py ├── vocabularies │ ├── __init__.py │ ├── data.py │ ├── am.py │ ├── config.py │ ├── trs.py │ ├── jfs.py │ ├── rm.py │ ├── cm.py │ ├── jazz.py │ └── core.py ├── __init__.py └── helpers.py ├── pyoslc_oauth ├── client │ └── __init__.py ├── routes │ ├── __init__.py │ ├── oauth.py │ └── consumer.py ├── templates │ └── pyoslc_oauth │ │ ├── selection.html │ │ ├── admin_login.html │ │ ├── base.html │ │ ├── publisher.html │ │ ├── configuration.html │ │ ├── macros.html │ │ ├── components.html │ │ ├── authorize.html │ │ ├── stream.html │ │ ├── scr.html │ │ ├── selection.xhtml │ │ └── manage_consumer.html ├── database.py ├── login_manager.py ├── vocabulary.py ├── server.py ├── __init__.py ├── forms.py └── models.py ├── .env ├── .flaskenv ├── docs ├── source │ ├── _static │ │ ├── 01.png │ │ └── 02.png │ ├── index.rst │ ├── libraries.rst │ ├── getting_the_code.rst │ └── conf.py ├── Makefile └── make.bat ├── documents └── PyOSLC Architecture.pdf ├── MANIFEST.in ├── setup.cfg ├── .gitignore ├── initialize.py ├── requirements.txt ├── tox.ini ├── .github └── workflows │ ├── publish.yml │ └── tests.yml ├── examples └── specifications.csv ├── LICENSE ├── setup.py └── README.md /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/web/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyoslc/rest/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/api/oauth/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyoslc/resources/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/functional/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyoslc/serializers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyoslc/vocabularies/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyoslc_oauth/client/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyoslc_oauth/routes/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | AUTHLIB_INSECURE_TRANSPORT=True -------------------------------------------------------------------------------- /app/api/adapter/dialogs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/api/adapter/mappings/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/api/adapter/namespaces/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/api/adapter/resources/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/api/adapter/services/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyoslc/resources/domains/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/api/adapter/namespaces/config/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyoslc_oauth/templates/pyoslc_oauth/selection.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.flaskenv: -------------------------------------------------------------------------------- 1 | FLASK_APP=app.wsgi:app 2 | FLASK_ENV=development 3 | FLASK_DEBUG=True 4 | -------------------------------------------------------------------------------- /docs/source/_static/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslab/pyoslc/HEAD/docs/source/_static/01.png -------------------------------------------------------------------------------- /docs/source/_static/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslab/pyoslc/HEAD/docs/source/_static/02.png -------------------------------------------------------------------------------- /app/wsgi.py: -------------------------------------------------------------------------------- 1 | from app import create_app 2 | from app.config import Config 3 | 4 | app = create_app(Config) 5 | -------------------------------------------------------------------------------- /app/api/adapter/static/pyicon16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslab/pyoslc/HEAD/app/api/adapter/static/pyicon16.ico -------------------------------------------------------------------------------- /app/api/adapter/static/pyicon24.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslab/pyoslc/HEAD/app/api/adapter/static/pyicon24.ico -------------------------------------------------------------------------------- /app/api/adapter/static/pyicon32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslab/pyoslc/HEAD/app/api/adapter/static/pyicon32.ico -------------------------------------------------------------------------------- /app/api/adapter/static/pyicon72.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslab/pyoslc/HEAD/app/api/adapter/static/pyicon72.ico -------------------------------------------------------------------------------- /documents/PyOSLC Architecture.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cslab/pyoslc/HEAD/documents/PyOSLC Architecture.pdf -------------------------------------------------------------------------------- /pyoslc/resources/domains/qm.py: -------------------------------------------------------------------------------- 1 | from pyoslc.resources.models import BaseResource 2 | 3 | 4 | class TestCase(BaseResource): 5 | pass 6 | -------------------------------------------------------------------------------- /pyoslc_oauth/database.py: -------------------------------------------------------------------------------- 1 | from flask_sqlalchemy import SQLAlchemy 2 | 3 | db = SQLAlchemy() 4 | 5 | 6 | def init_app(app): 7 | db.init_app(app) 8 | -------------------------------------------------------------------------------- /pyoslc/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Python implementation for the OSLC specificaction 3 | """ 4 | 5 | __version__ = '1.0.0-dev' 6 | __date__ = '2018/12/01' 7 | -------------------------------------------------------------------------------- /pyoslc_oauth/login_manager.py: -------------------------------------------------------------------------------- 1 | from flask_login import LoginManager 2 | 3 | login = LoginManager() 4 | 5 | 6 | def init_app(app): 7 | login.init_app(app) 8 | -------------------------------------------------------------------------------- /app/api/adapter/resources/repository.py: -------------------------------------------------------------------------------- 1 | class Repository(object): 2 | 3 | def __init__(self, title): 4 | self.title = title 5 | 6 | def get(self): 7 | pass 8 | -------------------------------------------------------------------------------- /tests/unit/test_resource.py: -------------------------------------------------------------------------------- 1 | from pyoslc.resources.models import ServiceProvider 2 | 3 | 4 | def test_service_provider(): 5 | sp = ServiceProvider() 6 | 7 | assert sp is not None 8 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | global-exclude *.pyc 2 | 3 | graft pyoslc/app/api/adapter/static 4 | graft pyoslc/app/api/adapter/dialogs/static 5 | graft pyoslc/app/api/adapter/dialogs/templates 6 | graft pyoslc/app/web/templates -------------------------------------------------------------------------------- /app/web/routes.py: -------------------------------------------------------------------------------- 1 | from flask import Blueprint, render_template 2 | 3 | bp = Blueprint('web', __name__, template_folder='templates') 4 | 5 | 6 | @bp.route('/') 7 | def index(): 8 | return render_template("web/index.html") 9 | -------------------------------------------------------------------------------- /pyoslc_oauth/templates/pyoslc_oauth/admin_login.html: -------------------------------------------------------------------------------- 1 | {% extends "routes/base.html" %} 2 | {% import "bootstrap/wtf.html" as wtf %} 3 | 4 | {% block content %} 5 | {{ wtf.quick_form(form, action=form.action) }} 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /app/api/oauth/oslc_oauth.py: -------------------------------------------------------------------------------- 1 | import pyoslc_oauth 2 | from app.api.oauth.pyoslc_app import PyOSLCApplication 3 | 4 | pyoslc = PyOSLCApplication('PyOSLC Contact Software') 5 | 6 | 7 | def init_app(app): 8 | pyoslc_oauth.init_app(app, pyoslc) 9 | -------------------------------------------------------------------------------- /pyoslc_oauth/templates/pyoslc_oauth/base.html: -------------------------------------------------------------------------------- 1 | {% extends "bootstrap/base.html" %} 2 | 3 | {% block title %}PyOSLC OAuth{% endblock %} 4 | 5 | {% block navbar %} 6 | {% endblock %} 7 | 8 | {% block content %} 9 | {% block form %}{% endblock %} 10 | {% endblock %} -------------------------------------------------------------------------------- /app/api/adapter/dialogs/templates/dialogs/base.html: -------------------------------------------------------------------------------- 1 | {% extends "bootstrap/base.html" %} 2 | 3 | {% block title %}PyOSLC OAuth{% endblock %} 4 | 5 | {% block navbar %} 6 | {% endblock %} 7 | 8 | {% block content %} 9 | {% block form %}{% endblock %} 10 | {% endblock %} -------------------------------------------------------------------------------- /app/api/adapter/vocabulary.py: -------------------------------------------------------------------------------- 1 | from rdflib import URIRef 2 | from rdflib.namespace import ClosedNamespace 3 | 4 | 5 | PYOSLC = ClosedNamespace( 6 | uri=URIRef("http://example.com/ns/pyoslc#"), 7 | terms=[ 8 | "TrackedResourceSetProvider", 9 | ] 10 | ) 11 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | license_file = LICENSE 3 | 4 | [tool:pytest] 5 | minversion = 2.7 6 | testpaths = tests 7 | 8 | [coverage:run] 9 | branch = True 10 | source = 11 | pyoslc 12 | pyoslc_oauth 13 | tests 14 | 15 | [coverage:paths] 16 | source = 17 | pyoslc 18 | pyoslc_oauth 19 | -------------------------------------------------------------------------------- /pyoslc/vocabularies/data.py: -------------------------------------------------------------------------------- 1 | from rdflib import URIRef 2 | from rdflib.namespace import ClosedNamespace 3 | 4 | OSLCData = ClosedNamespace( 5 | uri=URIRef("http://open-services.net/ns/servicemanagement/1.0/"), 6 | terms=[ 7 | # RDFS Classes in this namespace 8 | # RDF Properties in this namespace 9 | ] 10 | ) 11 | -------------------------------------------------------------------------------- /pyoslc/vocabularies/am.py: -------------------------------------------------------------------------------- 1 | from rdflib import URIRef 2 | from rdflib.namespace import ClosedNamespace 3 | 4 | OSLC_AM = ClosedNamespace( 5 | uri=URIRef("http://open-services.net/ns/am#"), 6 | terms=[ 7 | # RDFS Classes in this namespace 8 | "LinkType", 9 | 10 | # RDF Properties in this namespace 11 | "amServiceProviders", 12 | ] 13 | ) 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .vscode/ 3 | .idea/ 4 | 5 | venv/ 6 | 7 | *.pyc 8 | __pycache__/ 9 | 10 | .pytest_cache/ 11 | .coverage 12 | htmlcov/ 13 | 14 | dist/ 15 | build/ 16 | *.egg-info/ 17 | 18 | logs/ 19 | webservice/logs/ 20 | 21 | _cache 22 | app/oauth.sqlite 23 | pyoslc_oauth/OAuthStore.rdf 24 | 25 | docs/build 26 | 27 | .tox/ 28 | test-reports/ 29 | 30 | .python-version 31 | -------------------------------------------------------------------------------- /initialize.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import os 3 | import subprocess 4 | import sys 5 | 6 | subprocess.call(['virtualenv', 'venv']) 7 | if sys.platform == 'win32': 8 | bin = 'Scripts' 9 | else: 10 | bin = 'bin' 11 | 12 | requirements = open("requirements.txt", "r") 13 | 14 | for line in requirements: 15 | subprocess.call([os.path.join('venv', bin, 'pip'), 'install', '--upgrade', line]) 16 | -------------------------------------------------------------------------------- /app/api/adapter/exceptions.py: -------------------------------------------------------------------------------- 1 | from werkzeug.exceptions import HTTPException 2 | 3 | 4 | class NotModified(HTTPException): 5 | """*304* `Not Modified` 6 | 7 | Raise if the client sent a resource with no changes to be stored. 8 | """ 9 | 10 | code = 304 11 | description = ( 12 | "The client sent the same resource without changes to the server, " 13 | "it can not be updated." 14 | ) 15 | -------------------------------------------------------------------------------- /app/web/templates/web/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block button_home %} 4 | Home 5 | {% endblock %} 6 | 7 | {% block header %} 8 |
| Predicate | 20 |Object | 21 |
|---|---|
| {{ p }} | 28 |{{ o }} | 29 |
Client {{ client.name }} is requesting:
7 | {% if scopes is defined and grant.scopes %} 8 |An OSLC adapter implemented on Python.
21 |For showing the REST API implementation for the OSLC adapter click the next button.
23 | OSLC API 24 | {% block button_home %}{% endblock %} 25 |Click on Load to retrieve the Streams from PyOSLC-Adaptor.
35 | 36 | 37 || Name | 9 |Key | 10 |Trusted | 11 |Action | 12 |
|---|---|---|---|
| 18 | {% if consumer.provisional %} 19 | 20 | {% else %} 21 | {{ consumer.name }} 22 | {% endif %} 23 | | 24 |{{ consumer.key }} | 25 |{{ consumer.trusted }} | 26 |27 | {% if consumer.provisional %} 28 | 29 | 30 | {% else %} 31 | 32 | {% endif %} 33 | | 34 |
| Name | 45 |Key | 46 |Trusted | 47 |Action | 48 |
|---|---|---|---|
| 54 | {% if consumer.provisional %} 55 | 56 | {% else %} 57 | {{ consumer.name }} 58 | {% endif %} 59 | | 60 |{{ consumer.key }} | 61 |{{ consumer.trusted }} | 62 |63 | {% if consumer.provisional %} 64 | 65 | 66 | {% else %} 67 | 68 | {% endif %} 69 | | 70 |
Find a specific resource through a full-text search.
30 | 31 | 32 | 33 |