01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.lenya.config.impl;
20:
21: import org.apache.lenya.config.core.Configuration;
22: import org.apache.lenya.config.core.Parameter;
23:
24: /**
25: * Server Parameter web.app.server
26: */
27: public class ServerParameter extends Parameter {
28:
29: /**
30: *
31: */
32: public boolean test(String value) {
33: if (value.equals("Jetty") || value.equals("Tomcat")
34: || value.equals("WLS")) {
35: return true;
36: }
37: return false;
38: }
39:
40: /**
41: *
42: */
43: public String[] getAvailableValues() {
44: String[] aValues = new String[3];
45: aValues[0] = "Jetty";
46: aValues[1] = "Tomcat";
47: aValues[2] = "WLS";
48: return aValues;
49: }
50:
51: /**
52: *
53: */
54: public Parameter[] getSubsequentParameters(String value,
55: Configuration config) {
56: if (value.equals("Jetty")) {
57: Parameter[] p = new Parameter[2];
58: p[0] = config.getParameter("web.app.server.jetty.port");
59: p[1] = config
60: .getParameter("web.app.server.jetty.admin.port");
61: return p;
62: } else if (value.equals("Tomcat")) {
63: Parameter[] p = new Parameter[4];
64: p[0] = config.getParameter("tomcat.home.dir");
65: p[1] = config.getParameter("tomcat.webapps.dir");
66: p[2] = config.getParameter("tomcat.cache.dir");
67: p[3] = config.getParameter("tomcat.endorsed.dir");
68: return p;
69: }
70: return null;
71: }
72: }
|