summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/src/Ice/BasicStream.js4
-rw-r--r--js/src/Ice/Ice.js1
-rw-r--r--js/src/Ice/ValueFactory.js17
-rw-r--r--js/src/Ice/ValueFactoryManager.js7
-rw-r--r--js/src/Ice/sources.json1
-rw-r--r--js/test/Ice/exceptions/Client.js14
-rw-r--r--js/test/Ice/objects/Client.js34
-rw-r--r--js/test/Ice/slicing/objects/Client.js15
8 files changed, 31 insertions, 62 deletions
diff --git a/js/src/Ice/BasicStream.js b/js/src/Ice/BasicStream.js
index 43dbc355fd7..ea08694585c 100644
--- a/js/src/Ice/BasicStream.js
+++ b/js/src/Ice/BasicStream.js
@@ -116,7 +116,7 @@ var EncapsDecoder = Class({
if(userFactory !== undefined)
{
- v = userFactory.create(typeId);
+ v = userFactory(typeId);
}
//
@@ -128,7 +128,7 @@ var EncapsDecoder = Class({
userFactory = this._servantFactoryManager.find("");
if(userFactory !== undefined)
{
- v = userFactory.create(typeId);
+ v = userFactory(typeId);
}
}
diff --git a/js/src/Ice/Ice.js b/js/src/Ice/Ice.js
index 1ef8c2bd5cc..31248e043eb 100644
--- a/js/src/Ice/Ice.js
+++ b/js/src/Ice/Ice.js
@@ -35,7 +35,6 @@ module.exports.Ice = __M.require(module,
"../Ice/Router",
"../Ice/Version",
"../Ice/ObjectFactory",
- "../Ice/ValueFactory",
"../Ice/Buffer",
"../Ice/ArrayUtil",
"../Ice/UnknownSlicedObject",
diff --git a/js/src/Ice/ValueFactory.js b/js/src/Ice/ValueFactory.js
deleted file mode 100644
index ebea4cbfd40..00000000000
--- a/js/src/Ice/ValueFactory.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-var Ice = require("../Ice/Class").Ice;
-Ice.ValueFactory = Ice.Class({
- create: function(type)
- {
- throw new Error("not implemented");
- }
-});
-module.exports.Ice = Ice;
diff --git a/js/src/Ice/ValueFactoryManager.js b/js/src/Ice/ValueFactoryManager.js
index 55efddf9fea..20333b8bd66 100644
--- a/js/src/Ice/ValueFactoryManager.js
+++ b/js/src/Ice/ValueFactoryManager.js
@@ -47,7 +47,12 @@ var ValueFactoryManager = Ice.Class({
ex.kindOfObject = "value factory";
throw ex;
}
- this._factoryMap.set(id, factory);
+ this._factoryMap.set(id,
+ function(s)
+ {
+ return factory.create(s);
+ }
+ );
this._objectFactoryMap.set(id, factory);
},
find: function(id)
diff --git a/js/src/Ice/sources.json b/js/src/Ice/sources.json
index cb3387ea16d..e97f75ae638 100644
--- a/js/src/Ice/sources.json
+++ b/js/src/Ice/sources.json
@@ -98,7 +98,6 @@
"TraceUtil.js",
"UnknownSlicedObject.js",
"UUID.js",
- "ValueFactory.js",
"ValueFactoryManager.js",
"WSEndpoint.js",
"WSEndpointFactory.js"],
diff --git a/js/test/Ice/exceptions/Client.js b/js/test/Ice/exceptions/Client.js
index 53cad9d2f27..bd66d33c90f 100644
--- a/js/test/Ice/exceptions/Client.js
+++ b/js/test/Ice/exceptions/Client.js
@@ -40,14 +40,10 @@
{
};
- var ValueFactoryI = function()
- {
- };
-
- ValueFactoryI.prototype.create = function(type)
+ function ValueFactoryI()
{
return null;
- };
+ }
var p = new Ice.Promise();
var test = function(b)
@@ -232,11 +228,11 @@
function()
{
out.write("testing value factory registration exception... ");
- var vf = new ValueFactoryI();
- communicator.addValueFactory(vf, "::x");
+
+ communicator.addValueFactory(ValueFactoryI, "::x");
try
{
- communicator.addValueFactory(vf, "::x");
+ communicator.addValueFactory(ValueFactoryI, "::x");
test(false);
}
catch(ex)
diff --git a/js/test/Ice/objects/Client.js b/js/test/Ice/objects/Client.js
index db27ce73e71..f105d612ec4 100644
--- a/js/test/Ice/objects/Client.js
+++ b/js/test/Ice/objects/Client.js
@@ -136,16 +136,7 @@
JI.prototype = new Test.J();
JI.prototype.constructor = JI;
- var MyValueFactory = function()
- {
- Ice.ValueFactory.call(this);
- };
-
- MyValueFactory.prototype = new Ice.ValueFactory();
-
- MyValueFactory.prototype.constructor = MyValueFactory;
-
- MyValueFactory.prototype.create = function(type)
+ function MyValueFactory(type)
{
switch(type)
{
@@ -173,7 +164,7 @@
break;
}
return null;
- };
+ }
var MyObjectFactory = function()
{
@@ -217,17 +208,16 @@
Promise.try(
function()
{
- var factory = new MyValueFactory();
- communicator.addValueFactory(factory, "::Test::B");
- communicator.addValueFactory(factory, "::Test::C");
- communicator.addValueFactory(factory, "::Test::D");
- communicator.addValueFactory(factory, "::Test::E");
- communicator.addValueFactory(factory, "::Test::F");
- communicator.addValueFactory(factory, "::Test::I");
- communicator.addValueFactory(factory, "::Test::J");
- communicator.addValueFactory(factory, "::Test::H");
- communicator.addValueFactory(factory, "::Test::Inner::A");
- communicator.addValueFactory(factory, "::Test::Inner::Sub::A");
+ communicator.addValueFactory(MyValueFactory, "::Test::B");
+ communicator.addValueFactory(MyValueFactory, "::Test::C");
+ communicator.addValueFactory(MyValueFactory, "::Test::D");
+ communicator.addValueFactory(MyValueFactory, "::Test::E");
+ communicator.addValueFactory(MyValueFactory, "::Test::F");
+ communicator.addValueFactory(MyValueFactory, "::Test::I");
+ communicator.addValueFactory(MyValueFactory, "::Test::J");
+ communicator.addValueFactory(MyValueFactory, "::Test::H");
+ communicator.addValueFactory(MyValueFactory, "::Test::Inner::A");
+ communicator.addValueFactory(MyValueFactory, "::Test::Inner::Sub::A");
communicator.addObjectFactory(new MyObjectFactory(), "TestOF");
diff --git a/js/test/Ice/slicing/objects/Client.js b/js/test/Ice/slicing/objects/Client.js
index 7c9dae3b081..26b1ce5affd 100644
--- a/js/test/Ice/slicing/objects/Client.js
+++ b/js/test/Ice/slicing/objects/Client.js
@@ -24,17 +24,14 @@
}
});
- var PreservedFactoryI = Ice.Class(Ice.ValueFactory,
+ function PreservedFactoryI(id)
{
- create: function(id)
+ if(id === Test.Preserved.ice_staticId())
{
- if(id === Test.Preserved.ice_staticId())
- {
- return new PreservedI();
- }
- return null;
+ return new PreservedI();
}
- });
+ return null;
+ }
var p = new Promise();
var test = function(b)
@@ -679,7 +676,7 @@
// the Ice run time will install its own internal factory for Preserved upon receiving the
// first instance.
//
- communicator.addValueFactory(new PreservedFactoryI(), Test.Preserved.ice_staticId());
+ communicator.addValueFactory(PreservedFactoryI, Test.Preserved.ice_staticId());
//
// Server knows the most-derived class PDerived.