[jboss-dev-forums] [Design of POJO Server] - Re: Depends on microcontainer bean in -service.xml

alesj do-not-reply at jboss.com
Fri Mar 23 04:41:26 EDT 2007


"scott.stark at jboss.org" wrote : That should just work. 
Yup, it's all there:

ServiceMetaDataParser:

  | else if (element.getTagName().equals("depends"))
  |          {
  |             String mbeanRefName = element.getAttribute("optional-attribute-name");
  |             if ("".equals(mbeanRefName))
  |                mbeanRefName = null;
  |             else
  |                mbeanRefName = StringPropertyReplacer.replaceProperties(mbeanRefName);
  | 
  |             String proxyType = element.getAttribute("proxy-type");
  |             if ("".equals(proxyType))
  |                proxyType = null;
  |             else
  |                proxyType = StringPropertyReplacer.replaceProperties(proxyType);
  | 
  |             // Get the mbeanRef value
  |             String dependsObjectName = processDependency(mbeanName, mbeanRefName, element, services, replace);
  | 
  |             if (mbeanRefName != null)
  |             {
  |                ServiceValueMetaData value = new ServiceDependencyValueMetaData(dependsObjectName, proxyType);
  |                ServiceAttributeMetaData attribute = new ServiceAttributeMetaData();
  |                attribute.setName(mbeanRefName);
  |                attribute.setValue(value);
  |                attributes.add(attribute);
  |             }
  |             else
  |             {
  |                ServiceDependencyMetaData dependency = new ServiceDependencyMetaData();
  |                dependency.setIDependOn(dependsObjectName);
  |                dependencies.add(dependency);
  |             }
  |          }
  |          else if (element.getTagName().equals("depends-list"))
  |          {
  |             String dependsListName = element.getAttribute("optional-attribute-name");
  |             if ("".equals(dependsListName))
  |                dependsListName = null;
  | 
  |             NodeList dependsList = element.getChildNodes();
  |             ArrayList<String> dependsListNames = new ArrayList<String>();
  |             for (int l = 0; l < dependsList.getLength(); ++l)
  |             {
  |                if (dependsList.item(l).getNodeType() != Node.ELEMENT_NODE)
  |                   continue;
  | 
  |                Element dependsElement = (Element) dependsList.item(l);
  |                if (dependsElement.getTagName().equals("depends-list-element"))
  |                {
  |                   // Get the depends value
  |                   String dependsObjectName = processDependency(mbeanName, dependsListName, dependsElement, services, replace);
  |                   if (dependsListNames.contains(dependsObjectName) == false)
  |                      dependsListNames.add(dependsObjectName);
  | 
  |                   if (dependsListName == null)
  |                   {
  |                      ServiceDependencyMetaData dependency = new ServiceDependencyMetaData();
  |                      dependency.setIDependOn(dependsObjectName);
  |                      dependencies.add(dependency);
  |                   }
  |                }
  |             }

ServiceDependencyMetaData:

  |    public void visit(ServiceMetaDataVisitor visitor)
  |    {
  |       ServiceControllerContext context = visitor.getControllerContext();
  |       Object name = context.getName();
  |       Object other = iDependOn;
  |       try
  |       {
  |          other = getIDependOnObjectName().getCanonicalName();
  |       }
  |       catch (MalformedObjectNameException ignored)
  |       {
  |       }
  |       visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.CREATE));
  |       visitor.addDependency(new LifecycleDependencyItem(name, other, ControllerState.START));
  |       visitor.visit(this);
  |    }
  | 

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

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



More information about the jboss-dev-forums mailing list