You are viewing a plain text version of this content. The canonical link for it is here.
Posted to lokahi-commits@incubator.apache.org by to...@apache.org on 2006/07/24 17:18:29 UTC

svn commit: r425123 - in /incubator/lokahi/lokahi/trunk: conf/ docs/ src/java/org/apache/lokahi/core/agent/callable/context/ src/java/org/apache/lokahi/core/agent/task/ src/java/org/apache/lokahi/core/agent/util/ src/java/org/apache/lokahi/modjk/ src/j...

Author: toback
Date: Mon Jul 24 10:18:28 2006
New Revision: 425123

URL: http://svn.apache.org/viewvc?rev=425123&view=rev
Log:
Set default for apache httpd config file name to the default shipping name.

Fixed httpd configtest.

fixed context redeploy.


Added:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/SessionsOfContextCallable.java   (with props)
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/SessionsOfContextTask.java   (with props)
Modified:
    incubator/lokahi/lokahi/trunk/conf/lokahi.properties
    incubator/lokahi/lokahi/trunk/docs/README.TXT
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/HttpsdctlTask.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/CommandLineProcess.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/modjk/WorkersPropertiesFile.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java

Modified: incubator/lokahi/lokahi/trunk/conf/lokahi.properties
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/conf/lokahi.properties?rev=425123&r1=425122&r2=425123&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/conf/lokahi.properties (original)
+++ incubator/lokahi/lokahi/trunk/conf/lokahi.properties Mon Jul 24 10:18:28 2006
@@ -21,7 +21,7 @@
 SchemaOwner=tmc
 DatabasePropertiesFile=dbpool.props
 LogActivity=yes
-ApacheConfFile=httpsd.conf
+ApacheConfFile=httpd.conf
 WorkersProperties=workers.properties
 TimeoutForURLThread=5
 TimeoutForContextOp=20

Modified: incubator/lokahi/lokahi/trunk/docs/README.TXT
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/docs/README.TXT?rev=425123&r1=425122&r2=425123&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/docs/README.TXT (original)
+++ incubator/lokahi/lokahi/trunk/docs/README.TXT Mon Jul 24 10:18:28 2006
@@ -8,7 +8,7 @@
    SECTION I: Download Source Code
 
    1. Untar the tarball, or take the latest src from svn @
-      http://svn.apache.org/repos/asf/incubator/lokahi/lokahi/trunk/
+      https://svn.apache.org/repos/asf/incubator/lokahi/lokahi/trunk/
    2. Change directory (cd) to the home directory of lokahi.
 
    SECTION II: Build Software
@@ -77,7 +77,7 @@
 
    SECTION IV: Agent Install
 
-   1.	copy the files in $LOKAHI_SOURCE/build/agent to a directory on each server.
+   1.	copy the files in $LOKAHI_SOURCE/build/$APP_NAME/agent to a directory on each server.
    2.	start the agent by running:
       > $JAVA_HOME/bin/java -classpath  $JAVA_HOME/lib/tools.jar:$AGENT_HOME/axis.jar:$AGENT_HOME/commons-dbcp-1.2.1.jar:$AGENT_HOME/commons-discovery-0.2.jar:$AGENT_HOME/commons-logging.jar:$AGENT_HOME/commons-pool-1.2.jar:$AGENT_HOME/derby.jar:$AGENT_HOME/derbyclient.jar:$AGENT_HOME/jaxrpc.jar:$AGENT_HOME/jdom.jar:$AGENT_HOME/log4j-1.2.13.jar:$AGENT_HOME/lokahi.jar:$AGENT_HOME/saaj.jar:$AGENT_HOME/wsdl4j-1.5.1.jar org.apache.lokahi.core.agent.TMCAgent start
 

Added: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/SessionsOfContextCallable.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/SessionsOfContextCallable.java?rev=425123&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/SessionsOfContextCallable.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/SessionsOfContextCallable.java Mon Jul 24 10:18:28 2006
@@ -0,0 +1,45 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+* 
+*   http://www.apache.org/licenses/LICENSE-2.0
+* 
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.apache.lokahi.core.agent.callable.context;
+
+import org.apache.lokahi.core.agent.interfaces.AgentTomcat;
+
+import java.util.concurrent.Callable;
+
+/**
+ * @author Stephen Toback
+ * @version $Id$
+ */
+public class SessionsOfContextCallable implements Callable<String> {
+  private AgentTomcat tc;
+  private String context;
+  
+  public SessionsOfContextCallable(AgentTomcat tc, String context) {
+    this.tc = tc;
+    this.context = context;
+  }
+
+  public String call() throws Exception {
+    return tc.getSessions(context);
+  }
+}
+
+
+
+

Propchange: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/SessionsOfContextCallable.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/HttpsdctlTask.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/HttpsdctlTask.java?rev=425123&r1=425122&r2=425123&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/HttpsdctlTask.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/HttpsdctlTask.java Mon Jul 24 10:18:28 2006
@@ -6,9 +6,9 @@
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
-* 
+*
 *   http://www.apache.org/licenses/LICENSE-2.0
-* 
+*
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -34,7 +34,7 @@
 public class HttpsdctlTask extends AbstractAgentTask<String> {
 
   HttpsdctlTask(int jobId, TaskType t, String apacheRoot, String command) {
-    this.task = new FutureTask<String>(new CommandLineProcess(PropertiesFile.getConstantValue("path.to.sudo"), apacheRoot.trim() + "/bin/apachectl", "-k", command));
+    this.task = new FutureTask<String>(new CommandLineProcess(PropertiesFile.getConstantValue("path.to.sudo"), apacheRoot.trim() + "/bin/apachectl", command));
     this.setJobId(jobId);
     this.setType(t);
   }

Added: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/SessionsOfContextTask.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/SessionsOfContextTask.java?rev=425123&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/SessionsOfContextTask.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/SessionsOfContextTask.java Mon Jul 24 10:18:28 2006
@@ -0,0 +1,61 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+* 
+*   http://www.apache.org/licenses/LICENSE-2.0
+* 
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.apache.lokahi.core.agent.task;
+
+import org.apache.lokahi.core.agent.AbstractAgentTask;
+import org.apache.lokahi.core.agent.callable.context.SessionsOfContextCallable;
+import org.apache.lokahi.core.agent.dao.AgentJob;
+import org.apache.lokahi.core.agent.dao.TaskType;
+import org.apache.lokahi.core.agent.interfaces.AgentTomcat;
+import org.apache.lokahi.core.agent.util.ProcessFactory;
+import org.apache.lokahi.core.agent.util.TMCTaskException;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.FutureTask;
+
+/**
+ * @author Stephen Toback
+ * @version $Id$
+ */
+public class SessionsOfContextTask extends AbstractAgentTask<String> {
+
+  public SessionsOfContextTask(int jobId, TaskType t, AgentTomcat tc, String contextName) {
+	this.task = new FutureTask<String>(new SessionsOfContextCallable(tc, contextName));
+	this.setJobId(jobId);
+	this.setType(t);
+  }
+
+  public SessionsOfContextTask(AgentJob j) {
+    AgentTomcat tc = ProcessFactory.getTomcatByHttpPort(j.getOptions()[0]);
+    this.task = new FutureTask<String>(new SessionsOfContextCallable(tc,j.getOptions()[1]));
+    this.setJobId(j.getPk());
+    this.setType(j.getType());
+  }
+
+  public SessionsOfContextTask() {
+  }
+
+  public String getResult() throws TMCTaskException, ExecutionException, InterruptedException {
+	 return task.get();
+  }
+}
+
+
+
+

Propchange: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/SessionsOfContextTask.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/CommandLineProcess.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/CommandLineProcess.java?rev=425123&r1=425122&r2=425123&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/CommandLineProcess.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/CommandLineProcess.java Mon Jul 24 10:18:28 2006
@@ -39,15 +39,15 @@
   private InputStream is;
 
   public CommandLineProcess(String... command) {
+	StringBuilder sb = new StringBuilder();
     if (logger.isDebugEnabled()) {
-      StringBuilder sb = new StringBuilder();
       for (String s : command) {
         sb.append(s);
         sb.append(' ');
       }
       logger.debug("command=" + sb.toString());
     }
-    pb = new ProcessBuilder(command);
+    pb = new ProcessBuilder(sb.toString().trim().replaceAll("  +"," ").split(" "));
     pb.redirectErrorStream(true);
   }
 

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/modjk/WorkersPropertiesFile.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/modjk/WorkersPropertiesFile.java?rev=425123&r1=425122&r2=425123&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/modjk/WorkersPropertiesFile.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/modjk/WorkersPropertiesFile.java Mon Jul 24 10:18:28 2006
@@ -6,9 +6,9 @@
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
-* 
+*
 *   http://www.apache.org/licenses/LICENSE-2.0
-* 
+*
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -47,7 +47,7 @@
   public String build() throws SQLException {
     String ret = null;
     StringBuffer props = new StringBuffer();
-    props.append("### define your current Tomcat Home\nworkers.tomcat_home=/usr/local/covalent/tomcat4.0.4\n\n### should match current JDK being used\nworkers.java_home=/usr/local/java/IBMjava1.4.0_00\n\n### Set to \"/\" for linux\nps=/\n");
+    props.append("### define your current Tomcat Home\nworkers.tomcat_home=/usr/local/tomcat4.0.4\n\n### should match current JDK being used\nworkers.java_home=/usr/local/java/IBMjava1.4.0_00\n\n### Set to \"/\" for linux\nps=/\n");
     StringBuffer workers = new StringBuffer();
     Instance i = aw.getHardware().getInstance();
     Collection<HostingPool> c = HostingPool.getHostingPools(aw, true);
@@ -67,7 +67,7 @@
       props.append(workerList);
       props.append('\n');
       props.append(workers.append('\n'));
-      props.insert(0, "#This file automatically generated by TMC DO NOT MODIFY\n");
+      props.insert(0, "#This file automatically generated by Lokahi DO NOT MODIFY\n");
       ret = props.toString();
     }
     return ret;

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java?rev=425123&r1=425122&r2=425123&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java Mon Jul 24 10:18:28 2006
@@ -6,9 +6,9 @@
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
-* 
+*
 *   http://www.apache.org/licenses/LICENSE-2.0
-* 
+*
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -142,9 +142,11 @@
   }
 
   void redeployContext(JobPool jobPool, TomcatWorker tw, Project p, User u, TomcatContext tc) throws SQLException, IOException, AuthorizationException {
-    String options = Integer.toString(tw.getTomcat().getHttpPort())
+      String options = Integer.toString(tw.getTomcat().getHttpPort())
         + PropertiesFile.getConstantValue("agent.delim.options")
-        + tc.getContextName();
+        + tc.getContextName()
+        + PropertiesFile.getConstantValue("agent.delim.options")
+        + tc.getDocBase();
     this.function(tw, jobPool, options, p, u, "RedeployContext", tc);
   }