KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > tomcat50 > TerracottaPipeline


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.tomcat50;
5
6 import org.apache.catalina.Container;
7 import org.apache.catalina.Valve;
8 import org.apache.catalina.core.StandardPipeline;
9
10 import com.tc.tomcat50.session.SessionValve50;
11
12 public class TerracottaPipeline extends StandardPipeline {
13
14   private final SessionValve50 tcValve;
15
16   public TerracottaPipeline(Container container) {
17     super(container);
18     this.tcValve = new SessionValve50();
19     super.addValve(this.tcValve);
20   }
21
22   public void removeValve(Valve valve) {
23     if (valve == tcValve) { throw new IllegalArgumentException JavaDoc("Cannot remove the terracotta session valve"); }
24     super.removeValve(valve);
25   }
26
27   public Valve[] getValves() {
28     Valve[] rv = super.getValves();
29     if (super.valves == rv) {
30       // make defensive copy
31
rv = (Valve[]) rv.clone();
32     }
33     return rv;
34   }
35
36 }
37
Popular Tags