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 2008/02/21 18:44:09 UTC

svn commit: r629916 [2/3] - in /incubator/lokahi/lokahi/trunk: conf/ database/mysql/ database/oracle/ src/java/org/apache/lokahi/core/api/server/ src/java/org/apache/lokahi/core/api/template/ src/java/org/apache/lokahi/core/common/interfaces/ src/java/...

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/FileAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/FileAction.java?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/FileAction.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/FileAction.java Thu Feb 21 10:43:55 2008
@@ -48,6 +48,7 @@
       if ("AddFile".equalsIgnoreCase(f.getCommand()) || "UpdateFile".equalsIgnoreCase(f.getCommand())) {
         File fi = getTemplate(form);
         fm.perform(f, new Class[]{user.getClass(), fi.getClass(), f.getClass()}, new Object[]{user, fi, f});
+        messages = this.addMessage(messages, SUCCESS_MESSAGE, new ActionMessage("function.success." + f.getCommand(), fi.getName()));
       } else {
         Collection<File> c = getMultiTemplate(form);
         fm.perform(f, new Class[]{user.getClass(), Collection.class, f.getClass()}, new Object[]{user, c, f});
@@ -129,6 +130,7 @@
     return f;
   }
 }
+
 
 
 

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TMCStartupServlet.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TMCStartupServlet.java?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TMCStartupServlet.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/gui/www/TMCStartupServlet.java Thu Feb 21 10:43:55 2008
@@ -22,6 +22,7 @@
 import org.apache.lokahi.core.common.database.CachingBroker;
 import org.apache.lokahi.core.common.database.ConnBean;
 import org.apache.lokahi.core.common.database.DerbyBroker;
+import org.apache.lokahi.core.common.templating.TemplateBuilder;
 import org.apache.lokahi.core.common.util.PropertiesFile;
 import org.apache.lokahi.core.controller.CheckJvmThread;
 
@@ -56,6 +57,10 @@
 
     if (PropertiesFile.getConstantValue("lokahi.broker.implementation")!=null) {
         CachingBroker.setMasterBrokerClassName(PropertiesFile.getConstantValue("lokahi.broker.implementation"));        
+    }
+    
+    if (PropertiesFile.getConstantValue("lokahi.template.engine")!=null) {
+        TemplateBuilder.setMasterEngineClassName(PropertiesFile.getConstantValue("lokahi.template.engine"));        
     }
     
     // check for some specific init values that need non-standard action

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java Thu Feb 21 10:43:55 2008
@@ -20,6 +20,8 @@
 
 import org.apache.log4j.Logger;
 import org.apache.lokahi.core.api.file.File;
+import org.apache.lokahi.core.api.template.Template;
+import org.apache.lokahi.core.common.collection.TMCCollectionImpl;
 import org.apache.lokahi.core.common.database.BrokerFactory;
 import org.apache.lokahi.core.common.interfaces.Application;
 import org.apache.lokahi.core.common.interfaces.TMCBroker;
@@ -49,9 +51,9 @@
   private int forkWait;
   private String envVaribles;
   private String pidFileLocation;
-  private int mainId;
+  private String templateIds;
 
-  private File main;
+  private Collection<Template> templates;
 
   public int getPk() {
     return pk;
@@ -76,7 +78,10 @@
   public void setServerRoot(String serverRoot) {
     this.serverRoot = serverRoot;
   }
-
+  
+  public String getServerLocation() {
+	  return serverRoot;
+  }
   public String getLogLocation() {
     return logLocation;
   }
@@ -149,32 +154,39 @@
     this.pidFileLocation = pidFileLocation;
   }
 
-  public int getMainId() {
-    return mainId;
+  public String getTemplateIds() {
+    return templateIds;
   }
 
-  public void setMainId(int mainId) {
-    this.mainId = mainId;
-  }
-
-  public File getMain() {
-    if (main == null) {
-      try {
-        main = File.getFile(this.getMainId());
-      } catch (SQLException e) {
-        if (logger.isInfoEnabled()) {
-          logger.info("Exception: " + e.getMessage());
-        }
-      }
-    }
-    return main;
+  public void setTemplateIds(String templateIds) {
+    this.templateIds = templateIds;
   }
 
-  public void setMain(File main) {
-    this.main = main;
-    if (main != null) {
-      this.setMainId(main.getPk());
-    }
+  public Collection<Template> getTemplates() {
+	  if (templates == null) {
+		  try {
+			  templates = new TMCCollectionImpl<Template>();
+			  String[] templateIds = this.getTemplateIds().split(",");
+	    	  for (String templateId : templateIds) {
+	    		  templates.add(Template.getTemplate(Integer.parseInt(templateId)));
+	    	  }
+	      } catch (SQLException e) {
+	          logger.error("Exception: " + e.getMessage());
+	      }
+	  }
+	  return templates;
+  }
+
+  public void setTemplates(Collection<Template> templates) {
+	  this.templates = templates;
+	  if (templates != null) {
+		  StringBuilder templateIds = new StringBuilder();
+		  for (Template template : templates) {
+			  templateIds.append(template.getPk()); 
+			  templateIds.append(",");
+		  }
+		  this.setTemplateIds(templateIds.toString());
+	  }
   }
 
   public Apache() {
@@ -182,7 +194,7 @@
 
   public Apache(int container_id, String containerName, String logLocation, String envVaribles, int forkWait,
                 String pidfileLocation, String restartCommand, String startCommand, String stopCommand, String sysGroup,
-                String sysUser, String serverRoot, int mainId) {
+                String sysUser, String serverRoot, String templateIds) {
     this.setPk(container_id);
     this.setName(containerName);
     this.setLogLocation(logLocation);
@@ -195,7 +207,7 @@
     this.setSysGroup(sysGroup);
     this.setSysUser(sysUser);
     this.setServerRoot(serverRoot);
-    this.setMainId(mainId);
+    this.setTemplateIds(templateIds);
   }
 
   public Apache fillObject(ResultSet r) throws SQLException {
@@ -211,8 +223,7 @@
                       r.getString("SYS_GROUP"),
                       r.getString("SYS_USER"),
                       r.getString("SERVER_ROOT"),
-                      r.getInt("MAIN_ID"));
-
+                      r.getString("MAIN_ID"));
   }
 
   public static Apache getApache(int id, boolean fromCache) throws SQLException {
@@ -259,7 +270,7 @@
                          ap.getPidFileLocation(),
                          ap.getServerRoot(),
                          ap.getLogLocation(),
-                         ap.getMainId()));
+                         ap.getTemplateIds()));
     return ap;
   }
 
@@ -277,7 +288,7 @@
                   ap.getPidFileLocation(),
                   ap.getServerRoot(),
                   ap.getLogLocation(),
-                  ap.getMainId());
+                  ap.getTemplateIds());
   }
 
   public static boolean delete(Apache ap) throws SQLException {
@@ -305,7 +316,9 @@
     ret.append(elementBuilder("stopCommand", this.getStopCommand()));
     ret.append(elementBuilder("restartCommand", this.getRestartCommand()));
     ret.append(elementBuilder("forkWait", Integer.toString(this.getForkWait())));
-    ret.append(this.getMain().buildShortXMLRepresentation());
+    for (Template template : this.getTemplates()) {
+    	ret.append(template.buildShortXMLRepresentation());
+    }
     ret.append("</apache>\n");
     return ret;
   }
@@ -325,8 +338,8 @@
     buf.append(",forkWait=").append(forkWait);
     buf.append(",envVaribles=").append(envVaribles);
     buf.append(",pidFileLocation=").append(pidFileLocation);
-    buf.append(",mainId=").append(mainId);
-    buf.append(",main=").append(main);
+    buf.append(",templateIds=").append(templateIds);
+    buf.append(",templates=").append(templates);
     buf.append('}');
     return buf.toString();
   }
@@ -338,11 +351,11 @@
     final Apache apache = (Apache) o;
 
     if (forkWait != apache.forkWait) return false;
-    if (mainId != apache.mainId) return false;
+    if (templateIds != apache.templateIds) return false;
     if (pk != apache.pk) return false;
     if (envVaribles != null ? !envVaribles.equals(apache.envVaribles) : apache.envVaribles != null) return false;
     if (logLocation != null ? !logLocation.equals(apache.logLocation) : apache.logLocation != null) return false;
-    if (main != null ? !main.equals(apache.main) : apache.main != null) return false;
+    if (templates != null ? !templates.equals(apache.templates) : apache.templates != null) return false;
     if (!name.equals(apache.name)) return false;
     if (pidFileLocation != null ? !pidFileLocation.equals(apache.pidFileLocation) : apache.pidFileLocation != null)
       return false;
@@ -371,8 +384,8 @@
     result = 29 * result + forkWait;
     result = 29 * result + (envVaribles != null ? envVaribles.hashCode() : 0);
     result = 29 * result + (pidFileLocation != null ? pidFileLocation.hashCode() : 0);
-    result = 29 * result + mainId;
-    result = 29 * result + (main != null ? main.hashCode() : 0);
+    result = 29 * result + (templateIds != null ? templateIds.hashCode() : 0);
+    //result = 29 * result + (templates != null ? templates.hashCode() : 0);
     return result;
   }
 
@@ -389,6 +402,7 @@
     return ap;
   }
 }
+
 
 
 

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=629916&r1=629915&r2=629916&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 Thu Feb 21 10:43:55 2008
@@ -23,9 +23,10 @@
 import org.apache.lokahi.core.api.server.Hardware;
 import org.apache.lokahi.core.api.state.State;
 import org.apache.lokahi.core.common.database.BrokerFactory;
-import org.apache.lokahi.core.common.interfaces.Server;
+import org.apache.lokahi.core.common.interfaces.Application;
 import org.apache.lokahi.core.common.interfaces.TMCBroker;
 import org.apache.lokahi.core.common.interfaces.TMCDao;
+import org.apache.lokahi.core.common.interfaces.Worker;
 import org.apache.lokahi.core.common.util.PropertiesFile;
 import org.apache.lokahi.httpd.api.pool.ApachePool;
 import org.apache.lokahi.httpd.api.server.Apache;
@@ -39,7 +40,7 @@
  * @author The Apache Incubated Lokahi project - http://incubator.apache.org/lokahi/
  * @version $Id$
  */
-public class ApacheWorker extends TMCDao<ApacheWorker> implements Server {
+public class ApacheWorker extends TMCDao<ApacheWorker> implements Worker {
   static final Logger logger = Logger.getLogger(ApacheWorker.class);
   private static final TMCBroker<ApacheWorker> broker = new BrokerFactory<ApacheWorker>().getBroker();
   private int pk;
@@ -183,6 +184,10 @@
     }
   }
 
+  public Application getApplication() {
+	  return apache;
+  }
+  
   public int getPoolId() {
     return poolId;
   }
@@ -324,7 +329,7 @@
                                        r.getString("SYS_GROUP"),
                                        r.getString("SYS_USER"),
                                        r.getString("SERVER_ROOT"),
-                                       r.getInt("MAIN_ID")),
+                                       r.getString("MAIN_ID")),
                             new Hardware(r.getInt("HARDWARE_ID"),
                                          r.getString("HARDWARE_NAME"),
                                          r.getString("PHYSICAL_LOCATION"),
@@ -352,11 +357,11 @@
     return broker.delete("apache.worker.delete", aw.getPk());
   }
 
-  public String buildConfForWeb() {
+  public String buildConfForWeb(int templateId) {
     String ret = "A Database error has occurred.";
     ApacheWorkerModel awm = new ApacheWorkerModel();
     try {
-      ret = awm.buildConf(this);
+      ret = awm.buildConf(this, templateId);
     } catch (SQLException e) {
       if (logger.isInfoEnabled()) {
         logger.info("Exception: " + e.getMessage());
@@ -364,7 +369,11 @@
     }
     return ret;
   }
-
+  
+  public String buildConfForWeb(String templateId) {
+	  return buildConfForWeb(Integer.parseInt(templateId));
+  }
+  
   public String buildWorkersProperties() throws SQLException {
     ApacheWorkerModel awm = new ApacheWorkerModel();
     return awm.buildWorkerProperties(this);
@@ -434,6 +443,7 @@
   }
 
 }
+
 
 
 

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=629916&r1=629915&r2=629916&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 Thu Feb 21 10:43:55 2008
@@ -18,7 +18,6 @@
 */
 package org.apache.lokahi.httpd.api.worker;
 
-import org.apache.lokahi.core.api.file.File;
 import org.apache.lokahi.core.api.function.Function;
 import org.apache.lokahi.core.api.ipaddress.Ip;
 import org.apache.lokahi.core.api.job.Job;
@@ -26,12 +25,13 @@
 import org.apache.lokahi.core.api.project.Project;
 import org.apache.lokahi.core.api.server.Hardware;
 import org.apache.lokahi.core.api.state.State;
+import org.apache.lokahi.core.api.template.Template;
 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.TMCIllegalArgumentException;
 import org.apache.lokahi.core.common.interfaces.LokahiModel;
-import org.apache.lokahi.core.controller.task.BuildDeployApacheConfig;
+import org.apache.lokahi.core.common.templating.TemplateDeployer;
 import org.apache.lokahi.httpd.api.entity.VirtualHost;
 import org.apache.lokahi.modjk.WorkersPropertiesFile;
 
@@ -229,8 +229,8 @@
 
   private void deployApacheConfig(JobPool jobPool, ApacheWorker aw) throws TMCIllegalArgumentException {
     if (jobPool != null && aw.getApache() != null) {
-      Runnable task = new BuildDeployApacheConfig(aw, jobPool, false);
-      tpe.execute(task);
+    	Runnable task = new TemplateDeployer(aw, jobPool, false);
+    	tpe.execute(task);    	
     } else {
       throw new TMCIllegalArgumentException("Error with input");
     }
@@ -316,11 +316,21 @@
     ret.append('\n');
     return ret;
   }
-
-  public String buildConf(ApacheWorker aw) throws SQLException {
-    File f = aw.getApache().getMain();
-    StringBuffer content = new StringBuffer();
-    String temp = null;
+  
+  public String buildConf(ApacheWorker aw, int id) throws SQLException {
+	  //FIXME
+	  //Collection<Template> templates = aw.getApache().getTemplates();
+	  //StringBuffer content = new StringBuffer();
+	  String conf = templateEngine.buildConf(aw, id);
+	  return conf;    
+  }
+  
+  public Collection<String> buildConfs(ApacheWorker aw) throws SQLException {
+	  // FIXME
+	  Collection<Template> templates = aw.getApache().getTemplates();
+	  StringBuffer content = new StringBuffer();
+	  Collection<String> confs = templateEngine.buildConfs(aw);
+    /*String temp = null;
     Hardware h = aw.getHardware();
     if (f != null) {
       temp = f.getContent();
@@ -337,6 +347,8 @@
       content.append("DocumentRoot ").append(aw.getApache().getServerRoot()).append("/htdocs\n");
       content.append("ScriptAlias /htbin ").append(aw.getApache().getServerRoot()).append("/htbin\n");
       content.append("</VirtualHost>\n");
+      
+      
       Collection<VirtualHost> c = VirtualHost.getVirtualHosts(aw);
       Collection<VirtualHost> catchalls = new TMCSet<VirtualHost>();
       Collection<Ip> Ips = new TMCSet<Ip>();
@@ -378,7 +390,8 @@
       }
       content.append(this.appendVhosts(c, h));
     }
-    return content.toString();
+    */
+    return confs;
   }
 
   private StringBuffer appendIps(Collection<Ip> ips, String preface, String endOfLine) {

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=629916&r1=629915&r2=629916&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 Thu Feb 21 10:43:55 2008
@@ -53,6 +53,7 @@
         Collection<Apache> c = getMultiTemplate(form, Apache.class);
         am.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()) {
@@ -125,12 +126,27 @@
     String forkWait = (String) dynaForm.get("forkWait");
     String envVars = (String) dynaForm.get("envVaribles");
     String pidLoc = (String) dynaForm.get("pidFileLocation");
-    String mainId = (String) dynaForm.get("mainId");
+    String[] mainIds = (String[]) dynaForm.get("mainId");
     if (Id != null && !"".equals(Id)) {
       a.setPk(Integer.parseInt(Id));
     }
-    if (mainId != null && !"".equals(mainId)) {
-      a.setMainId(Integer.parseInt(mainId));
+    
+    if (mainIds != null && !"".equals(mainIds)) {
+    	StringBuilder sb = new StringBuilder();
+    	for (String mainId : mainIds) {
+    		if (mainId != null && !"".equals(mainId)) {
+    			sb.append(mainId);
+    			sb.append(",");
+    		}
+    	}
+    	// if we dont have updated templates, use the old ones
+    	if (sb.length() > 0) {
+    		a.setTemplateIds(sb.toString());
+    	} else {
+    		if (Id != null && !"".equals(Id)) {
+    			a.setTemplateIds(Apache.getApache(Integer.parseInt(Id), false).getTemplateIds());
+    		}
+    	}
     }
     a.setName(name);
     a.setServerRoot(base);
@@ -149,6 +165,7 @@
   }
 
 }
+
 
 
 

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/Tomcat.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/Tomcat.java?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/Tomcat.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/server/Tomcat.java Thu Feb 21 10:43:55 2008
@@ -19,6 +19,8 @@
 package org.apache.lokahi.tomcat.api.server;
 
 import org.apache.log4j.Logger;
+import org.apache.lokahi.core.api.template.Template;
+import org.apache.lokahi.core.common.collection.TMCCollectionImpl;
 import org.apache.lokahi.core.common.database.BrokerFactory;
 import org.apache.lokahi.core.common.interfaces.Application;
 import org.apache.lokahi.core.common.interfaces.TMCBroker;
@@ -57,6 +59,9 @@
   private String startClass;
   private String stdOutLog;
 
+  private String templateIds;	// comma separated value of ids
+  private Collection<Template> templates; // collection because we can have more than 1 
+  
   public int getPk() {
     return this.id;
   }
@@ -80,6 +85,10 @@
   public void setBaseLocation(String baseLocation) {
     this.baseLocation = baseLocation;
   }
+  
+  public String getServerLocation() {
+	  return baseLocation;
+  }
 
   public String getTomcatHome() {
     return tomcatHome;
@@ -202,12 +211,47 @@
     this.javaOptions = javaOptions;
   }
 
+  public String getTemplateIds() {
+    return templateIds;
+  }
+
+  public void setTemplateIds(String templateIds) {
+    this.templateIds = templateIds;
+  }
+
+  public Collection<Template> getTemplates() {
+    if (templates == null) {
+      try {
+    	  templates = new TMCCollectionImpl<Template>();
+    	  String[] templateIds = this.getTemplateIds().split(",");
+    	  for (String templateId : templateIds) {
+    		  templates.add(Template.getTemplate(Integer.parseInt(templateId)));
+    	  }
+      } catch (SQLException e) {
+          logger.error("Exception: " + e.getMessage());
+      }
+    }
+    return templates;
+  }
+
+  public void setTemplates(Collection<Template> templates) {
+    this.templates = templates;
+    if (templates != null) {
+    	StringBuilder templateIds = new StringBuilder();
+    	for (Template template : templates) {
+    		templateIds.append(template.getPk()); 
+    		templateIds.append(",");
+    	}
+    	this.setTemplateIds(templateIds.toString());
+    }
+  }
+  
   public Tomcat() {
   }
 
   public Tomcat(int id, String name, String baseLocation, String tomcatHome,
                 int httpPort, String description, String sysUser, String sysGroup, Blob entry, int version,
-                String stdOutLog, String startClass, String javaHome) throws SQLException {
+                String stdOutLog, String startClass, String javaHome, String templateIds) throws SQLException {
     this.setPk(id);
     this.setName(name);
     this.setBaseLocation(baseLocation);
@@ -222,11 +266,12 @@
     this.setStdOutLog(stdOutLog);
     this.setStartClass(startClass);
     this.setJavaHome(javaHome);
+    this.setTemplateIds(templateIds);
   }
 
   public Tomcat(String name, String baseLocation, String tomcatHome,
                 int httpPort, String description, String sysUser, String sysGroup, int version,
-                String stdOutLog, String startClass, String javaHome) {
+                String stdOutLog, String startClass, String javaHome, String templateIds) {
     this.setName(name);
     this.setBaseLocation(baseLocation);
     this.setTomcatHome(tomcatHome);
@@ -238,6 +283,7 @@
     this.setStdOutLog(stdOutLog);
     this.setStartClass(startClass);
     this.setJavaHome(javaHome);
+    this.setTemplateIds(templateIds);
   }
 
   public Tomcat fillObject(ResultSet r) throws SQLException {
@@ -253,7 +299,8 @@
                       r.getInt("TOMCAT_TYPE"),
                       r.getString("STD_OUT_LOG"),
                       r.getString("START_CLASS"),
-                      r.getString("JAVA_HOME"));
+                      r.getString("JAVA_HOME"),
+                      r.getString("TEMPLATE_IDS"));
   }
 
   public static void update(Tomcat tc) throws SQLException {
@@ -270,7 +317,8 @@
                   tc.getJavaHome(),
                   tc.getStartClass(),
                   tc.getStdOutLog(),
-                  (tc.getEntry()).getBytes());
+                  (tc.getEntry()).getBytes(),
+                  tc.getTemplateIds());
   }
 
   public static Tomcat store(Tomcat tc) throws SQLException {
@@ -286,7 +334,8 @@
                          tc.getJavaHome(),
                          tc.getStartClass(),
                          tc.getStdOutLog(),
-                         (tc.getEntry()).getBytes()));
+                         (tc.getEntry()).getBytes(),
+                         tc.getTemplateIds()));
     return tc;
   }
 
@@ -339,53 +388,7 @@
   public static Tomcat getTomcat(int id, boolean fromCache) throws SQLException {
     return new Tomcat().get(id);
   }
-
-  public String buildJvmconfEntry() {
-    StringBuilder ret = new StringBuilder();
-    ret.append(this.getHttpPort());
-    ret.append(".tomcat.name=");
-    ret.append(this.getServerName());
-    ret.append('\n');
-    ret.append(this.getHttpPort());
-    ret.append(".java.param.user=www\n");
-    ret.append(this.getHttpPort());
-    ret.append(".java.param.group=www\n");
-    ret.append(this.getHttpPort());
-    ret.append(".java.param.jvmgroup=tomcat\n");
-    ret.append(this.getHttpPort());
-    ret.append(".java.param.options=-Dcatalina.base=");
-    ret.append(this.getBaseLocation());
-    ret.append(" -Dcatalina.home=");
-    ret.append(this.getTomcatHome());
-    ret.append(' ');
-    ret.append(this.getJavaOptions());
-    ret.append('\n');
-    ret.append(this.getHttpPort());
-    ret.append(".java.param.env=");
-    ret.append(this.getEnvironment());
-    ret.append('\n');
-    ret.append(this.getHttpPort());
-    ret.append(".java.home=");
-    ret.append(this.getJavaHome());
-    ret.append('\n');
-    ret.append(this.getHttpPort());
-    ret.append(".tomcat.startclass=");
-    ret.append(this.getStartClass());
-    ret.append('\n');
-    ret.append(this.getHttpPort());
-    ret.append(".java.param.standard.out.log=");
-    ret.append(this.getStdOutLog());
-    ret.append('\n');
-    ret.append(this.getHttpPort());
-    ret.append(".tomcat.param.jmx=");
-    if (this.getType() >= 6) {
-      ret.append("yes\n");
-    } else {
-      ret.append("no\n");
-    }
-    return ret.toString();
-  }
-
+  
   public StringBuilder buildShortXMLRepresentation() {
     LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(3, 1);
     map.put("id", Integer.toString(this.getPk()));
@@ -409,6 +412,7 @@
     ret.append(elementBuilder("standardOutLog", this.getStdOutLog()));
     ret.append(elementBuilder("startClass", this.getStartClass()));
     ret.append(elementBuilder("javaHome", this.getJavaHome()));
+    ret.append(elementBuilder("templateIds", this.getTemplateIds()));
     ret.append("</tomcat>\n");
     return ret;
   }
@@ -433,6 +437,7 @@
     if (sysGroup != null ? !sysGroup.equals(tomcat.sysGroup) : tomcat.sysGroup != null) return false;
     if (sysUser != null ? !sysUser.equals(tomcat.sysUser) : tomcat.sysUser != null) return false;
     if (tomcatHome != null ? !tomcatHome.equals(tomcat.tomcatHome) : tomcat.tomcatHome != null) return false;
+    if (templateIds != null ? !templateIds.equals(tomcat.templateIds) : tomcat.templateIds != null) return false;
 
     return true;
   }
@@ -453,9 +458,11 @@
     result = 29 * result + (javaHome != null ? javaHome.hashCode() : 0);
     result = 29 * result + (startClass != null ? startClass.hashCode() : 0);
     result = 29 * result + (stdOutLog != null ? stdOutLog.hashCode() : 0);
+    result = 29 * result + (templateIds != null ? templateIds.hashCode() : 0);
     return result;
   }
 }
+
 
 
 

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorker.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorker.java?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorker.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorker.java Thu Feb 21 10:43:55 2008
@@ -23,10 +23,12 @@
 import org.apache.lokahi.core.api.server.Hardware;
 import org.apache.lokahi.core.api.state.State;
 import org.apache.lokahi.core.common.database.BrokerFactory;
-import org.apache.lokahi.core.common.interfaces.Server;
+import org.apache.lokahi.core.common.interfaces.Application;
 import org.apache.lokahi.core.common.interfaces.TMCBroker;
 import org.apache.lokahi.core.common.interfaces.TMCDao;
+import org.apache.lokahi.core.common.interfaces.Worker;
 import org.apache.lokahi.core.common.util.PropertiesFile;
+import org.apache.lokahi.httpd.api.worker.ApacheWorkerModel;
 import org.apache.lokahi.tomcat.api.entity.TomcatContext;
 import org.apache.lokahi.tomcat.api.pool.TomcatPool;
 import org.apache.lokahi.tomcat.api.server.Tomcat;
@@ -40,7 +42,7 @@
  * @author The Apache Incubated Lokahi project - http://incubator.apache.org/lokahi/
  * @version $Id$
  */
-public class TomcatWorker extends TMCDao<TomcatWorker> implements Server {
+public class TomcatWorker extends TMCDao<TomcatWorker> implements Worker {
   private static final TMCBroker<TomcatWorker> broker = new BrokerFactory<TomcatWorker>().getBroker();
   static final Logger logger = Logger.getLogger(TomcatWorker.class);
   private int workerId;
@@ -146,6 +148,10 @@
       this.setTomcatId(tomcat.getPk());
     }
   }
+  
+  public Application getApplication() {
+	  return tomcat;
+  }
 
   public State getState() {
     if (state == null) {
@@ -236,19 +242,21 @@
     return getTomcatWorkers(tp.getPk(), cache);
   }
 
-  public String buildConfForWeb() {
+  public String buildConfForWeb(int templateId) {
     String ret = "A database error has occurred.";
+    TomcatWorkerModel twm = new TomcatWorkerModel();
     try {
-      ServerXmlFile sxf = new ServerXmlFile(this);
-      ret = sxf.build();
+    	ret = twm.buildConf(this, templateId);
     } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
+    	logger.error("Exception: " + e.getMessage());
     }
     return ret;
   }
 
+  public String buildConfForWeb(String templateId) {
+	  return this.buildConfForWeb(Integer.parseInt(templateId));
+  }
+  
   public static void update(TomcatWorker tw) throws SQLException {
     broker.update("tomcat.worker.update", tw.getPk(), tw.getHardwareId(), tw.getStateId(), tw.getTomcatId());
   }
@@ -424,6 +432,7 @@
     return result;
   }
 }
+
 
 
 

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerModel.java?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerModel.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerModel.java Thu Feb 21 10:43:55 2008
@@ -22,7 +22,6 @@
 import org.apache.lokahi.core.api.job.Job;
 import org.apache.lokahi.core.api.jobpool.JobPool;
 import org.apache.lokahi.core.api.project.Project;
-import org.apache.lokahi.core.api.server.HardwareModel;
 import org.apache.lokahi.core.api.state.State;
 import org.apache.lokahi.core.api.user.User;
 import org.apache.lokahi.core.common.authorization.AuthorizationManager;
@@ -33,6 +32,7 @@
 import org.apache.lokahi.core.common.exception.TMCIllegalArgumentException;
 import org.apache.lokahi.core.common.exception.UnsupportedParameterException;
 import org.apache.lokahi.core.common.interfaces.LokahiModel;
+import org.apache.lokahi.core.common.templating.TemplateDeployer;
 import org.apache.lokahi.core.common.util.PropertiesFile;
 import org.apache.lokahi.tomcat.api.server.Tomcat;
 
@@ -143,13 +143,9 @@
       try {
         m.invoke(this, u, null, jp, tw);
       } catch (IllegalAccessException e) {
-        if (logger.isInfoEnabled()) {
-          logger.info("Exception: " + e.getMessage());
-        }
+          logger.error("Exception: " + e.getMessage());
       } catch (InvocationTargetException e) {
-        if (logger.isInfoEnabled()) {
-          logger.info("InvocationTargetException: " + e.getMessage());
-        }
+          logger.error("InvocationTargetException: " + e.getMessage());
         Throwable ex = e.getCause();
         if (ex != null) {
           logger.info("TMCMessage: " + ex.getMessage());
@@ -187,22 +183,9 @@
   }
 
   public void deployTomcatConfig(User u, Project p, JobPool jobPool, TomcatWorker tw, Function f) throws SQLException, AuthorizationException, IOException, TMCIllegalArgumentException {
-    f = Function.getFunction("PutFile");
-    State s = State.NEW;
-    if (jobPool == null) {
-      jobPool = new JobPool(p, u, s, tw.getName(), f);
-      jobPool = JobPool.store(jobPool);
-    }
-    if (jobPool != null && tw.getTomcat() != null && f != null) {
-      Job j = new Job(-1, s, tw.getTomcat().getBaseLocation() + "/conf/server.xml", tw.getHardware(), f, jobPool);
-      ServerXmlFile sxf = new ServerXmlFile(tw);
-      j.setResult(sxf.build());
-      Job.store(j);
-      HardwareModel hm = new HardwareModel();
-      hm.deployJvmConf(u, tw.getHardware(), jobPool);
-    } else {
-      throw new TMCIllegalArgumentException("Error with input");
-    }
+	  if (!u.isAllowed(f, p)) throw new AuthorizationException("User " + u.getName() + " Not allowed to " + f.getName());
+	  Runnable task = new TemplateDeployer(tw, jobPool, false);
+	  tpe.execute(task);
   }
 
   private void function(User u, Project p, String functionCommand, String options, JobPool jobPool, TomcatWorker tw) throws SQLException, IOException, AuthorizationException {
@@ -253,7 +236,13 @@
   public TomcatWorker getObject(int id) throws SQLException {
     return this.viewTomcatWorker(id);
   }
+  
+  public String buildConf(TomcatWorker tw, int id) throws SQLException {
+	  String conf = templateEngine.buildConf(tw, id);
+	  return conf;    
+  }
 }
+
 
 
 

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/TomcatAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/TomcatAction.java?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/TomcatAction.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/gui/www/TomcatAction.java Thu Feb 21 10:43:55 2008
@@ -26,6 +26,7 @@
 import org.apache.lokahi.core.common.exception.TMCException;
 import org.apache.lokahi.core.common.exception.TMCIllegalArgumentException;
 import org.apache.lokahi.core.gui.www.TMCAction;
+import org.apache.lokahi.httpd.api.server.Apache;
 import org.apache.lokahi.tomcat.api.server.Tomcat;
 import org.apache.lokahi.tomcat.api.server.TomcatModel;
 import org.apache.struts.action.ActionMessage;
@@ -53,6 +54,7 @@
         Collection<Tomcat> c = getMultiTemplate(form);
         tm.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()) {
@@ -122,6 +124,8 @@
     String javaHome = (String) dynaForm.get("javaHome");
     String startClass = (String) dynaForm.get("startClass");
     String stdOutLog = (String) dynaForm.get("stdOutLog");
+    String[] templateIds = ((String[]) dynaForm.get("template"));
+    
     if (Id != null && !"".equals(Id)) {
       t.setPk(Integer.parseInt(Id));
     }
@@ -139,9 +143,27 @@
     t.setStartClass(startClass);
     t.setStdOutLog(stdOutLog);
     t.setJavaHome(javaHome);
+    
+    
+    if (templateIds != null && !"".equals(templateIds)) {
+    	StringBuilder sb = new StringBuilder();
+    	for (String templateId : templateIds) {
+    		if (templateId != null && !"".equals(templateId)) {
+    			sb.append(templateId);
+    			sb.append(",");
+    		}
+    	}
+    	// if we dont have updated templates, use the old ones
+    	if (sb.length() > 0) {
+    		t.setTemplateIds(sb.toString());
+    	} else {
+    		if (Id != null && !"".equals(Id)) {
+    			t.setTemplateIds(Tomcat.getTomcat(Integer.parseInt(Id), false).getTemplateIds());
+    		}
+    	}
+    }
+
     return t;
   }
 }
-
-
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/menu/global.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/menu/global.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/menu/global.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/menu/global.vm Thu Feb 21 10:43:55 2008
@@ -49,14 +49,15 @@
   #if($User.isAllowed("ConfigtestApache"))
   <option value="$appRoot/Apache/Pool/configtestapache.vm">&nbsp;Configtest&nbsp;</option>
   #end
-  #if($User.isAllowed("ViewApachePool"))
-  <option value="$appRoot/Apache/Pool/viewconf.vm">&nbsp;View Apache Config&nbsp;</option>
-  #end
-  #if($User.isAllowed("ViewApachePool"))
-  <option value="$appRoot/Apache/Pool/viewprop.vm">&nbsp;View workers.properties&nbsp;</option>
-  #end
+  ##if($User.isAllowed("ViewApachePool"))
+  ##<option value="$appRoot/Apache/Pool/viewconf.vm">&nbsp;View Apache Config&nbsp;</option>
+  ##end
+  ##if($User.isAllowed("ViewApachePool"))
+  ##<option value="$appRoot/Apache/Pool/viewprop.vm">&nbsp;View workers.properties&nbsp;</option>
+  ##end
   #if($User.isAllowed("DeployApacheConfig"))
   <option value="$appRoot/Apache/Pool/deployconf.vm">&nbsp;Deploy Apache Config&nbsp;</option>
   #end
 </select>
+
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/menu/indiv.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/menu/indiv.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/menu/indiv.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Pool/menu/indiv.vm Thu Feb 21 10:43:55 2008
@@ -46,14 +46,15 @@
   #if($User.isAllowed("ConfigtestApache"))
   <option value="$appRoot/Apache/Pool/configtestapache.vm?id=$!{ent.getPk()}">&nbsp;Configtest&nbsp;</option>
   #end
-  #if($User.isAllowed("ViewApachePool"))
-  <option value="$appRoot/Apache/Pool/viewconf.vm">&nbsp;View Apache Config&nbsp;</option>
-  #end
-  #if($User.isAllowed("ViewApachePool"))
-  <option value="$appRoot/Apache/Pool/viewprop.vm">&nbsp;View workers.properties&nbsp;</option>
-  #end
+  ##if($User.isAllowed("ViewApachePool"))
+  ##<option value="$appRoot/Apache/Pool/viewconf.vm">&nbsp;View Apache Config&nbsp;</option>
+  ###end
+  ##if($User.isAllowed("ViewApachePool"))
+  ##<option value="$appRoot/Apache/Pool/viewprop.vm">&nbsp;View workers.properties&nbsp;</option>
+  ##end
   #if($User.isAllowed("DeployApacheConfig"))
   <option value="$appRoot/Apache/Pool/deployconf.vm?id=$!{ent.getPk()}">&nbsp;Deploy Apache Config&nbsp;</option>
   #end
 </select>
+
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Server/add.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Server/add.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Server/add.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Server/add.vm Thu Feb 21 10:43:55 2008
@@ -131,14 +131,28 @@
 </tr>
 <tr>
   <td>
-    Apache Main:
+    Apache Template:
   </td>
   <td>
-    #set ($allFiles = $view.getFiles())
+    #set ($allFiles = $view.getTemplates())
 
     <select name=mainId>
       #foreach ($file in $allFiles)
-      <option value="$file.getPk()">$file.getName()
+      <option value="$file.getPk()">$file.getName()</option>
+        #end
+    </select>
+  </td>
+</tr>
+
+<tr>
+  <td>
+    Worker.properties Template:
+  </td>
+  <td>
+    <select name=mainId>
+    	<option value="">None</option>
+      #foreach ($file in $allFiles)
+      <option value="$file.getPk()">$file.getName()</option>
         #end
     </select>
   </td>
@@ -170,5 +184,6 @@
 <br />
 </div>
 #parse("/layout/footer.vm")
+
 
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Server/details.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Server/details.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Server/details.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Server/details.vm Thu Feb 21 10:43:55 2008
@@ -67,8 +67,26 @@
       <tr class="headercolor1"><td>Restart Command:</td><td>$!{apache.getRestartCommand()}</td><td></td></tr>
       <tr class="headercolor2"><td>Environment Varibles:</td><td>$!{apache.getEnvVaribles()}</td><td></td></tr>
       <tr class="headercolor1"><td>Pid File Location:</td><td>$!{apache.getPidFileLocation()}</td><td></td></tr>
-<tr class="headercolor2"><td>Apache Main:</td><td><a href="$appRoot/Core/File/details.vm?id=$!{apache.getMain().getPk()}"> $!{apache.getMain().getDescriptor()}</a></td><td> </td></tr>
-
+      <tr class="headercolor2"><td>Apache Templates:</td>
+      	#set ($templates = $!{apache.getTemplates()})
+      	#set($cc=2)
+      	#set ($next = false)
+      	#if (!$templates || $templates.isEmpty())
+      		<td></td><td></td></tr>
+	    #end
+      	#foreach ($template in $templates)
+      		#if ($next ==  true)
+      			<tr class="headercolor2"><td></td>
+		    #end
+      		#if ($cc == 1)
+      		 #set($cc=2)
+		    #else
+		     #set($cc=1)
+		    #end
+	      	<td class="bodycolor2$cc"><a href="$appRoot/Core/Template/details.vm?id=$!{template.getPk()}"> $!{template.getName()}</a></td>
+			<td class="bodycolor2$cc"></td></tr>
+			#set ($next = true)
+      	#end
     </table>
 
 
@@ -98,5 +116,6 @@
   </div>
 
   #parse("/layout/footer.vm")
+
 
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Server/update.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Server/update.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Server/update.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Server/update.vm Thu Feb 21 10:43:55 2008
@@ -54,22 +54,34 @@
 Stop Command: <input type="text" id="stopCommand" name="stopCommand" value="$!{apache.getStopCommand()}"><br />
 Restart Command: <input type="text" id="restartCommand" name="restartCommand" value="$!{apache.getRestartCommand()}"><br />
 Environment Varibles: <input type="text" id="envVaribles" name="envVaribles" value="$!{apache.getEnvVaribles()}"><br />
-	Pid File Location: <input type="text" id="pidFileLocation" name="pidFileLocation" value="$!{apache.getPidFileLocation()}"><br />
-Apache Main:
-#set ($allFiles = $view.getFiles())
-#if ($apache.getMain())
-#if ($allfiles.remove($apache.getMain()))
+Pid File Location: <input type="text" id="pidFileLocation" name="pidFileLocation" value="$!{apache.getPidFileLocation()}"><br />
 
+Current Templates:<br />
+#set ($templates = $!{apache.getTemplates()})
+#foreach ($template in $templates)
+<a href="$appRoot/Core/Template/details.vm?id=$!{template.getPk()}"> $!{template.getName()}</a><br />
 #end
-#end
-<select name=mainId>
-<option value="$!{apache.getMain().getPk()}">$!{apache.getMain().getDescriptor()}
-#foreach ($file in $allFiles)
-<option value="$file.getPk()">$file.getDescriptor()
-#end
-</select>
 <br />
+New Apache Template:
+    #set ($allFiles = $view.getTemplates())
+    <select name=mainId>
+    	##<option value="">Select One</option>
+      #foreach ($file in $allFiles)
+      <option value="$file.getPk()">$file.getName()</option>
+        #end
+    </select>
+<br />
+New Worker.properties Template:
+    <select name=mainId>
+    	##<option value="">Select One</option>
+    	<option value="">None</option>
+      #foreach ($file in $allFiles)
+      <option value="$file.getPk()">$file.getName()</option>
+        #end
+    </select>
 <br />
+<br />
+Be sure you have the correct template selected before clicking 'Update'!<br />
 <input type="submit" value="Update"><br />
 </form>
 #end
@@ -89,5 +101,6 @@
 <br />
 </div>
 #parse("/layout/footer.vm")
+
 
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/add.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/add.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/add.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/add.vm Thu Feb 21 10:43:55 2008
@@ -48,7 +48,7 @@
       #end
 
 
-      Debug: Number of workers: $numberOfWorkers<br /><br />
+      ##Debug: Number of workers: $numberOfWorkers<br /><br />
 
       <form name="Form" method="post" action='$link.setAction("administration/ApachePoolAction")'>
         <table>
@@ -122,5 +122,6 @@
   <br />
 </div>
 #parse("/layout/footer.vm")
+
 
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/menu/global.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/menu/global.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/menu/global.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/menu/global.vm Thu Feb 21 10:43:55 2008
@@ -43,11 +43,12 @@
   #if($User.isAllowed("ConfigtestApache"))
   <option value="$appRoot/Apache/Worker/configtestapache.vm">&nbsp;Configtest&nbsp;&nbsp;</option>
   #end
-  <option value="$appRoot/Apache/Worker/viewconf.vm">&nbsp;View Config File&nbsp;&nbsp;</option>
-  <option value="$appRoot/Apache/Worker/viewprop.vm">&nbsp;View workers.properties&nbsp;&nbsp;</option>
+  ##<option value="$appRoot/Apache/Worker/viewconf.vm">&nbsp;View Config File&nbsp;&nbsp;</option>
+  ##<option value="$appRoot/Apache/Worker/viewprop.vm">&nbsp;View workers.properties&nbsp;&nbsp;</option>
   #if($User.isAllowed("DeployApacheConfig"))
   <option value="$appRoot/Apache/Worker/deployconf.vm">&nbsp;Deploy Config Files&nbsp;&nbsp;</option>
   #end
   #end
 </select>
+
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/menu/indiv.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/menu/indiv.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/menu/indiv.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/menu/indiv.vm Thu Feb 21 10:43:55 2008
@@ -46,14 +46,15 @@
   #if($User.isAllowed("ConfigtestApache"))
   <option value="$appRoot/Apache/Worker/configtestapache.vm?id=$!{ent.getPk()}">&nbsp;Configtest&nbsp;</option>
   #end
-  #if($User.isAllowed("ViewApacheWorker"))
-  <option value="$appRoot/Apache/Worker/viewconf.vm?id=$!{ent.getPk()}">&nbsp;View Config File&nbsp;</option>
-  #end
-  #if($User.isAllowed("ViewApacheWorker"))
-  <option value="$appRoot/Apache/Worker/viewprop.vm?id=$!{ent.getPk()}">&nbsp;View workers.properties&nbsp;</option>
+  
+  #foreach ($template in $ent.getApache().getTemplates())
+	  #if($User.isAllowed("ViewApacheWorker"))
+	  <option value="$appRoot/Apache/Worker/viewconf.vm?id=$!{ent.getPk()}&ct=$!{template.getPk()}">&nbsp;View $template.getName()&nbsp;</option>
+	  #end
   #end
   #if($User.isAllowed("DeployApacheConfig"))
   <option value="$appRoot/Apache/Worker/deployconf.vm?id=$!{ent.getPk()}">&nbsp;Deploy Config Files&nbsp;</option>
   #end
 </select>
+
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/viewconf.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/viewconf.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/viewconf.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Apache/Worker/viewconf.vm Thu Feb 21 10:43:55 2008
@@ -26,6 +26,10 @@
 #set ($id = $request.getParameter("id"))
 #end
 
+#if ($request.getParameter("ct"))
+#set ($ct = $request.getParameter("ct"))
+#end
+
 <div align="center" class="contentbox">
   <br /><br />
 
@@ -46,7 +50,7 @@
       #if ($id)
       #set ($apacheWorker = $view.getApacheWorker($id))
 
-      <TextArea cols="90" READONLY rows="30">$!{apacheWorker.buildConfForWeb()}</textarea>
+      <TextArea cols="90" READONLY rows="30">$!{apacheWorker.buildConfForWeb($ct)}</textarea>
 
       #else
       Apache Worker:
@@ -65,5 +69,6 @@
   <br />
 </div>
 #parse("/layout/footer.vm")
+
 
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Core/Entity/index.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Entity/index.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Entity/index.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Entity/index.vm Thu Feb 21 10:43:55 2008
@@ -31,7 +31,7 @@
     <tr valign="top" class="body">
       <td align="center" valign="top"
           style="border-right-color:#666666;border-right-style:solid;border-right-width:1px;"><br />
-        <a href="$appRoot/Core/File/list.vm">&nbsp;Manage Files&nbsp;</a><br />
+        <a href="$appRoot/Core/Template/list.vm">&nbsp;Manage Templates&nbsp;</a><br />
         <a href="$appRoot/Core/Environment/list.vm">&nbsp;Manage Environments&nbsp;</a><br />
         <a href="$appRoot/Core/Instance/list.vm">&nbsp;Manage Instances&nbsp;</a><br />
         <a href="$appRoot/Core/Alerts/list.vm">&nbsp;Manage Alerts&nbsp;</a><br />
@@ -45,4 +45,5 @@
 </div>
 
 #parse("/layout/footer.vm")
+
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Core/Project/details.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Project/details.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Project/details.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Project/details.vm Thu Feb 21 10:43:55 2008
@@ -49,16 +49,16 @@
 		<a class="info" href="$appRoot/Core/Project/details.vm?projectId=$project.getPk()">All</a> &nbsp;
   </td> 
 	<td colspan="2" align="right">
-#if ($User.isAllowed("AddVirtualHost", $project) || $User.isAllowed("AddVirtualHostToProject", $project) || $User.isAllowed("AddUser", $project) || $User.isAllowed("AddUserToProject", $project) || $User.isAllowed("DeleteProject", $project))
+#if ($User.isAllowed("AddVirtualHost", $projectId) || $User.isAllowed("AddVirtualHostToProject", $projectId) || $User.isAllowed("AddUser", $project) || $User.isAllowed("AddUserToProject", $project) || $User.isAllowed("DeleteProject", $project))
 	    <select name=methodToCall onchange='OnChange(this);'>
        	      <option value="" selected>Select Action</option>
-#if ($User.isAllowed("AddVirtualHost", $project) || $User.isAllowed("AddVirtualHostToProject", $project))
+#if ($User.isAllowed("AddVirtualHost", $projectId) || $User.isAllowed("AddVirtualHostToProject", $projectId))
               <option value="$appRoot/Template/addVhost.vm?project=$projectId">Add a VirtualHost</option>
 #end
-#if ($User.isAllowed("AddUser", $project) || $User.isAllowed("AddUserToProject", $project))
+#if ($User.isAllowed("AddUser", $projectId) || $User.isAllowed("AddUserToProject", $projectId))
               <option value="$appRoot/Core/User/addToProject.vm?project=$projectId">Add a User</option>
 #end
-#if ($User.isAllowed("DeleteProject", $project))
+#if ($User.isAllowed("DeleteProject", $projectId))
               <option value="$appRoot/Core/Project/delete.vm?project=$projectId">Delete this Project</option>
 #end
             </select>
@@ -90,14 +90,14 @@
 			<td> &nbsp; </td>
 			<td><a href="$appRoot/Apache/Pool/view.vm?id=$!{ap.getPk()}">$!{ap.getName()}</a></td>
 			<td align="right">
-      #if ($User.isAllowed("AddContext", $project) || $User.isAllowed("AddUser", $project) || $User.isAllowed("AddUserToProject", $project) || $User.isAllowed("DeleteVirtualHost", $project, $vhost) || $User.isAllowed("ViewVirtualHost", $project, $vhost) || $User.isAllowed("UpdateVirtualHost", $project, $vhost))
+      #if ($User.isAllowed("AddContext", $projectId) || $User.isAllowed("AddUser", $projectId) || $User.isAllowed("AddUserToProject", $projectId) || $User.isAllowed("DeleteVirtualHost", $project, $vhost) || $User.isAllowed("ViewVirtualHost", $project, $vhost) || $User.isAllowed("UpdateVirtualHost", $project, $vhost))
 	      <select name=methodToCall onchange='OnChange(this);'>
        	<option value="" selected>Select Action</option>
-        #if ($User.isAllowed("AddContext", $project))
+        #if ($User.isAllowed("AddContext", $projectId))
           <option value="$appRoot/Tomcat/Entity/add.vm?id=$!{vhost.getPk()}&projectId=$projectId">Add a context</option>
           <option value="$appRoot/Tomcat/Entity/addExistingToVhost.vm?v=$!{vhost.getPk()}&p=$projectId">Add an existing context</option>
         #end
-        #if ($User.isAllowed("AddUser", $project) || $User.isAllowed("AddUserToProject", $project))
+        #if ($User.isAllowed("AddUser", $projectId) || $User.isAllowed("AddUserToProject", $projectId))
           <option value="$appRoot/Core/User/addToProject.vm?project=$projectId">Add a User</option>
         #end
         <!-- $User.isAllowed("DeleteVirtualHost", $project, $vhost) -->
@@ -298,5 +298,6 @@
 <br />
 </div>
 #parse("/layout/footer.vm")
+
 
 

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/add.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/add.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/add.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/add.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,111 @@
+##
+## 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.
+##
+## $Id$
+##
+#set ($menu = "/layout/menu/EntityTop.vm")
+#set ($pageSelected = "template")
+#parse("/layout/header.vm")
+<div align="center" class="contentbox">
+  <br /><br />
+
+  <div class="projectbox">
+    <table width="100%" border="0" cellspacing="0" cellpadding="1">
+      <tr class="info" valign="top">
+        <td colspan=3>Administration - <b>Template</b>
+        </td>
+        <td align="right">
+          #parse("Core/Template/menu/global.vm")
+        </td>
+      </tr>
+    </table>
+    <br />
+
+    <div class="messagebox">
+
+      <form name="Form" method="post" action='$link.setAction("administration/FileAction")'>
+        <table>
+          <tr>
+            <td>
+              Name:
+              <br />
+              <small>
+              	Descriptive display name<br />
+              	Example: <strong>Intranet Apache 2.0 - httpsd</strong>
+              </small>
+            </td>
+            <td>
+              <input type="text" id="name" name="name" value="$!{name}">
+            </td>
+          </tr>
+          <tr>
+            <td>
+              Content:
+              <br />
+              <a id="viewTemplateVars" onclick="javascript:toggleDisplay('templateVariables');">Click here to see valid variables</a>
+              <div id="templateVariables" style="display:none">
+    	          Variables (&lt;value&gt;=&lt;text to put in template&gt;):<br />
+        	      #set ($vars = $view.getTemplateVariables())
+        	      <strong>
+            	  #foreach ($var in $vars) 
+	            	  <span class="templateVar">$var</span>
+		          #end  
+		          </strong>
+		          <br />
+		          <span class="templateNotice">The text in the template will be replaced with the actual value when the file is built and deployed.</span>
+	    	  </div>
+            </td>
+            <td>
+              <textarea id="content" name="content" cols="80" rows="30">$!{content}</textarea>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              Path:<br />
+              <small>
+              	Path to this file on the file system<br />
+              	<font color="#FF0000">Note: Do not include the file name here! It will be appended on when deployed.</font><br />
+              	Example: <strong>/opt/apache2/conf/</strong>
+              </small>
+            </td>
+            <td>
+              <input type="text" id="path" name="path" value="$!{path}">
+            </td>
+          </tr>
+          <tr>
+            <td>
+              Descriptor:
+              <br />
+              <small>Actual name of the file.<br />
+              	<font color="#FF0000">Note: This is the file name that will be deployed!</font><br />
+              	Example: <strong>httpsd.conf</strong>, <strong>server.xml</strong>
+              </small>
+            </td>
+            <td>
+              <input type="text" id="descriptor" name="descriptor" value="$!{descriptor}">
+            </td>
+          </tr>
+        </table>
+        <input type="hidden" name="methodToCall" value="AddFile">
+        <input type="submit" value="Submit">
+      </form>
+    </div>
+  </div>
+  #parse("/layout/footer.vm")
+
+

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/add.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/confirm.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/confirm.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/confirm.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/confirm.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,34 @@
+##
+## 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.
+##
+## $Id$
+##
+<div class="messagebox">
+<!-- $function $User.isAllowed($function)  $methodToCall  $actionLink -->
+#if ($User.isAllowed($function) && $methodToCall && $actionLink)
+<br />
+<form name="Form" method="post" action='$link.setAction($actionLink)'>
+<input type=hidden name="methodToCall" value="$methodToCall" >
+<input type="submit" value="$buttonName"><br />
+<br />
+$methodToCall
+<input type=hidden name=id value="$individual.getPk()" >&nbsp;&nbsp;
+$individual.getName()
+</form>
+#end
+</div>

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/confirm.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/copy.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/copy.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/copy.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/copy.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,90 @@
+##
+## 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.
+##
+## $Id$
+##
+#set ($menu = "/layout/menu/EntityTop.vm")
+#set ($pageSelected = "template")
+#parse("/layout/header.vm")
+<div align="center" class="contentbox">
+  <br /><br />
+
+  <div class="projectbox">
+    <table width="100%" border="0" cellspacing="0" cellpadding="1">
+      <tr class="info" valign="top">
+        <td colspan=3>Administration - <b>Template</b>
+        </td>
+        <td align="right">
+          #parse("Core/Template/menu/global.vm")
+        </td>
+      </tr>
+    </table>
+    <br />
+
+    <div class="messagebox">
+      <SCRIPT LANGUAGE=javascript>
+        <!--
+        function OnChangeIt(dropdown)
+        {
+          var myindex = dropdown.selectedIndex;
+          var SelValue = dropdown.options[myindex].value;
+          var baseURL = "$appRoot/Core/Template/update.vm?id=" + SelValue;
+          top.location.href = baseURL;
+
+          return true;
+        }
+        //-->
+      </SCRIPT>
+      #set ($id = $request.getParameter("id"))
+      #set ($methodToCall = "AddFile")
+
+      #if($id)
+      #set ($file = $view.getTemplate($id))
+      #if ($User.isAllowed("AddFile") && $methodToCall == "AddFile")
+      <form name="Form" method="post" action='$link.setAction("administration/FileAction")'>
+        <input type="hidden" id="id" name="id" value="$!{id}">
+        <input type="hidden" id="methodToCall" name="methodToCall" value="$methodToCall">
+
+        Name: <input type="text" id="name" name="name" value="$!{file.getName()}"><br />
+        Path: <input type="text" id="path" name="path" value="$!{file.getPath()}"><br />
+        Descriptor: <input type="text" id="descriptor" name="descriptor" value="$!{file.getDescriptor()}"><br />
+        Content: <textarea id="content" name="content" cols="90" rows="30">$!{file.getContent()}</textarea><br />
+        <input type="submit" value="update">
+      </form>
+      #end
+
+      #else
+      Template:
+      #set ($files = $view.getTemplates())
+      <select name=id onchange='OnChangeIt(this);'>
+        <option value="">Select one
+          #foreach ($file in $files)
+        <option value="$file.getPk()">$file.getName()
+          #end
+      </select><br />
+
+      #end
+    </div>
+    <br />
+  </div>
+  <br />
+</div>
+#parse("/layout/footer.vm")
+
+
+

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/copy.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/delete.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/delete.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/delete.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/delete.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,26 @@
+####
+## 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.
+##
+## $Id$
+##
+#set($actionLink = "administration/Template/Delete")
+#set($methodToCall = "DeleteFile")
+#set($buttonName = "Delete")
+#set ($function = "DeleteFile")
+#set ($currentPage = "delete.vm")
+#parse("Core/Template/list.vm")
\ No newline at end of file

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/delete.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/details.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/details.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/details.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/details.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,97 @@
+##
+## 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.
+##
+## $Id$
+##
+#set ($menu = "/layout/menu/EntityTop.vm")
+#set ($pageSelected = "template")
+#parse("/layout/header.vm")
+<div align="center" class="contentbox">
+  <br /><br />
+
+  <div class="projectbox">
+    <table width="100%" border="0" cellspacing="0" cellpadding="1">
+      <tr class="info" valign="top">
+        <td colspan=3>Administration - <b>Template</b>
+        </td>
+        <td align="right">
+          #parse("Core/Template/menu/indiv.vm")
+        </td>
+      </tr>
+    </table>
+    <br />
+
+    <div class="messagebox">
+      <SCRIPT LANGUAGE=javascript>
+        <!--
+        function OnChangeIt(dropdown)
+        {
+          var myindex = dropdown.selectedIndex;
+          var SelValue = dropdown.options[myindex].value;
+          var baseURL = "$appRoot/Core/Template/details.vm?id=" + SelValue;
+          top.location.href = baseURL;
+
+          return true;
+        }
+        //-->
+      </SCRIPT>
+      #set ($id = $request.getParameter("id"))
+      #set ($methodToCall = "UpdateFile")
+
+      #if($id)
+      #set ($file = $view.getTemplate($id))
+	  #set ($ent = $file)
+      #if ($User.isAllowed("ViewFile")) <br />
+      Name: "$!{file.getName()}" <br />
+      Path: "$!{file.getPath()}" <br />
+      Descriptor: "$!{file.getDescriptor()}" <br />
+      Content: <textarea id="content" name="content" READONLY cols="90" rows="30">$!{file.getContent()}</textarea><br />
+      #end
+
+      #if ($User.isAllowed("UpdateFile"))
+      <br /><br /><a href="$appRoot/Core/Template/update.vm?id=$id">Update this Template</a> &nbsp;<br /><br />
+      #end
+
+      #if ($User.isAllowed("DeleteFile"))
+      <form method="post" action='$link.setAction("administration/File/Delete")' method="post">
+        <input type="hidden" name="id" value="$!{id}">
+        <input type="hidden" name="methodToCall" value="DeleteFile">
+        #submit_button("Submit" "Delete" "button" "")
+      </form>
+      #end
+
+      #else
+      Template:
+      #set ($files = $view.getTemplates())
+      <select name=id onchange='OnChangeIt(this);'>
+        <option value="">Select one
+          #foreach ($file in $files)
+        <option value="$file.getPk()">$file.getName()
+          #end
+      </select><br />
+
+      #end
+    </div>
+    <br />
+  </div>
+  <br />
+</div>
+#parse("/layout/footer.vm")
+
+
+

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/details.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/list.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/list.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/list.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/list.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,47 @@
+##
+## 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.
+##
+## $Id$
+##
+#if (!$collection)
+#set ($menu = "/layout/menu/EntityTop.vm")
+#set ($pageSelected = "template")
+#parse("/layout/header.vm")
+#set ($plf = "true")
+#if ($request.getParameter("id"))
+#set ($id = $request.getParameter("id"))
+#set ($individual = $view.getTemplate($id))
+#set ($indivPage = "/Core/Template/confirm.vm")
+#else
+#set ($collection = $view.getTemplates())
+#end
+#end
+#set ($entity = "Template")
+#set ($usesEnv = "false")
+#set ($path = "Core/Template")
+#set ($addFunction = "Add$entity")
+#set ($deleteFunction = "Delete$entity")
+#if (! $currentPage)
+#set ($currentPage = "$appRoot/Core/Template/list.vm")
+#end
+
+#parse("/layout/list2.vm")
+#if ($plf)
+#parse("/layout/footer.vm")
+#end
+

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/list.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/global.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/global.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/global.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/global.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,41 @@
+##
+## 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.
+##
+## $Id$
+##
+<select name=methodToCall onchange='OnChange(this);'>
+  <option value="" selected>Select Action
+    #if($page)
+  <option value="$appRoot/Core/Template/$page">&nbsp;Details&nbsp;</option>
+  #else
+  <option value="$appRoot/Core/Template/details.vm">&nbsp;Details&nbsp;</option>
+  #end
+  #if ($User.isAllowed("AddFile"))
+  <option value="$appRoot/Core/Template/add.vm">&nbsp;Add&nbsp;</option>
+  #end
+  #if($User.isAllowed("UpdateFile"))
+  <option value="$appRoot/Core/Template/update.vm">&nbsp;Update&nbsp;</option>
+  #end
+  #if ($User.isAllowed("DeleteFile"))
+  <option value="$appRoot/Core/Template/delete.vm">&nbsp;Delete&nbsp;</option>
+  #end
+  #if ($User.isAllowed("AddFile"))
+  <option value="$appRoot/Core/Template/copy.vm">&nbsp;Copy&nbsp;</option>
+  #end
+</select>
+

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/global.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/indiv.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/indiv.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/indiv.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/indiv.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,38 @@
+##
+## 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.
+##
+## $Id$
+##
+<select name=methodToCall onchange='OnChange(this);'>
+  <option value="" selected>Select Action
+    #if($page)
+  <option value="$appRoot/Core/Template/$page?id=$!{ent.getPk()}">&nbsp;Details&nbsp;</option>
+  #else
+  <option value="$appRoot/Core/Template/details.vm?id=$!{ent.getPk()}">&nbsp;Details&nbsp;</option>
+  #end
+  #if($User.isAllowed("UpdateFile"))
+  <option value="$appRoot/Core/Template/update.vm?id=$!{ent.getPk()}">&nbsp;Update&nbsp;</option>
+  #end
+  #if($User.isAllowed("DeleteFile"))
+  <option value="$appRoot/Core/Template/delete.vm?id=$!{ent.getPk()}">&nbsp;Delete&nbsp;</option>
+  #end
+  #if ($User.isAllowed("AddFile"))
+  <option value="$appRoot/Core/Template/copy.vm?id=$!{ent.getPk()}">&nbsp;Copy&nbsp;</option>
+  #end
+</select>
+

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/menu/indiv.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lokahi/lokahi/trunk/src/www/Core/Template/update.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Core/Template/update.vm?rev=629916&view=auto
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Core/Template/update.vm (added)
+++ incubator/lokahi/lokahi/trunk/src/www/Core/Template/update.vm Thu Feb 21 10:43:55 2008
@@ -0,0 +1,103 @@
+##
+## 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.
+##
+## $Id$
+##
+#set ($menu = "/layout/menu/EntityTop.vm")
+#set ($pageSelected = "template")
+#parse("/layout/header.vm")
+<div align="center" class="contentbox">
+  <br /><br />
+
+  <div class="projectbox">
+    <table width="100%" border="0" cellspacing="0" cellpadding="1">
+      <tr class="info" valign="top">
+        <td colspan=3>Administration - <b>Template</b>
+        </td>
+        <td align="right">
+          #parse("Core/Template/menu/global.vm")
+        </td>
+      </tr>
+    </table>
+    <br />
+
+    <div class="messagebox">
+      <SCRIPT LANGUAGE=javascript>
+        <!--
+        function OnChangeIt(dropdown)
+        {
+          var myindex = dropdown.selectedIndex;
+          var SelValue = dropdown.options[myindex].value;
+          var baseURL = "$appRoot/Core/Template/update.vm?id=" + SelValue;
+          top.location.href = baseURL;
+
+          return true;
+        }
+        //-->
+      </SCRIPT>
+      #set ($id = $request.getParameter("id"))
+      #set ($methodToCall = "UpdateFile")
+
+      #if($id)
+      #set ($file = $view.getTemplate($id))
+      #if ($User.isAllowed("UpdateFile") && $methodToCall == "UpdateFile")
+      <form name="Form" method="post" action='$link.setAction("administration/FileAction")'>
+        <input type="hidden" id="id" name="id" value="$!{id}">
+        <input type="hidden" id="methodToCall" name="methodToCall" value="$methodToCall">
+
+        Name: <input type="text" id="name" name="name" value="$!{file.getName()}"><br />
+        Path: <input type="text" id="path" name="path" value="$!{file.getPath()}"><br />
+        Descriptor: <input type="text" id="descriptor" name="descriptor" value="$!{file.getDescriptor()}"><br />
+        Content: 
+        <a id="viewTemplateVars" onclick="javascript:toggleDisplay('templateVariables');">Click here to see valid variables</a>
+         <div id="templateVariables" style="display:none">
+    	 	Variables (&lt;value&gt;=&lt;text to put in template&gt;):<br />
+	        #set ($vars = $view.getTemplateVariables())
+        	<strong>
+              #foreach ($var in $vars) 
+	            <span class="templateVar">$var</span>
+		      #end  
+		    </strong>
+		    <br />
+		    <span class="templateNotice">The text in the template will be replaced with the actual value when the file is built and deployed.</span>
+	    </div>
+        <textarea id="content" name="content" cols="90" rows="30">$!{file.getContent()}</textarea><br />
+        <input type="submit" value="Update">
+      </form>
+      #end
+
+      #else
+      Template:
+      #set ($files = $view.getTemplates())
+      <select name=id onchange='OnChangeIt(this);'>
+        <option value="">Select one
+          #foreach ($file in $files)
+        <option value="$file.getPk()">$file.getName()
+          #end
+      </select><br />
+
+      #end
+    </div>
+    <br />
+  </div>
+  <br />
+</div>
+#parse("/layout/footer.vm")
+
+
+

Propchange: incubator/lokahi/lokahi/trunk/src/www/Core/Template/update.vm
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/menu/global.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/menu/global.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/menu/global.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/menu/global.vm Thu Feb 21 10:43:55 2008
@@ -43,11 +43,12 @@
   #if($User.isAllowed("StartTomcat"))
   <option value="$appRoot/Tomcat/Pool/starttomcat.vm">&nbsp;Start&nbsp;</option>
   #end
-  #if($User.isAllowed("ViewTomcatPool"))
-  <option value="$appRoot/Tomcat/Pool/viewconf.vm">&nbsp;View server.xml&nbsp;</option>
-  #end
+  ##if($User.isAllowed("ViewTomcatPool"))
+  ##<option value="$appRoot/Tomcat/Pool/viewconf.vm">&nbsp;View server.xml&nbsp;</option>
+  ##end
   #if($User.isAllowed("DeployTomcatConfig"))
   <option value="$appRoot/Tomcat/Pool/deployconf.vm">&nbsp;Deploy Tomcat Config&nbsp;</option>
   #end
 </select>
+
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/menu/indiv.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/menu/indiv.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/menu/indiv.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Pool/menu/indiv.vm Thu Feb 21 10:43:55 2008
@@ -40,11 +40,12 @@
   #if($User.isAllowed("StartTomcat"))
   <option value="$appRoot/Tomcat/Pool/starttomcat.vm?id=$!{ent.getPk()}">&nbsp;Start&nbsp;</option>
   #end
-  #if($User.isAllowed("ViewTomcatPool"))
-  <option value="$appRoot/Tomcat/Pool/viewconf.vm">&nbsp;View server.xml&nbsp;</option>
-  #end
+  ##if($User.isAllowed("ViewTomcatPool"))
+  ##<option value="$appRoot/Tomcat/Pool/viewconf.vm">&nbsp;View server.xml&nbsp;</option>
+  ###end
   #if($User.isAllowed("DeployTomcatConfig"))
   <option value="$appRoot/Tomcat/Pool/deployconf.vm?id=$!{ent.getPk()}">&nbsp;Deploy Tomcat Config&nbsp;</option>
   #end
 </select>
+
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/add.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/add.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/add.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/add.vm Thu Feb 21 10:43:55 2008
@@ -143,25 +143,38 @@
     <textarea id="javaOpts" cols="70" rows="7" name="javaOpts">$!{javaOpts}</textarea>
   </td>
 </tr>
-<!--
-<input type="hidden" id="pidFileLocation" name="pidFileLocation" value="$!{pidFileLocation}">
+
+##<input type="hidden" id="pidFileLocation" name="pidFileLocation" value="$!{pidFileLocation}">
+##</td>
+##</tr>
+<tr>
+	<td>
+	Server.xml Template:
+	</td>
+	<td>
+	#set ($allFiles = $view.getTemplates())
+
+	<select name=template>
+	     #foreach ($file in $allFiles)
+	     <option value="$file.getPk()">$file.getName()
+	      #end
+    </select>
 </td>
 </tr>
 <tr>
-<td>
-Files:
-</td>
-<td>
-#set ($allFiles = $view.getFiles())
+	<td>
+	JVM.conf Template:
+	</td>
+	<td>
+	#set ($allFiles = $view.getTemplates())
 
-<select name=files multiple>
-			      #foreach ($file in $allFiles)
-			      <option value="$file.getPk()">$file.getName()
-			      #end
-			      </select>
+	<select name=template>
+	     #foreach ($file in $allFiles)
+	     <option value="$file.getPk()">$file.getName()
+	      #end
+    </select>
 </td>
 </tr>
--->
 </table>
 <input type="hidden" name="methodToCall" value="AddTomcat">
 <input type="submit" value="Submit">
@@ -172,5 +185,6 @@
 <br />
 </div>
 #parse("/layout/footer.vm")
+
 
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/details.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/details.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/details.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/details.vm Thu Feb 21 10:43:55 2008
@@ -67,6 +67,26 @@
     <tr class="headercolor2"><td>JVM Options:</td><td colspan="2"><textarea readonly id="entry" name="entry" cols="40"
                                                                             rows="5"> $!{tomcat.getEntry()} </textarea>
     </td></tr>
+    <tr class="headercolor1"><td>Tomcat Templates:</td>
+      	#set ($templates = $!{tomcat.getTemplates()})
+      	#set($cc=2)
+      	#set ($next = false)
+      	#if (!$templates || $templates.isEmpty())
+      		<td></td><td></td></tr>
+	    #end
+      	#foreach ($template in $templates)
+      		#if ($next ==  true)
+      			<tr class="headercolor1"><td></td>
+		    #end
+      		#if ($cc == 1)
+      		 #set($cc=2)
+		    #else
+		     #set($cc=1)
+		    #end
+	      	<td class="bodycolor1$cc"><a href="$appRoot/Core/Template/details.vm?id=$!{template.getPk()}"> $!{template.getName()}</a></td>
+			<td class="bodycolor1$cc"></td></tr>
+			#set ($next = true)
+      	#end
   </table>
 
   #set ($collection = $view.getTomcatWorkers($tomcat))
@@ -94,6 +114,7 @@
 </div>
 
 #parse("/layout/footer.vm")
+
 
 
 

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=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/update.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Server/update.vm Thu Feb 21 10:43:55 2008
@@ -66,6 +66,29 @@
 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.getJavaOptions()}</textarea><br />
+Current Templates:<br />
+#set ($templates = $!{tomcat.getTemplates()})
+#foreach ($template in $templates)
+<a href="$appRoot/Core/Template/details.vm?id=$!{template.getPk()}"> $!{template.getName()}</a><br />
+#end
+<br />
+New Server.xml Template:
+    #set ($allFiles = $view.getTemplates())
+    <select name=template>
+      #foreach ($file in $allFiles)
+      <option value="$file.getPk()">$file.getName()</option>
+        #end
+    </select>
+<br />
+New JVM.conf Template:
+    <select name=template>
+      #foreach ($file in $allFiles)
+      <option value="$file.getPk()">$file.getName()</option>
+        #end
+    </select>
+<br />
+<br />
+Be sure you have the correct template selected before clicking 'Update'!<br />
         <input type="hidden" name="methodToCall" value="UpdateTomcat">
         <input type="submit" value="Update"><br />
       </form>
@@ -79,7 +102,6 @@
         <option value="$appRoot/Tomcat/Server/update.vm?id=$ap.getPk()">$ap.getName()
           #end
       </select><br />
-
       #end
     </div>
     <br />
@@ -87,4 +109,5 @@
   <br />
 </div>
 #parse("/layout/footer.vm")
+
 

Modified: incubator/lokahi/lokahi/trunk/src/www/Tomcat/Worker/menu/global.vm
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/www/Tomcat/Worker/menu/global.vm?rev=629916&r1=629915&r2=629916&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/www/Tomcat/Worker/menu/global.vm (original)
+++ incubator/lokahi/lokahi/trunk/src/www/Tomcat/Worker/menu/global.vm Thu Feb 21 10:43:55 2008
@@ -26,7 +26,8 @@
   <option value="$appRoot/Tomcat/Worker/restarttomcat.vm">&nbsp;Restart&nbsp;</option>
   <option value="$appRoot/Tomcat/Worker/stoptomcat.vm">&nbsp;Stop&nbsp;</option>
   <option value="$appRoot/Tomcat/Worker/starttomcat.vm">&nbsp;Start&nbsp;</option>
-  <option value="$appRoot/Tomcat/Worker/viewconf.vm">&nbsp;View server.xml&nbsp;</option>
+  ##<option value="$appRoot/Tomcat/Worker/viewconf.vm">&nbsp;View server.xml&nbsp;</option>
   <option value="$appRoot/Tomcat/Worker/deployconf.vm">&nbsp;Deploy Config File&nbsp;</option>
 </select>
+