incubator-lokahi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tob...@apache.org
Subject svn commit: r493210 [2/2] - in /incubator/lokahi/lokahi/branches/jackrabbit: lib/ src/java/org/apache/lokahi/core/agent/jmx/ src/java/org/apache/lokahi/core/api/environment/ src/java/org/apache/lokahi/core/api/file/ src/java/org/apache/lokahi/core/api/...
Date Fri, 05 Jan 2007 22:22:25 GMT
Modified: incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorker.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorker.java?view=diff&rev=493210&r1=493209&r2=493210
==============================================================================
--- incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorker.java
(original)
+++ incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorker.java
Fri Jan  5 14:22:23 2007
@@ -6,9 +6,9 @@
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
-* 
+*
 *   http://www.apache.org/licenses/LICENSE-2.0
-* 
+*
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,19 +19,14 @@
 package org.apache.lokahi.tomcat.api.worker;
 
 import org.apache.log4j.Logger;
-import org.apache.lokahi.core.api.instance.Instance;
 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.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.core.common.util.RestUtil;
 import org.apache.lokahi.tomcat.api.entity.TomcatContext;
-import org.apache.lokahi.tomcat.api.pool.TomcatPool;
 import org.apache.lokahi.tomcat.api.server.Tomcat;
 
-import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.Collection;
 import java.util.LinkedHashMap;
@@ -40,8 +35,7 @@
  * @author Stephen Toback
  * @version $Id$
  */
-public class TomcatWorker extends TMCDao<TomcatWorker> implements Server {
-  private static final TMCBroker<TomcatWorker> broker = new BrokerFactory<TomcatWorker>().getBroker();
+public class TomcatWorker implements Worker<Tomcat> {
   static final Logger logger = Logger.getLogger(TomcatWorker.class);
   private int workerId;
   private int hardwareId;
@@ -62,8 +56,8 @@
 
   public String getName() {
     String ret = "Invalid Name";
-    if (this.getHardware() != null && this.getTomcat() != null) {
-      ret = this.getHardware().getName() + ':' + this.getTomcat().getHttpPort();
+    if (this.getHardware() != null && this.getApplication() != null) {
+      ret = this.getHardware().getName() + ':' + this.getApplication().getHttpPort();
     }
     return ret;
   }
@@ -127,7 +121,7 @@
     }
   }
 
-  public Tomcat getTomcat() {
+  public Tomcat getApplication() {
     if (tomcat == null) {
       try {
         this.tomcat = Tomcat.getTomcat(this.getTomcatId(), true);
@@ -140,7 +134,7 @@
     return tomcat;
   }
 
-  public void setTomcat(Tomcat tomcat) {
+  public void setApplication(Tomcat tomcat) {
     this.tomcat = tomcat;
     if (tomcat != null) {
       this.setTomcatId(tomcat.getPk());
@@ -167,8 +161,8 @@
 
   public int getType() {
     int ret = 0;
-    if (this.getTomcat() != null) {
-      ret = this.getTomcat().getType();
+    if (this.getApplication() != null) {
+      ret = this.getApplication().getType();
     }
     return ret;
   }
@@ -179,21 +173,13 @@
   public TomcatWorker(Hardware hardware, State state, Tomcat tomcat) {
     this.setHardware(hardware);
     this.setState(state);
-    this.setTomcat(tomcat);
-  }
-
-  /** @deprecated  */
-  public TomcatWorker(int workerId, int hardwareId, int stateId, int tomcatId) {
-    this.workerId = workerId;
-    this.hardwareId = hardwareId;
-    this.stateId = stateId;
-    this.tomcatId = tomcatId;
+    this.setApplication(tomcat);
   }
 
   public TomcatWorker(int workerId, int stateId, Tomcat t, Hardware h) {
     this.workerId = workerId;
     this.stateId = stateId;
-    this.setTomcat(t);
+    this.setApplication(t);
     this.setHardware(h);
   }
 
@@ -219,23 +205,6 @@
     return c;
   }
 
-  public TomcatWorker fillObject(ResultSet r) throws SQLException {
-    return new TomcatWorker(r.getInt("WORKER_ID"),
-                            r.getInt("STATE_ID"),
-                            new Tomcat().fillObject(r),
-                            new Hardware().fillObject(r));
-  }
-
-  /** @deprecated  */
-  public String buildServerXML() throws SQLException {
-    ServerXmlFile sxf = new ServerXmlFile(this);
-    return sxf.build();
-  }
-
-  public static Collection<TomcatWorker> getTomcatWorkers(TomcatPool tp, boolean cache)
throws SQLException {
-    return getTomcatWorkers(tp.getPk(), cache);
-  }
-
   public String buildConfForWeb() {
     String ret = "A database error has occurred.";
     try {
@@ -249,152 +218,23 @@
     return ret;
   }
 
-  public static void update(TomcatWorker tw) throws SQLException {
-    broker.update("tomcat.worker.update", tw.getPk(), tw.getHardwareId(), tw.getStateId(),
tw.getTomcatId());
-  }
-
-  public static boolean delete(TomcatWorker tw) throws SQLException {
-    return broker.delete("tomcat.worker.delete", tw.getPk());
-  }
-
-  public static TomcatWorker store(TomcatWorker tw) throws SQLException {
-    TomcatWorker ret = getTomcatWorker(tw.getHardware(), tw.getTomcat(), false);
-    if (ret == null) {
-      tw.setPk(broker.save("tomcat.worker.store", tw.getHardwareId(), tw.getStateId(), tw.getTomcatId()));
-      ret = tw;
-    }
-    return ret;
-  }
-
-  public static Collection<TomcatWorker> getTomcatWorkers(int poolId, boolean cache)
throws SQLException {
-    Collection<TomcatWorker> c;
-    try {
-      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.pool", poolId);
-    } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
-      throw e;
-    }
-    return c;
-  }
-
-  public static Collection<TomcatWorker> getTomcatWorkers(boolean cache) throws SQLException
{
-    Collection<TomcatWorker> c;
-    try {
-      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.all");
-    } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
-      throw e;
-    }
-    return c;
-  }
-
-  public TomcatWorker get(int id) throws SQLException {
-    TomcatWorker t;
-    try {
-      t = broker.getObject(TomcatWorker.class, "tomcat.worker.by.id", false, id);
-    } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
-      throw e;
-    }
-    if (logger.isDebugEnabled()) {
-      logger.debug("id=" + id);
-      logger.debug("t=" + t);
-    }
-    return t;
-  }
-
-  public static TomcatWorker getTomcatWorker(int id, boolean cache) throws SQLException {
-    return new TomcatWorker().get(id);
-  }
-
-  public static TomcatWorker getTomcatWorker(Hardware h, Tomcat t, boolean cache) throws
SQLException {
-    TomcatWorker tw;
-    try {
-      tw = broker.getObject(TomcatWorker.class, "tomcat.worker.by.hardware.server", cache,
h.getPk(), t.getPk());
-    } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
-      throw e;
-    }
-    return tw;
-  }
-
-  public static Collection<TomcatWorker> getTomcatWorkers(Hardware h, boolean cache)
throws SQLException {
-    Collection<TomcatWorker> c;
-    try {
-      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.hardware", h.getPk());
-    } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
-      throw e;
-    }
-    return c;
-  }
-
-  public static Collection<TomcatWorker> getTomcatWorkers(Tomcat t, boolean cache)
throws SQLException {
-    Collection<TomcatWorker> c;
-    try {
-      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.server", t.getPk());
-    } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
-      throw e;
-    }
-    return c;
-  }
-
-  public static Collection<TomcatWorker> getTomcatWorkers(String name, boolean cache)
throws SQLException {
-    Collection<TomcatWorker> c;
-    try {
-      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.name", name);
-    } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
-      throw e;
-    }
-    return c;
-  }
-
-  public static Collection<TomcatWorker> getTomcatWorkers(String name, Instance i,
boolean cache) throws SQLException {
-    Collection<TomcatWorker> c;
-    try {
-      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.name.instance",
name, i.getPk());
-    } catch (SQLException e) {
-      if (logger.isInfoEnabled()) {
-        logger.info("Exception: " + e.getMessage());
-      }
-      throw e;
-    }
-    return c;
-  }
-
   public StringBuilder buildShortXMLRepresentation() {
     LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(3,
1);
     map.put("id", Integer.toString(this.getPk()));
     map.put("name", this.getName());
     map.put("href", PropertiesFile.getConstantValue("rest.servlet.url") + "tomcatworker/"
+ this.getPk() + '/');
-    return elementBuilder("tomcatworker", map);
+    return RestUtil.elementBuilder("tomcatworker", map);
   }
 
   public StringBuilder buildXMLRepresention() {
     StringBuilder ret = new StringBuilder();
     ret.append("<tomcatworker>\n");
-    ret.append(elementBuilder("id", Integer.toString(this.getPk())));
-    ret.append(elementBuilder("name", this.getName()));
-    ret.append(elementBuilder("version", Integer.toString(this.getType())));
-    ret.append(elementBuilder("workerName", this.getWorkerName()));
+    ret.append(RestUtil.elementBuilder("id", Integer.toString(this.getPk())));
+    ret.append(RestUtil.elementBuilder("name", this.getName()));
+    ret.append(RestUtil.elementBuilder("version", Integer.toString(this.getType())));
+    ret.append(RestUtil.elementBuilder("workerName", this.getWorkerName()));
     ret.append(this.getHardware().buildShortXMLRepresentation());
-    ret.append(this.getTomcat().buildShortXMLRepresentation());
+    ret.append(this.getApplication().buildShortXMLRepresentation());
     ret.append(this.getState().buildShortXMLRepresentation());
     for (final TomcatContext tc : this.getAllContexts()) {
       ret.append(tc.buildShortXMLRepresentation());

Added: incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerDAO.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerDAO.java?view=auto&rev=493210
==============================================================================
--- incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerDAO.java
(added)
+++ incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerDAO.java
Fri Jan  5 14:22:23 2007
@@ -0,0 +1,162 @@
+package org.apache.lokahi.tomcat.api.worker;
+
+import org.apache.lokahi.core.common.interfaces.TMCDao;
+import org.apache.lokahi.core.common.interfaces.TMCBroker;
+import org.apache.lokahi.core.common.database.BrokerFactory;
+import org.apache.lokahi.core.api.server.Hardware;
+import org.apache.lokahi.core.api.instance.Instance;
+import org.apache.lokahi.tomcat.api.pool.TomcatPool;
+import org.apache.lokahi.tomcat.api.server.Tomcat;
+import org.apache.log4j.Logger;
+
+import java.util.Collection;
+import java.sql.SQLException;
+import java.sql.ResultSet;
+
+/** User: toback */
+public class TomcatWorkerDAO extends TMCDao<TomcatWorker> {
+  static final Logger logger = Logger.getLogger(TomcatWorkerDAO.class);
+  private static final TMCBroker<TomcatWorkerDAO> broker = new BrokerFactory<TomcatWorkerDAO>().getBroker();
+
+  public TomcatWorker fillObject(ResultSet r) throws SQLException {
+    return new TomcatWorker(r.getInt("WORKER_ID"),
+                            r.getInt("STATE_ID"),
+                            new Tomcat().fillObject(r),
+                            new Hardware().fillObject(r));
+  }
+
+  public TomcatWorker get(int id) throws SQLException {
+    TomcatWorker t;
+    try {
+      t = TomcatWorkerDAO.broker.getObject(TomcatWorker.class, "tomcat.worker.by.id", false,
id);
+    } catch (SQLException e) {
+      if (logger.isInfoEnabled()) {
+        logger.info("Exception: " + e.getMessage());
+      }
+      throw e;
+    }
+    if (logger.isDebugEnabled()) {
+      logger.debug("id=" + id);
+      logger.debug("t=" + t);
+    }
+    return t;
+  }
+
+
+
+  public static Collection<TomcatWorker> getTomcatWorkers(TomcatPool tp, boolean cache)
throws SQLException {
+    return getTomcatWorkers(tp.getPk(), cache);
+  }
+
+  public static void update(TomcatWorker tw) throws SQLException {
+    broker.update("tomcat.worker.update", tw.getPk(), tw.getHardwareId(), tw.getStateId(),
tw.getTomcatId());
+  }
+
+  public static boolean delete(TomcatWorker tw) throws SQLException {
+    return broker.delete("tomcat.worker.delete", tw.getPk());
+  }
+
+  public static TomcatWorker store(TomcatWorker tw) throws SQLException {
+    TomcatWorker ret = getTomcatWorker(tw.getHardware(), tw.getApplication(), false);
+    if (ret == null) {
+      tw.setPk(broker.save("tomcat.worker.store", tw.getHardwareId(), tw.getStateId(), tw.getTomcatId()));
+      ret = tw;
+    }
+    return ret;
+  }
+
+  public static Collection<TomcatWorker> getTomcatWorkers(int poolId, boolean cache)
throws SQLException {
+    Collection<TomcatWorker> c;
+    try {
+      c = broker.getObjects(TomcatWorkerDAO.class, cache, "tomcat.worker.by.pool", poolId);
+    } catch (SQLException e) {
+      if (TomcatWorker.logger.isInfoEnabled()) {
+        TomcatWorker.logger.info("Exception: " + e.getMessage());
+      }
+      throw e;
+    }
+    return c;
+  }
+
+  public static Collection<TomcatWorker> getTomcatWorkers(boolean cache) throws SQLException
{
+    Collection<TomcatWorker> c;
+    try {
+      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.all");
+    } catch (SQLException e) {
+      if (TomcatWorker.logger.isInfoEnabled()) {
+        TomcatWorker.logger.info("Exception: " + e.getMessage());
+      }
+      throw e;
+    }
+    return c;
+  }
+
+  public static TomcatWorker getTomcatWorker(int id, boolean cache) throws SQLException {
+    return new TomcatWorker().get(id);
+  }
+
+  public static TomcatWorker getTomcatWorker(Hardware h, Tomcat t, boolean cache) throws
SQLException {
+    TomcatWorker tw;
+    try {
+      tw = broker.getObject(TomcatWorker.class, "tomcat.worker.by.hardware.server", cache,
h.getPk(), t.getPk());
+    } catch (SQLException e) {
+      if (TomcatWorker.logger.isInfoEnabled()) {
+        TomcatWorker.logger.info("Exception: " + e.getMessage());
+      }
+      throw e;
+    }
+    return tw;
+  }
+
+  public static Collection<TomcatWorker> getTomcatWorkers(Hardware h, boolean cache)
throws SQLException {
+    Collection<TomcatWorker> c;
+    try {
+      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.hardware", h.getPk());
+    } catch (SQLException e) {
+      if (TomcatWorker.logger.isInfoEnabled()) {
+        TomcatWorker.logger.info("Exception: " + e.getMessage());
+      }
+      throw e;
+    }
+    return c;
+  }
+
+  public static Collection<TomcatWorker> getTomcatWorkers(Tomcat t, boolean cache)
throws SQLException {
+    Collection<TomcatWorker> c;
+    try {
+      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.server", t.getPk());
+    } catch (SQLException e) {
+      if (TomcatWorker.logger.isInfoEnabled()) {
+        TomcatWorker.logger.info("Exception: " + e.getMessage());
+      }
+      throw e;
+    }
+    return c;
+  }
+
+  public static Collection<TomcatWorker> getTomcatWorkers(String name, boolean cache)
throws SQLException {
+    Collection<TomcatWorker> c;
+    try {
+      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.name", name);
+    } catch (SQLException e) {
+      if (TomcatWorker.logger.isInfoEnabled()) {
+        TomcatWorker.logger.info("Exception: " + e.getMessage());
+      }
+      throw e;
+    }
+    return c;
+  }
+
+  public static Collection<TomcatWorker> getTomcatWorkers(String name, Instance i,
boolean cache) throws SQLException {
+    Collection<TomcatWorker> c;
+    try {
+      c = broker.getObjects(TomcatWorker.class, cache, "tomcat.worker.by.name.instance",
name, i.getPk());
+    } catch (SQLException e) {
+      if (TomcatWorker.logger.isInfoEnabled()) {
+        TomcatWorker.logger.info("Exception: " + e.getMessage());
+      }
+      throw e;
+    }
+    return c;
+  }
+}

Modified: incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerModel.java?view=diff&rev=493210&r1=493209&r2=493210
==============================================================================
--- incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerModel.java
(original)
+++ incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/api/worker/TomcatWorkerModel.java
Fri Jan  5 14:22:23 2007
@@ -6,9 +6,9 @@
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
-* 
+*
 *   http://www.apache.org/licenses/LICENSE-2.0
-* 
+*
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -74,7 +74,7 @@
 
   public void updateTomcat(User u, Project p, JobPool jobPool, TomcatWorker tw) throws SQLException,
IOException, AuthorizationException {
     String options;
-    Tomcat tc = tw.getTomcat();
+    Tomcat tc = tw.getApplication();
     if (tc != null) {
       String delim = PropertiesFile.getConstantValue("agent.delim.options");
       options = "tc4" + delim +
@@ -88,7 +88,7 @@
 	  this.jpInit(f, u, tw.getName());
 	  if (u.isAllowed(f) && "UpdateTomcatWorker".equals(f.getCommand())) {
 		  if (tw.getPk() >= 1 && tw.getName() != null && !"".equals(tw.getName()))
{
-			  TomcatWorker.update(tw);
+			  TomcatWorkerDAO.update(tw);
 		  } else {
 	        throw new TMCIllegalArgumentException("TomcatWorker can not be null");
 	      }
@@ -98,7 +98,7 @@
 	  jp.setState(State.COMPLETE);
 	  JobPool.update(jp);
   }
-  
+
   public void stopTomcat(User u, Collection<TomcatWorker> c, Function f) throws TMCException,
TMCIllegalArgumentException, SQLException, NoSuchMethodException, IOException {
     Method m = TomcatWorkerModel.class.getMethod("stopTomcat", User.class, Project.class,
JobPool.class, TomcatWorker.class);
     tomcatFunction(m, u, c, f);
@@ -127,7 +127,7 @@
     for (final TomcatWorker tw : c) {
       names.append(tw.getName());
       names.append(',');
-      TomcatWorker.delete(tw);
+      TomcatWorkerDAO.delete(tw);
     }
     jp.setOptions(names.toString());
     jp.setState(State.NEW);
@@ -193,8 +193,8 @@
       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);
+    if (jobPool != null && tw.getApplication() != null && f != null) {
+      Job j = new Job(-1, s, tw.getApplication().getBaseLocation() + "/conf/server.xml",
tw.getHardware(), f, jobPool);
       ServerXmlFile sxf = new ServerXmlFile(tw);
       j.setResult(sxf.build());
       Job.store(j);
@@ -215,11 +215,11 @@
     String options;
     if (!u.isAllowed(f, p)) throw new AuthorizationException("User " + u.getName() + " Not
allowed to " + f.getName());
     if (origOptions == null || "".equals(origOptions)) {
-      //options = tw.getTomcat().getServerName();
-      options = Integer.toString(tw.getTomcat().getHttpPort()) + PropertiesFile.getConstantValue("agent.delim.options")
+ tw.getTomcat().getServerName(); 
-      
+      //options = tw.getApplication().getServerName();
+      options = Integer.toString(tw.getApplication().getHttpPort()) + PropertiesFile.getConstantValue("agent.delim.options")
+ tw.getApplication().getServerName();
+
     } else {
-      options = tw.getTomcat().getServerName() + PropertiesFile.getConstantValue("agent.delim.options")
+ origOptions;
+      options = tw.getApplication().getServerName() + PropertiesFile.getConstantValue("agent.delim.options")
+ origOptions;
     }
     State s = State.NEW;
     AuthorizationManager am = u.getAuthManager();
@@ -239,11 +239,11 @@
   }
 
   public TomcatWorker viewTomcatWorker(int id) throws SQLException {
-    return TomcatWorker.getTomcatWorker(id, false);
+    return TomcatWorkerDAO.getTomcatWorker(id, false);
   }
 
   public Collection<TomcatWorker> viewTomcatWorkers() throws SQLException {
-    return TomcatWorker.getTomcatWorkers(false);
+    return TomcatWorkerDAO.getTomcatWorkers(false);
   }
 
   public Collection<TomcatWorker> getObjects() throws SQLException {

Modified: incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/gui/www/TomcatPoolAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/gui/www/TomcatPoolAction.java?view=diff&rev=493210&r1=493209&r2=493210
==============================================================================
--- incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/gui/www/TomcatPoolAction.java
(original)
+++ incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/gui/www/TomcatPoolAction.java
Fri Jan  5 14:22:23 2007
@@ -6,9 +6,9 @@
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
-* 
+*
 *   http://www.apache.org/licenses/LICENSE-2.0
-* 
+*
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -31,6 +31,7 @@
 import org.apache.lokahi.tomcat.api.pool.TomcatPoolModel;
 import org.apache.lokahi.tomcat.api.server.Tomcat;
 import org.apache.lokahi.tomcat.api.worker.TomcatWorker;
+import org.apache.lokahi.tomcat.api.worker.TomcatWorkerDAO;
 import org.apache.struts.action.ActionMessage;
 import org.apache.struts.action.ActionMessages;
 import org.apache.struts.validator.DynaValidatorForm;
@@ -124,11 +125,11 @@
       for (int i = 0; i < tomcats.length; i++) {
         Hardware h = Hardware.getHardware(Integer.parseInt(hardware[i]), true);
         Tomcat t = Tomcat.getTomcat(Integer.parseInt(tomcats[i]), true);
-        TomcatWorker tw = TomcatWorker.getTomcatWorker(h, t, false);
+        TomcatWorker tw = TomcatWorkerDAO.getTomcatWorker(h, t, false);
         if (tw != null) {
           c.add(tw);
         } else {
-          c.add(TomcatWorker.store(new TomcatWorker(h, t)));
+          c.add(TomcatWorkerDAO.store(new TomcatWorker(h, t)));
         }
       }
       tp.setTomcatWorkers(c);

Modified: incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/gui/www/TomcatWorkerAction.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/gui/www/TomcatWorkerAction.java?view=diff&rev=493210&r1=493209&r2=493210
==============================================================================
--- incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/gui/www/TomcatWorkerAction.java
(original)
+++ incubator/lokahi/lokahi/branches/jackrabbit/src/java/org/apache/lokahi/tomcat/gui/www/TomcatWorkerAction.java
Fri Jan  5 14:22:23 2007
@@ -6,9 +6,9 @@
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
-* 
+*
 *   http://www.apache.org/licenses/LICENSE-2.0
-* 
+*
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -28,6 +28,7 @@
 import org.apache.lokahi.core.gui.www.TMCAction;
 import org.apache.lokahi.tomcat.api.worker.TomcatWorker;
 import org.apache.lokahi.tomcat.api.worker.TomcatWorkerModel;
+import org.apache.lokahi.tomcat.api.worker.TomcatWorkerDAO;
 import org.apache.struts.action.ActionMessage;
 import org.apache.struts.action.ActionMessages;
 import org.apache.struts.validator.DynaValidatorForm;
@@ -115,7 +116,7 @@
       StringBuffer names = new StringBuffer();
       for (int i = 0; i < ids.length; i++) {
         if (!"".equals(ids[i])) {
-          TomcatWorker hp = TomcatWorker.getTomcatWorker(Integer.parseInt(ids[i]), false);
+          TomcatWorker hp = TomcatWorkerDAO.getTomcatWorker(Integer.parseInt(ids[i]), false);
           if (hp != null) {
             c.add(hp);
             names.append(hp.getName());



Mime
View raw message