[jboss-dev-forums] [Design of POJO Server] - JBAS-6297, mbean service optional injection

scott.stark@jboss.org do-not-reply at jboss.com
Mon Dec 8 22:22:46 EST 2008


I'm not understanding the current mc optional dependency implementation. I expected that I could simply leverage an optional notion from AbstractDependencyItem to update the ServiceInjectionValueMetaData.visit method to create an optional dependency like:


  |    public void visit(ServiceMetaDataVisitor visitor)
  |    {
  |       ServiceControllerContext context = visitor.getControllerContext();
  |       Object name = context.getName();
  |       ControllerState whenRequired = visitor.getContextState();
  | 
  |       boolean optional = isOptional();
  |       DependencyItem item = new AbstractDependencyItem(name, dependency, whenRequired, dependentState, optional);
  |       visitor.addDependency(item);
  | 
  |       visitor.visit(this);
  |    }
  | 

But optionality does not exist in AbstractDependencyItem. It only exists in a protected OptionalDependencyItem which is an inner class of the AbstractDependencyValueMetaData class. Why isn't this a general DependencyItem notion?

I guess I'll look at updating the ServiceInjectionValueMetaData.getValue to return null and see what additional changes are needed to deal with that.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4195198#4195198

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4195198



More information about the jboss-dev-forums mailing list