incubator-lokahi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tob...@apache.org
Subject svn commit: r421955 - in /incubator/lokahi/lokahi/trunk/src: java/org/apache/lokahi/core/agent/callable/context/ java/org/apache/lokahi/core/agent/jmx/ java/org/apache/lokahi/core/agent/task/ java/org/apache/lokahi/core/agent/util/ java/org/apache/loka...
Date Fri, 14 Jul 2006 17:19:56 GMT
Author: toback
Date: Fri Jul 14 10:19:54 2006
New Revision: 421955

URL: http://svn.apache.org/viewvc?rev=421955&view=rev
Log:
Minor patches to allow hosting pools to exist without tomcat pools.

Added missing install and update context for the agent.

fixed the jmx jvm control to auto find all jmx enabled jvms.


Added:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/InstallContextCallable.java   (with props)
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/UndeployContextCallable.java   (with props)
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/InstallContextTask.java   (with props)
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/UndeployContextTask.java   (with props)
Modified:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXConnect.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/ProcessFactory.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/pool/HostingPoolModel.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HostingPoolAction.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TemplateAction.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/ApacheModel.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorker.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorkerModel.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/gui/www/ApacheAction.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/TomcatModel.java
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/ContextAction.java
    incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/confirm.vm
    incubator/lokahi/lokahi/trunk/src/www/Apache/Server/confirm.vm
    incubator/lokahi/lokahi/trunk/src/www/Core/Server/confirm.vm
    incubator/lokahi/lokahi/trunk/src/www/Tomcat/Entity/view.vm
    incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/confirm.vm
    incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/update.vm
    incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/confirm.vm
    incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/update.vm

Added: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/InstallContextCallable.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/InstallContextCallable.java?rev=421955&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/InstallContextCallable.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/InstallContextCallable.java Fri Jul 14 10:19:54 2006
@@ -0,0 +1,44 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed 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 InstallContextCallable implements Callable<Boolean> {
+  private AgentTomcat tc;
+  private String contextName;
+  private String docBase;
+
+  public InstallContextCallable(AgentTomcat tc, String contextName, String docBase) {
+    this.tc = tc;
+    this.contextName = contextName;
+    this.docBase = docBase;
+  }
+
+  public Boolean call() throws Exception {
+    return tc.addContext(contextName, docBase);
+  }
+
+}
+
+
+

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

Added: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/UndeployContextCallable.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/UndeployContextCallable.java?rev=421955&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/UndeployContextCallable.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/callable/context/UndeployContextCallable.java Fri Jul 14 10:19:54 2006
@@ -0,0 +1,44 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed 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 UndeployContextCallable implements Callable<Boolean> {
+  private AgentTomcat tc;
+  private String contextName;
+  private String docBase;
+
+  public UndeployContextCallable(AgentTomcat tc, String contextName, String docBase) {
+    this.tc = tc;
+    this.contextName = contextName;
+    this.docBase = docBase;
+  }
+
+  public Boolean call() throws Exception {
+    return tc.removeContext(contextName);
+  }
+
+}
+
+
+

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

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXConnect.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXConnect.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXConnect.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXConnect.java Fri Jul 14 10:19:54 2006
@@ -215,17 +215,19 @@
     int httpPort = Integer.parseInt(args[0]);
     String function = args[1];
     AgentTask task = null;
-    AgentTomcat t = null;
     Class c = Class.forName("tmc.agent.task." + function + "Task");
     Constructor[] cs = c.getConstructors();
+    AgentTomcat t = null;
     if (cs.length == 1) {
+
       String name = "Agent" + (httpPort - 2);
-      ArrayList<JMXVirtualMachine> jmxvm = getAllJMXVirtualMachines();
+      ArrayList<JMXVirtualMachine> jmxvm = JMXConnect.getAllJMXVirtualMachines();
       for (JMXVirtualMachine jvm : jmxvm) {
         if (jvm instanceof JMXTomcat && name.equals(jvm.getVmName())) {
           t = (JMXTomcat) jvm;
         }
       }
+
       Constructor cons = cs[0];
       Class[] params = cons.getParameterTypes();
       if (t != null) {

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java Fri Jul 14 10:19:54 2006
@@ -31,6 +31,7 @@
 import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.ArrayList;
 
 /**
  * @author Stephen Toback
@@ -118,6 +119,18 @@
     this.setStartClass(command);
     this.setJavaOptions(args);
     buildVmName();
+  }
+
+  public static JMXTomcat discover(int httpPort){
+      JMXTomcat t = null;
+      String name = "Agent" + (httpPort - 2);
+      ArrayList<JMXVirtualMachine> jmxvm = JMXConnect.getAllJMXVirtualMachines();
+      for (JMXVirtualMachine jvm : jmxvm) {
+        if (jvm instanceof JMXTomcat && name.equals(jvm.getVmName())) {
+          t = (JMXTomcat) jvm;
+        }
+      }
+    return t;
   }
 
   protected JMXTomcat(int pid) {//todo rework this

Added: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/InstallContextTask.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/InstallContextTask.java?rev=421955&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/InstallContextTask.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/InstallContextTask.java Fri Jul 14 10:19:54 2006
@@ -0,0 +1,61 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed 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.InstallContextCallable;
+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 InstallContextTask extends AbstractAgentTask<Boolean> {
+
+  /** @deprecated  */
+  public InstallContextTask(int jobId, TaskType t, AgentTomcat tc, String contextName, String docBase) {
+    this.task = new FutureTask<Boolean>(new InstallContextCallable(tc, contextName, docBase));
+    this.setJobId(jobId);
+    this.setType(t);
+  }
+
+  public InstallContextTask(AgentJob j) {
+    AgentTomcat tc = ProcessFactory.getTomcatByHttpPort(j.getOptions()[0]);
+    this.task = new FutureTask<Boolean>(new InstallContextCallable(tc, j.getOptions()[1], j.getOptions()[2]));
+    this.setJobId(j.getPk());
+    this.setType(j.getType());
+  }
+
+  public InstallContextTask() {
+  }
+
+  public String getResult() throws TMCTaskException, ExecutionException, InterruptedException {
+    if (!task.get()) throw new TMCTaskException("Error in context install");
+    return "Context installation was sucessful";
+  }
+
+}
+
+
+
+

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

Added: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/UndeployContextTask.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/UndeployContextTask.java?rev=421955&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/UndeployContextTask.java (added)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/task/UndeployContextTask.java Fri Jul 14 10:19:54 2006
@@ -0,0 +1,61 @@
+/*
+* Copyright 2006  The Apache Software Foundation
+*
+* Licensed 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.UndeployContextCallable;
+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 UndeployContextTask extends AbstractAgentTask<Boolean> {
+
+  /** @deprecated  */
+  public UndeployContextTask(int jobId, TaskType t, AgentTomcat tc, String contextName, String docBase) {
+    this.task = new FutureTask<Boolean>(new UndeployContextCallable(tc, contextName, docBase));
+    this.setJobId(jobId);
+    this.setType(t);
+  }
+
+  public UndeployContextTask(AgentJob j) {
+    AgentTomcat tc = ProcessFactory.getTomcatByHttpPort(j.getOptions()[0]);
+    this.task = new FutureTask<Boolean>(new UndeployContextCallable(tc, j.getOptions()[1], j.getOptions()[2]));
+    this.setJobId(j.getPk());
+    this.setType(j.getType());
+  }
+
+  public UndeployContextTask() {
+  }
+
+  public String getResult() throws TMCTaskException, ExecutionException, InterruptedException {
+    if (!task.get()) throw new TMCTaskException("Error in context undeploy");
+    return "Context undeploy was sucessful";
+  }
+
+}
+
+
+
+

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

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/ProcessFactory.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/ProcessFactory.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/ProcessFactory.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/util/ProcessFactory.java Fri Jul 14 10:19:54 2006
@@ -99,13 +99,9 @@
   }
 
   public static AgentTomcat getTomcatByHttpPort(int port) {
-    return getTomcatByHttpPort(Integer.toString(port));
-  }
-
-  public static AgentTomcat getTomcatByHttpPort(String port) {
     AgentTomcat t;
     if ("yes".equalsIgnoreCase(tomcatProps.getProperty(port + ".tomcat.param.jmx"))) {
-      t = new JMXTomcat();
+      t = JMXTomcat.discover(port);
     } else {
       t = new HttpTomcat();
     }
@@ -117,6 +113,10 @@
     t.setStandardOutLog(tomcatProps.getProperty(port + ".java.param.standard.out.log"));
 
     return t;
+  }
+
+  public static AgentTomcat getTomcatByHttpPort(String port) {
+    return getTomcatByHttpPort(Integer.parseInt(port));
   }
 }
 

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/pool/HostingPoolModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/pool/HostingPoolModel.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/pool/HostingPoolModel.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/api/pool/HostingPoolModel.java Fri Jul 14 10:19:54 2006
@@ -163,52 +163,62 @@
     this.buildDeploy(null, hp, jobPool, Function.getFunction("DeployApacheConfig"), u);
   }
 
-  public void updateTomcat(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException {
-    TomcatPoolModel tpm = new TomcatPoolModel();
+  public void updateTomcat(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
+	if (hp.getTomcatPool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Tomcat Pool");
+	TomcatPoolModel tpm = new TomcatPoolModel();
     tpm.updateTomcat(u, p, hp.getTomcatPool());
   }
 
-  public void restartTomcat(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException {
-    TomcatPoolModel tpm = new TomcatPoolModel();
+  public void restartTomcat(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
+    if (hp.getTomcatPool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Tomcat Pool");
+	TomcatPoolModel tpm = new TomcatPoolModel();
     tpm.restartTomcat(u, p, hp.getTomcatPool());
   }
 
-  public void startTomcat(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException {
-    TomcatPoolModel tpm = new TomcatPoolModel();
+  public void startTomcat(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
+	if (hp.getTomcatPool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Tomcat Pool");
+	TomcatPoolModel tpm = new TomcatPoolModel();
     tpm.startTomcat(u, p, hp.getTomcatPool());
   }
 
-  public void stopTomcat(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException {
-    TomcatPoolModel tpm = new TomcatPoolModel();
+  public void stopTomcat(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
+	if (hp.getTomcatPool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Tomcat Pool");
+	TomcatPoolModel tpm = new TomcatPoolModel();
     tpm.stopTomcat(u, p, hp.getTomcatPool());
   }
 
   public void updateApache(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
-    ApachePoolModel apm = new ApachePoolModel();
+	if (hp.getApachePool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool");
+	ApachePoolModel apm = new ApachePoolModel();
     apm.updateApache(u, p, hp.getApachePool());
   }
 
   public void gracefulApache(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
-    ApachePoolModel apm = new ApachePoolModel();
+	if (hp.getApachePool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool");
+	ApachePoolModel apm = new ApachePoolModel();
     apm.gracefulApache(u, p, hp.getApachePool());
   }
 
   public void configtestApache(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
-    ApachePoolModel apm = new ApachePoolModel();
+	if (hp.getApachePool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool");
+	ApachePoolModel apm = new ApachePoolModel();
     apm.configtestApache(u, p, hp.getApachePool());
   }
 
   public void restartApache(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
-    ApachePoolModel apm = new ApachePoolModel();
+	if (hp.getApachePool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool");
+	ApachePoolModel apm = new ApachePoolModel();
     apm.restartApache(u, p, hp.getApachePool());
   }
 
   public void startApache(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
+	if (hp.getApachePool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool");
     ApachePoolModel apm = new ApachePoolModel();
     apm.startApache(u, p, hp.getApachePool());
   }
 
   public void stopApache(User u, Project p, HostingPool hp) throws NoSuchMethodException, SQLException, IOException, AuthorizationException, TMCIllegalArgumentException {
+	if (hp.getApachePool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool");
     ApachePoolModel apm = new ApachePoolModel();
     apm.stopApache(u, p, hp.getApachePool());
   }
@@ -216,63 +226,78 @@
   public void gracefulApache(User u, Collection<HostingPool> c, Function f) throws NoSuchMethodException, SQLException, IOException, TMCIllegalArgumentException, AuthorizationException {
     ApachePoolModel apm = new ApachePoolModel();
     Collection<ApachePool> aps = this.getApachePools(c);
-    apm.gracefulApache(u, aps, f);
+    if (aps.size() > 0)
+    	apm.gracefulApache(u, aps, f);
   }
 
   public void configtestApache(User u, Collection<HostingPool> c, Function f) throws NoSuchMethodException, SQLException, IOException, TMCIllegalArgumentException, AuthorizationException {
     ApachePoolModel apm = new ApachePoolModel();
     Collection<ApachePool> aps = this.getApachePools(c);
-    apm.configtestApache(u, aps, f);
+    if (aps.size() > 0)
+    	apm.configtestApache(u, aps, f);
   }
 
   public void restartApache(User u, Collection<HostingPool> c, Function f) throws NoSuchMethodException, SQLException, IOException, TMCIllegalArgumentException, AuthorizationException {
     ApachePoolModel apm = new ApachePoolModel();
     Collection<ApachePool> aps = this.getApachePools(c);
-    apm.restartApache(u, aps, f);
+    if (aps.size() > 0)
+    	apm.restartApache(u, aps, f);
   }
 
   public void startApache(User u, Collection<HostingPool> c, Function f) throws NoSuchMethodException, SQLException, IOException, TMCIllegalArgumentException, AuthorizationException {
     ApachePoolModel apm = new ApachePoolModel();
     Collection<ApachePool> aps = this.getApachePools(c);
-    apm.startApache(u, aps, f);
+    if (aps.size() > 0)
+    	apm.startApache(u, aps, f);
   }
 
   public void stopApache(User u, Collection<HostingPool> c, Function f) throws NoSuchMethodException, SQLException, IOException, TMCIllegalArgumentException, AuthorizationException {
-    ApachePoolModel apm = new ApachePoolModel();
+	ApachePoolModel apm = new ApachePoolModel();
     Collection<ApachePool> aps = this.getApachePools(c);
-    apm.stopApache(u, aps, f);
+    if (aps.size() > 0)
+    	apm.stopApache(u, aps, f);
   }
 
   public void deployApacheConfig(User u, Collection<HostingPool> c, Function f) throws NoSuchMethodException, SQLException, IOException, TMCIllegalArgumentException, AuthorizationException {
     ApachePoolModel apm = new ApachePoolModel();
     Collection<ApachePool> aps = this.getApachePools(c);
-    apm.deployApacheConfig(u, aps, f);
+    if (aps.size() > 0)
+    	apm.deployApacheConfig(u, aps, f);
   }
 
   public void stopTomcat(User u, Collection<HostingPool> c, Function f) throws TMCException, TMCIllegalArgumentException, SQLException, NoSuchMethodException, IOException {
     TomcatPoolModel tpm = new TomcatPoolModel();
-    tpm.stopTomcat(u, this.getTomcatPools(c), f);
+    Collection<TomcatPool> tws = this.getTomcatPools(c);
+    if (tws.size() > 0)
+    	tpm.stopTomcat(u, tws, f);
   }
 
   public void startTomcat(User u, Collection<HostingPool> c, Function f) throws TMCException, TMCIllegalArgumentException, SQLException, NoSuchMethodException, IOException {
     TomcatPoolModel tpm = new TomcatPoolModel();
-    tpm.startTomcat(u, this.getTomcatPools(c), f);
+    Collection<TomcatPool> tws = this.getTomcatPools(c);
+    if (tws.size() > 0)
+    	tpm.startTomcat(u, tws, f);
   }
 
   public void restartTomcat(User u, Collection<HostingPool> c, Function f) throws TMCException, TMCIllegalArgumentException, SQLException, NoSuchMethodException, IOException {
     TomcatPoolModel tpm = new TomcatPoolModel();
-    tpm.restartTomcat(u, this.getTomcatPools(c), f);
+    Collection<TomcatPool> tws = this.getTomcatPools(c);
+    if (tws.size() > 0)
+    	tpm.restartTomcat(u, tws, f);
   }
 
   public void deployTomcatConfig(User u, Collection<HostingPool> c, Function f) throws TMCException, TMCIllegalArgumentException, SQLException, NoSuchMethodException, IOException {
     TomcatPoolModel tpm = new TomcatPoolModel();
-    tpm.deployTomcatConfig(u, this.getTomcatPools(c), f);
+    Collection<TomcatPool> tws = this.getTomcatPools(c);
+    if (tws.size() > 0)
+    	tpm.deployTomcatConfig(u, tws, f);
   }
 
   private Collection<ApachePool> getApachePools(Collection<HostingPool> hps) {
     Collection<ApachePool> aps = new TMCSet<ApachePool>();
     for (HostingPool hp : hps) {
-      aps.add(hp.getApachePool());
+    	if (hp.getApachePool() != null)
+    		aps.add(hp.getApachePool());
     }
     return aps;
   }
@@ -280,7 +305,8 @@
   private Collection<TomcatPool> getTomcatPools(Collection<HostingPool> hps) {
     Collection<TomcatPool> aps = new TMCSet<TomcatPool>();
     for (HostingPool hp : hps) {
-      aps.add(hp.getTomcatPool());
+    	if (hp.getTomcatPool() != null)
+    		aps.add(hp.getTomcatPool());
     }
     return aps;
   }

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HostingPoolAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HostingPoolAction.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HostingPoolAction.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/HostingPoolAction.java Fri Jul 14 10:19:54 2006
@@ -49,7 +49,6 @@
         Collection<HostingPool> c = getMultiTemplate(form);
         hpm.perform(f, new Class[]{user.getClass(), Collection.class, f.getClass()}, new Object[]{user, c, f});
       }
-      messages = this.addMessage(messages, SUCCESS_MESSAGE, new ActionMessage("function.success." + f.getCommand()));
     } catch (AuthorizationException e) {
       messages = this.addMessage(messages, new ActionMessage("error.notAuthorized"));
       if (logger.isInfoEnabled()) {
@@ -61,7 +60,7 @@
       }
       messages = this.addMessage(messages, new ActionMessage("error.db"));
     } catch (TMCIllegalArgumentException e) {
-      messages = this.addMessage(messages, new ActionMessage("error.badData"));
+      messages = this.addMessage(messages, new ActionMessage("error.badData.wMessage", e.getMessage()));
       if (logger.isInfoEnabled()) {
         logger.info("Exception: " + e.getMessage());
       }
@@ -98,7 +97,7 @@
     return c;
   }
 
-  private HostingPool getTemplate(DynaValidatorForm dynaForm) {
+  private HostingPool getTemplate(DynaValidatorForm dynaForm) throws TMCIllegalArgumentException {
     HostingPool hp = new HostingPool();
     String Id = null;
     if (dynaForm.getMap().containsKey("id")) {
@@ -108,6 +107,8 @@
     String envId = (String) dynaForm.get("envId");
     String apId = (String) dynaForm.get("apachePoolId");
     String name = (String) dynaForm.get("poolName");
+    if ((tpId == null || "".equals(tpId)) && (apId == null || "".equals(apId)))
+    	throw new TMCIllegalArgumentException(name + " needs either a Tomcat Pool or an Apache Pool (or both)");
     if (Id != null && !"".equals(Id)) {
       hp.setPk(Integer.parseInt(Id));
     }

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TemplateAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TemplateAction.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TemplateAction.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TemplateAction.java Fri Jul 14 10:19:54 2006
@@ -70,7 +70,7 @@
       } else if ("UpdateVirtualHost".equals(method)) {
         updateVhost(user, f, form);
       } else {
-        messages = this.addMessage(messages, new ActionMessage("error.errorForward", "Invalid method action" + method));
+        messages = this.addMessage(messages, new ActionMessage("error.errorForward", "Invalid method action " + method));
       }
     } catch (AuthorizationException e) {
       messages = this.addMessage(messages, new ActionMessage("error.notAuthorized"));
@@ -83,7 +83,7 @@
       }
       messages = this.addMessage(messages, new ActionMessage("error.db"));
     } catch (TMCIllegalArgumentException e) {
-      messages = this.addMessage(messages, new ActionMessage("error.badData"));
+      messages = this.addMessage(messages, new ActionMessage("error.badData.wMessage",e.getMessage()));
       if (logger.isInfoEnabled()) {
         logger.info("Exception: " + e.getMessage());
       }
@@ -91,12 +91,12 @@
       if (logger.isInfoEnabled()) {
         logger.info("Exception: " + e.getMessage());
       }
-      messages = this.addMessage(messages, new ActionMessage("error.badData"));
+      messages = this.addMessage(messages, new ActionMessage("error.badData.wMessage", e.getMessage()));
     } catch (IOException e) {
       if (logger.isInfoEnabled()) {
         logger.info("Exception: " + e.getMessage());
       }
-      messages = this.addMessage(messages, new ActionMessage("error.badData"));
+      messages = this.addMessage(messages, new ActionMessage("error.badData.wMessage", e.getMessage()));
     }
     return messages;
   }
@@ -174,6 +174,7 @@
     if (!"".equals(hostingPoolId)) {
       hp = HostingPool.getHostingPool(Integer.parseInt(hostingPoolId), true);
     }
+    if (hp.getApachePool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool for virtual hosts");
     if (hp == null || p == null) throw new TMCIllegalArgumentException("Project, Hosting Pool must be chosen");
     State s = State.getState(8);
     Environment e = hp.getEnv();
@@ -199,6 +200,7 @@
     jp.setOptions("virtualhost: " + vh.getName() + " context: " + tc.getName());
     JobPool.update(jp);
     HostingPool hp = vh.getHostingPool();
+    if (hp.getTomcatPool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Tomcat Pool for context");
     HostingPoolModel hpm = new HostingPoolModel();
     hpm.deployApacheConfs(p, user, jp, hp);
   }
@@ -250,25 +252,30 @@
     Environment e = hp.getEnv();
     JobPool jp = new JobPool(p, user, vhostName, f);
     jp = JobPool.store(jp);
-    if (!hp.isVhostAllowed(vhostName)) throw new TMCIllegalArgumentException("Name not allowed");
-    VirtualHost vh = new VirtualHost(vhostName, entry, e, s, hp, catchAll, nameBased);
-    Collection<Ip> ips = new TMCSet<Ip>();
-    for (int i = 0; i < ipId.length; i++) {
-      Ip ip = Ip.getIp(Integer.parseInt(ipId[i]), true);
-      ips.add(ip);
-    }
-    vh.setIps(ips);
-    vh.setContexts(contexts);
-    vh = VirtualHost.store(vh);
-    HostingPoolModel hpm = new HostingPoolModel();
-    hpm.addVirtualHost(vh, jp, hp, user);
-    if (p.addTomcatContexts(contexts)
-        && p.addVirtualHost(vh)
-        && Project.update(p)
-        ) {
+    if (hp.getApachePool() != null) {
+    	if (!hp.isVhostAllowed(vhostName)) throw new TMCIllegalArgumentException("Name not allowed");
+    	VirtualHost vh = new VirtualHost(vhostName, entry, e, s, hp, catchAll, nameBased);
+    	Collection<Ip> ips = new TMCSet<Ip>();
+    	for (int i = 0; i < ipId.length; i++) {
+    		Ip ip = Ip.getIp(Integer.parseInt(ipId[i]), true);
+    		ips.add(ip);
+    	}
+    	vh.setIps(ips);
+    	vh.setContexts(contexts);
+    	vh = VirtualHost.store(vh);
+    	HostingPoolModel hpm = new HostingPoolModel();
+    	hpm.addVirtualHost(vh, jp, hp, user);
+    	if (p.addTomcatContexts(contexts)
+    			&& p.addVirtualHost(vh)
+    			&& Project.update(p)
+        	) {
 
-      //NICE it worked...
+    		//NICE it worked...
 
+    	}
+    }
+    else {
+    	throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool for virtual host");
     }
 
   }
@@ -329,6 +336,7 @@
             logger.info("Exception: " + e.getMessage());
           }
         }
+        if (hp.getApachePool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Apache Pool for virtual host");
         if (hp != null) {
           try {
             changedHPs = vhost.changeHostingPool(hp, ips, nameBased, catchAll);
@@ -362,10 +370,13 @@
           s, Environment
           e) throws SQLException, TMCIllegalArgumentException {
     Collection<TomcatContext> contexts = new TMCSet<TomcatContext>();
-    if (!hp.isContextAllowed(contextName)) throw new TMCIllegalArgumentException("Name not allowed");
-    for (int i = 0; i < contextName.length; i++) {
-      TomcatContext tc = new TomcatContext(contextName[i], docBase[i], s, e, hp.getTomcatPool());
-      contexts.add(TomcatContext.store(tc));
+    if (contextName.length > 0) {
+    	if (hp.getTomcatPool() == null) throw new TMCIllegalArgumentException(hp.getName() + " has no Tomcat Pool for context");
+    	if (!hp.isContextAllowed(contextName)) throw new TMCIllegalArgumentException("Name not allowed");
+    	for (int i = 0; i < contextName.length; i++) {
+    		TomcatContext tc = new TomcatContext(contextName[i], docBase[i], s, e, hp.getTomcatPool());
+    		contexts.add(TomcatContext.store(tc));
+    	}
     }
     return contexts;
   }

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/ApacheModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/ApacheModel.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/ApacheModel.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/ApacheModel.java Fri Jul 14 10:19:54 2006
@@ -56,6 +56,19 @@
     JobPool.update(jp);
   }
 
+  public void deleteApache(User u, Collection<Apache> c, Function f) throws SQLException, AuthorizationException, TMCIllegalArgumentException {
+	  this.jpInit(f, u);
+	  StringBuffer names = new StringBuffer();
+	  for (final Apache a : c) {
+		  names.append(a.getName());
+		  names.append(',');
+		  this.deleteApache(u, a, f);
+	  }
+	  jp.setOptions(names.toString());
+	  jp.setState(State.COMPLETE);
+	  JobPool.update(jp);
+  }
+  
   public void updateApache(User u, Apache a, Function f) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
     this.jpInit(f, u, a.getName());
     if (u.isAllowed(f) && "UpdateApache".equals(f.getCommand())) {

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorker.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorker.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorker.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorker.java Fri Jul 14 10:19:54 2006
@@ -346,7 +346,7 @@
   }
 
   public static boolean delete(ApacheWorker aw) throws SQLException {
-    return broker.delete("sp_am_drop_worker", aw.getPk());
+    return broker.delete("apache.worker.delete", aw.getPk());
   }
 
   public String buildConfForWeb() {

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorkerModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorkerModel.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorkerModel.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/worker/ApacheWorkerModel.java Fri Jul 14 10:19:54 2006
@@ -75,6 +75,35 @@
 	  JobPool.update(jp);
   }
   
+  private void deleteWorker(User u, ApacheWorker aw, Function f) throws AuthorizationException, SQLException {
+	  if (u.isAllowed(f) && "DeleteApacheWorker".equals(f.getCommand())) {
+		  ApacheWorker.delete(aw);
+	  } else {
+		  throw new AuthorizationException("User " + u.getName() + " Not allowed to " + f.getName());
+	  }
+  }
+  
+  public void deleteApacheWorker(User u, ApacheWorker aw, Function f) throws SQLException, AuthorizationException, TMCIllegalArgumentException {
+	  if (aw == null || aw.getPk() < 1) throw new TMCIllegalArgumentException("ApacheWorker can not be null");
+	  this.jpInit(f, u, aw.getName());
+	  this.deleteWorker(u, aw, f);
+	  jp.setState(State.COMPLETE);
+	  JobPool.update(jp);
+  }
+  
+  public void deleteApacheWorker(User u, Collection<ApacheWorker> c, Function f) throws SQLException, AuthorizationException, TMCIllegalArgumentException {
+	  this.jpInit(f, u);
+	  StringBuffer names = new StringBuffer();
+	  for (final ApacheWorker aw : c) {
+		  names.append(aw.getName());
+		  names.append(',');
+		  this.deleteApacheWorker(u, aw, f);
+	  }
+	  jp.setOptions(names.toString());
+	  jp.setState(State.COMPLETE);
+	  JobPool.update(jp);
+  }
+  
   public void gracefulApache(User u, Project p, ApacheWorker aw) throws SQLException, IOException, TMCIllegalArgumentException, AuthorizationException {
     this.gracefulApache(u, p, null, aw);
   }

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/gui/www/ApacheAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/gui/www/ApacheAction.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/gui/www/ApacheAction.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/gui/www/ApacheAction.java Fri Jul 14 10:19:54 2006
@@ -18,6 +18,7 @@
 import org.apache.log4j.Logger;
 import org.apache.lokahi.core.api.function.Function;
 import org.apache.lokahi.core.api.user.User;
+import org.apache.lokahi.core.common.collection.TMCSet;
 import org.apache.lokahi.core.common.exception.AuthorizationException;
 import org.apache.lokahi.core.common.exception.TMCException;
 import org.apache.lokahi.core.common.exception.TMCIllegalArgumentException;
@@ -88,6 +89,22 @@
     return messages;
   }
 
+  private Collection<Apache> getMultiTemplate(DynaValidatorForm dynaForm) throws SQLException {
+	  Collection<Apache> c = new TMCSet<Apache>();
+	  String[] ids = (String[]) dynaForm.get("id");
+	  if (ids != null && ids.length > 0) {
+		  for (int i = 0; i < ids.length; i++) {
+			  if (!"".equals(ids[i])) {
+				  Apache a = Apache.getApache(Integer.parseInt(ids[i]), false);
+				  if (a != null) {
+					  c.add(a);
+				  }
+			  }
+		  }
+	  }
+	  return c;
+  }
+  
   private Apache getTemplate(DynaValidatorForm dynaForm) throws SQLException {
     Apache a = new Apache();
     String Id = null;

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=421955&r1=421954&r2=421955&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 Fri Jul 14 10:19:54 2006
@@ -424,6 +424,7 @@
     if (p == null || hp == null || vh == null) throw new TMCIllegalArgumentException("Error with input");
     if (!u.isAllowed(f, p, tc))
       throw new AuthorizationException("User " + u.getName() + " Not allowed to " + f.getName());
+    if (hp.getTomcatPool() == null) throw new TMCIllegalArgumentException("Can not add context because " + hp.getName() + " has no Tomcat Pool");
     if (!hp.isContextAllowed(tc)) throw new AlreadyExistException("Name not allowed, already exists.");
     tc.setTomcatPool(hp.getTomcatPool());
     tc = TomcatContext.store(tc);

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/TomcatModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/TomcatModel.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/TomcatModel.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/TomcatModel.java Fri Jul 14 10:19:54 2006
@@ -58,6 +58,19 @@
     JobPool.update(jp);
   }
 
+  public void deleteTomcat(User u, Collection<Tomcat> c, Function f) throws SQLException, AuthorizationException, TMCIllegalArgumentException {
+	  this.jpInit(f, u);
+	  StringBuffer names = new StringBuffer();
+	  for (final Tomcat t : c) {
+		  names.append(t.getName());
+		  names.append(',');
+		  this.deleteTomcat(u, t, f);
+	  }
+	  jp.setOptions(names.toString());
+	  jp.setState(State.COMPLETE);
+	  JobPool.update(jp);
+  }
+  
   public void updateTomcat(User u, Tomcat a, Function f) throws AuthorizationException, TMCIllegalArgumentException, SQLException, IOException {
     this.jpInit(f, u, a.getName());
     if (u.isAllowed(f) && "UpdateTomcat".equals(f.getCommand())) {

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/ContextAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/ContextAction.java?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/ContextAction.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/ContextAction.java Fri Jul 14 10:19:54 2006
@@ -59,6 +59,10 @@
         removeContextFromVhost(form, f, user, tcm);
       } else {
         String id = (String) form.get("id");
+        if ("".equals(form.get("projectId"))) {
+          messages = this.addMessage(messages, new ActionMessage("errors.required", "A project"));
+          return messages;
+        }
         Project p = Project.getProject(Integer.parseInt((String) form.get("projectId")));
         TomcatContext tc = TomcatContext.getTomcatContext(Integer.parseInt(id));
         tcm.perform(f, new Class[]{p.getClass(), user.getClass(), tc.getClass()}, new Object[]{p, user, tc});
@@ -75,7 +79,7 @@
       }
       messages = this.addMessage(messages, new ActionMessage("error.db"));
     } catch (TMCIllegalArgumentException e) {
-      messages = this.addMessage(messages, new ActionMessage("error.badData"));
+      messages = this.addMessage(messages, new ActionMessage("error.badData.wMessage", e.getMessage()));
       if (logger.isInfoEnabled()) {
         logger.info("Exception: " + e.getMessage());
       }
@@ -113,6 +117,8 @@
       p = Project.getProject(projectId);
     }
     HostingPool hp = HostingPool.getHostingPool(Integer.parseInt((String) form.get("hpId")), true);
+    if (hp.getTomcatPool() == null)
+      throw new TMCIllegalArgumentException(hp.getName() + " has no Tomcat Pool for context");
     VirtualHost vh = VirtualHost.getVirtualHost(Integer.parseInt((String) form.get("vhostId")));
     tcm.addContext(tc, vh, hp, p, u, Function.getFunction("AddContext"));
   }
@@ -133,19 +139,6 @@
     tc.setEnvId(Integer.parseInt((String) form.get("envId")));
     tcm.updateContext(tc, u, f, p);
   }
-
-//   				    <form name="Form" method="post" action='$link.setAction("/administration/Context/Delete")'>
-//    #else
-//  				    <form name="Form" method="post" action='$link.setAction("Context/SubmitJobAction")'>
-//    #end
-//              <input type="hidden" id="id" name="id" value="$!{cid}">
-//         #if($vid)
-//              <input type="hidden" id="vhostId" name="vhostId" value="$!{vid}">
-//         #end
-//         #if ($f.getStartCommand() ==  "RemoveContextFromVhost")
-//              Remove from project?  <input type="checkbox" name="removeFromProject" id="removeFromProject" value="true"><br>
-//         #end
-//              <input type="hidden" id="projectId" name="projectId" value="$!{pid}">
 
   public void removeContextFromVhost(DynaValidatorForm form, Function f, User u, TomcatContextModel tcm) throws SQLException, TMCIllegalArgumentException, AuthorizationException {
     TomcatContext tc = TomcatContext.getTomcatContext(Integer.parseInt((String) form.get("id")));

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/confirm.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/confirm.vm?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/confirm.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/confirm.vm Fri Jul 14 10:19:54 2006
@@ -20,7 +20,7 @@
 <form name="Form" method="post" action='$link.setAction($actionLink)'>
   <br />
   <input type=hidden name="methodToCall" value="$methodToCall">
-  <input type="submit" value="$buttonName">
+  <input type="submit" value="$buttonName"><br />
   <br />
   $methodToCall
   <input type=hidden name=id value="$individual.getPk()">&nbsp;&nbsp;

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Server/confirm.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Server/confirm.vm?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Server/confirm.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Server/confirm.vm Fri Jul 14 10:19:54 2006
@@ -16,12 +16,16 @@
 ## $Id$
 ##
 #if ($User.isAllowed($function) && $methodToCall && $actionLink)
+<div class="messagebox">
 <form name="Form" method="post" action='$link.setAction($actionLink)'>
   <input type=hidden name="methodToCall" value="$methodToCall">
+  <br />
   <input type="submit" value="$buttonName"><br />
+  <br />
   $methodToCall
   <input type=hidden name=id value="$individual.getPk()">&nbsp;&nbsp;
   $individual.getName()
 </form>
+</div>
 #end
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Core/Server/confirm.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Server/confirm.vm?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Server/confirm.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Server/confirm.vm Fri Jul 14 10:19:54 2006
@@ -16,12 +16,16 @@
 ## $Id$
 ##
 #if ($User.isAllowed($function) && $methodToCall && $actionLink)
+<div class="messagebox">
 <form name="Form" method="post" action='$link.setAction($actionLink)'>
   <input type=hidden name="methodToCall" value="$methodToCall">
+  <br />
   <input type="submit" value="$buttonName"><br />
+  <br />
   $methodToCall
   <input type=hidden name=id value="$individual.getPk()">&nbsp;&nbsp;
   $individual.getName()
 </form>
+</div>
 #end
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Entity/view.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Entity/view.vm?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Entity/view.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Entity/view.vm Fri Jul 14 10:19:54 2006
@@ -71,6 +71,9 @@
 
       #end
     </div>
+    <br />
+    </div>
+    <br />
   </div>
   #parse("/layout/footer.vm")
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/confirm.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/confirm.vm?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/confirm.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/confirm.vm Fri Jul 14 10:19:54 2006
@@ -18,10 +18,9 @@
 #if ($User.isAllowed($function) && $methodToCall && $actionLink)
 <div class="messagebox">
 <form name="Form" method="post" action='$link.setAction($actionLink)'>
-  <br />
   <input type=hidden name="methodToCall" value="$methodToCall">
   <br />
-  <input type="submit" value="$buttonName">
+  <input type="submit" value="$buttonName"><br />
   <br />
   $methodToCall
   <input type=hidden name=id value="$individual.getPk()">&nbsp;&nbsp;

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/update.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/update.vm?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/update.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/update.vm Fri Jul 14 10:19:54 2006
@@ -40,7 +40,7 @@
 #if ($User.isAllowed("UpdateTomcatPool") && $methodToCall == "UpdateTomcatPool")
 <br />
 <form name="Form" method="post" action='$link.setAction("administration/TomcatPoolAction")'>
-<input type="hidden" id="id" name="id" value="$!{id}">
+<input type="hidden" id="poolId" name="poolId" value="$!{id}">
 <input type="hidden" id="methodToCall" name="methodToCall" value="$methodToCall">
 Name: <input type="text" readonly id="workerName" name="workerName" value="$!{tomcatPool.getWorkerName()}"><br />
 Pool Name: <input type="text" readonly id="poolName" name="poolName" value="$!{tomcatPool.getName()}"><br />

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/confirm.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/confirm.vm?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/confirm.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/confirm.vm Fri Jul 14 10:19:54 2006
@@ -16,12 +16,16 @@
 ## $Id$
 ##
 #if ($User.isAllowed($function) && $methodToCall && $actionLink)
+<div class="messagebox">
 <form name="Form" method="post" action='$link.setAction($actionLink)'>
   <input type=hidden name="methodToCall" value="$methodToCall">
+  <br />
   <input type="submit" value="$buttonName"><br />
+  <br />
   $methodToCall
   <input type=hidden name=id value="$individual.getPk()">&nbsp;&nbsp;
   $individual.getName()
 </form>
+</div>
 #end
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/update.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/update.vm?rev=421955&r1=421954&r2=421955&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/update.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/update.vm Fri Jul 14 10:19:54 2006
@@ -62,7 +62,7 @@
 Standard Out Log: <input type="text" id="stdOutLog" name="stdOutLog" value="$!{tomcat.getStdOutLog()}"><br />
 Java Home: <input type="text" id="javaHome" name="javaHome" value="$!{tomcat.getJavaHome()}"><br />
 Environment Varibles:  <textarea id="env" name="env" cols="40" rows="5"> $!{tomcat.getEnv()} </textarea><br />
-Java Options:  <textarea id="javaOpts" name="javaOpts" cols="40" rows="5"> $!{tomcat.getJavaOpts()} </textarea><br />
+Java Options:  <textarea id="javaOpts" name="javaOpts" cols="40" rows="5"> $!{tomcat.getJavaOptions()} </textarea><br />
         <input type="hidden" name="methodToCall" value="UpdateTomcat">
         <input type="submit" value="Update"><br />
       </form>



Mime
View raw message