Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
391a389
synch manager aligned with spec
pchainho May 5, 2017
a1ac759
hello world working
pchainho May 5, 2017
1ebb55f
hello world resume working
pchainho May 6, 2017
b052ea0
subscribe msgs aligned with specs
luistduarte May 8, 2017
7d2945c
Merge pull request #196 from reTHINK-project/specs-align-subscribe-msg
luistduarte May 8, 2017
64a2304
children objects aligned with spec and working
pchainho May 8, 2017
7b90247
children resume working
pchainho May 8, 2017
0343df3
children resume working
pchainho May 8, 2017
0a7c277
Merge branch 'develop' into specs-align
vitormsilva May 9, 2017
92cc0cf
tests fixed
pchainho May 9, 2017
eecd05d
update tests and fixes
vitormsilva May 9, 2017
eb91dff
observer addChild test fixed
pchainho May 9, 2017
53af708
Update the package.json and karma.conf.js; Update distribution files
vitormsilva May 10, 2017
2e736ff
Merge pull request #197 from reTHINK-project/specs-align
vitormsilva May 10, 2017
b01f63b
preparing release 0.8.1
luistduarte May 11, 2017
48c7ec6
Fix the dataObjectStorage subscriptions
vitormsilva May 11, 2017
3b5c7f1
Fix tests for DataObjectStorage
vitormsilva May 11, 2017
f0d95c0
fix karma conf js
vitormsilva May 11, 2017
1017a33
removed mutual authentication to get subscribes working after resume
pchainho May 11, 2017
2ab3a6a
better way to remove mutual authentication to get subscribes working …
pchainho May 11, 2017
72013c3
Merge branch 'develop' of https://github.com/reTHINK-project/dev-runt…
pchainho May 11, 2017
338396c
registry.registerDataObject: improved alignment with spec
pchainho May 12, 2017
e26d8d8
readme udpated, broken links fixed
pchainho May 13, 2017
9bfd261
syncherManager._newSubscription childrens initialization fixed
pchainho May 15, 2017
b5c2b53
Merge branch 'master' into develop
luistduarte May 15, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@
- [Tasks](#tasks)

## <a id="note">Note</a>
In order to try speed up the instalation process, we remove the first verification of global modules, so, if you want install this repository, you should install globaly this modules:
In order to speed up the installation process, we have removed the first verification of global modules, so, if you want to install this repository, you should globally install this module:

```shell
npm install -g karma-cli
```

## <a id="overview">Overview</a>

This repository contains the source code and associated documentation of the core components required to support the deployment and execution of Hyperties in user devices or in network servers. More information about the Hyperty concept and the reTHINK framework in general is provided [here](https://github.com/reTHINK-project/dev-service-framework/blob/master/README.md).
This repository contains the source code and associated documentation of the core components required to support the deployment and execution of Hyperties in user devices or in network servers. The full specification is provided [here]().

The Hyperty Runtime architecture follows a security by design approach since it was highly influenced by a careful [security analysis](docs/specs/securityanalysis.md) where different types of components are executed in isolated sandboxes. Thus, components downloaded from a specific Service Provider are executed in sandboxes that are different from the sandboxes used to execute components downloaded from another service provider. Communication between components running in different sandboxes is only possible through messages exchanged through a Message Bus functionality provided by the Hyperty Runtime Core Sandbox. On the other hand, and according to the [ProtoOFly concept](https://github.com/reTHINK-project/dev-service-framework/blob/master/docs/manuals/hyperty-messaging-framework.md#protocol-on-the-fly-protofly-and-protostubs), the protocol stub is executed in isolated sandbox and provides the bridge for the Hperty Runtime to communicate with associated Service Provider. The detailed specification of the Hyperty Runtime Core is provided [here](docs/specs/readme.md).
The Hyperty Runtime architecture follows a security by design approach where different types of components are executed in isolated sandboxes. Thus, components downloaded from a specific Service Provider are executed in sandboxes that are different from the sandboxes used to execute components downloaded from another service provider. Communication between components running in different sandboxes is only possible through messages exchanged through a Message Bus functionality provided by the Hyperty Runtime Core Sandbox. On the other hand, and according to the ProtoOFly concept, the protocol stub is executed in isolated sandbox and provides the bridge for the Hperty Runtime to communicate with associated Service Provider.

Hyperty Core Runtime components are platform agnostic and are to be included in platform specific Hyperty Runtimes, like Web Browsers and Nodejs based platforms.

The detailed specification of the Hyperty Runtime Core is provided [here](https://github.com/reTHINK-project/specs/blob/master/runtime/readme.md) and the full reTHINK Framework is provided [here](https://github.com/reTHINK-project/specs).

## <a id="user-view">User View</a>

**How to include the Hyperty Runtime Core in other Projects**
Expand Down Expand Up @@ -65,7 +67,7 @@ console.log('MiniBus: ', MiniBus);

```

if you found some issues, please submit them into the respective repository;
if you find some issues, please submit them into the respective repository;

---

Expand Down
51 changes: 26 additions & 25 deletions dist/PEP.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/ReThinkCtx.js

Large diffs are not rendered by default.

350 changes: 175 additions & 175 deletions dist/Runtime.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/minibus.js

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions dist/sandbox.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "runtime-core",
"version": "0.8.0",
"version": "0.8.1",
"description": "core runtime development",
"files": [
"dist"
Expand Down Expand Up @@ -34,7 +34,7 @@
},
"homepage": "https://rethink-project.eu/",
"dependencies": {
"service-framework": "github:rethink-project/dev-service-framework#v0.6.0"
"service-framework": "github:rethink-project/dev-service-framework#v0.6.1"
},
"devDependencies": {
"babel-core": "^6.21.0",
Expand Down
7 changes: 5 additions & 2 deletions src/policy/context/RuntimeCoreCtx.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,21 @@ class RuntimeCoreCtx extends ReThinkCtx {
return new Promise((resolve, reject) => {
console.log('[Policy.RuntimeCoreCtx.prepareToForward]', message);

// uncomment this to enable mutual authentication
return resolve(message);

// TODO remove this validation. When the Nodejs auth was completed this should work like browser;
this.runtimeCapabilities.isAvailable('node').then((result) => {

console.log('[RuntimeCoreCtx - isAvailable - node] - ', result);
console.log('[RuntimeCoreCtx - isAvailable - node] - ', result);
if (result) {
return resolve(message);
} else {
if (isIncoming) {
let isSubscription = message.type === 'subscribe';
let isFromRemoteSM = _this.isFromRemoteSM(message.from);

if (isSubscription & isFromRemoteSM) {
if (isSubscription & isFromRemoteSM) {
// TODO: should verify why the mutualAuthentication is not working
// TODO: this should uncommented
_this.doMutualAuthentication(message).then(() => {
Expand Down
67 changes: 30 additions & 37 deletions src/registry/Registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import AddressAllocation from '../allocation/AddressAllocation';
import HypertyInstance from './HypertyInstance';

import {MessageFactory} from 'service-framework/dist/MessageFactory';
import {divideURL, isHypertyURL, isURL, isUserURL, generateGUID, getUserIdentityDomain, isBackendServiceURL} from '../utils/utils.js';
import {divideURL, isHypertyURL, isURL, isUserURL, generateGUID, getUserIdentityDomain, isBackendServiceURL, deepClone} from '../utils/utils.js';

import 'proxy-observe';
import { WatchingYou } from 'service-framework/dist/Utils';
Expand Down Expand Up @@ -328,7 +328,7 @@ class Registry {
let preAuth = [];

if (dataObject) {
preAuth = dataObject.preAuth;
preAuth = dataObject.authorise;
}
return preAuth;
}
Expand Down Expand Up @@ -417,6 +417,8 @@ class Registry {
let dataObject = _this.dataObjectList[dataObjectURL];

if (dataObject) {
if (!dataObject.subscribers) { dataObject.subscribers = []; }

dataObject.subscribers.push(subscriberURL);
_this.dataObjectList[dataObjectURL] = dataObject;
}
Expand Down Expand Up @@ -447,13 +449,16 @@ class Registry {
* @param {Array} resources dataObject resources
* @param {Array} authorise list of pre authorised authorised IDs
*/
registerDataObject(identifier, dataObjectschema, dataObjectUrl, dataObjectReporter, resources, addressURL, authorise) {
//registerDataObject(identifier, dataObjectschema, dataObjectUrl, dataObjectReporter, resources, addressURL, authorise) {
registerDataObject(objectRegistration) {
let _this = this;

let registration = deepClone(objectRegistration);

return new Promise(function(resolve, reject) {

let dataScheme = [];
let filteredDataScheme = dataObjectUrl.split(':');
let filteredDataScheme = registration.url.split(':');
dataScheme.push(filteredDataScheme[0]);

_this.storageManager.get('registry:DataObjectURLs').then((urlsList) => {
Expand All @@ -463,7 +468,7 @@ class Registry {
}

//update the list with the new elements
urlsList[identifier + dataObjectschema + resources + dataObjectReporter] = addressURL.address;
urlsList[objectRegistration.name + objectRegistration.schema + objectRegistration.resources + objectRegistration.reporter] = objectRegistration.url;

let p2pHandler;
let p2pRequester;
Expand All @@ -473,59 +478,47 @@ class Registry {
p2pRequester = runtimeUtils.runtimeDescriptor.p2pRequesterStub;
}

let runtime = _this.runtimeURL;
let status = 'live';

//message to register the new data object, within the domain registry
let messageValue = {
name: identifier,
resources: resources,
dataSchemes: dataScheme,
schema: dataObjectschema,
url: dataObjectUrl,
expires: _this.expiresTime,
reporter: dataObjectReporter,
preAuth: authorise,
subscribers: [],
runtime: runtime,
status: status
};
registration.startingTime = registration.created;

delete registration.authorise;
delete registration.created;
delete registration.mutual;
delete registration.resume;

registration.expires = _this.expiresTime;
registration.dataSchemes = dataScheme;

if (p2pHandler) {
messageValue.p2pHandler = p2pHandler;
messageValue.p2pRequester = p2pRequester;
registration.p2pHandler = p2pHandler;
registration.p2pRequester = p2pRequester;
}

if (_this.isInterworkingProtoStub(dataObjectReporter)) {
messageValue.interworking = true;
if (_this.isInterworkingProtoStub(registration.reporter)) {
registration.interworking = true;
}

let message;

if (addressURL.newAddress) {
if (!registration.resume) {

console.log('[Registry] registering new data object URL', dataObjectUrl);
console.log('[Registry.registerDataObject] registering new data object URL', objectRegistration);

message = {type: 'create', from: _this.registryURL, to: 'domain://registry.' + _this.registryDomain + '/', body: {value: messageValue, policy: 'policy'}};
message = {type: 'create', from: _this.registryURL, to: 'domain://registry.' + _this.registryDomain + '/', body: {value: registration, policy: 'policy'}};

} else {

console.log('[Registry] registering previously registered data object URL', dataObjectUrl);

/*messageValue = {name: identifier, resources: resources, dataSchemes: dataScheme, schema: dataObjectschema, url: dataObjectUrl, expires: _this.expiresTime, reporter: dataObjectReporter, preAuth: authorise, subscribers: []};

message = {type:'create', from: _this.registryURL, to: 'domain://registry.' + _this.registryDomain + '/', body: {value: messageValue, policy: 'policy'}};*/
console.log('[Registry.registerDataObject] registering previously registered data object URL', objectRegistration);

message = {
type: 'update',
to: 'domain://registry.' + _this.registryDomain + '/',
from: _this.registryURL,
body: {resource: dataObjectUrl, value: {status: 'live'} }
body: {resource: objectRegistration.url, value: {status: 'live'} }
};

}

_this.dataObjectList[dataObjectUrl] = messageValue;
_this.dataObjectList[objectRegistration.url] = objectRegistration;

// step to obtain the list of all URL registered to updated with the new one.
_this.storageManager.set('registry:DataObjectURLs', 0, urlsList).then(() => {
Expand All @@ -538,7 +531,7 @@ class Registry {
);*/

_this._messageBus.postMessage(message, (reply) => {
console.log('[Registry] ===> registerDataObject Reply: ', reply);
console.log('[Registry.registerDataObject] ===> registerDataObject Reply: ', reply);
if (reply.body.code === 200) {
resolve('ok');
} else {
Expand Down
1 change: 1 addition & 0 deletions src/runtime/RuntimeUA.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class RuntimeUA {
} else {
throw new Error('Check your Runtime Factory because it need the Storage Manager implementation');
}

if (typeof runtimeFactory.runtimeCapabilities === 'function') {
this.runtimeCapabilities = runtimeFactory.runtimeCapabilities(this.storageManager);
} else {
Expand Down
Loading