diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/DefaultFlowRegistry.java b/spring-webflow/src/main/java/org/springframework/webflow/config/DefaultFlowRegistry.java new file mode 100644 index 00000000..83bc4c73 --- /dev/null +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/DefaultFlowRegistry.java @@ -0,0 +1,43 @@ +/* + * Copyright 2004-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.webflow.config; + +import org.springframework.webflow.definition.registry.FlowDefinitionRegistry; +import org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl; +import org.springframework.webflow.engine.model.registry.FlowModelRegistry; +import org.springframework.webflow.engine.model.registry.FlowModelRegistryImpl; + +/** + * Flow registry implementation created by FlowRegistryFactoryBean. + * @author Keith Donald + */ +class DefaultFlowRegistry extends FlowDefinitionRegistryImpl { + + private FlowModelRegistry flowModelRegistry = new FlowModelRegistryImpl(); + + public FlowModelRegistry getFlowModelRegistry() { + return flowModelRegistry; + } + + public void setParent(FlowDefinitionRegistry parent) { + super.setParent(parent); + if (parent instanceof DefaultFlowRegistry) { + DefaultFlowRegistry parentFlowRegistry = (DefaultFlowRegistry) parent; + // link so a flow in the child registry that extends from a flow in the parent registry can find its parent + flowModelRegistry.setParent(parentFlowRegistry.getFlowModelRegistry()); + } + } +} \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryFactoryBean.java index 3d12ddc6..78364521 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryFactoryBean.java @@ -32,7 +32,6 @@ import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.definition.registry.FlowDefinitionConstructionException; import org.springframework.webflow.definition.registry.FlowDefinitionHolder; import org.springframework.webflow.definition.registry.FlowDefinitionRegistry; -import org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl; import org.springframework.webflow.engine.builder.DefaultFlowHolder; import org.springframework.webflow.engine.builder.FlowAssembler; import org.springframework.webflow.engine.builder.FlowBuilder; @@ -44,8 +43,6 @@ import org.springframework.webflow.engine.model.builder.DefaultFlowModelHolder; import org.springframework.webflow.engine.model.builder.FlowModelBuilder; import org.springframework.webflow.engine.model.builder.xml.XmlFlowModelBuilder; import org.springframework.webflow.engine.model.registry.FlowModelHolder; -import org.springframework.webflow.engine.model.registry.FlowModelRegistry; -import org.springframework.webflow.engine.model.registry.FlowModelRegistryImpl; /** * A factory for a flow definition registry. Is a Spring FactoryBean, for provision by the flow definition registry bean @@ -231,6 +228,8 @@ class FlowRegistryFactoryBean implements FactoryBean, BeanClassLoaderAware, Init private FlowModelHolder createFlowModelHolder(FlowDefinitionResource resource) { FlowModelHolder modelHolder = new DefaultFlowModelHolder(createFlowModelBuilder(resource)); + // register the flow model holder with the backing flow model registry - this is needed to support flow model + // merging during the flow build process flowRegistry.getFlowModelRegistry().registerFlowModel(resource.getId(), modelHolder); return modelHolder; } @@ -294,20 +293,4 @@ class FlowRegistryFactoryBean implements FactoryBean, BeanClassLoaderAware, Init } } - public static class DefaultFlowRegistry extends FlowDefinitionRegistryImpl { - private FlowModelRegistry flowModelRegistry = new FlowModelRegistryImpl(); - - public FlowModelRegistry getFlowModelRegistry() { - return flowModelRegistry; - } - - public void setParent(FlowDefinitionRegistry parent) { - super.setParent(parent); - if (parent instanceof DefaultFlowRegistry) { - DefaultFlowRegistry parentFlowRegistry = (DefaultFlowRegistry) parent; - flowModelRegistry.setParent(parentFlowRegistry.getFlowModelRegistry()); - } - } - } - } \ No newline at end of file