2 Replies Latest reply on Jul 29, 2005 12:22 PM by Adrian Brock

    what is supply/demand?

    Bill Burke Master

      Are they aliased dependencies?

      Thanks

        • 1. Re: what is supply/demand?
          Adrian Brock Master

          The intention of supply/demand is to provide a dependency on something
          that is "not known" to the MC. I have not done any extensive testing on this
          feature yet (other than the proof of concept classloading dependency tests).

          It works with the KernelRegistryPlugin to see whether the thing exists.

          You could for example register a POJO that implements KernelRegistryPlugin
          to do lookups on JNDI to see whether the binding exists.

          public JNDIRegistryPlugin implements KernelRegistryPlugin
          {
           public KernelRegistryEntry getEntry(Object name)
           {
           try
           {
           Object o = context.lookup((String) name);
           return createRegistryEntry(name, o);
           }
           catch (NameNotFoundException e)
           {
           return null;
           }
           }
          }
          


          Then use it in a demands
          <bean ...>
           <demands>jnp://remotehost:1099/something</demands>
          </bean>
          


          The supplies is so you can have abitrary dependency names without
          having to create a registry plugin...
          <bean ...>
           <demands>LogicalName</demands>
          </bean>
          <bean ...>
           <supplies>LogicalName</supplies>
          </bean>
          


          • 2. Re: what is supply/demand?
            Adrian Brock Master

            I think they could be used as aliases, but I haven't tried it to see whether this works,
            I don't see why it shouldn't...

            <bean ...>
             <property name="Something"><inject bean="LogicalName"/></property>
            </bean>
            <bean ...>
             <supplies>LogicalName</supplies>
            </bean>