You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Richard Emberson <re...@edgedynamics.com> on 2003/06/20 01:02:30 UTC

Domain.java and Namespace.java

I've been trying to generate an XML Schema definition for the
Domain.xml file. So, I've been looking through the Slide code
and I've reach a point of non-understanding.
Domain.java has the following code:

     Namespace namespace = new Namespace();
     namespace.setName(configuration.getAttribute("name"));
     namespace.setLogger(namespaceLogger);

     Configuration namespaceConfigurationDefinition =
         configuration.getConfiguration("configuration");
     namespace.loadParameters(namespaceConfigurationDefinition);

     Configuration namespaceDefinition =
         configuration.getConfiguration("definition");
     namespace.loadDefinition(namespaceDefinition);
     addNamespace(namespace);
     try {
         Configuration namespaceBaseDataDefinition =
             configuration.getConfiguration("data");
         namespace.loadBaseData(namespaceBaseDataDefinition);
     } catch (ConfigurationException e) {
         info("No basedata found for the namespace");
     }

     namespace.loadConfiguration(namespaceConfigurationDefinition);

Note that this creates a Namespace object, namespace, and then calls
the Namespace instance methods loadParameters(...) and
loadConfiguration(..) (calling loadDefinition(...) and loadBaseData(...)
in between).

Now the Namespace code for those two methods are:

void loadConfiguration(Configuration namespaceConfigurationDefinition)
     throws SlideException {

     getLogger().log("Loading namespace " + getName() + "
         configuration",LOG_CHANNEL,Logger.INFO);

     // Load Namespace Config
     config = new NamespaceConfig();
     config.initializeNamespaceConfig(this,
                                      namespaceConfigurationDefinition);
}
void loadParameters(Configuration namespaceConfigurationDefinition)
     throws SlideException {

     getLogger().log("Loading namespace " + getName() + "
         parameters",LOG_CHANNEL,Logger.INFO);

     // Load Namespace Config
     config = new NamespaceConfig();
     config.initializeNamespaceParameters(this,
                                          namespaceConfigurationDefinition);
}

Note that both Namespace methods instantiate the Namespace instance
variable 'config'; Thus the 'config' instance variable created in the
call to the loadParameters() method is overridden by the creation
in the loadConfiguration() method.

So, my question is: Whats up? Why create a NamespaceConfig object
only to drop it and create a second.

Thanks.

Richard


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