001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)EventImpl.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.binding.proxy;
030:
031: import java.util.ArrayList;
032:
033: /**
034: * Implementation of ServiceEndpoint for junit test cases.
035: *
036: * @author Sun Microsystems, Inc.
037: */
038: public class EventImpl implements
039: com.sun.jbi.binding.proxy.connection.Event {
040: ArrayList mList;
041: int mReadIndex;
042:
043: EventImpl() {
044: mList = new ArrayList();
045: mReadIndex = 0;
046: }
047:
048: public String getEventName() {
049: return (null);
050: }
051:
052: public String getSender() {
053: return (null);
054: }
055:
056: public String getString()
057: throws com.sun.jbi.binding.proxy.connection.EventException {
058: if (mReadIndex < mList.size()) {
059: Object o = mList.get(mReadIndex++);
060: if (o instanceof String) {
061: return ((String) o);
062: }
063: }
064: throw new com.sun.jbi.binding.proxy.connection.EventException(
065: "Size or type mismatch");
066: }
067:
068: public long getLong()
069: throws com.sun.jbi.binding.proxy.connection.EventException {
070: if (mReadIndex < mList.size()) {
071: Object o = mList.get(mReadIndex++);
072: if (o instanceof Long) {
073: return (((Long) o).longValue());
074: }
075: }
076: throw new com.sun.jbi.binding.proxy.connection.EventException(
077: "Size or type mismatch");
078:
079: }
080:
081: public void putString(String value)
082: throws com.sun.jbi.binding.proxy.connection.EventException {
083: mList.add(value);
084: }
085:
086: public void putLong(long value)
087: throws com.sun.jbi.binding.proxy.connection.EventException {
088: mList.add(new Long(value));
089: }
090:
091: public Object getObject()
092: throws com.sun.jbi.binding.proxy.connection.EventException {
093: if (mReadIndex < mList.size()) {
094: Object o = mList.get(mReadIndex++);
095: return (o);
096: }
097: throw new com.sun.jbi.binding.proxy.connection.EventException(
098: "Size or type mismatch");
099:
100: }
101:
102: public void putObject(Object value)
103: throws com.sun.jbi.binding.proxy.connection.EventException {
104: mList.add(value);
105: }
106:
107: }
|