Source Code Cross Referenced for FlowDefinitionResource.java in  » Workflow-Engines » spring-webflow-1.0.4 » org » springframework » webflow » definition » registry » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » spring webflow 1.0.4 » org.springframework.webflow.definition.registry 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.springframework.webflow.definition.registry;
017:
018:        import java.io.Serializable;
019:
020:        import org.springframework.core.io.Resource;
021:        import org.springframework.core.style.ToStringCreator;
022:        import org.springframework.util.Assert;
023:        import org.springframework.webflow.core.collection.AttributeMap;
024:        import org.springframework.webflow.core.collection.CollectionUtils;
025:
026:        /**
027:         * A pointer to an externalized flow definition resource. Adds assigned
028:         * identification information about the resource including the flow id and
029:         * attributes.
030:         * 
031:         * @see ExternalizedFlowDefinitionRegistrar
032:         * 
033:         * @author Keith Donald
034:         */
035:        public class FlowDefinitionResource implements  Serializable {
036:
037:            /**
038:             * The identifier to assign to the flow definition.
039:             */
040:            private String id;
041:
042:            /**
043:             * Attributes that can be used to affect flow construction.
044:             */
045:            private AttributeMap attributes;
046:
047:            /**
048:             * The externalized location of the flow definition resource.
049:             */
050:            private Resource location;
051:
052:            /**
053:             * Creates a new externalized flow definition resource. The flow id assigned will be
054:             * the same name as the externalized resource's filename, excluding the extension.
055:             * @param location the flow resource location
056:             */
057:            public FlowDefinitionResource(Resource location) {
058:                init(conventionalFlowId(location), location, null);
059:            }
060:
061:            /**
062:             * Creates a new externalized flow definition resource. The flow id assigned will be
063:             * the same name as the externalized resource's filename, excluding the extension.
064:             * @param location the flow resource location
065:             * @param attributes flow definition attributes to be assigned
066:             */
067:            public FlowDefinitionResource(Resource location,
068:                    AttributeMap attributes) {
069:                init(conventionalFlowId(location), location, attributes);
070:            }
071:
072:            /**
073:             * Creates a new externalized flow definition.
074:             * @param id the flow id to be assigned
075:             * @param location the flow resource location
076:             */
077:            public FlowDefinitionResource(String id, Resource location) {
078:                init(id, location, null);
079:            }
080:
081:            /**
082:             * Creates a new externalized flow definition.
083:             * @param id the flow id to be assigned
084:             * @param location the flow resource location
085:             * @param attributes flow definition attributes to be assigned
086:             */
087:            public FlowDefinitionResource(String id, Resource location,
088:                    AttributeMap attributes) {
089:                init(id, location, attributes);
090:            }
091:
092:            /**
093:             * Returns the identifier to assign to the flow definition.
094:             */
095:            public String getId() {
096:                return id;
097:            }
098:
099:            /**
100:             * Returns the externalized flow definition resource location.
101:             */
102:            public Resource getLocation() {
103:                return location;
104:            }
105:
106:            /**
107:             * Returns arbitrary flow definition attributes.
108:             */
109:            public AttributeMap getAttributes() {
110:                return attributes;
111:            }
112:
113:            public boolean equals(Object o) {
114:                if (!(o instanceof  FlowDefinitionResource)) {
115:                    return false;
116:                }
117:                FlowDefinitionResource other = (FlowDefinitionResource) o;
118:                return id.equals(other.id) && location.equals(other.location);
119:            }
120:
121:            public int hashCode() {
122:                return id.hashCode() + location.hashCode();
123:            }
124:
125:            // internal helpers
126:
127:            /**
128:             * Initialize this object.
129:             */
130:            private void init(String id, Resource location,
131:                    AttributeMap attributes) {
132:                Assert
133:                        .hasText(id,
134:                                "The id of the externalized flow definition is required");
135:                Assert
136:                        .notNull(location,
137:                                "The location of the externalized flow definition is required");
138:                this .id = id;
139:                this .location = location;
140:                if (attributes != null) {
141:                    this .attributes = attributes;
142:                } else {
143:                    this .attributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP;
144:                }
145:            }
146:
147:            // public utilities
148:
149:            /**
150:             * Returns the flow id assigned to the flow definition contained in given resource.
151:             * By convention this will be the filename of the resource, excluding extension.
152:             * @see FlowDefinitionResource#FlowDefinitionResource(Resource)
153:             * @see FlowDefinitionResource#FlowDefinitionResource(Resource, AttributeMap)
154:             * @since 1.0.1
155:             */
156:            public static String conventionalFlowId(Resource location) {
157:                String fileName = location.getFilename();
158:                int extensionIndex = fileName.lastIndexOf('.');
159:                if (extensionIndex != -1) {
160:                    return fileName.substring(0, extensionIndex);
161:                } else {
162:                    return fileName;
163:                }
164:            }
165:
166:            public String toString() {
167:                return new ToStringCreator(this ).append("id", id).append(
168:                        "location", location).append("attributes", attributes)
169:                        .toString();
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.