Source Code Cross Referenced for ServiceDefinition.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » messaging » 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 » ERP CRM Financial » Kuali Financial System » edu.iu.uis.eden.messaging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2006 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package edu.iu.uis.eden.messaging;
018:
019:        import java.io.Serializable;
020:        import java.net.URL;
021:        import java.net.URLEncoder;
022:
023:        import javax.xml.namespace.QName;
024:
025:        import org.apache.log4j.Logger;
026:        import org.kuali.rice.config.ConfigurationException;
027:        import org.kuali.rice.core.Core;
028:        import org.kuali.rice.security.credentials.CredentialsSource;
029:        import org.kuali.rice.security.credentials.CredentialsSource.CredentialsType;
030:        import org.springframework.util.Assert;
031:
032:        import edu.iu.uis.eden.messaging.exceptionhandling.DefaultMessageExceptionHandler;
033:
034:        /**
035:         * The definition of a service on the service bus.
036:         * 
037:         * @author Kuali Rice Team (kuali-rice@googlegroups.com)
038:         */
039:        public abstract class ServiceDefinition implements  Serializable {
040:
041:            private static final Logger LOG = Logger
042:                    .getLogger(ServiceDefinition.class);
043:
044:            private static final long serialVersionUID = 43631161206712702L;
045:
046:            private Object service;
047:            private String localServiceName;
048:            private String serviceNameSpaceURI;
049:            private transient QName serviceName;
050:            private Boolean queue = Boolean.TRUE;
051:            private Integer priority;
052:            private Integer retryAttempts;
053:            private Long millisToLive;
054:            private String messageExceptionHandler;
055:            private URL serviceEndPoint;
056:            private Boolean busSecurity = Boolean.TRUE;
057:            private CredentialsType credentialsType;
058:            private String messageEntity;
059:
060:            public ServiceDefinition() {
061:                // nothing to do
062:            }
063:
064:            public ServiceDefinition(final Boolean busSecurity) {
065:                Assert.notNull(busSecurity, "busSecurity cannot be null");
066:                this .busSecurity = busSecurity;
067:            }
068:
069:            public Object getService() {
070:                return this .service;
071:            }
072:
073:            public void setService(Object service) {
074:                this .service = service;
075:            }
076:
077:            public String getLocalServiceName() {
078:                return this .localServiceName;
079:            }
080:
081:            public void setLocalServiceName(String serviceName) {
082:                this .localServiceName = serviceName;
083:            }
084:
085:            public String getMessageExceptionHandler() {
086:                return this .messageExceptionHandler;
087:            }
088:
089:            public void setMessageExceptionHandler(
090:                    String messageExceptionHandler) {
091:                this .messageExceptionHandler = messageExceptionHandler;
092:            }
093:
094:            public Integer getPriority() {
095:                return this .priority;
096:            }
097:
098:            public void setPriority(Integer priority) {
099:                this .priority = priority;
100:            }
101:
102:            public Boolean getQueue() {
103:                return this .queue;
104:            }
105:
106:            public void setQueue(Boolean queue) {
107:                this .queue = queue;
108:            }
109:
110:            public Integer getRetryAttempts() {
111:                return this .retryAttempts;
112:            }
113:
114:            public void setRetryAttempts(Integer retryAttempts) {
115:                this .retryAttempts = retryAttempts;
116:            }
117:
118:            public QName getServiceName() {
119:                if (this .serviceName == null) {
120:                    if (this .localServiceName == null) {
121:                        int i = 0;
122:                    }
123:                    if (this .serviceNameSpaceURI == null) {
124:                        this .serviceName = new QName(this .messageEntity,
125:                                this .localServiceName);
126:                    } else {
127:                        this .serviceName = new QName(this .serviceNameSpaceURI,
128:                                this .localServiceName);
129:                    }
130:
131:                }
132:                return this .serviceName;
133:            }
134:
135:            public void setServiceName(QName serviceName) {
136:                this .serviceName = serviceName;
137:            }
138:
139:            public URL getServiceEndPoint() {
140:                return this .serviceEndPoint;
141:            }
142:
143:            public void setServiceEndPoint(URL serviceEndPoint) {
144:                this .serviceEndPoint = serviceEndPoint;
145:            }
146:
147:            public void setCredentialsType(
148:                    CredentialsSource.CredentialsType credentialsType) {
149:                this .credentialsType = credentialsType;
150:            }
151:
152:            public CredentialsSource.CredentialsType getCredentialsType() {
153:                return this .credentialsType;
154:            }
155:
156:            public void validate() {
157:
158:                if (this .serviceName == null && this .localServiceName == null) {
159:                    throw new ConfigurationException(
160:                            "Must give a serviceName or localServiceName");
161:                }
162:
163:                String messageEntity = Core.getCurrentContextConfig()
164:                        .getMessageEntity();
165:                if (messageEntity == null) {
166:                    throw new ConfigurationException(
167:                            "Must have a messageEntity");
168:                }
169:                this .messageEntity = messageEntity;
170:
171:                //		if (this.serviceName == null) {
172:                //			if (this.serviceNameSpaceURI == null) {
173:                //			    this.serviceName = new QName(messageEntity, this.localServiceName);	
174:                //			} else {
175:                //			    this.serviceName = new QName(this.serviceNameSpaceURI, this.localServiceName);
176:                //			}
177:                //			
178:                //		}
179:                if (this .serviceName != null && this .localServiceName == null) {
180:                    this .localServiceName = this .getServiceName()
181:                            .getLocalPart();
182:                }
183:
184:                LOG.debug("Validating service " + this .serviceName);
185:
186:                String endPointURL = Core.getCurrentContextConfig()
187:                        .getEndPointUrl();
188:                if (this .serviceEndPoint == null && endPointURL == null) {
189:                    throw new ConfigurationException(
190:                            "Must provide a serviceEndPoint or serviceServletURL");
191:                } else if (this .serviceEndPoint == null) {
192:                    if (!endPointURL.endsWith("/")) {
193:                        endPointURL += "/";
194:                    }
195:                    try {
196:                        this .serviceEndPoint = new URL(endPointURL
197:                                + URLEncoder.encode(this .getServiceName()
198:                                        .toString(), "UTF-8"));
199:                    } catch (Exception e) {
200:                        throw new ConfigurationException(
201:                                "Service Endpoint URL creation failed.", e);
202:                    }
203:
204:                }
205:
206:                if (this .service == null) {
207:                    throw new ConfigurationException("Must provide a service");
208:                }
209:
210:                if (this .priority == null) {
211:                    setPriority(5);
212:                }
213:
214:                if (this .retryAttempts == null) {
215:                    setRetryAttempts(0);
216:                }
217:
218:                if (this .millisToLive == null) {
219:                    setMillisToLive(new Long(-1));
220:                }
221:
222:                if (getMessageExceptionHandler() == null) {
223:                    setMessageExceptionHandler(DefaultMessageExceptionHandler.class
224:                            .getName());
225:                }
226:            }
227:
228:            public String getServiceNameSpaceURI() {
229:                return this .serviceNameSpaceURI;
230:            }
231:
232:            public void setServiceNameSpaceURI(String serviceNameSpaceURI) {
233:                this .serviceNameSpaceURI = serviceNameSpaceURI;
234:            }
235:
236:            public Long getMillisToLive() {
237:                return this .millisToLive;
238:            }
239:
240:            public void setMillisToLive(Long millisToLive) {
241:                this .millisToLive = millisToLive;
242:            }
243:
244:            public Boolean getBusSecurity() {
245:                return this .busSecurity;
246:            }
247:
248:            public void setBusSecurity(Boolean busSecurity) {
249:                this .busSecurity = busSecurity;
250:            }
251:
252:            public boolean isSame(ServiceDefinition serviceDefinition) {
253:                return this.getBusSecurity().equals(
254:                        serviceDefinition.getBusSecurity())
255:                        && this.getMessageExceptionHandler().equals(
256:                                serviceDefinition.getMessageExceptionHandler())
257:                        && this.getMillisToLive().equals(
258:                                serviceDefinition.getMillisToLive())
259:                        && this.getPriority().equals(
260:                                serviceDefinition.getPriority())
261:                        && this.getQueue().equals(serviceDefinition.getQueue())
262:                        && this.getRetryAttempts().equals(
263:                                serviceDefinition.getRetryAttempts())
264:                        && this.getServiceEndPoint().equals(
265:                                serviceDefinition.getServiceEndPoint())
266:                        && this.getServiceName().equals(
267:                                serviceDefinition.getServiceName())
268:                        && this.getCredentialsType() == serviceDefinition
269:                                .getCredentialsType();
270:            }
271:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.