summaryrefslogtreecommitdiff
path: root/cs/src/Ice/ObjectFactoryManager.cs
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-01-29 03:05:56 +0000
committerMichi Henning <michi@zeroc.com>2004-01-29 03:05:56 +0000
commit7161952dadb673138229cf61e684fe73cd5a9bca (patch)
treea1566729f1b807814b65c662e621127d8f44b896 /cs/src/Ice/ObjectFactoryManager.cs
parentfix (diff)
downloadice-7161952dadb673138229cf61e684fe73cd5a9bca.tar.bz2
ice-7161952dadb673138229cf61e684fe73cd5a9bca.tar.xz
ice-7161952dadb673138229cf61e684fe73cd5a9bca.zip
*** empty log message ***
Diffstat (limited to 'cs/src/Ice/ObjectFactoryManager.cs')
-rwxr-xr-xcs/src/Ice/ObjectFactoryManager.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/cs/src/Ice/ObjectFactoryManager.cs b/cs/src/Ice/ObjectFactoryManager.cs
new file mode 100755
index 00000000000..26f057c37dc
--- /dev/null
+++ b/cs/src/Ice/ObjectFactoryManager.cs
@@ -0,0 +1,85 @@
+// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+namespace IceInternal
+{
+
+using System.Collections;
+
+public sealed class ObjectFactoryManager
+{
+ public void
+ add(Ice.ObjectFactory factory, string id)
+ {
+ lock(this)
+ {
+ object o = _factoryMap[id];
+ if(o != null)
+ {
+ Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException();
+ ex.id = id;
+ ex.kindOfObject = "user exception factory";
+ throw ex;
+ }
+ _factoryMap[id] = factory;
+ }
+ }
+
+ public void
+ remove(string id)
+ {
+ lock(this)
+ {
+ object o = _factoryMap[id];
+ if(o == null)
+ {
+ Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
+ ex.id = id;
+ ex.kindOfObject = "user exception factory";
+ throw ex;
+ }
+ _factoryMap.Remove(id);
+ }
+ }
+
+ public Ice.ObjectFactory
+ find(string id)
+ {
+ lock(this)
+ {
+ return (Ice.ObjectFactory)_factoryMap[id];
+ }
+ }
+
+ //
+ // Only for use by Instance
+ //
+ internal ObjectFactoryManager()
+ {
+ _factoryMap = new Hashtable();
+ }
+
+ internal void destroy()
+ {
+ foreach(Ice.ObjectFactory factory in _factoryMap.Values)
+ {
+ factory.destroy();
+ }
+ _factoryMap.Clear();
+ }
+
+ private Hashtable _factoryMap;
+}
+
+}