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/impl RegistryInfrastructureConstructor.java
Date Wed, 17 Nov 2004 11:30:05 GMT
knut        2004/11/17 03:30:04

  Modified:    framework/src/java/org/apache/hivemind/ant
                        RegistrySerializer.java
               framework/src/java/org/apache/hivemind/parse
                        DescriptorParser.java
               framework/src/java/org/apache/hivemind/impl
                        RegistryInfrastructureConstructor.java
  Log:
  reusing IdUtils.qualify(String, String)
  
  Revision  Changes    Path
  1.6       +12 -18    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RegistrySerializer.java	16 Nov 2004 10:27:12 -0000	1.5
  +++ RegistrySerializer.java	17 Nov 2004 11:30:04 -0000	1.6
  @@ -60,6 +60,7 @@
   import org.apache.hivemind.schema.rules.SetModuleRule;
   import org.apache.hivemind.schema.rules.SetParentRule;
   import org.apache.hivemind.schema.rules.SetPropertyRule;
  +import org.apache.hivemind.util.IdUtils;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
  @@ -311,7 +312,7 @@
       {
           Element servicePoint = _document.createElement("service-point");
   
  -        servicePoint.setAttribute("id", getQualifiedId(spd.getId()));
  +        servicePoint.setAttribute("id", qualify(spd.getId()));
           servicePoint.setAttribute("interface", spd.getInterfaceClassName());
           if (spd.getVisibility() == Visibility.PRIVATE)
               servicePoint.setAttribute("visibility", "private");
  @@ -324,8 +325,7 @@
           if (spd.getParametersSchema() != null)
               addSchema(servicePoint, (SchemaImpl) spd.getParametersSchema(), "parameters-schema");
           else if (spd.getParametersSchemaId() != null)
  -            servicePoint.setAttribute("parameters-schema-id", getQualifiedId(spd
  -                    .getParametersSchemaId()));
  +            servicePoint.setAttribute("parameters-schema-id", qualify(spd.getParametersSchemaId()));
   
           servicePoint.setAttribute("uid", Integer.toString(_uid++));
   
  @@ -359,15 +359,14 @@
       {
           Element configurationPoint = _document.createElement("configuration-point");
   
  -        configurationPoint.setAttribute("id", getQualifiedId(cpd.getId()));
  +        configurationPoint.setAttribute("id", qualify(cpd.getId()));
           if (cpd.getVisibility() == Visibility.PRIVATE)
               configurationPoint.setAttribute("visibility", "private");
   
           if (cpd.getContributionsSchema() != null)
               addSchema(configurationPoint, (SchemaImpl) cpd.getContributionsSchema(), "schema");
           else if (cpd.getContributionsSchemaId() != null)
  -            configurationPoint.setAttribute("schema-id", getQualifiedId(cpd
  -                    .getContributionsSchemaId()));
  +            configurationPoint.setAttribute("schema-id", qualify(cpd.getContributionsSchemaId()));
   
           configurationPoint.setAttribute("uid", Integer.toString(_uid++));
   
  @@ -380,7 +379,7 @@
       {
           Element contribution = _document.createElement("contribution");
   
  -        contribution.setAttribute("configuration-id", getQualifiedId(cd.getConfigurationId()));
  +        contribution.setAttribute("configuration-id", qualify(cd.getConfigurationId()));
   
           contribution.setAttribute("uid", Integer.toString(_uid++));
   
  @@ -407,7 +406,7 @@
       {
           Element implementation = _document.createElement("implementation");
   
  -        implementation.setAttribute("service-id", getQualifiedId(id.getServiceId()));
  +        implementation.setAttribute("service-id", qualify(id.getServiceId()));
   
           implementation.setAttribute("uid", Integer.toString(_uid++));
   
  @@ -467,9 +466,7 @@
               instanceBuilder = _document.createElement("invoke-factory");
   
               if (!ifd.getFactoryServiceId().equals("hivemind.BuilderFactory"))
  -                instanceBuilder.setAttribute(
  -                        "service-id",
  -                        getQualifiedId(ifd.getFactoryServiceId()));
  +                instanceBuilder.setAttribute("service-id", qualify(ifd.getFactoryServiceId()));
               if (ifd.getServiceModel() != null)
                   instanceBuilder.setAttribute("model", ifd.getServiceModel());
   
  @@ -495,7 +492,7 @@
       {
           Element interceptor = _document.createElement("interceptor");
   
  -        interceptor.setAttribute("service-id", getQualifiedId(icd.getFactoryServiceId()));
  +        interceptor.setAttribute("service-id", qualify(icd.getFactoryServiceId()));
           if (icd.getBefore() != null)
               interceptor.setAttribute("before", icd.getBefore());
           if (icd.getAfter() != null)
  @@ -536,7 +533,7 @@
           Element schema = _document.createElement(elementName);
   
           if (s.getId() != null)
  -            schema.setAttribute("id", getQualifiedId(s.getId()));
  +            schema.setAttribute("id", qualify(s.getId()));
   
           if (((SchemaImpl) s).getVisibility() == Visibility.PRIVATE)
               schema.setAttribute("visibility", "private");
  @@ -719,12 +716,9 @@
           return attribute;
       }
   
  -    private String getQualifiedId(String id)
  +    private String qualify(String id)
       {
  -        if (id.indexOf('.') != -1)
  -            return id;
  -
  -        return _md.getModuleId() + '.' + id;
  +        return IdUtils.qualify(_md.getModuleId(), id);
       }
   
       private DocumentBuilder getBuilder()
  
  
  
  1.42      +2 -4      jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java
  
  Index: DescriptorParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- DescriptorParser.java	16 Nov 2004 10:27:10 -0000	1.41
  +++ DescriptorParser.java	17 Nov 2004 11:30:04 -0000	1.42
  @@ -47,6 +47,7 @@
   import org.apache.hivemind.schema.rules.SetModuleRule;
   import org.apache.hivemind.schema.rules.SetParentRule;
   import org.apache.hivemind.schema.rules.SetPropertyRule;
  +import org.apache.hivemind.util.IdUtils;
   import org.apache.oro.text.regex.MalformedPatternException;
   import org.apache.oro.text.regex.Pattern;
   import org.apache.oro.text.regex.Perl5Compiler;
  @@ -1351,10 +1352,7 @@
   
       private String qualify(String id)
       {
  -        if (id.indexOf('.') >= 0)
  -            return id;
  -
  -        return _moduleDescriptor.getModuleId() + "." + id;
  +        return IdUtils.qualify(_moduleDescriptor.getModuleId(), id);
       }
   
       /** @since 1.1 */
  
  
  
  1.6       +6 -17     jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureConstructor.java
  
  Index: RegistryInfrastructureConstructor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureConstructor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RegistryInfrastructureConstructor.java	16 Nov 2004 10:27:11 -0000	1.5
  +++ RegistryInfrastructureConstructor.java	17 Nov 2004 11:30:04 -0000	1.6
  @@ -212,7 +212,7 @@
               {
                   Schema schema = (Schema) schemas.next();
   
  -                _schemas.put(qualify(id, schema.getId()), schema);
  +                _schemas.put(IdUtils.qualify(id, schema.getId()), schema);
               }
   
           _modules.put(id, module);
  @@ -398,7 +398,7 @@
               ImplementationDescriptor impl = (ImplementationDescriptor) implementations.get(i);
   
               String pointId = impl.getServiceId();
  -            String qualifiedId = qualify(moduleId, pointId);
  +            String qualifiedId = IdUtils.qualify(moduleId, pointId);
   
               addImplementations(sourceModule, qualifiedId, impl);
           }
  @@ -418,7 +418,7 @@
               ContributionDescriptor cd = (ContributionDescriptor) contributions.get(i);
   
               String pointId = cd.getConfigurationId();
  -            String qualifiedId = qualify(moduleId, pointId);
  +            String qualifiedId = IdUtils.qualify(moduleId, pointId);
   
               ConfigurationPointImpl point = (ConfigurationPointImpl) _configurationPoints
                       .get(qualifiedId);
  @@ -443,17 +443,6 @@
           }
       }
   
  -    /**
  -     * Qualifies the artifact id with the module id, if necessary.
  -     */
  -    private static String qualify(String moduleId, String artifactId)
  -    {
  -        if (artifactId.indexOf('.') >= 0)
  -            return artifactId;
  -
  -        return moduleId + "." + artifactId;
  -    }
  -
       private void setParametersSchema(ServicePointDescriptor spd, ServicePointImpl point)
       {
           Schema schema = spd.getParametersSchema();
  @@ -463,7 +452,7 @@
           else if (spd.getParametersSchemaId() != null)
           {
               String moduleId = point.getModule().getModuleId();
  -            String schemaId = qualify(moduleId, spd.getParametersSchemaId());
  +            String schemaId = IdUtils.qualify(moduleId, spd.getParametersSchemaId());
   
               schema = getSchema(schemaId, point.getModule().getModuleId(), spd.getLocation());
   
  @@ -481,7 +470,7 @@
           else if (cpd.getContributionsSchemaId() != null)
           {
               String moduleId = point.getModule().getModuleId();
  -            String schemaId = qualify(moduleId, cpd.getContributionsSchemaId());
  +            String schemaId = IdUtils.qualify(moduleId, cpd.getContributionsSchemaId());
   
               schema = getSchema(schemaId, point.getModule().getModuleId(), cpd.getLocation());
   
  @@ -632,7 +621,7 @@
           // Allow the factory id to be unqualified, to refer to an interceptor factory
           // service from within the same module.
   
  -        sic.setFactoryServiceId(qualify(sourceModuleId, id.getFactoryServiceId()));
  +        sic.setFactoryServiceId(IdUtils.qualify(sourceModuleId, id.getFactoryServiceId()));
           sic.setLocation(id.getLocation());
   
           sic.setFollowingInterceptorIds(IdUtils.qualifyList(sourceModuleId, id.getBefore()));
  
  
  

---------------------------------------------------------------------
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