*
*/
protected void printServletEnvironment(ServletOutputStream out,
- HttpServletRequest req,
- @SuppressWarnings("unused") HttpServletResponse res)
+ HttpServletRequest req, HttpServletResponse res)
throws IOException {
// Document the properties from ServletRequest
* to allow interceptors to clean up resources, time out object and
* perform actions that are unrelated to sending/receiving data.
*/
+ @Override
public void heartbeat();
/**
* @return boolean
* @see Object#equals(Object)
*/
+ @Override
public boolean equals(Object listener);
/**
* @return int
* @see Object#hashCode()
*/
+ @Override
public int hashCode();
}
import org.apache.catalina.tribes.ChannelInterceptor;
import org.apache.catalina.tribes.ChannelMessage;
import org.apache.catalina.tribes.Member;
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
/**
* Abstract class for the interceptor base class.
public abstract class ChannelInterceptorBase implements ChannelInterceptor {
- private static final Log log = LogFactory.getLog(ChannelInterceptorBase.class);
-
private ChannelInterceptor next;
private ChannelInterceptor previous;
//default value, always process
return ((optionFlag&messageFlags) == optionFlag);
}
+ @Override
public final void setNext(ChannelInterceptor next) {
this.next = next;
}
+ @Override
public final ChannelInterceptor getNext() {
return next;
}
+ @Override
public final void setPrevious(ChannelInterceptor previous) {
this.previous = previous;
}
+ @Override
public void setOptionFlag(int optionFlag) {
this.optionFlag = optionFlag;
}
+ @Override
public final ChannelInterceptor getPrevious() {
return previous;
}
+ @Override
public int getOptionFlag() {
return optionFlag;
}
+ @Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws
ChannelException {
if (getNext() != null) getNext().sendMessage(destination, msg, payload);
}
+ @Override
public void messageReceived(ChannelMessage msg) {
if (getPrevious() != null) getPrevious().messageReceived(msg);
}
return true;
}
+ @Override
public void memberAdded(Member member) {
//notify upwards
if (getPrevious() != null) getPrevious().memberAdded(member);
}
+ @Override
public void memberDisappeared(Member member) {
//notify upwards
if (getPrevious() != null) getPrevious().memberDisappeared(member);
}
+ @Override
public void heartbeat() {
if (getNext() != null) getNext().heartbeat();
}
/**
* has members
*/
+ @Override
public boolean hasMembers() {
if ( getNext()!=null )return getNext().hasMembers();
else return false;
* Get all current cluster members
* @return all members or empty array
*/
+ @Override
public Member[] getMembers() {
if ( getNext()!=null ) return getNext().getMembers();
else return null;
* @param mbr Member
* @return Member
*/
+ @Override
public Member getMember(Member mbr) {
if ( getNext()!=null) return getNext().getMember(mbr);
else return null;
*
* @return Member
*/
+ @Override
public Member getLocalMember(boolean incAlive) {
if ( getNext()!=null ) return getNext().getLocalMember(incAlive);
else return null;
* SND_RX_SEQ - starts the replication receiver<BR>
* @throws ChannelException if a startup error occurs or the service is already started.
*/
+ @Override
public void start(int svc) throws ChannelException {
if ( getNext()!=null ) getNext().start(svc);
}
* SND_RX_SEQ - stops the replication receiver<BR>
* @throws ChannelException if a startup error occurs or the service is already started.
*/
+ @Override
public void stop(int svc) throws ChannelException {
if (getNext() != null) getNext().stop(svc);
}
+ @Override
public void fireInterceptorEvent(InterceptorEvent event) {
//empty operation
}
protected AtomicInteger size = new AtomicInteger(0);
protected ConcurrentLinkedQueue<XByteBuffer> queue = new ConcurrentLinkedQueue<XByteBuffer>();
+ @Override
public void setMaxSize(int bytes) {
this.maxSize = bytes;
}
+ @Override
public XByteBuffer getBuffer(int minSize, boolean discard) {
XByteBuffer buffer = queue.poll();
if ( buffer != null ) size.addAndGet(-buffer.getCapacity());
return buffer;
}
+ @Override
public void returnBuffer(XByteBuffer buffer) {
if ( (size.get() + buffer.getCapacity()) <= maxSize ) {
size.addAndGet(buffer.getCapacity());
}
}
+ @Override
public void clear() {
queue.clear();
size.set(0);
/**
* @return Returns the message byte buffer
*/
+ @Override
public XByteBuffer getMessage() {
return message;
}
/**
* @param message The message to send.
*/
+ @Override
public void setMessage(XByteBuffer message) {
this.message = message;
}
/**
* @return Returns the timestamp.
*/
+ @Override
public long getTimestamp() {
return timestamp;
}
/**
* @param timestamp The timestamp to send
*/
+ @Override
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
/**
* @return Returns the uniqueId.
*/
+ @Override
public byte[] getUniqueId() {
return uniqueId;
}
* see org.apache.catalina.tribes.Channel#sendMessage(org.apache.catalina.tribes.Member[], java.io.Serializable, int)
*
*/
+ @Override
public int getOptions() {
return options;
}
*
* @param options the message options
*/
+ @Override
public void setOptions(int options) {
this.options = options;
}
* Returns the source or reply-to address
* @return Member
*/
+ @Override
public Member getAddress() {
return address;
}
* Sets the source or reply-to address
* @param address Member
*/
+ @Override
public void setAddress(Member address) {
this.address = address;
}
* Complete clone
* @return ClusterData
*/
+ @Override
public Object deepclone() {
byte[] d = this.getDataPackage();
return ChannelData.getDataFromPackage(d);
* @throws IOException
* TODO Implement this org.apache.catalina.tribes.transport.DataSender method
*/
+ @Override
public abstract void connect() throws IOException;
/**
*
* TODO Implement this org.apache.catalina.tribes.transport.DataSender method
*/
+ @Override
public abstract void disconnect();
/**
* @return boolean
* TODO Implement this org.apache.catalina.tribes.transport.DataSender method
*/
+ @Override
public boolean keepalive() {
boolean disconnect = false;
if (isUdpBased()) disconnect = true; //always disconnect UDP, TODO optimize the keepalive handling
this.connected = connected;
}
+ @Override
public boolean isConnected() {
return connected;
}
+ @Override
public long getConnectTime() {
return connectTime;
}
return keepAliveTime;
}
+ @Override
public int getRequestCount() {
return requestCount;
}
return throwOnFailedAck;
}
+ @Override
public void setKeepAliveCount(int keepAliveCount) {
this.keepAliveCount = keepAliveCount;
}
+ @Override
public void setKeepAliveTime(long keepAliveTime) {
this.keepAliveTime = keepAliveTime;
}
this.requestCount = requestCount;
}
+ @Override
public void setRxBufSize(int rxBufSize) {
this.rxBufSize = rxBufSize;
}
+ @Override
public void setTimeout(long timeout) {
this.timeout = timeout;
}
+ @Override
public void setTxBufSize(int txBufSize) {
this.txBufSize = txBufSize;
}
lookUpBase64Alphabet[63] = (byte) '/';
}
- public static boolean isBase64( String isValidString )
- {
- return isArrayByteBase64(isValidString.getBytes());
- }
-
- public static boolean isBase64( byte octect )
- {
- //shall we ignore white space? JEFF??
- return (octect == PAD || base64Alphabet[octect] != -1);
- }
-
- public static boolean isArrayByteBase64( byte[] arrayOctect )
- {
- int length = arrayOctect.length;
- if (length == 0)
- {
- // shouldn't a 0 length array be valid base64 data?
- // return false;
- return true;
- }
- for (int i=0; i < length; i++)
- {
- if ( !Base64.isBase64(arrayOctect[i]) )
- return false;
- }
- return true;
- }
-
/**
* Encodes hex octets into Base64.
*
CUSTOM,
RESET,
- WEBAPP,
/**
* Hook called after request, but before recycling. Can be used for logging,
REQ_SSL_ATTRIBUTE,
/**
- * Chain for request creation. Called each time a new request is created
- * (requests are recycled).
- */
- NEW_REQUEST,
-
- /**
* Callback for lazy evaluation - extract the SSL-certificate (including
* forcing a re-handshake if necessary)
*/
add(item);
return item;
}
-
-
- /**
- * Returns the one-based position of the distance from the top that the
- * specified object exists on this stack, where the top-most element is
- * considered to be at distance <code>1</code>. If the object is not
- * present on the stack, return <code>-1</code> instead. The
- * <code>equals()</code> method is used to compare to the items
- * in this stack.
- *
- * @param object the object to be searched for
- * @return the 1-based depth into the stack of the object, or -1 if not found
- */
- public int search(E object) {
- int i = size() - 1; // Current index
- int n = 1; // Current distance
- while (i >= 0) {
- Object current = get(i);
- if ((object == null && current == null) ||
- (object != null && object.equals(current))) {
- return n;
- }
- i--;
- n++;
- }
- return -1;
- }
-
-
}
* includes the name of the attribute in this notification</li>
* </ul>
*/
+ @Override
public boolean isNotificationEnabled(Notification notification) {
if (notification == null)
* @exception ReflectionException if a Java reflection exception
* occurs when invoking the getter
*/
+ @Override
public Object getAttribute(String name)
throws AttributeNotFoundException, MBeanException,
ReflectionException {
*
* @param names Names of the requested attributes
*/
+ @Override
public AttributeList getAttributes(String names[]) {
// Validate the input parameters
/**
* Return the <code>MBeanInfo</code> object for this MBean.
*/
+ @Override
public MBeanInfo getMBeanInfo() {
return managedBean.getMBeanInfo();
}
* @exception ReflectioNException if a Java reflection exception
* occurs when invoking a method
*/
+ @Override
public Object invoke(String name, Object params[], String signature[])
throws MBeanException, ReflectionException
{
* @exception ReflectionException if a Java reflection exception
* occurs when invoking the getter
*/
+ @Override
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException, MBeanException,
ReflectionException
*
* @return The list of attributes that were set and their new values
*/
+ @Override
public AttributeList setAttributes(AttributeList attributes) {
AttributeList response = new AttributeList();
*
* @exception IllegalArgumentException if the listener parameter is null
*/
+ @Override
public void addAttributeChangeNotificationListener
(NotificationListener listener, String name, Object handback)
throws IllegalArgumentException {
* @exception ListenerNotFoundException if this listener is not
* registered in the MBean
*/
+ @Override
public void removeAttributeChangeNotificationListener
(NotificationListener listener, String name)
throws ListenerNotFoundException {
* @exception RuntimeOperationsException wraps IllegalArgumentException
* when the specified notification is <code>null</code> or invalid
*/
+ @Override
public void sendAttributeChangeNotification
(AttributeChangeNotification notification)
throws MBeanException, RuntimeOperationsException {
* @exception RuntimeOperationsException wraps IllegalArgumentException
* when the specified notification is <code>null</code> or invalid
*/
+ @Override
public void sendAttributeChangeNotification
(Attribute oldValue, Attribute newValue)
throws MBeanException, RuntimeOperationsException {
* @exception RuntimeOperationsException wraps IllegalArgumentException
* when the specified notification is <code>null</code> or invalid
*/
+ @Override
public void sendNotification(Notification notification)
throws MBeanException, RuntimeOperationsException {
* @exception RuntimeOperationsException wraps IllegalArgumentException
* when the specified notification is <code>null</code> or invalid
*/
+ @Override
public void sendNotification(String message)
throws MBeanException, RuntimeOperationsException {
*
* @exception IllegalArgumentException if the listener parameter is null
*/
+ @Override
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
* Return an <code>MBeanNotificationInfo</code> object describing the
* notifications sent by this MBean.
*/
+ @Override
public MBeanNotificationInfo[] getNotificationInfo() {
// Acquire the set of application notifications
* @exception ListenerNotFoundException if this listener is not
* registered in the MBean
*/
+ @Override
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {
// XXX We can add some method patterns here- like setName() and
// setDomain() for code that doesn't implement the Registration
+ @Override
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws Exception
return oname;
}
+ @Override
public void postRegister(Boolean registrationDone) {
if( resource instanceof MBeanRegistration ) {
((MBeanRegistration)resource).postRegister(registrationDone);
}
}
+ @Override
public void preDeregister() throws Exception {
if( resource instanceof MBeanRegistration ) {
((MBeanRegistration)resource).preDeregister();
}
}
+ @Override
public void postDeregister() {
if( resource instanceof MBeanRegistration ) {
((MBeanRegistration)resource).postDeregister();
*
* @exception IllegalArgumentException if the listener parameter is null
*/
+ @Override
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
* Return an <code>MBeanNotificationInfo</code> object describing the
* notifications sent by this MBean.
*/
+ @Override
public MBeanNotificationInfo[] getNotificationInfo() {
return (new MBeanNotificationInfo[0]);
* @exception ListenerNotFoundException if this listener is not
* registered in the MBean
*/
+ @Override
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException {