Here's a patch that gets all the virualhosts that are related to a
context.
-Jeff
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD
and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and then
delete it from your system.
------------------------------------------------------------------------------
Index: T:/tmcg2/trunk/database/functions.sql
===================================================================
--- T:/tmcg2/trunk/database/functions.sql (revision 124)
+++ T:/tmcg2/trunk/database/functions.sql (working copy)
@@ -49,6 +49,18 @@
RETURN l_cursor;
END;
/
+CREATE OR REPLACE FUNCTION F_AM_GET_VHOST_BY_CONTEXT(c_id IN NUMBER)
+RETURN tmctypes.cursortype
+AS
+ l_cursor tmctypes.cursorType;
+BEGIN
+ OPEN l_cursor FOR
+ SELECT *
+ FROM am_vhost
+ WHERE vhost_id in (SELECT VHOST_ID FROM TMC_REL_VHOST_CONTEXT
WHERE CONTEXT_ID=c_id);
+ RETURN l_cursor;
+END;
+/
CREATE OR REPLACE FUNCTION F_AM_GET_APACHEW_BY_ID(v_id IN NUMBER)
RETURN tmctypes.cursortype
AS
Index: T:/tmcg2/trunk/conf/db.properties
===================================================================
--- T:/tmcg2/trunk/conf/db.properties (revision 124)
+++ T:/tmcg2/trunk/conf/db.properties (working copy)
@@ -181,6 +181,7 @@
oracle.apache.entity.by.worker=f_am_get_vhost_by_aw
oracle.apache.entity.by.id=f_am_get_vhost_by_id
oracle.apache.entity.by.name=f_am_get_vhost_by_name
+oracle.apache.entity.by.context=F_AM_GET_VHOST_BY_CONTEXT
oracle.util.alert.all=f_tmc_get_active_ats_for_all
oracle.util.alert.by.id=f_tmc_get_alert_by_id
oracle.util.alert.delete=sp_tmc_drop_alert
Index:
T:/tmcg2/trunk/src/java/org/apache/lokahi/httpd/api/entity/VirtualHost.java
===================================================================
--- T:/tmcg2/trunk/src/java/org/apache/lokahi/httpd/api/entity/VirtualHost.java
(revision 124)
+++ T:/tmcg2/trunk/src/java/org/apache/lokahi/httpd/api/entity/VirtualHost.java
(working copy)
@@ -27,6 +27,7 @@
import org.apache.lokahi.core.api.server.Hardware;
import org.apache.lokahi.core.api.state.State;
import org.apache.lokahi.core.api.user.User;
+import org.apache.lokahi.core.common.collection.TMCCollectionImpl;
import org.apache.lokahi.core.common.collection.TMCSet;
import org.apache.lokahi.core.common.database.BrokerFactory;
import org.apache.lokahi.core.common.exception.AuthorizationException;
@@ -173,6 +174,19 @@
}
return contexts;
}
+
+ public static Collection<VirtualHost> getVirtualHosts(TomcatContext tc) {
+ Collection<VirtualHost> vhs = new
TMCCollectionImpl<VirtualHost>();
+
+ try {
+ vhs = broker.getObjects(VirtualHost.class,
false,"apache.entity.by.context", tc.getPk());
+ } catch (SQLException se) {
+ if (logger.isInfoEnabled()) {
+ logger.info("SQLException: " + se.getMessage());
+ }
+ }
+ return vhs;
+ }
public Collection<TomcatContext> getContextsNoDB() {
if (contexts == null) {