Date: 2004-06-30T13:05:05
   Editor: 162.93.14.73 <>
   Wiki: Jakarta HiveMind Wiki
   Page: FeatureRequest
   URL: http://wiki.apache.org/jakarta-hivemind/FeatureRequest

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -90,3 +90,43 @@
 {{{
 ThreadLocalStorage tls = (ThreadLocalStorage) 
r.getService("hivemind.ThreadLocalStorage", ThreadLocalStorage.class);
 }}}
+
+Which is an often copied piece of code. Why not, given a slightly different 
module definition
+
+{{{
+module (id=org.apache.hivemind version="1.0.0")
+{
+  service-point (id=service.ThreadLocalStorage 
interface=org.apache.hivemind.service.ThreadLocalStorage)
+  {
+  }
+}
+}}}
+
+then support a simplified lookup for services whose intent is to only have a 
single implementation
+
+{{{
+ThreadLocalStorage tls = (ThreadLocalStorage) 
r.getService(ThreadLocalStorage.class);
+}}}
+
+The internals of the above lookup could look like
+
+{{{
+public Object getService(Class serviceClass) {
+  return getService(serviceClass.getName(), serviceClass);
+}
+}}}
+
+This would prevent the proliferation of constants interfaces whose only 
existence is to provide a string value that is as unique as the service 
interface class name.
+
+An example of such potential proliferation is the Hivemind class.
+
+{{{
+public final class HiveMind
+{
+    /**
+     * The full id of the [EMAIL PROTECTED] 
org.apache.hivemind.service.ThreadEventNotifier}
+     * service.
+     */
+    public static final String THREAD_EVENT_NOTIFIER_SERVICE = 
"hivemind.ThreadEventNotifier";
+}
+}}}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to