diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2007-07-24 18:20:55 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2007-07-24 18:20:55 +0000 |
| commit | d8c02962be928f57812ec780b1a41be85e6bb037 (patch) | |
| tree | 57ec64804d42f639581c331091eaa1b456bdd169 /java/common/src | |
| parent | a6303894d7f9a24df4a691af3ce94647c033ebff (diff) | |
| download | qpid-python-d8c02962be928f57812ec780b1a41be85e6bb037.tar.gz | |
Initial submit of 0-10 communication layer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@559151 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
30 files changed, 1640 insertions, 0 deletions
diff --git a/java/common/src/main/java/org/apache/qpidity/AbstractMethod.java b/java/common/src/main/java/org/apache/qpidity/AbstractMethod.java new file mode 100644 index 0000000000..663027e2d8 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/AbstractMethod.java @@ -0,0 +1,31 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.nio.ByteBuffer; + +/** + * AbstractMethod + * + * @author Rafael H. Schloming + */ + +abstract class AbstractMethod implements Method {} diff --git a/java/common/src/main/java/org/apache/qpidity/BBDecoder.java b/java/common/src/main/java/org/apache/qpidity/BBDecoder.java new file mode 100644 index 0000000000..0a4c6ef063 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/BBDecoder.java @@ -0,0 +1,109 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.nio.ByteBuffer; + +import java.util.Map; +import java.util.UUID; + +/** + * BBDecoder + * + * @author Rafael H. Schloming + */ + +class BBDecoder implements Decoder +{ + + private final ByteBuffer in; + + public BBDecoder(ByteBuffer in) { + this.in = in; + } + + public boolean readBit() + { + //throw new Error("TODO"); + return false; + } + + public byte readOctet() + { + throw new Error("TODO"); + } + + public short readShort() + { + return in.getShort(); + } + + public int readLong() + { + return in.getInt(); + } + + public long readLonglong() + { + throw new Error("TODO"); + } + + public long readTimestamp() + { + throw new Error("TODO"); + } + + + public String readShortstr() + { + byte size = in.get(); + byte[] bytes = new byte[size]; + in.get(bytes); + return new String(bytes); + } + + public String readLongstr() + { + throw new Error("TODO"); + } + + public Map<String,?> readTable() + { + //throw new Error("TODO"); + return null; + } + + public Range<Integer>[] readRfc1982LongSet() + { + throw new Error("TODO"); + } + + public UUID readUuid() + { + throw new Error("TODO"); + } + + public String readContent() + { + throw new Error("TODO"); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/BBEncoder.java b/java/common/src/main/java/org/apache/qpidity/BBEncoder.java new file mode 100644 index 0000000000..36edf278f3 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/BBEncoder.java @@ -0,0 +1,110 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.nio.ByteBuffer; + +import java.util.Map; +import java.util.UUID; + +/** + * BBEncoder + * + * @author Rafael H. Schloming + */ + +class BBEncoder implements Encoder +{ + + private final ByteBuffer out; + + public BBEncoder(ByteBuffer out) { + this.out = out; + } + + public void writeBit(boolean b) + { + //throw new Error("TODO"); + } + + public void writeOctet(byte b) + { + out.put(b); + } + + public void writeShort(short s) + { + out.putShort(s); + } + + public void writeLong(int i) + { + out.putInt(i); + } + + public void writeLonglong(long l) + { + throw new Error("TODO"); + } + + + public void writeTimestamp(long l) + { + throw new Error("TODO"); + } + + + public void writeShortstr(String s) + { + if (s.length() > 255) { + throw new IllegalArgumentException(s); + } + writeOctet((byte) s.length()); + out.put(s.getBytes()); + } + + public void writeLongstr(String s) + { + throw new Error("TODO"); + } + + + public void writeTable(Map<String,?> table) + { + //throw new Error("TODO"); + } + + public void writeRfc1982LongSet(Range<Integer>[] ranges) + { + throw new Error("TODO"); + } + + public void writeUuid(UUID uuid) + { + throw new Error("TODO"); + } + + public void writeContent(String c) + { + throw new Error("TODO"); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/BodyHandler.java b/java/common/src/main/java/org/apache/qpidity/BodyHandler.java new file mode 100644 index 0000000000..0b772c6f04 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/BodyHandler.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * BodyHandler + * + * @author Rafael H. Schloming + */ + +class BodyHandler<C> implements Handler<Event<C,Frame>> +{ + + public void handle(Event<C,Frame> event) + { + System.out.println("got body frame: " + event.target); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Channel.java b/java/common/src/main/java/org/apache/qpidity/Channel.java new file mode 100644 index 0000000000..a9060622e8 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Channel.java @@ -0,0 +1,91 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * Channel + * + * @author Rafael H. Schloming + */ + +class Channel extends Invoker + implements Handler<Frame>, DelegateResolver<Channel> +{ + + final private Connection connection; + final private TrackSwitch<Channel> tracks; + + + // session may be null + private Session session; + + public Channel(Connection connection) + { + this.connection = connection; + tracks = new TrackSwitch<Channel>(); + tracks.map(Frame.L1, new MethodHandler<Channel>()); + tracks.map(Frame.L2, new MethodHandler<Channel>()); + tracks.map(Frame.L3, new SessionResolver<Frame>(new MethodHandler<Session>())); + tracks.map(Frame.L4, new SessionResolver<Frame>(new ContentHandler<Session>())); + } + + public Session getSession() + { + return session; + } + + void setSession(Session session) + { + this.session = session; + } + + public void handle(Frame frame) + { + tracks.handle(new Event<Channel,Frame>(this, frame)); + } + + public void write(Writable writable) + { + System.out.println("writing: " + writable); + } + + protected StructFactory getFactory() + { + return connection.getFactory(); + } + + public Delegate<Channel> resolve(Struct struct) + { + return new ChannelDelegate(); + } + + protected void invoke(Method m) + { + write(m); + } + + protected void invoke(Method m, Handler<Struct> handler) + { + throw new UnsupportedOperationException(); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Connection.java b/java/common/src/main/java/org/apache/qpidity/Connection.java new file mode 100644 index 0000000000..bb8b945051 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Connection.java @@ -0,0 +1,59 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.util.HashMap; +import java.util.Map; + +/** + * Connection + * + * @author Rafael H. Schloming + * + * @todo the channels map should probably be replaced with something + * more efficient, e.g. an array or a map implementation that can use + * short instead of Short + */ + +class Connection implements Handler<Frame> +{ + + final private Map<Short,Channel> channels = new HashMap<Short,Channel>(); + final private StructFactory factory = new StructFactory_v0_10(); + + public void handle(Frame frame) + { + Channel channel = channels.get(frame.getChannel()); + if (channel == null) + { + channel = new Channel(this); + channels.put(frame.getChannel(), channel); + } + + channel.handle(frame); + } + + public StructFactory getFactory() + { + return factory; + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/ContentHandler.java b/java/common/src/main/java/org/apache/qpidity/ContentHandler.java new file mode 100644 index 0000000000..ea73a3574d --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/ContentHandler.java @@ -0,0 +1,42 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * ContentHandler is a stateful handler that aggregates and dispatches + * method and header frames, and passes body frames through to another + * handler. + * + * @author Rafael H. Schloming + */ + +class ContentHandler<C extends DelegateResolver<C>> extends TypeSwitch<C> +{ + + public ContentHandler() + { + map(Frame.METHOD, new SegmentAssembler<C>(new MethodDispatcher<C>())); + map(Frame.HEADER, new SegmentAssembler<C>(new HeaderHandler<C>())); + map(Frame.BODY, new BodyHandler<C>()); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Decoder.java b/java/common/src/main/java/org/apache/qpidity/Decoder.java new file mode 100644 index 0000000000..5001d3ebee --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Decoder.java @@ -0,0 +1,52 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.util.Map; +import java.util.UUID; + +/** + * Decoder + * + * @author Rafael H. Schloming + */ + +public interface Decoder +{ + + boolean readBit(); + byte readOctet(); + short readShort(); + int readLong(); + long readLonglong(); + + long readTimestamp(); + + String readShortstr(); + String readLongstr(); + + Map<String,?> readTable(); + Range<Integer>[] readRfc1982LongSet(); + UUID readUuid(); + + String readContent(); + +} diff --git a/java/common/src/main/java/org/apache/qpidity/DelegateResolver.java b/java/common/src/main/java/org/apache/qpidity/DelegateResolver.java new file mode 100644 index 0000000000..632781847e --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/DelegateResolver.java @@ -0,0 +1,36 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * A DelegateResolver locates the desired delegate to use for handling + * a given Struct. + * + * @author Rafael H. Schloming + */ + +interface DelegateResolver<C> +{ + + Delegate<C> resolve(Struct struct); + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Delegator.java b/java/common/src/main/java/org/apache/qpidity/Delegator.java new file mode 100644 index 0000000000..00e769e0f2 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Delegator.java @@ -0,0 +1,35 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * Delegator + * + * @author Rafael H. Schloming + */ + +interface Delegator +{ + + <C> void delegate(C context, Delegate<C> delegate); + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Encoder.java b/java/common/src/main/java/org/apache/qpidity/Encoder.java new file mode 100644 index 0000000000..27360a551a --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Encoder.java @@ -0,0 +1,52 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.util.Map; +import java.util.UUID; + +/** + * Encoder + * + * @author Rafael H. Schloming + */ + +public interface Encoder +{ + + void writeBit(boolean b); + void writeOctet(byte b); + void writeShort(short s); + void writeLong(int i); + void writeLonglong(long l); + + void writeTimestamp(long l); + + void writeShortstr(String s); + void writeLongstr(String s); + + void writeTable(Map<String,?> table); + void writeRfc1982LongSet(Range<Integer>[] ranges); + void writeUuid(UUID uuid); + + void writeContent(String c); + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Event.java b/java/common/src/main/java/org/apache/qpidity/Event.java new file mode 100644 index 0000000000..ae210f4c20 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Event.java @@ -0,0 +1,44 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * Events are a common class of thing to handle. An event has a + * context and a target. This division permits the same target + * instance to be used in a variety of contexts. + * + * @author Rafael H. Schloming + */ + +public class Event<C, T> +{ + + C context; + T target; + + public Event(C context, T target) + { + this.context = context; + this.target = target; + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Frame.java b/java/common/src/main/java/org/apache/qpidity/Frame.java new file mode 100644 index 0000000000..298400d511 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Frame.java @@ -0,0 +1,135 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.nio.ByteBuffer; +import java.nio.ShortBuffer; + +/** + * Frame + * + * @author Rafael H. Schloming + */ + +class Frame +{ + + public static final short L1 = 0; + public static final short L2 = 1; + public static final short L3 = 2; + public static final short L4 = 3; + + public static final short METHOD = 1; + public static final short HEADER = 2; + public static final short BODY = 3; + + final private short channel; + final private short track; + final private short type; + final private boolean firstSegment; + final private boolean lastSegment; + final private boolean firstFrame; + final private boolean lastFrame; + final private ByteBuffer payload; + + // XXX + final private int sequence = 0; + + public Frame(short channel, short track, short type, boolean firstSegment, + boolean lastSegment, boolean firstFrame, boolean lastFrame, + ByteBuffer payload) + { + this.channel = channel; + this.track = track; + this.type = type; + this.firstSegment = firstSegment; + this.lastSegment = lastSegment; + this.firstFrame = firstFrame; + this.lastFrame = lastFrame; + this.payload = payload; + } + + public short getChannel() + { + return channel; + } + + public short getTrack() + { + return track; + } + + public short getType() + { + return type; + } + + public boolean isFirstSegment() + { + return firstSegment; + } + + public boolean isLastSegment() + { + return lastSegment; + } + + public boolean isFirstFrame() + { + return firstFrame; + } + + public boolean isLastFrame() + { + return lastFrame; + } + + public ByteBuffer getPayload() + { + return payload.slice(); + } + + public int getSize() + { + return payload.remaining(); + } + + public String toString() + { + StringBuilder str = new StringBuilder(); + str.append(String.format + ("[%05d %05d %1d %1d %d%d%d%d]", channel, track, type, + getSize(), + firstSegment ? 1 : 0, lastSegment ? 1 : 0, + firstFrame ? 1 : 0, lastFrame ? 1 : 0)); + ShortBuffer shorts = payload.asShortBuffer(); + for (int i = 0; i < shorts.limit(); i++) { + str.append(String.format(" %04x", shorts.get(i))); + if (str.length() > 70) { + str.append(" ..."); + break; + } + } + + return str.toString(); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Handler.java b/java/common/src/main/java/org/apache/qpidity/Handler.java new file mode 100644 index 0000000000..0ff949cc1d --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Handler.java @@ -0,0 +1,35 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +/** + * Handler is a basic interface used throughout this library for + * callbacks, listeners, event handlers, etc. + * + * @author Rafael H. Schloming + */ + +public interface Handler<E> +{ + + void handle(E event); + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Header.java b/java/common/src/main/java/org/apache/qpidity/Header.java new file mode 100644 index 0000000000..1d494c6d41 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Header.java @@ -0,0 +1,30 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * Header + * + * @author Rafael H. Schloming + */ + +interface Header extends Struct {} diff --git a/java/common/src/main/java/org/apache/qpidity/HeaderHandler.java b/java/common/src/main/java/org/apache/qpidity/HeaderHandler.java new file mode 100644 index 0000000000..a63c032e38 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/HeaderHandler.java @@ -0,0 +1,38 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * HeaderHandler + * + * @author Rafael H. Schloming + */ + +class HeaderHandler<C> implements Handler<Event<C,Segment>> +{ + + public void handle(Event<C,Segment> event) + { + System.out.println("got header segment:\n " + event.target); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Method.java b/java/common/src/main/java/org/apache/qpidity/Method.java new file mode 100644 index 0000000000..12a7b48f94 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Method.java @@ -0,0 +1,34 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * Method + * + * @author Rafael H. Schloming + */ + +interface Method extends Struct { + + int getEncodingType(); + +} diff --git a/java/common/src/main/java/org/apache/qpidity/MethodDispatcher.java b/java/common/src/main/java/org/apache/qpidity/MethodDispatcher.java new file mode 100644 index 0000000000..a2a4ebb0fc --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/MethodDispatcher.java @@ -0,0 +1,48 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.nio.ByteBuffer; + +/** + * A MethodDispatcher parses and dispatches a method segment. + * + * @author Rafael H. Schloming + */ + +class MethodDispatcher<C extends DelegateResolver<C>> + implements Handler<Event<C,Segment>> +{ + + // XXX: should be passed in + final private StructFactory factory = new StructFactory_v0_10(); + + public void handle(Event<C,Segment> event) + { + System.out.println("got method segment:\n " + event.target); + ByteBuffer bb = event.target.getPayload(); + int type = bb.getInt(); + Struct struct = factory.create(type, new BBDecoder(bb)); + Delegate<C> delegate = event.context.resolve(struct); + struct.delegate(event.context, delegate); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/MethodHandler.java b/java/common/src/main/java/org/apache/qpidity/MethodHandler.java new file mode 100644 index 0000000000..ebc7471622 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/MethodHandler.java @@ -0,0 +1,40 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * MethodHandler is a stateful handler that aggregates frames into + * method segments and dispatches the resulting method. It does not + * accept any segment type other than Frame.METHOD. + * + * @author Rafael H. Schloming + */ + +class MethodHandler<C extends DelegateResolver<C>> extends TypeSwitch<C> +{ + + public MethodHandler() + { + map(Frame.METHOD, new SegmentAssembler<C>(new MethodDispatcher<C>())); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Range.java b/java/common/src/main/java/org/apache/qpidity/Range.java new file mode 100644 index 0000000000..4766ecb471 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Range.java @@ -0,0 +1,51 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * Range + * + * @author Rafael H. Schloming + */ + +public class Range<C extends Comparable> +{ + private final C lower; + private final C upper; + + public Range(C lower, C upper) + { + this.lower = lower; + this.upper = upper; + } + + public C getLower() + { + return lower; + } + + public C getUpper() + { + return upper; + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Segment.java b/java/common/src/main/java/org/apache/qpidity/Segment.java new file mode 100644 index 0000000000..cd1d4ab05d --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Segment.java @@ -0,0 +1,80 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.nio.ByteBuffer; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * Segment + * + * @author Rafael H. Schloming + */ + +class Segment +{ + + private final Collection<Frame> frames = new ArrayList<Frame>(); + + public void add(Frame frame) + { + frames.add(frame); + } + + public ByteBuffer getPayload() + { + // we should probably use our own decoder interface here so + // that we can directly read from the incoming frame objects + // and automatically skip frame boundaries without copying + // everything in order to get a contiguous byte buffer + int capacity = 0; + for (Frame frame : frames) + { + capacity += frame.getSize(); + } + ByteBuffer buf = ByteBuffer.allocate(capacity); + for (Frame frame : frames) + { + buf.put(frame.getPayload()); + } + buf.flip(); + return buf; + } + + public String toString() + { + StringBuffer buf = new StringBuffer(); + String sep = ",\n "; + + for (Frame f : frames) + { + buf.append(f.toString()); + buf.append(sep); + } + + buf.setLength(buf.length() - sep.length()); + + return buf.toString(); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/SegmentAssembler.java b/java/common/src/main/java/org/apache/qpidity/SegmentAssembler.java new file mode 100644 index 0000000000..2d47e760c1 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/SegmentAssembler.java @@ -0,0 +1,61 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.nio.ByteBuffer; + +/** + * SegmentAssembler is a stateful handler that aggregates Frame events + * into Segment events. This should only be used where it is necessary + * to assemble a Segment before processing, e.g. for Method and Header + * segments. + * + * @author Rafael H. Schloming + */ + +class SegmentAssembler<C> implements Handler<Event<C,Frame>> +{ + + final private Handler<Event<C,Segment>> handler; + private Segment segment; + + public SegmentAssembler(Handler<Event<C,Segment>> handler) + { + this.handler = handler; + } + + public void handle(Event<C, Frame> event) + { + Frame frame = event.target; + if (frame.isFirstFrame()) + { + segment = new Segment(); + } + + segment.add(frame); + + if (frame.isLastFrame()) + { + handler.handle(new Event<C, Segment>(event.context, segment)); + } + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Session.java b/java/common/src/main/java/org/apache/qpidity/Session.java new file mode 100644 index 0000000000..32da625070 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Session.java @@ -0,0 +1,70 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.util.HashMap; +import java.util.Map; + +/** + * Session + * + * @author Rafael H. Schloming + */ + +public class Session extends Invoker implements DelegateResolver<Session> +{ + + // channel may be null + Channel channel; + private int command_id = 0; + // XXX + final Map<Integer,Handler<Struct>> handlers = new HashMap<Integer,Handler<Struct>>(); + final private Delegate<Session> delegate = new SessionDelegate(); + + public void attach(Channel channel) + { + this.channel = channel; + channel.setSession(this); + } + + protected void invoke(Method m) + { + command_id++; + channel.write(m); + } + + protected void invoke(Method m, Handler<Struct> handler) + { + invoke(m); + handlers.put(command_id, handler); + } + + protected StructFactory getFactory() + { + return channel.getFactory(); + } + + public Delegate<Session> resolve(Struct struct) + { + return delegate; + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/SessionResolver.java b/java/common/src/main/java/org/apache/qpidity/SessionResolver.java new file mode 100644 index 0000000000..24e52839fd --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/SessionResolver.java @@ -0,0 +1,47 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * SessionResolver is a stateless handler that accepts incoming events + * whose context is a Channel, and produces an event whose context is + * a Session. + * + * @author Rafael H. Schloming + */ + +class SessionResolver<T> implements Handler<Event<Channel,T>> +{ + + final private Handler<Event<Session,T>> handler; + + public SessionResolver(Handler<Event<Session,T>> handler) + { + this.handler = handler; + } + + public void handle(Event<Channel,T> event) + { + handler.handle(new Event<Session,T>(event.context.getSession(), event.target)); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Struct.java b/java/common/src/main/java/org/apache/qpidity/Struct.java new file mode 100644 index 0000000000..6d9913b042 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Struct.java @@ -0,0 +1,30 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * Struct + * + * @author Rafael H. Schloming + */ + +interface Struct extends Delegator, Writable {} diff --git a/java/common/src/main/java/org/apache/qpidity/Stub.java b/java/common/src/main/java/org/apache/qpidity/Stub.java new file mode 100644 index 0000000000..d8de56f8b1 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Stub.java @@ -0,0 +1,78 @@ +package org.apache.qpidity; + +import java.nio.ByteBuffer; +import java.util.*; +import java.lang.annotation.*; + +public class Stub { + + private static Connection conn = new Connection(); + + private static void frame(short track, short type, boolean first, boolean last) { + frame(track, type, first, last, null); + } + + private static void frame(short track, short type, boolean first, boolean last, Method m) { + ByteBuffer buf = ByteBuffer.allocate(512); + if (m != null) { + buf.putInt(m.getEncodingType()); + m.write(new BBEncoder(buf)); + } + buf.flip(); + Frame frame = new Frame((short)0, track, type, true, true, first, last, buf); + conn.handle(frame); + } + + public static final void main(String[] args) { + StructFactory f = new StructFactory_v0_10(); + frame(Frame.L2, Frame.METHOD, true, true, f.newSessionOpen(0)); + frame(Frame.L4, Frame.METHOD, true, false, f.newQueueDeclare((short) 0, "asdf", "alternate", false, false, false, false, false, null)); + frame(Frame.L4, Frame.METHOD, false, false); + frame(Frame.L3, Frame.METHOD, true, true, f.newExchangeDeclare((short) 0, "exchange", "type", "alternate", false, false, false, null)); + frame(Frame.L4, Frame.METHOD, false, true); + frame(Frame.L4, Frame.HEADER, true, false); + frame(Frame.L4, Frame.HEADER, false, false); + frame(Frame.L4, Frame.HEADER, false, true); + frame(Frame.L4, Frame.BODY, true, false); + frame(Frame.L4, Frame.BODY, false, false); + frame(Frame.L4, Frame.BODY, false, false); + frame(Frame.L1, Frame.METHOD, true, true, f.newExchangeDeclare((short) 0, "exchange", "type", "alternate", false, false, false, null)); + frame(Frame.L4, Frame.BODY, false, false); + frame(Frame.L4, Frame.BODY, false, true); + } + +} + +//====: Channel and Session Delegates :=======================================// + +class ChannelDelegate extends Delegate<Channel> { + + public @Override void sessionOpen(Channel channel, SessionOpen open) { + Session ssn = new Session(); + ssn.attach(channel); + System.out.println("Session Open"); + } + +} + +class SessionDelegate extends Delegate<Session> { + + public @Override void queueDeclare(Session session, QueueDeclare qd) { + System.out.println("got a queue declare: " + qd.getQueue()); + } + + public @Override void exchangeDeclare(Session session, ExchangeDeclare ed) { + System.out.println("got an exchange declare: " + ed.getExchange() + ", " + ed.getType()); + session.queueDeclare((short) 0, "asdf", "alternate", false, false, false, false, false, null); + } + + /* + public @Override void executionResult(Session session, ExecutionResult result) { + Handler<Struct> handler = session.handlers.get(result.getCommandId()); + if (handler != null) { + handler.handle(result.getData()); + } + } + */ + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Switch.java b/java/common/src/main/java/org/apache/qpidity/Switch.java new file mode 100644 index 0000000000..a84ae1507b --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Switch.java @@ -0,0 +1,52 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +import java.util.HashMap; +import java.util.Map; + +/** + * A Switch performs generic event dispatch. + * + * @author Rafael H. Schloming + */ + +abstract class Switch<K,E> implements Handler<E> +{ + + final private Map<K,Handler<E>> handlers = + new HashMap<K,Handler<E>>(); + + public void map(K key, Handler<E> handler) + { + handlers.put(key, handler); + } + + public void handle(E event) + { + K key = resolve(event); + Handler<E> handler = handlers.get(key); + handler.handle(event); + } + + abstract K resolve(E event); + +} diff --git a/java/common/src/main/java/org/apache/qpidity/TrackSwitch.java b/java/common/src/main/java/org/apache/qpidity/TrackSwitch.java new file mode 100644 index 0000000000..c9b3cda032 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/TrackSwitch.java @@ -0,0 +1,39 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * A TrackSwitch sends incoming frames to a different handler based on + * track. + * + * @author Rafael H. Schloming + */ + +class TrackSwitch<C> extends Switch<Short,Event<C,Frame>> +{ + + public Short resolve(Event<C,Frame> event) + { + return event.target.getTrack(); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/TypeSwitch.java b/java/common/src/main/java/org/apache/qpidity/TypeSwitch.java new file mode 100644 index 0000000000..a5073486c7 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/TypeSwitch.java @@ -0,0 +1,39 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + + +/** + * A TypeSwitch sends incoming frames to a different handler based on + * type. + * + * @author Rafael H. Schloming + */ + +class TypeSwitch<C> extends Switch<Short,Event<C,Frame>> +{ + + public Short resolve(Event<C,Frame> event) + { + return event.target.getType(); + } + +} diff --git a/java/common/src/main/java/org/apache/qpidity/Writable.java b/java/common/src/main/java/org/apache/qpidity/Writable.java new file mode 100644 index 0000000000..9554da880a --- /dev/null +++ b/java/common/src/main/java/org/apache/qpidity/Writable.java @@ -0,0 +1,34 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpidity; + +/** + * Writable + * + * @author Rafael H. Schloming + */ + +interface Writable +{ + + void write(Encoder enc); + +} |
