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:
021: import javax.xml.namespace.QName;
022:
023: import org.kuali.bus.services.KSBServiceLocator;
024: import org.kuali.rice.core.Core;
025: import org.kuali.rice.util.RiceUtilities;
026:
027: /**
028: * Model bean that represents the definition of a service on the bus.
029: *
030: * @see ServiceDefinition
031: *
032: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
033: */
034: public class ServiceInfo implements Serializable {
035:
036: private static final long serialVersionUID = -4244884858494208070L;
037: private ServiceDefinition serviceDefinition;
038: private Long messageEntryId;
039: private QName qname;
040: private String endpointUrl;
041: private String serializedMessageEntity;
042: private String serviceName;
043: private Boolean alive = true;
044: private String messageEntity;
045: private String serverIp;
046: private Integer lockVerNbr;
047:
048: public ServiceInfo() {
049: // default constructor with nothing to do
050: }
051:
052: public ServiceInfo(ServiceDefinition serviceDefinition) {
053: this .setServiceDefinition(serviceDefinition);
054: this .setQname(serviceDefinition.getServiceName());
055: this .setMessageEntity(Core.getCurrentContextConfig()
056: .getMessageEntity());
057: this .setServerIp(RiceUtilities.getIpNumber());
058: this .setEndpointUrl(serviceDefinition.getServiceEndPoint()
059: .toString());
060: this .setServiceName(this .getQname().toString());
061: }
062:
063: public Long getMessageEntryId() {
064: return this .messageEntryId;
065: }
066:
067: public void setMessageEntryId(Long messageEntryId) {
068: this .messageEntryId = messageEntryId;
069: }
070:
071: public ServiceDefinition getServiceDefinition() {
072: if (this .serviceDefinition == null
073: && this .serializedMessageEntity != null) {
074: this .serviceDefinition = (ServiceDefinition) KSBServiceLocator
075: .getMessageHelper().deserializeObject(
076: this .serializedMessageEntity);
077: }
078: return this .serviceDefinition;
079: }
080:
081: public void setServiceDefinition(ServiceDefinition serviceDefinition) {
082: this .serviceDefinition = serviceDefinition;
083: }
084:
085: public QName getQname() {
086: if (this .qname == null) {
087: this .qname = QName.valueOf(this .getServiceName());
088: }
089: return this .qname;
090: }
091:
092: public void setQname(QName serviceName) {
093: this .qname = serviceName;
094: }
095:
096: public String getEndpointUrl() {
097: return this .endpointUrl;
098: }
099:
100: public void setEndpointUrl(String ipNumber) {
101: this .endpointUrl = ipNumber;
102: }
103:
104: public Integer getLockVerNbr() {
105: return this .lockVerNbr;
106: }
107:
108: public void setLockVerNbr(Integer lockVerNbr) {
109: this .lockVerNbr = lockVerNbr;
110: }
111:
112: public String getMessageEntity() {
113: return this .messageEntity;
114: }
115:
116: public void setMessageEntity(String messageEntity) {
117: this .messageEntity = messageEntity;
118: }
119:
120: public String getServerIp() {
121: return this .serverIp;
122: }
123:
124: public void setServerIp(String serverIp) {
125: this .serverIp = serverIp;
126: }
127:
128: public Boolean getAlive() {
129: return this .alive;
130: }
131:
132: public void setAlive(Boolean alive) {
133: this .alive = alive;
134: }
135:
136: public void setSerializedMessageEntity(
137: String serializedMessageEntity) {
138: this .serializedMessageEntity = serializedMessageEntity;
139: }
140:
141: public String getSerializedMessageEntity() {
142: return this .serializedMessageEntity;
143: }
144:
145: public String getServiceName() {
146: return this .serviceName;
147: }
148:
149: public void setServiceName(String serviceName) {
150: this.serviceName = serviceName;
151: }
152:
153: }
|