1 package com.ubermq.jms.server.admin; 2 3 import com.ubermq.jms.common.routing.*; 4 import java.rmi.*; 5 import java.rmi.server.*; 6 import java.util.*; 7 8 14 public class RemoteAdminProxy 15 extends UnicastRemoteObject 16 implements MessageServerAdmin 17 { 18 private MessageServerAdmin delegate; 19 20 public RemoteAdminProxy(MessageServerAdmin a) 21 throws RemoteException 22 { 23 super(); 24 this.delegate = a; 25 } 26 27 31 public String getServerName() throws java.rmi.RemoteException 32 { 33 return delegate.getServerName(); 34 } 35 36 41 public Collection getConnections() throws java.rmi.RemoteException 42 { 43 Collection c = delegate.getConnections(); 44 ArrayList ret = new ArrayList(); 45 46 Iterator iter = c.iterator(); 47 while (iter.hasNext()) 48 { 49 ConnectionAdmin admin = (ConnectionAdmin)iter.next(); 50 ret.add(new RemoteConnectionAdminProxy(admin)); 51 } 52 53 return ret; 54 } 55 56 63 public Collection getPersistentConsumers() throws RemoteException 64 { 65 Collection c = delegate.getPersistentConsumers(); 66 ArrayList ret = new ArrayList(); 67 68 Iterator iter = c.iterator(); 69 while (iter.hasNext()) 70 { 71 PersistentConsumerAdmin admin = (PersistentConsumerAdmin)iter.next(); 72 ret.add(new RemotePersistentConsumerAdminProxy(admin)); 73 } 74 75 return ret; 76 } 77 78 81 public void close() throws java.rmi.RemoteException 82 { 83 delegate.close(); 84 } 85 86 92 public IRouterStatistics getRouterStatistics() 93 throws java.rmi.RemoteException 94 { 95 IRouterStatistics r = delegate.getRouterStatistics(); 96 return new MyStatsHolder(r); 97 } 98 99 private static class MyStatsHolder 100 implements IRouterStatistics, java.io.Serializable 101 { 102 private int in, out, dropped; 103 private java.util.Date startTime; 104 private String description; 105 106 public static final long serialVersionUID = 1l; 107 108 MyStatsHolder(IRouterStatistics s) 109 { 110 this.in = s.getMessagesIn(); 111 this.out = s.getMessagesOut(); 112 this.dropped = s.getMessagesDropped(); 113 this.startTime = s.getStartTime(); 114 this.description = s.getStatisticsAsText(); 115 } 116 117 121 public int getMessagesDropped() 122 { 123 return dropped; 124 } 125 126 129 public int getMessagesIn() 130 { 131 return in; 132 } 133 134 138 public String getStatisticsAsText() 139 { 140 return description; 141 } 142 143 147 public boolean isRunning() 148 { 149 return true; 150 } 151 152 155 public java.util.Date getStartTime() 156 { 157 return startTime; 158 } 159 160 163 public int getMessagesOut() 164 { 165 return out; 166 } 167 168 171 public void messageIn() 172 { 173 } 174 175 178 public void messageOut() 179 { 180 } 181 182 185 public void messageDropped() 186 { 187 } 188 } 189 190 } 191 | Popular Tags |