01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.messaging;
18:
19: import java.util.ArrayList;
20: import java.util.List;
21:
22: import org.kuali.rice.resourceloader.ContextClassLoaderProxy;
23:
24: /**
25: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
26: */
27: public class JavaServiceDefinition extends ServiceDefinition {
28:
29: private static final long serialVersionUID = -5267226536419496719L;
30:
31: private List<String> serviceInterfaces = new ArrayList<String>();
32:
33: public List<String> getServiceInterfaces() {
34: return this .serviceInterfaces;
35: }
36:
37: public void setServiceInterfaces(List<String> serviceInterfaces) {
38: this .serviceInterfaces = serviceInterfaces;
39: }
40:
41: public void setServiceInterface(String serviceName) {
42: this .serviceInterfaces.add(serviceName);
43: }
44:
45: public String getServiceInterface() {
46: return this .serviceInterfaces.get(0);
47: }
48:
49: @Override
50: public void validate() {
51: super .validate();
52: if (this .serviceInterfaces == null
53: || this .serviceInterfaces.isEmpty()) {
54: Class[] interfaces = ContextClassLoaderProxy
55: .getInterfacesToProxy(getService());
56: for (Class serviceInterfaceClass : interfaces) {
57: this .serviceInterfaces.add(serviceInterfaceClass
58: .getName());
59: }
60: }
61: if (getBusSecurity() == null) {
62: setBusSecurity(true);
63: }
64: }
65:
66: @Override
67: public boolean isSame(ServiceDefinition serviceDefinition) {
68: boolean same = serviceDefinition instanceof JavaServiceDefinition;
69: if (!same) {
70: return same;
71: }
72: same = super .isSame(serviceDefinition);
73: if (!same) {
74: return same;
75: }
76: for (String interfaceName : this .serviceInterfaces) {
77: if (!((JavaServiceDefinition) serviceDefinition)
78: .getServiceInterfaces().contains(interfaceName)) {
79: return false;
80: }
81: }
82: return same;
83: }
84:
85: }
|