Author: jfrederic.clere(a)jboss.com
Date: 2008-03-26 13:38:43 -0400 (Wed, 26 Mar 2008)
New Revision: 1466
Modified:
sandbox/httpd/src/native/mod_manager/mod_manager.c
Log:
Add handling of application commands (except STOP).
Modified: sandbox/httpd/src/native/mod_manager/mod_manager.c
===================================================================
--- sandbox/httpd/src/native/mod_manager/mod_manager.c 2008-03-26 16:13:29 UTC (rev
1465)
+++ sandbox/httpd/src/native/mod_manager/mod_manager.c 2008-03-26 17:38:43 UTC (rev
1466)
@@ -328,7 +328,7 @@
/* Map nothing by default */
vhost->host = NULL;
- vhost->host = NULL;
+ vhost->context = NULL;
vhost->next = NULL;
phost = vhost;
@@ -428,7 +428,7 @@
for (i=0; i<size; i++) {
hostinfo_t *ou;
get_host(hoststatsmem, &ou, id[i]);
- ap_rprintf(r, "host: %d %s %d %d\n", id[i], ou->host,
ou->vhost,
+ ap_rprintf(r, "host: %d [%s] %d %d\n", id[i], ou->host,
ou->vhost,
ou->node);
}
@@ -444,18 +444,94 @@
return OK;
}
-/* Process an enable application message */
-static int process_enable(request_rec *r, char *buff)
+/* Process an enable/disable/stop application message */
+static int process_appl_cmd(request_rec *r, char *buff, int status)
{
+ char *JVMRoute;
+ nodeinfo_t nodeinfo;
+ nodeinfo_t *node;
+ struct cluster_host *vhost;
+ struct cluster_host *phost;
+
+ char **ptr = process_buff(r, buff);
+ if (ptr == NULL)
+ return 500;
+
+ /* Map nothing by default */
+ vhost->host = NULL;
+ vhost->context = NULL;
+ vhost->next = NULL;
+ vhost = apr_palloc(r->pool, sizeof(struct cluster_host));
+ phost = vhost;
+
+ int i = 0;
+ while (ptr[i]) {
+ if (strcasecmp(ptr[i], "JVMRoute") == 0) {
+ if (strlen(ptr[i+1])>=sizeof(nodeinfo.mess.JVMRoute))
+ return 500;
+ strcpy(nodeinfo.mess.JVMRoute, ptr[i+1]);
+ nodeinfo.mess.id = 0;
+ }
+ if (strcasecmp(ptr[i], "Alias") == 0) {
+ if (phost->host && !phost->context) {
+ return 500;
+ }
+ if (phost->host) {
+ phost->next = apr_palloc(r->pool, sizeof(struct cluster_host));
+ phost = phost->next;
+ phost->next = NULL;
+ phost->host = ptr[i+1];
+ phost->context = NULL;
+ } else {
+ phost->host = ptr[i+1];
+ }
+ }
+ if (strcasecmp(ptr[i], "Context") == 0) {
+ if (phost->context) {
+ return 500;
+ }
+ phost->context = ptr[i+1];
+ }
+ i++;
+ i++;
+ }
+
+ /* Read the node */
+ node = read_node(nodestatsmem, &nodeinfo);
+ if (node == NULL)
+ return 500;
+
+ /* Read the ID of the virtual corresponding to the first Alias */
+ hostinfo_t hostinfo;
+ hostinfo_t *host;
+
+ hostinfo.node = node->mess.id;
+ if (vhost->host != NULL)
+ strcpy(hostinfo.host, vhost->host);
+ else
+ hostinfo.host[0] = '\0';
+
+ hostinfo.id = 0;
+ host = read_host(hoststatsmem, &hostinfo);
+ if (host == NULL) {
+ return 500;
+ }
+
+ /* Now update each context from Context: part */
+ insert_update_contexts(contextstatsmem, phost->context, node->mess.id,
host->vhost, status);
return OK;
}
+static int process_enable(request_rec *r, char *buff)
+{
+ return process_appl_cmd(r, buff, ENABLED);
+}
static int process_disable(request_rec *r, char *buff)
{
- return OK;
+ return process_appl_cmd(r, buff, DISABLED);
}
static int process_stop(request_rec *r, char *buff)
{
- return OK;
+ return process_appl_cmd(r, buff, STOPPED);
}
static int process_remove(request_rec *r, char *buff)
{
_______________________________________________
jbossnative-commits mailing list
jbossnative-commits(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbossnative-commits