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 org.apache.commons.lang.StringUtils;
022:
023: /**
024: * Encapsulates an asynchronous call to a service.
025: *
026: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
027: */
028: public class AsynchronousCall implements Serializable {
029:
030: private static final long serialVersionUID = -1036656564567726747L;
031:
032: private Object[] arguments;
033:
034: private Class[] paramTypes;
035:
036: private ServiceInfo serviceInfo;
037:
038: private Serializable context;
039:
040: private String methodName;
041:
042: private AsynchronousCallback callback;
043:
044: private boolean ignoreStoreAndForward;
045:
046: public AsynchronousCall(Class[] paramTypes, Object[] arguments,
047: ServiceInfo serviceInfo, String methodName,
048: AsynchronousCallback callback, Serializable context) {
049: this .arguments = arguments;
050: this .paramTypes = paramTypes;
051: this .serviceInfo = serviceInfo;
052: this .methodName = methodName;
053: this .callback = callback;
054: this .context = context;
055: }
056:
057: public Object[] getArguments() {
058: return this .arguments;
059: }
060:
061: public Class[] getParamTypes() {
062: return this .paramTypes;
063: }
064:
065: public ServiceInfo getServiceInfo() {
066: return this .serviceInfo;
067: }
068:
069: public String getMethodName() {
070: return this .methodName;
071: }
072:
073: public AsynchronousCallback getCallback() {
074: return this .callback;
075: }
076:
077: public String toString() {
078: return "[AsynchronousCall: " + "serviceInfo="
079: + this .serviceInfo + ", methodName=" + this .methodName
080: + ", paramTypes="
081: + getStringifiedArray(this .paramTypes) + ", arguments="
082: + getStringifiedArray(this .arguments) + "]";
083: }
084:
085: /**
086: * Takes an Object[] and returns a human-readable String of the contents
087: * Candidate for relocation to a utility class
088: *
089: * @param array
090: * the Object[]
091: * @return a human-readable String of the contents
092: */
093: private static final String getStringifiedArray(Object[] array) {
094: if (array == null) {
095: return null;
096: }
097: StringBuffer sb = new StringBuffer(array.getClass().toString());
098: sb.append("[");
099: StringUtils.join(array, ", ");
100: sb.append("]");
101: return sb.toString();
102: }
103:
104: public boolean isIgnoreStoreAndForward() {
105: return this .ignoreStoreAndForward;
106: }
107:
108: public void setIgnoreStoreAndForward(boolean ignoreStoreAndForward) {
109: this .ignoreStoreAndForward = ignoreStoreAndForward;
110: }
111:
112: public Serializable getContext() {
113: return this .context;
114: }
115:
116: public void setContext(Serializable context) {
117: this.context = context;
118: }
119:
120: }
|