hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject cvs commit: jakarta-hivemind/framework/src/java/org/apache/hivemind/ant ConstructRegistry.java RegistrySerializer.java
Date Thu, 14 Oct 2004 15:37:18 GMT
knut        2004/10/14 08:37:18

  Modified:    framework/src/java/org/apache/hivemind/ant
                        ConstructRegistry.java RegistrySerializer.java
  Log:
  - added missing serialization for DependencyDescriptor and SubModuleDescriptor
  
  Revision  Changes    Path
  1.16      +0 -13     jakarta-hivemind/framework/src/java/org/apache/hivemind/ant/ConstructRegistry.java
  
  Index: ConstructRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/ant/ConstructRegistry.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ConstructRegistry.java	14 Oct 2004 14:31:34 -0000	1.15
  +++ ConstructRegistry.java	14 Oct 2004 15:37:18 -0000	1.16
  @@ -23,10 +23,6 @@
   import java.util.ArrayList;
   import java.util.List;
   
  -import javax.xml.parsers.DocumentBuilder;
  -import javax.xml.parsers.DocumentBuilderFactory;
  -import javax.xml.parsers.ParserConfigurationException;
  -
   import org.apache.hivemind.Resource;
   import org.apache.hivemind.impl.DefaultClassResolver;
   import org.apache.hivemind.impl.ModuleDescriptorProvider;
  @@ -111,15 +107,6 @@
               writeDocument(registry, _output);
           }
   
  -    }
  -
  -    private DocumentBuilder getBuilder() throws ParserConfigurationException
  -    {
  -        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  -
  -        factory.setIgnoringComments(true);
  -
  -        return factory.newDocumentBuilder();
       }
   
       private Document constructRegistry(File[] moduleDescriptors) throws BuildException
  
  
  
  1.2       +59 -0     jakarta-hivemind/framework/src/java/org/apache/hivemind/ant/RegistrySerializer.java
  
  Index: RegistrySerializer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/ant/RegistrySerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RegistrySerializer.java	14 Oct 2004 14:31:34 -0000	1.1
  +++ RegistrySerializer.java	14 Oct 2004 15:37:18 -0000	1.2
  @@ -41,12 +41,14 @@
   import org.apache.hivemind.parse.ContributionDescriptor;
   import org.apache.hivemind.parse.ConversionDescriptor;
   import org.apache.hivemind.parse.CreateInstanceDescriptor;
  +import org.apache.hivemind.parse.DependencyDescriptor;
   import org.apache.hivemind.parse.ImplementationDescriptor;
   import org.apache.hivemind.parse.InstanceBuilder;
   import org.apache.hivemind.parse.InterceptorDescriptor;
   import org.apache.hivemind.parse.InvokeFactoryDescriptor;
   import org.apache.hivemind.parse.ModuleDescriptor;
   import org.apache.hivemind.parse.ServicePointDescriptor;
  +import org.apache.hivemind.parse.SubModuleDescriptor;
   import org.apache.hivemind.schema.AttributeModel;
   import org.apache.hivemind.schema.ElementModel;
   import org.apache.hivemind.schema.Rule;
  @@ -156,6 +158,8 @@
   
           module.appendChild(_document.createTextNode(md.getAnnotation()));
   
  +        addDependencies(module);
  +
           addServicePoints(module);
   
           addConfigurationPoints(module);
  @@ -166,9 +170,28 @@
   
           addSchemas(module);
   
  +        addSubModules(module);
  +
           return module;
       }
   
  +    private void addDependencies(Element module)
  +    {
  +        List dependencies = _md.getDependencies();
  +
  +        if (dependencies != null)
  +        {
  +            for (Iterator i = dependencies.iterator(); i.hasNext();)
  +            {
  +                DependencyDescriptor dd = (DependencyDescriptor) i.next();
  +
  +                Element dependency = getDependencyElement(dd);
  +
  +                module.appendChild(dependency);
  +            }
  +        }
  +    }
  +
       private void addServicePoints(Element module)
       {
           List servicePoints = _md.getServicePoints();
  @@ -260,6 +283,33 @@
           }
       }
   
  +    private void addSubModules(Element module)
  +    {
  +        List subModules = _md.getSubModules();
  +
  +        if (subModules != null)
  +        {
  +            for (Iterator i = subModules.iterator(); i.hasNext();)
  +            {
  +                SubModuleDescriptor smd = (SubModuleDescriptor) i.next();
  +
  +                Element subModule = getSubModuleElement(smd);
  +
  +                module.appendChild(subModule);
  +            }
  +        }
  +    }
  +
  +    private Element getDependencyElement(DependencyDescriptor dd)
  +    {
  +        Element dependency = _document.createElement("dependency");
  +
  +        dependency.setAttribute("module-id", dd.getModuleId());
  +        dependency.setAttribute("version", dd.getVersion());
  +
  +        return dependency;
  +    }
  +
       private Element getServicePointElement(ServicePointDescriptor spd)
       {
           Element servicePoint = _document.createElement("service-point");
  @@ -398,6 +448,15 @@
           }
   
           return implementation;
  +    }
  +
  +    private Element getSubModuleElement(SubModuleDescriptor smd)
  +    {
  +        Element subModule = _document.createElement("sub-module");
  +
  +        subModule.setAttribute("descriptor", smd.getDescriptor().getPath());
  +
  +        return subModule;
       }
   
       private Element getInstanceBuilderElement(InstanceBuilder ib)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org


Mime
View raw message