KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > store > ProxyMessageStore


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.store;
19
20 import java.io.IOException JavaDoc;
21
22 import org.apache.activemq.broker.ConnectionContext;
23 import org.apache.activemq.command.ActiveMQDestination;
24 import org.apache.activemq.command.Message;
25 import org.apache.activemq.command.MessageAck;
26 import org.apache.activemq.command.MessageId;
27 import org.apache.activemq.memory.UsageManager;
28
29 /**
30  * A simple proxy that delegates to another MessageStore.
31  */

32 public class ProxyMessageStore implements MessageStore {
33
34     final MessageStore delegate;
35     
36     public ProxyMessageStore(MessageStore delegate) {
37         this.delegate = delegate;
38     }
39     
40     public MessageStore getDelegate() {
41         return delegate;
42     }
43
44     public void addMessage(ConnectionContext context, Message message) throws IOException JavaDoc {
45         delegate.addMessage(context, message);
46     }
47     public Message getMessage(MessageId identity) throws IOException JavaDoc {
48         return delegate.getMessage(identity);
49     }
50     public void recover(MessageRecoveryListener listener) throws Exception JavaDoc {
51         delegate.recover(listener);
52     }
53     public void removeAllMessages(ConnectionContext context) throws IOException JavaDoc {
54         delegate.removeAllMessages(context);
55     }
56     public void removeMessage(ConnectionContext context, MessageAck ack) throws IOException JavaDoc {
57         delegate.removeMessage(context, ack);
58     }
59     public void start() throws Exception JavaDoc {
60         delegate.start();
61     }
62     public void stop() throws Exception JavaDoc {
63         delegate.stop();
64     }
65     public ActiveMQDestination getDestination() {
66         return delegate.getDestination();
67     }
68
69     public void setUsageManager(UsageManager usageManager) {
70         delegate.setUsageManager(usageManager);
71     }
72
73  
74     public int getMessageCount() throws IOException JavaDoc{
75         return delegate.getMessageCount();
76     }
77
78
79     public void recoverNextMessages(int maxReturned,MessageRecoveryListener listener) throws Exception JavaDoc{
80        delegate.recoverNextMessages(maxReturned,listener);
81         
82     }
83
84     public void resetBatching(){
85         delegate.resetBatching();
86         
87     }
88 }
89
Popular Tags