Skip to content

Commit

Permalink
Refactor Catalina interfaces to make wider use of the Contained inter…
Browse files Browse the repository at this point in the history
…face and reduce duplication.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1771257 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Nov 25, 2016
1 parent 67af44c commit 2156b71
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 70 deletions.
26 changes: 4 additions & 22 deletions java/org/apache/catalina/Cluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.catalina;

/**
Expand All @@ -29,9 +28,7 @@
* @author Bip Thelin
* @author Remy Maucherat
*/
public interface Cluster {

// ------------------------------------------------------------- Properties
public interface Cluster extends Contained {

/**
* Return the name of the cluster that this Server is currently
Expand All @@ -41,6 +38,7 @@ public interface Cluster {
*/
public String getClusterName();


/**
* Set the name of the cluster to join, if no cluster with
* this name is present create one.
Expand All @@ -49,22 +47,6 @@ public interface Cluster {
*/
public void setClusterName(String clusterName);

/**
* Set the Container associated with our Cluster
*
* @param container The Container to use
*/
public void setContainer(Container container);

/**
* Get the Container associated with our Cluster
*
* @return The Container associated with our Cluster
*/
public Container getContainer();


// --------------------------------------------------------- Public Methods

/**
* Create a new manager which will use this cluster to replicate its
Expand All @@ -77,6 +59,7 @@ public interface Cluster {
*/
public Manager createManager(String name);


/**
* Register a manager with the cluster. If the cluster is not responsible
* for creating a manager, then the container will at least notify the
Expand All @@ -85,14 +68,13 @@ public interface Cluster {
*/
public void registerManager(Manager manager);


/**
* Removes a manager from the cluster
* @param manager Manager
*/
public void removeManager(Manager manager);

// --------------------------------------------------------- Cluster Wide Deployments


/**
* Execute a periodic task, such as reloading, etc. This method will be
Expand Down
28 changes: 2 additions & 26 deletions java/org/apache/catalina/Pipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/


package org.apache.catalina;


/**
* <p>Interface describing a collection of Valves that should be executed
* in sequence when the <code>invoke()</code> method is invoked. It is
Expand All @@ -37,11 +34,7 @@
* @author Craig R. McClanahan
* @author Peter Donald
*/
public interface Pipeline {


// ------------------------------------------------------------- Properties

public interface Pipeline extends Contained {

/**
* @return the Valve instance that has been distinguished as the basic
Expand All @@ -65,9 +58,6 @@ public interface Pipeline {
public void setBasic(Valve valve);


// --------------------------------------------------------- Public Methods


/**
* <p>Add a new Valve to the end of the pipeline associated with this
* Container. Prior to adding the Valve, the Valve's
Expand Down Expand Up @@ -123,24 +113,10 @@ public interface Pipeline {
*/
public Valve getFirst();


/**
* Returns true if all the valves in this pipeline support async, false otherwise
* @return true if all the valves in this pipeline support async, false otherwise
*/
public boolean isAsyncSupported();


/**
* @return the Container with which this Pipeline is associated.
*/
public Container getContainer();


/**
* Set the Container with which this Pipeline is associated.
*
* @param container The new associated container
*/
public void setContainer(Container container);

}
22 changes: 2 additions & 20 deletions java/org/apache/catalina/Realm.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,14 @@
*
* @author Craig R. McClanahan
*/
public interface Realm {


// ------------------------------------------------------------- Properties

/**
* @return the Container with which this Realm has been associated.
*/
public Container getContainer();


/**
* Set the Container with which this Realm has been associated.
*
* @param container The associated Container
*/
public void setContainer(Container container);

public interface Realm extends Contained {

/**
* @return the CredentialHandler configured for this Realm.
*/
public CredentialHandler getCredentialHandler();


/**
* Set the CredentialHandler to be used by this Realm.
*
Expand All @@ -67,8 +51,6 @@ public interface Realm {
public void setCredentialHandler(CredentialHandler credentialHandler);


// --------------------------------------------------------- Public Methods

/**
* Add a property change listener to this component.
*
Expand Down
3 changes: 1 addition & 2 deletions java/org/apache/catalina/core/StandardPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
* @author Craig R. McClanahan
*/

public class StandardPipeline extends LifecycleBase
implements Pipeline, Contained {
public class StandardPipeline extends LifecycleBase implements Pipeline {

private static final Log log = LogFactory.getLog(StandardPipeline.class);

Expand Down
4 changes: 4 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
<code>HttpServletRequest#getRequestURL()</code> to reduce duplicate
code. Duplicate code identified by the Simian tool. (markt)
</scode>
<scode>
Refactor Catalina interfaces to make wider use of the
<code>Contained</code> interface and reduce duplication. (markt)
</scode>
</changelog>
</subsection>
<subsection name="Coyote">
Expand Down

0 comments on commit 2156b71

Please sign in to comment.