001: /*
002: * ========================================================================
003: *
004: * Copyright 2003-2005 The Apache Software Foundation.
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: *
018: * ========================================================================
019: */
020: package org.apache.cactus.integration.ant.container;
021:
022: import java.io.File;
023:
024: import org.apache.cactus.integration.ant.deployment.DeployableFile;
025: import org.apache.cactus.integration.ant.util.AntTaskFactory;
026: import org.apache.commons.logging.Log;
027: import org.apache.tools.ant.types.Path;
028: import org.apache.tools.ant.types.Environment.Variable;
029:
030: /**
031: * Interface for classes that can be used as nested elements in the
032: * <code><containers></code> element of the <code><cactus></code>
033: * task.
034: *
035: * @version $Id: Container.java 239130 2005-01-29 15:49:18Z vmassol $
036: */
037: public interface Container {
038: /**
039: * Returns a displayable name of the container for logging purposes.
040: *
041: * @return The container name
042: */
043: String getName();
044:
045: /**
046: * Returns the port to which the container should listen.
047: *
048: * @return The port
049: */
050: int getPort();
051:
052: /**
053: * @return the context that the webapp will load on, null if the client
054: * should determine on it's own
055: */
056: String getTestContext();
057:
058: /**
059: * @return the time to wait after the container has been started up.
060: */
061: long getStartUpWait();
062:
063: /**
064: * Returns the value of the 'todir' attribute.
065: *
066: * @return The output directory
067: */
068: File getToDir();
069:
070: /**
071: * @return the list of system properties that will be set in the container
072: * JVM
073: */
074: Variable[] getSystemProperties();
075:
076: /**
077: * Subclasses should implement this method to perform any initialization
078: * that may be necessary. This method is called before any of the accessors
079: * or the methods {@link AbstractContainer#startUp} and
080: * {@link AbstractContainer#shutDown} are called, but after all attributes
081: * have been set.
082: */
083: void init();
084:
085: /**
086: * Returns whether the container element is enabled, which is determined by
087: * the evaluation of the if- and unless conditions
088: *
089: * @return <code>true</code> if the container is enabled
090: */
091: boolean isEnabled();
092:
093: /**
094: * Returns whether a specific test case is to be excluded from being run in
095: * the container.
096: *
097: * @param theTestName The fully qualified name of the test fixture class
098: * @return <code>true</code> if the test should be excluded, otherwise
099: * <code>false</code>
100: */
101: boolean isExcluded(String theTestName);
102:
103: /**
104: * Sets the factory to use for creating Ant tasks.
105: *
106: * @param theFactory The factory to use for creating Ant tasks
107: */
108: void setAntTaskFactory(AntTaskFactory theFactory);
109:
110: /**
111: * Sets the log which the implementation should use.
112: *
113: * @param theLog The log to set
114: */
115: void setLog(Log theLog);
116:
117: /**
118: * Sets the file that should be deployed to the container. This can be
119: * either a WAR or an EAR file, depending on the capabilities of the
120: * container.
121: *
122: * @param theDeployableFile The file to deploy
123: */
124: void setDeployableFile(DeployableFile theDeployableFile);
125:
126: /**
127: * Sets the system properties that will be passed to the JVM in which the
128: * server will execute.
129: *
130: * @param theProperties the list of system properties to set in the
131: * container JVM
132: */
133: void setSystemProperties(Variable[] theProperties);
134:
135: /**
136: * Sets additional classpath entries that will be added to the container
137: * classpath used to start the containers.
138: *
139: * @param theClasspath the container classpath entries to add
140: * @since Cactus 1.6
141: */
142: void setContainerClasspath(Path theClasspath);
143:
144: /**
145: * @return additional container classpath entries
146: * @since Cactus 1.6
147: */
148: Path getContainerClasspath();
149:
150: /**
151: * Subclasses must implement this method to perform the actual task of
152: * starting up the container.
153: */
154: void startUp();
155:
156: /**
157: * Subclasses must implement this method to perform the actual task of
158: * shutting down the container.
159: */
160: void shutDown();
161:
162: /**
163: * Returns the server (name or IP) to where the container is living.
164: *
165: * @return The server
166: */
167: String getServer();
168:
169: /**
170: * Returns the protocol, that should be used for communication to the
171: * container.
172: *
173: * @return The protocol
174: */
175: String getProtocol();
176:
177: /**
178: * @return the base URL of the container, including protocol, name and port
179: */
180: String getBaseURL();
181: }
|