diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowBuilderInfo.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowBuilderInfo.java index 50370963..c073b509 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowBuilderInfo.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowBuilderInfo.java @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 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 java.util.Collections; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowBuilderServicesBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowBuilderServicesBeanDefinitionParser.java index 1dea37b7..7509910a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowBuilderServicesBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowBuilderServicesBeanDefinitionParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 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.beans.factory.config.BeanDefinitionHolder; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResource.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResource.java index 0cee41a7..077d4547 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResource.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResource.java @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 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.core.io.Resource; @@ -20,7 +35,13 @@ public class FlowDefinitionResource { private AttributeMap attributes; - FlowDefinitionResource(String flowId, Resource path, AttributeMap attributes) { + /** + * Creates a new flow definition resource + * @param flowId the flow id + * @param path the location of the resource + * @param attributes meta-attributes describing the flow resource + */ + public FlowDefinitionResource(String flowId, Resource path, AttributeMap attributes) { this.id = flowId; this.path = path; this.attributes = attributes; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResourceFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResourceFactory.java index 76494728..fb465c0b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResourceFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowDefinitionResourceFactory.java @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 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 java.io.File; @@ -12,26 +27,59 @@ import org.springframework.core.io.support.ResourcePatternResolver; import org.springframework.util.Assert; import org.springframework.webflow.core.collection.AttributeMap; +/** + * A factory for creating flow definition resources that serve as pointers to external Flow definition files. + * + * @author Keith Donald + */ public class FlowDefinitionResourceFactory { + private ResourceLoader resourceLoader; + /** + * Creates a new flow definition resource factory using a default resource loader. + */ public FlowDefinitionResourceFactory() { this.resourceLoader = new DefaultResourceLoader(); } + /** + * Creates a new flow definition resource factory using the specified resource loader. + * @param resourceLoader the resource loader + */ public FlowDefinitionResourceFactory(ResourceLoader resourceLoader) { Assert.notNull(resourceLoader, "The resource loader cannot be null"); this.resourceLoader = resourceLoader; } + /** + * Create a flow definition resource from the path location provided. + * @param path the encoded {@link Resource} path. + * @return the flow definition resource + */ public FlowDefinitionResource createResource(String path) { return createResource(path, null, null); } + /** + * Create a flow definition resource from the path location provided. The returned resource will be configured with + * the provided attributes. + * @param path the encoded {@link Resource} path. + * @param attributes the flow definition meta attributes to configure + * @return the flow definition resource + */ public FlowDefinitionResource createResource(String path, AttributeMap attributes) { return createResource(path, attributes, null); } + /** + * Create a flow definition resource from the path location provided. The returned resource will be configured with + * the provided attributes and flow id. + * @param path the encoded {@link Resource} path. + * @param attributes the flow definition meta attributes to configure + * @param flowId the flow definition id to configure + * @return the flow definition resource + */ public FlowDefinitionResource createResource(String path, AttributeMap attributes, String flowId) { Resource resource = resourceLoader.getResource(path); if (flowId == null || flowId.length() == 0) { @@ -40,6 +88,11 @@ public class FlowDefinitionResourceFactory { return new FlowDefinitionResource(flowId, resource, attributes); } + /** + * Create an array of flow definition resources from the path pattern location provided. + * @param pattern the encoded {@link Resource} path pattern. + * @return the flow definition resources + */ public FlowDefinitionResource[] createResources(String pattern) throws IOException { if (resourceLoader instanceof ResourcePatternResolver) { ResourcePatternResolver resolver = (ResourcePatternResolver) resourceLoader; @@ -56,17 +109,36 @@ public class FlowDefinitionResourceFactory { } } + /** + * Create a file-based based resource from the file path provided. + * @param path the {@link FileSystemResource} path + * @return the file-based flow definition resource + */ public FlowDefinitionResource createFileResource(String path) { Resource resource = new FileSystemResource(new File(path)); return new FlowDefinitionResource(getFlowId(resource), resource, null); } + /** + * Create a classpath-based resource from the path provided. + * @param path the {@link ClassPathResource} path + * @param clazz to specify if the path should be relative to another class + * @return the classpath-based flow definition resource + */ public FlowDefinitionResource createClassPathResource(String path, Class clazz) { Resource resource = new ClassPathResource(path, clazz); return new FlowDefinitionResource(getFlowId(resource), resource, null); } - private String getFlowId(Resource flowResource) { + // subclassing hooks + + /** + * Obtains the flow id from the flow resource. By default, the flow id becomes the filename of the resource minus + * the extension. Subclasses may override. + * @param flowResource the flow resource + * @return the flow id + */ + protected String getFlowId(Resource flowResource) { String fileName = flowResource.getFilename(); int extensionIndex = fileName.lastIndexOf('.'); if (extensionIndex != -1) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowElementAttribute.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowElementAttribute.java index dd89da0f..f2f47d49 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowElementAttribute.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowElementAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 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. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderBeanDefinitionParser.java index b79a61fe..6a7b6c2b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 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. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderFactoryBean.java index 68a2e8fc..566a904f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionListenerLoaderFactoryBean.java @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 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 java.util.Iterator; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionRepositoryType.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionRepositoryType.java index 988b78ed..62bab5b5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionRepositoryType.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutionRepositoryType.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 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. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorBeanDefinitionParser.java index 9c317d78..6edcc3b6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 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. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorFactoryBean.java index eece9b38..416c2ca3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 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. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorSystemDefaults.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorSystemDefaults.java index 42151854..790a9a8c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorSystemDefaults.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorSystemDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 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. diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowLocation.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowLocation.java index 0a0dcc20..d38556db 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowLocation.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowLocation.java @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 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 java.util.Collections; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryBeanDefinitionParser.java index 8e1a4910..e5422750 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowRegistryBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 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. @@ -31,7 +31,7 @@ import org.springframework.util.xml.DomUtils; import org.w3c.dom.Element; /** - * {@link BeanDefinitionParser} for the flow <registry> tag. + * {@link BeanDefinitionParser} for the flow <flow-registry> tag. * * @author Keith Donald */ 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 de7097ce..8e9e0151 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 @@ -1,3 +1,18 @@ +/* + * Copyright 2004-2008 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 java.util.Iterator; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandler.java index 3ca473d6..e15433cb 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007 the original author or authors. + * Copyright 2004-2008 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.