Comparing version 0.0.1-alfa to 0.0.1
@@ -6,10 +6,10 @@ | ||
exports.createProcessor = function(name, kind) { | ||
return new Processor(name, kind); | ||
exports.createProcessor = function(name, value) { | ||
return new Processor(name, value); | ||
} | ||
function Processor(name, kind) | ||
function Processor(name, value) | ||
{ | ||
this.name = name; | ||
this.kind = kind; | ||
this.value = value; | ||
this.processors = []; | ||
@@ -26,5 +26,5 @@ } | ||
Processor.prototype.createProcessor = function (name, kind) | ||
Processor.prototype.createProcessor = function (name, value) | ||
{ | ||
var processor = new Processor(name, kind); | ||
var processor = new Processor(name, value); | ||
this.addProcessor(processor); | ||
@@ -36,4 +36,4 @@ return processor; | ||
{ | ||
if (this.name != null && this.kind != null && message[this.kind] == null) | ||
message[this.kind] = this.name; | ||
if (this.name && this.value && message[this.name] == null) | ||
message[this.name] = this.value; | ||
@@ -48,6 +48,6 @@ if (this.parent != null) { | ||
Processor.prototype.accepts = function (message) | ||
Processor.prototype.canProcess = function (message) | ||
{ | ||
if (this.name != null && this.kind != null) { | ||
if (message[this.kind] != this.name) | ||
if (this.name && this.value) { | ||
if (message[this.name] != this.value) | ||
return false; | ||
@@ -60,3 +60,3 @@ } | ||
for (var processor in this.processors) | ||
if (this.processors[processor].accepts(message)) | ||
if (this.processors[processor].canProcess(message)) | ||
return true; | ||
@@ -75,3 +75,3 @@ | ||
for (var processor in this.processors) | ||
if (this.processors[processor].accepts(message)) | ||
if (this.processors[processor].canProcess(message)) | ||
{ | ||
@@ -86,4 +86,4 @@ this.processors[processor].process(message); | ||
if (this.name != null && this.kind != null) | ||
descriptor[this.kind] = this.name; | ||
if (this.name && this.value) | ||
descriptor[this.name] = this.value; | ||
@@ -114,3 +114,3 @@ if (this.processors == null || this.processors.length == 0) | ||
RemoteHost.prototype.accepts = function (message) { | ||
RemoteHost.prototype.canProcess = function (message) { | ||
if (this.descriptor == null) | ||
@@ -120,3 +120,3 @@ return false; | ||
for (var processor in this.descriptor.processors) { | ||
if (accepts(this.descriptor.processors[processor], message)) | ||
if (canProcess(this.descriptor.processors[processor], message)) | ||
return true; | ||
@@ -127,3 +127,3 @@ } | ||
function accepts(descriptor, message) { | ||
function canProcess(descriptor, message) { | ||
for (var name in descriptor) { | ||
@@ -138,3 +138,3 @@ if (name == 'processors') | ||
for (var processor in descriptor.processors) { | ||
if (accepts(descriptor.processors[processor], message)) | ||
if (canProcess(descriptor.processors[processor], message)) | ||
return true; | ||
@@ -217,3 +217,3 @@ } | ||
for (var remote in this.remotes) { | ||
if (this.remotes[remote].accepts(message)) { | ||
if (this.remotes[remote].canProcess(message)) { | ||
hosts.push(this.remotes[remote]); | ||
@@ -220,0 +220,0 @@ } |
{ "name": "ajfabriq" | ||
, "description": "Distributed applications using messages" | ||
, "keywords": [ "distributed", "nodejs", "javascript" ] | ||
, "version": "0.0.1-alfa" | ||
, "version": "0.0.1" | ||
, "author": "Angel 'Java' Lopez <webmaster@ajlopez.com> (http://www.ajlopez.com)" | ||
@@ -10,2 +10,3 @@ , "repository": { "type": "git", "url": "git://github.com/ajlopez/AjFabriqNode.git" } | ||
, "scripts": { | ||
"test": "nodeunit test" | ||
} | ||
@@ -15,3 +16,4 @@ , "dependencies": { | ||
, "devDependencies": { | ||
"nodeunit": ">= 0.7.4" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
13075
9
0
315
63
1