NormW wrote:
Greetings All,
The link below is a diff to the above referenced file, and which does the
following:
- adds 'debug' into setAttribute() (it was listed already in
setAttributeInfo[]),
- adds 'max_connections' to 'setAttributeInfo[]' (it was already in
setAttribute()),
- adds 'max_connections' to 'getAttributeInfo[]',
- adds 'max_connections' to 'getAttribute()',
- re-orders getAttributeInfo[] to a more logical sequence for status worker
display:
  : balance related items are grouped,
  : route items are grouped,
  : connections items are grouped,
  : 'debug' and 'disabled' at the end of the list (to be in a standard
location).
- code presentaion in related areas made same as status worker.

That makes other changes hard to see ;-(



http://normw.gknw.com/patches/jk_worker_ajp13.c.diff


The resulting jk_worker_ajp13.c has been successfully compiled and tested to
display correctly in status worker pages on a NetWare platform.
Norm.
-----------------------------------------
---- jk_worker_ajp13.c.orig 2004-05-12 17:56:30.000000000 +1000
+++ jk_worker_ajp13.c 2004-05-12 22:00:46.000000000 +1000
@@ -35,23 +35,23 @@
 #include "jk_registry.h"

 /* -------------------- Impl -------------------- */
-static char *jk2_worker_ajp13_getAttributeInfo[] =
-    { "lb_factor", "lb_value", "debug", "channel", "level",
-    "route", "routeRedirect", "errorState", "graceful", "groups",
"disabled",
-    "epCount", "errorTime", "connectTimeout", "replyTimeout",
-    "prepostTimeout", NULL
-};
-
+/*
+ * Object properties having multiple values.
+ */
 static char *jk2_worker_ajp13_multiValueInfo[] = { "group", NULL };

-static char *jk2_worker_ajp13_setAttributeInfo[] =
-    { "debug", "channel", "route", "routeRedirect", "secretkey", "group",
-"graceful",
-    "disabled", "lb_factor", "level", "connectTimeout", "replyTimeout",
-    "prepostTimeout", NULL
+/*
+ * Properties available to Get.
+ */
+static char *jk2_worker_ajp13_getAttributeInfo[] = {
+    "channel", "groups", "max_connections", "epCount", "level",
"lb_factor",
+    "lb_value", "route", "routeRedirect","graceful", "errorState",
"errorTime",
+    "connectTimeout", "replyTimeout", "prepostTimeout", "debug",
"disabled", NULL
 };

-
+/*
+ * Get worker properties.
+ */
 static void *JK_METHOD jk2_worker_ajp13_getAttribute(jk_env_t *env,
                                                      jk_bean_t *bean,
                                                      char *name)
@@ -59,66 +59,101 @@
     jk_worker_t *worker = (jk_worker_t *)bean->object;

     if (strcmp(name, "channelName") == 0 || strcmp(name, "channel") == 0) {
-        if (worker->channel != NULL)
+
+        if (worker->channel != NULL) {
+
             return worker->channel->mbean->name;
-        else
+        }
+        else {
+
             return worker->channelName;
-    }
-    else if (strcmp(name, "route") == 0) {
-        return worker->route;
-    }
-    else if (strcmp(name, "routeRedirect") == 0) {
-        return worker->routeRedirect;
-    }
-    else if (strcmp(name, "debug") == 0) {
-        return jk2_env_itoa(env, bean->debug);
+        }
     }
     else if (strcmp(name, "groups") == 0) {
+
         return jk2_map_concatKeys(env, worker->groups, ":");
     }
+    else if (strcmp(name, "max_connections") == 0) {
+
+        return jk2_env_itoa(env, worker->maxEndpoints);
+    }
+    else if (strcmp(name, "epCount") == 0) {
+
+        if (worker->endpointCache == NULL) {
+
+            return "0";
+        }
+        return jk2_env_itoa(env, worker->endpointCache->count);
+    }
     else if (strcmp(name, "level") == 0) {
+
         return jk2_env_itoa(env, worker->level);
     }
-    else if (strcmp(name, "errorTime") == 0) {
-        return jk2_env_itoa(env, worker->error_time);
+    else if (strcmp(name, "lb_factor") == 0) {
+
+        return jk2_env_itoa(env, worker->lb_factor);
     }
     else if (strcmp(name, "lb_value") == 0) {
+
         return jk2_env_itoa(env, worker->lb_value);
     }
-    else if (strcmp(name, "lb_factor") == 0) {
-        return jk2_env_itoa(env, worker->lb_factor);
+    else if (strcmp(name, "route") == 0) {
+
+        return worker->route;
     }
-    else if (strcmp(name, "errorState") == 0) {
-        return jk2_env_itoa(env, worker->in_error_state);
+    else if (strcmp(name, "routeRedirect") == 0) {
+
+        return worker->routeRedirect;
     }
     else if (strcmp(name, "graceful") == 0) {
+
         return jk2_env_itoa(env, worker->graceful);
     }
+    else if (strcmp(name, "errorState") == 0) {
+
+        return jk2_env_itoa(env, worker->in_error_state);
+    }
+    else if (strcmp(name, "errorTime") == 0) {
+
+        return jk2_env_itoa(env, worker->error_time);
+    }
     else if (strcmp(name, "connectTimeout") == 0) {
+
         return jk2_env_itoa(env, worker->connect_timeout);
     }
     else if (strcmp(name, "replyTimeout") == 0) {
+
         return jk2_env_itoa(env, worker->reply_timeout);
     }
     else if (strcmp(name, "prepostTimeout") == 0) {
+
         return jk2_env_itoa(env, worker->prepost_timeout);
     }
+    else if (strcmp(name, "debug") == 0) {
+
+        return jk2_env_itoa(env, bean->debug);
+    }
     else if (strcmp(name, "disabled") == 0) {
+
         return jk2_env_itoa(env, bean->disabled);
     }
-    else if (strcmp(name, "epCount") == 0) {
-        if (worker->endpointCache == NULL)
-            return "0";
-        return jk2_env_itoa(env, worker->endpointCache->count);
-    }
     else {
+
         return NULL;
     }
 }

+/*
+ * Properties available to Set.
+ */
+static char *jk2_worker_ajp13_setAttributeInfo[] = {
+    "channel", "group", "secretkey", "max_connections", "level",
"lb_factor",
+    "route", "routeRedirect", "graceful", "connectTimeout", "replyTimeout",
+    "prepostTimeout", "debug", "disabled", NULL
+};

 /*
- * Initialize the worker
+ * Set worker properties.
  */
 static int JK_METHOD
 jk2_worker_ajp13_setAttribute(jk_env_t *env, jk_bean_t *mbean,
@@ -127,52 +162,70 @@
     jk_worker_t *ajp13 = (jk_worker_t *)mbean->object;
     char *value = (char *)valueP;

-    if (strcmp(name, "secretkey") == 0) {
+    if (strcmp(name, "channel") == 0) {
+
+        ajp13->channelName = value;
+    }
+    else if (strcmp(name, "group") == 0) {
+
+        ajp13->groups->add(env, ajp13->groups, value, ajp13);
+    }
+    else if (strcmp(name, "secretkey") == 0) {
+
         ajp13->secret = value;
     }
+    else if (strcmp(name, "max_connections") == 0) {
+
+        ajp13->maxEndpoints = atoi(value);
+    }
+    else if (strcmp(name, "level") == 0) {
+
+        ajp13->level = atoi(value);
+    }
+    else if (strcmp(name, "lb_factor") == 0) {
+
+        ajp13->lb_factor = atoi(value);
+    }
     else if (strcmp(name, "tomcatId") == 0) {
+
         ajp13->route = value;
     }
     else if (strcmp(name, "route") == 0) {
+
         ajp13->route = value;
     }
     else if (strcmp(name, "routeRedirect") == 0) {
+
         ajp13->routeRedirect = value;
     }
     else if (strcmp(name, "graceful") == 0) {
+
         ajp13->graceful = atoi(value);
     }
     else if (strcmp(name, "connectTimeout") == 0) {
+
         ajp13->connect_timeout = atoi(value);
     }
     else if (strcmp(name, "replyTimeout") == 0) {
+
         ajp13->reply_timeout = atoi(value);
     }
     else if (strcmp(name, "prepostTimeout") == 0) {
+
         ajp13->prepost_timeout = atoi(value);
     }
-    else if (strcmp(name, "disabled") == 0) {
-        mbean->disabled = atoi(value);
-    }
-    else if (strcmp(name, "group") == 0) {
-        ajp13->groups->add(env, ajp13->groups, value, ajp13);
-    }
-    else if (strcmp(name, "lb_factor") == 0) {
-        ajp13->lb_factor = atoi(value);
-    }
-    else if (strcmp(name, "level") == 0) {
-        ajp13->level = atoi(value);
-    }
-    else if (strcmp(name, "channel") == 0) {
-        ajp13->channelName = value;
+     else if (strcmp(name, "debug") == 0) {
+
+        mbean->debug = atoi(value);
     }
-    else if (strcmp(name, "max_connections") == 0) {
-        ajp13->maxEndpoints = atoi(value);
+   else if (strcmp(name, "disabled") == 0) {
+
+        mbean->disabled = atoi(value);
     }
     else {
+
         return JK_ERR;
     }
-
     return JK_OK;
 }

@@ -1010,22 +1063,23 @@
     w->endpointCache = NULL;

     w->channel = NULL;
-    w->secret = NULL;
+    w->secret  = NULL;

     w->lb_factor = 1;
-    w->graceful = 0;
-    w->service = jk2_worker_ajp13_service;
-
-    result->setAttribute = jk2_worker_ajp13_setAttribute;
-    result->getAttribute = jk2_worker_ajp13_getAttribute;
-    result->init = jk2_worker_ajp13_init;
-    result->destroy = jk2_worker_ajp13_destroy;
+    w->graceful  = 0;
+    w->service   = jk2_worker_ajp13_service;

-    result->getAttributeInfo = jk2_worker_ajp13_getAttributeInfo;
-    result->multiValueInfo = jk2_worker_ajp13_multiValueInfo;
+    result->multiValueInfo   = jk2_worker_ajp13_multiValueInfo;
     result->setAttributeInfo = jk2_worker_ajp13_setAttributeInfo;
+    result->setAttribute     = jk2_worker_ajp13_setAttribute;
+    result->getAttributeInfo = jk2_worker_ajp13_getAttributeInfo;
+    result->getAttribute     = jk2_worker_ajp13_getAttribute;
+
+    result->init    = jk2_worker_ajp13_init;
+    result->destroy = jk2_worker_ajp13_destroy;

     result->object = w;
+
     w->mbean = result;

     w->workerEnv = env->getByName(env, "workerEnv");
----------------------------------------


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to