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: */package org.apache.geronimo.tomcat.cluster;
17:
18: import org.apache.geronimo.system.serverinfo.ServerInfo;
19: import org.apache.geronimo.gbean.GBeanInfo;
20: import org.apache.geronimo.gbean.GBeanInfoBuilder;
21: import org.apache.commons.logging.Log;
22: import org.apache.commons.logging.LogFactory;
23: import org.apache.catalina.ha.deploy.FarmWarDeployer;
24:
25: public class FarmWarDeployerGBean extends ClusterDeployerGBean {
26:
27: private static final Log log = LogFactory
28: .getLog(FarmWarDeployerGBean.class);
29:
30: private final ServerInfo serverInfo;
31:
32: public FarmWarDeployerGBean() {
33: serverInfo = null;
34: }
35:
36: public FarmWarDeployerGBean(String tempDir, String deployDir,
37: String watchDir, boolean watchEnabled,
38: int processDeployFrequency, ServerInfo serverInfo)
39: throws Exception {
40:
41: super ("org.apache.catalina.cluster.deploy.FarmWarDeployer",
42: null);
43:
44: if (serverInfo == null) {
45: throw new IllegalArgumentException(
46: "serverInfo cannot be null.");
47: }
48:
49: this .serverInfo = serverInfo;
50:
51: FarmWarDeployer farm = (FarmWarDeployer) deployer;
52:
53: if (tempDir == null)
54: tempDir = "var/catalina/war-temp";
55: farm.setTempDir(serverInfo.resolvePath(tempDir));
56:
57: if (deployDir == null)
58: deployDir = "var/catalina/war-deploy";
59: farm.setDeployDir(serverInfo.resolvePath(deployDir));
60:
61: if (watchDir == null)
62: watchDir = "var/catalina/war-listen";
63: farm.setWatchDir(serverInfo.resolvePath(watchDir));
64:
65: farm.setWatchEnabled(watchEnabled);
66:
67: farm.setProcessDeployFrequency(processDeployFrequency);
68:
69: }
70:
71: public static final GBeanInfo GBEAN_INFO;
72:
73: static {
74: GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(
75: "ClusterDeployer", FarmWarDeployerGBean.class,
76: ClusterDeployerGBean.GBEAN_INFO);
77:
78: infoFactory.addAttribute("tempDir", String.class, true);
79: infoFactory.addAttribute("deployDir", String.class, true);
80: infoFactory.addAttribute("watchDir", String.class, true);
81: infoFactory.addAttribute("watchEnabled", boolean.class, true);
82: infoFactory.addAttribute("processDeployFrequency", int.class,
83: true);
84: infoFactory.addReference("ServerInfo", ServerInfo.class,
85: "GBean");
86: infoFactory.addOperation("getInternalObject", "Object");
87: infoFactory.setConstructor(new String[] { "tempDir",
88: "deployDir", "watchDir", "watchEnabled",
89: "processDeployFrequency", "ServerInfo" });
90: GBEAN_INFO = infoFactory.getBeanInfo();
91: }
92:
93: public static GBeanInfo getGBeanInfo() {
94: return GBEAN_INFO;
95: }
96: }
|