Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jjjrmi

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jjjrmi - npm Package Compare versions

Comparing version 0.4.10 to 0.4.17

6

package.json
{
"name": "jjjrmi",
"version": "0.4.10",
"version": "0.4.17",
"keywords": [

@@ -13,3 +13,5 @@ "util",

"contributors": [],
"dependencies": {},
"dependencies": {
"jjjserver": "^0.4.17"
},
"main": "./src/JJJRMISocket.js",

@@ -16,0 +18,0 @@ "files": [

/* global Constants */
let Constants = require("./Constants");
class EncoderInterfaceException extends Error{
constructor(object, method){
super(`Object of class '${object.constructor.name}' is missing method '${method}'`);
this.object = object;
}
getObject(){
return this.object;
}
}
class Encoder {

@@ -11,9 +22,9 @@ constructor(object, translator, keys) {

if (typeof object.constructor.__isTransient !== "function") {
throw new Error(`Class "${object.constructor.name}" missing method "__isTransient".`);
EncoderInterfaceException(object, "__isTransient");
}
if (typeof object.constructor.__isEnum !== "function") {
throw new Error(`Class "${object.constructor.name}" missing method "__isEnum".`);
EncoderInterfaceException(object, "__isEnum");
}
if (typeof object.constructor.__getClass !== "function") {
throw new Error(`Class "${object.constructor.name}" missing method "__getClass".`);
EncoderInterfaceException(object, "__getClass");
}

@@ -47,8 +58,17 @@ }

}
/* The object's class is expected to be generated from java at this point */
if (typeof this.object.constructor.__isEnum !== "function"){
throw new EncoderInterfaceException(this.object, "__isEnum");
}
if (typeof this.object.constructor.__getClass !== "function"){
throw new EncoderInterfaceException(this.object, "__getClass");
}
if (typeof this.object.constructor.__isTransient !== "function"){
throw new EncoderInterfaceException(this.object, "__isTransient");
}
/* is Enum */
else if (this.object.constructor.__isEnum()) {
return new EncodedEnum(this.object, this.translator, this.keys).toJSON();
}
/* handler has been registered */
else if (this.translator.hasHandler(this.object.constructor)) {
if (this.translator.hasHandler(this.object.constructor)) {
let handler = this.translator.getHandler(this.object.constructor);

@@ -64,3 +84,6 @@ let encodedObject = new EncodedObject(this.object, this.translator, this.keys);

return encodedObject.toJSON();
}
}
else if (this.object.constructor.__isEnum()) {
return new EncodedEnum(this.object, this.translator, this.keys).toJSON();
}
/* encode object */

@@ -174,2 +197,8 @@ else {

/**
* Add a key-value pair to the json object.
* @param {type} name
* @param {type} value
* @returns {undefined}
*/
setField(name, value) {

@@ -176,0 +205,0 @@ let encodedValue = new Encoder(value, this.translator, this.keys).encode();

let Translator = require("./Translator");
let jjjrmi = require("./gen/package");
let jjjserver = require("jjjserver");
let ArrayList = require("./java-equiv/ArrayList");

@@ -88,3 +88,3 @@ let HashMap = require("./java-equiv/HashMap");

};
let packet = new jjjrmi.MethodRequest(uid, ptr, methodName, argsArray);
let packet = new jjjserver.MethodRequest(uid, ptr, methodName, argsArray);
let encodedPacket = this.translator.encode(packet);

@@ -116,3 +116,3 @@ if (this.flags.SENT) console.log(encodedPacket);

switch (rmiMessage.type) {
case jjjrmi.JJJMessageType.FORGET:{
case jjjserver.JJJMessageType.FORGET:{
if (this.flags.ONMESSAGE) console.log(this.jjjSocketName + " FORGET");

@@ -122,3 +122,3 @@ this.translator.removeByKey(rmiMessage.key);

}
case jjjrmi.JJJMessageType.READY:{
case jjjserver.JJJMessageType.READY:{
if (this.flags.CONNECT || this.flags.ONMESSAGE) console.log(this.jjjSocketName + " READY");

@@ -129,3 +129,3 @@ this.onready(rmiMessage.getRoot());

/* client originated request */
case jjjrmi.JJJMessageType.LOCAL:{
case jjjserver.JJJMessageType.LOCAL:{
if (this.flags.ONMESSAGE) console.log(`Response to client side request: ${this.jjjSocketName} ${rmiMessage.methodName}`);

@@ -138,3 +138,3 @@ let callback = this.callback[rmiMessage.uid];

/* server originated request */
case jjjrmi.JJJMessageType.REMOTE:{
case jjjserver.JJJMessageType.REMOTE:{
if (this.flags.ONMESSAGE) console.log(`Server side originated request: ${this.jjjSocketName} ${rmiMessage.methodName}`);

@@ -152,3 +152,3 @@ let target = this.translator.getReferredObject(rmiMessage.ptr);

}
case jjjrmi.JJJMessageType.EXCEPTION:{
case jjjserver.JJJMessageType.EXCEPTION:{
if (!this.flags.SILENT) console.log(this.jjjSocketName + " EXCEPTION " + rmiMessage.methodName);

@@ -161,3 +161,3 @@ if (!this.flags.SILENT) console.warn(rmiMessage);

}
case jjjrmi.JJJMessageType.REJECTED_CONNECTION:{
case jjjserver.JJJMessageType.REJECTED_CONNECTION:{
if (this.flags.CONNECT || this.flags.ONMESSAGE) console.log(this.jjjSocketName + " REJECTED_CONNECTION");

@@ -228,3 +228,3 @@ this.onreject();

/* register the classes required for JJJRMISocket */
JJJRMISocket.registerPackage(jjjrmi);
JJJRMISocket.registerPackage(jjjserver);
JJJRMISocket.registerClass(ArrayList);

@@ -231,0 +231,0 @@ JJJRMISocket.registerClass(HashMap);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc