felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfre...@apache.org
Subject svn commit: r423855 [3/5] - in /incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/mosgi/ src/main...
Date Thu, 20 Jul 2006 09:36:50 GMT
Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ProcessorMBean.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ProcessorMBean.java?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ProcessorMBean.java (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ProcessorMBean.java Thu Jul 20 02:36:47 2006
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) MX4J.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.
+ *
+ */
+package org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http;
+
+import java.io.IOException;
+import org.w3c.dom.Document;
+
+/**
+ * Processor ManagementBean, just defines a generic description
+ *
+ * @author <a href="mailto:tibu@users.sourceforge.net">Carlos Quiroz</a>
+ * @version $Revision: 1.1.1.1 $
+ */
+public interface ProcessorMBean
+{
+   public String getName();
+
+   /**
+    * The method will process the result string and produce an output. The
+    * implementor is also responsible to set the mime type, response code and
+    * send the headers before answering as follow:
+    * <code>
+    *    out.setCode(HttpConstants.STATUS_OKAY);
+    *    out.setHeader("Content-type", "text/html");
+    *    out.sendHeaders();
+    *    out.write("some text");
+    * </code>
+    *
+    * @param out The output stream
+    * @param in The input stream
+    * @param document A document containing the data
+    */
+   public void writeResponse(HttpOutputStream out, HttpInputStream in, Document document) throws IOException;
+
+   /**
+    * The method will process the result exception and produce output. The
+    * implementor is also responsible to set the mime type, response code and
+    * send the headers before answering as follow:
+    * <code>
+    *    out.setCode(HttpConstants.STATUS_OKAY);
+    *    out.setHeader("Content-type", "text/html");
+    *    out.sendHeaders();
+    *    out.write("some text");
+    * </code>
+    *
+    * @param out The output stream
+    * @param in The input stream
+    * @param e The exception to be reported
+    */
+   public void writeError(HttpOutputStream out, HttpInputStream in, Exception e) throws IOException;
+
+   /**
+    * Preprocess a path and return a replacement path. For instance the / path
+    * could be replaced by the server path
+    *
+    * @param path The original path
+    * @return the replacement path. If not modification the path param should
+    * be returned
+    */
+   public String preProcess(String path);
+
+   /**
+    * Let the processor load internally a not found element. This can be used
+    * to load images, stylesheets and so on. If return is not null, the path is
+    * processed
+    *
+    * @param path The request element
+    * @param out The output stream
+    * @param in The input stream
+    */
+   public String notFoundElement(String path, HttpOutputStream out, HttpInputStream in) throws IOException, HttpException;
+}

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ServerByDomainCommandProcessor.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ServerByDomainCommandProcessor.java?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ServerByDomainCommandProcessor.java (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ServerByDomainCommandProcessor.java Thu Jul 20 02:36:47 2006
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) MX4J.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.
+ *
+ */
+package org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http;
+
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import javax.management.JMException;
+import javax.management.MBeanInfo;
+import java.io.IOException;
+import java.util.Set;
+import java.util.HashMap;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * ServerByDomainCommandProcessor, processes a request for getting all the
+ * MBeans of the current server grouped by domains
+ *
+ * @author <a href="mailto:tibu@users.sourceforge.net">Carlos Quiroz</a>
+ * @version $Revision: 1.1.1.1 $
+ */
+public class ServerByDomainCommandProcessor extends HttpCommandProcessorAdaptor
+{
+  public ServerByDomainCommandProcessor()
+  {
+  }
+
+  public Document executeRequest(HttpInputStream in) throws IOException, JMException
+  {
+    Document document = builder.newDocument();
+
+    Element root = document.createElement("Server");
+    document.appendChild(root);
+
+    String targetClass = in.getVariable("instanceof");
+    String queryNames = in.getVariable("querynames");
+    ObjectName query = null;
+    if (queryNames != null)
+    {
+      try
+      {
+        query = new ObjectName(queryNames);
+      }
+      catch (MalformedObjectNameException e)
+      {
+        Element exceptionElement = document.createElement("Exception");
+        exceptionElement.setAttribute("errorMsg", e.getMessage());
+        root.appendChild(exceptionElement);
+        return document;
+      }
+    }
+    Set mbeans = server.queryMBeans(query, null);
+    Iterator i = mbeans.iterator();
+    // this will order the domains
+    Map domains = new TreeMap();
+    while (i.hasNext())
+    {
+      ObjectInstance instance = (ObjectInstance)i.next();
+      ObjectName name = instance.getObjectName();
+      String domain = name.getDomain();
+      if (domains.containsKey(domain))
+      {
+        ((Set)domains.get(domain)).add(name);
+      }
+      else
+      {
+        Set objects = new TreeSet(CommandProcessorUtil.createObjectNameComparator());
+        objects.add(name);
+        domains.put(domain, objects);
+      }
+    }
+    i = domains.keySet().iterator();
+    while (i.hasNext())
+    {
+      String domain = (String)i.next();
+      Element domainElement = document.createElement("Domain");
+      root.appendChild(domainElement);
+      domainElement.setAttribute("name", domain);
+      Set names = (Set)domains.get(domain);
+      Iterator j = names.iterator();
+      while (j.hasNext())
+      {
+        ObjectName targetName = (ObjectName)j.next();
+        if (targetClass != null && !server.isInstanceOf(targetName, targetClass))
+        {
+          continue;
+        }
+        Element mBeanElement = document.createElement("MBean");
+        mBeanElement.setAttribute("objectname", targetName.toString());
+        MBeanInfo info = server.getMBeanInfo(targetName);
+        mBeanElement.setAttribute("description", info.getDescription());
+        mBeanElement.setAttribute("classname", info.getClassName());
+        domainElement.appendChild(mBeanElement);
+      }
+    }
+    return document;
+  }
+
+}

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ServerCommandProcessor.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ServerCommandProcessor.java?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ServerCommandProcessor.java (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/ServerCommandProcessor.java Thu Jul 20 02:36:47 2006
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) MX4J.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.
+ *
+ */
+package org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.management.JMException;
+import javax.management.MBeanInfo;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * ServerCommandProcessor, processes a request for getting all the
+ * MBeans of the current server
+ *
+ * @author <a href="mailto:tibu@users.sourceforge.net">Carlos Quiroz</a>
+ * @version $Revision: 1.1.1.1 $
+ */
+public class ServerCommandProcessor extends HttpCommandProcessorAdaptor
+{
+  public ServerCommandProcessor()
+  {
+  }
+
+  public Document executeRequest(HttpInputStream in) throws IOException, JMException
+  {
+    Document document = builder.newDocument();
+
+    Element root = document.createElement("Server");
+    document.appendChild(root);
+
+    String classVariable = in.getVariable("instanceof");
+    String queryNames = in.getVariable("querynames");
+    Set mbeans = null;
+    ObjectName query = null;
+    if (queryNames != null)
+    {
+      try
+      {
+        query = new ObjectName(queryNames);
+        mbeans = new TreeSet(CommandProcessorUtil.createObjectInstanceComparator());
+        mbeans.addAll(server.queryMBeans(query, null));
+      }
+      catch (MalformedObjectNameException e)
+      {
+        Element exceptionElement = document.createElement("Exception");
+        exceptionElement.setAttribute("errorMsg", e.getMessage());
+        root.appendChild(exceptionElement);
+        return document;
+      }
+    } else {
+      mbeans = new TreeSet(CommandProcessorUtil.createObjectInstanceComparator());
+      mbeans.addAll(server.queryMBeans(null, null));
+    }
+    Iterator i = mbeans.iterator();
+    while (i.hasNext())
+    {
+      ObjectInstance instance = (ObjectInstance)i.next();
+      if (classVariable != null && !classVariable.equals(instance.getClassName()))
+      {
+        continue;
+      }
+      Element mBeanElement = document.createElement("MBean");
+      mBeanElement.setAttribute("objectname", instance.getObjectName().toString());
+      mBeanElement.setAttribute("classname", instance.getClassName());
+      MBeanInfo info = server.getMBeanInfo(instance.getObjectName());
+      mBeanElement.setAttribute("description", info.getDescription());
+      root.appendChild(mBeanElement);
+    }
+    return document;
+  }
+
+}

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/SetAttributeCommandProcessor.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/SetAttributeCommandProcessor.java?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/SetAttributeCommandProcessor.java (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/SetAttributeCommandProcessor.java Thu Jul 20 02:36:47 2006
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) MX4J.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.
+ *
+ */
+package org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http;
+
+import javax.management.ObjectName;
+import javax.management.JMException;
+import javax.management.MalformedObjectNameException;
+import javax.management.MBeanInfo;
+import javax.management.Attribute;
+import javax.management.MBeanAttributeInfo;
+import java.io.IOException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * SetAttributeCommandProcessor, processes a request for setting one attribute
+ * in one MBean
+ *
+ * @author <a href="mailto:tibu@users.sourceforge.net">Carlos Quiroz</a>
+ * @version $Revision: 1.1.1.1 $
+ */
+public class SetAttributeCommandProcessor extends HttpCommandProcessorAdaptor
+{
+
+  public SetAttributeCommandProcessor()
+  {
+  }
+
+  public Document executeRequest(HttpInputStream in) throws IOException, JMException
+  {
+    Document document = builder.newDocument();
+
+    Element root = document.createElement("MBeanOperation");
+    document.appendChild(root);
+    Element operationElement = document.createElement("Operation");
+    operationElement.setAttribute("operation", "setattribute");
+    root.appendChild(operationElement);
+
+    String objectVariable = in.getVariable("objectname");
+    String attributeVariable = in.getVariable("attribute");
+    String valueVariable = in.getVariable("value");
+    if (objectVariable == null || objectVariable.equals("") ||
+      attributeVariable == null || attributeVariable.equals("") ||
+      valueVariable == null)
+    {
+      operationElement.setAttribute("result", "error");
+      operationElement.setAttribute("errorMsg", "Incorrect parameters in the request");
+      return document;
+    }
+    operationElement.setAttribute("objectname", objectVariable);
+    ObjectName name = null;
+    try
+    {
+      name = new ObjectName(objectVariable);
+    }
+    catch (MalformedObjectNameException e)
+    {
+      operationElement.setAttribute("result", "error");
+      operationElement.setAttribute("errorMsg", "Malformed object name");
+      return document;
+    }
+
+    if (server.isRegistered(name))
+    {
+      MBeanInfo info = server.getMBeanInfo(name);
+      MBeanAttributeInfo[] attributes = info.getAttributes();
+      MBeanAttributeInfo targetAttribute = null;
+      if (attributes != null)
+      {
+        for (int i=0;i<attributes.length;i++)
+        {
+          if (attributes[i].getName().equals(attributeVariable))
+          {
+            targetAttribute = attributes[i];
+            break;
+          }
+        }
+      }
+      if (targetAttribute != null)
+      {
+        String type = targetAttribute.getType();
+        Object value = null;
+        if (valueVariable != null)
+        {
+          try
+          {
+            value = CommandProcessorUtil.createParameterValue(type, valueVariable);
+          }
+          catch (Exception e)
+          {
+            operationElement.setAttribute("result", "error");
+            operationElement.setAttribute("errorMsg", "Value: " + valueVariable + " could not be converted to " + type);
+          }
+          if (value != null)
+          {
+            try
+            {
+              server.setAttribute(name, new Attribute(attributeVariable, value));
+              operationElement.setAttribute("result", "success");
+            }
+            catch (Exception e)
+            {
+              operationElement.setAttribute("result", "error");
+              operationElement.setAttribute("errorMsg", e.getMessage());
+            }
+          }
+        }
+      }
+      else
+      {
+        operationElement.setAttribute("result", "error");
+        operationElement.setAttribute("errorMsg", "Attribute " + attributeVariable + " not found");
+      }
+    }
+    else
+    {
+      if (name != null)
+      {
+        operationElement.setAttribute("result", "error");
+        operationElement.setAttribute("errorMsg", "MBean " + name + " not registered");
+      }
+    }
+    return document;
+  }
+
+}

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/SetAttributesCommandProcessor.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/SetAttributesCommandProcessor.java?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/SetAttributesCommandProcessor.java (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/SetAttributesCommandProcessor.java Thu Jul 20 02:36:47 2006
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) MX4J.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.
+ *
+ */
+package org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import javax.management.Attribute;
+import javax.management.JMException;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanInfo;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * SetAttributesCommandProcessor, processes a request for setting one or more attributes
+ * in one MBean. it uses th facility of havin multiple submit buttons in a web page
+ * if the set_all=Set variable is passed all attributes will be set, if a set_XXX varialbe
+ * is passed only the specific attribute will be set
+ *
+ * @author <a href="mailto:tibu@users.sourceforge.net">Carlos Quiroz</a>
+ * @version $Revision: 1.1.1.1 $
+ */
+public class SetAttributesCommandProcessor extends HttpCommandProcessorAdaptor
+{
+
+  public SetAttributesCommandProcessor()
+  {
+  }
+
+  public Document executeRequest(HttpInputStream in) throws IOException, JMException
+  {
+    Document document = builder.newDocument();
+
+    Element root = document.createElement("MBeanOperation");
+    document.appendChild(root);
+    Element operationElement = document.createElement("Operation");
+    operationElement.setAttribute("operation", "setattributes");
+    root.appendChild(operationElement);
+
+    String objectVariable = in.getVariable("objectname");
+    if (objectVariable == null || objectVariable.equals(""))
+    {
+      operationElement.setAttribute("result", "error");
+      operationElement.setAttribute("errorMsg", "Missing objectname in the request");
+      return document;
+    }
+    operationElement.setAttribute("objectname", objectVariable);
+    ObjectName name = null;
+    try
+    {
+      name = new ObjectName(objectVariable);
+    }
+    catch (MalformedObjectNameException e)
+    {
+      operationElement.setAttribute("result", "error");
+      operationElement.setAttribute("errorMsg", "Malformed object name");
+      return document;
+    }
+    if (server.isRegistered(name))
+    {
+      Map variables = in.getVariables();
+      if (variables.containsKey("setall"))
+      {
+        Iterator keys = variables.keySet().iterator();
+        SortedMap allAttributes = new TreeMap();
+        while (keys.hasNext()) {
+          String key = (String)keys.next();
+          if (key.startsWith("value_"))
+          {
+            String attributeVariable = key.substring(6, key.length());
+            String valueVariable = in.getVariable(key);
+            Element attributeElement = setAttribute(document, attributeVariable, valueVariable, name);
+            allAttributes.put(attributeVariable, attributeElement);
+            operationElement.appendChild(attributeElement);
+          }
+        }
+        keys = allAttributes.keySet().iterator();
+        while (keys.hasNext()) {
+          Element attributeElement = (Element)allAttributes.get(keys.next());
+          operationElement.appendChild(attributeElement);
+        }
+      }
+      else
+      {
+        Iterator keys = variables.keySet().iterator();
+        SortedMap allAttributes = new TreeMap();
+        while (keys.hasNext())
+        {
+          String key = (String)keys.next();
+          if (key.startsWith("set_"))
+          {
+            String attributeVariable = key.substring(4, key.length());
+            String valueVariable = in.getVariable("value_" + attributeVariable);
+            Element attributeElement = setAttribute(document, attributeVariable, valueVariable, name);
+            allAttributes.put(attributeVariable, attributeElement);
+          }
+        }
+        keys = allAttributes.keySet().iterator();
+        while (keys.hasNext()) {
+          Element attributeElement = (Element)allAttributes.get(keys.next());
+          operationElement.appendChild(attributeElement);
+        }
+      }
+      //operationElement.setAttribute("result", "success");
+    }
+    else
+    {
+      if (name != null)
+      {
+        operationElement.setAttribute("result", "error");
+        operationElement.setAttribute("errorMsg", "MBean " + name + " not registered");
+      }
+    }
+    return document;
+  }
+
+  private Element setAttribute(Document document, String attributeVariable, String valueVariable, ObjectName name) throws JMException
+  {
+    Element attributeElement = document.createElement("Attribute");
+    attributeElement.setAttribute("attribute", attributeVariable);
+    MBeanInfo info = server.getMBeanInfo(name);
+    MBeanAttributeInfo[] attributes = info.getAttributes();
+    MBeanAttributeInfo targetAttribute = null;
+    if (attributes != null)
+    {
+      for (int i=0;i<attributes.length;i++)
+      {
+        if (attributes[i].getName().equals(attributeVariable))
+        {
+          targetAttribute = attributes[i];
+          break;
+        }
+      }
+    }
+    if (targetAttribute != null)
+    {
+      String type = targetAttribute.getType();
+      Object value = null;
+      if (valueVariable != null)
+      {
+        try
+        {
+          value = CommandProcessorUtil.createParameterValue(type, valueVariable);
+        }
+        catch (Exception e)
+        {
+          attributeElement.setAttribute("result", "error");
+          attributeElement.setAttribute("errorMsg", "Value: " + valueVariable + " could not be converted to " + type);
+        }
+        if (value != null)
+        {
+          try
+          {
+            server.setAttribute(name, new Attribute(attributeVariable, value));
+            attributeElement.setAttribute("result", "success");
+            attributeElement.setAttribute("value", valueVariable);
+          }
+          catch (Exception e)
+          {
+            attributeElement.setAttribute("result", "error");
+            attributeElement.setAttribute("errorMsg", e.getMessage());
+          }
+        }
+      }
+    }
+    else
+    {
+      attributeElement.setAttribute("result", "error");
+      attributeElement.setAttribute("errorMsg", "Attribute " + attributeVariable + " not found");
+    }
+    return attributeElement;
+  }
+
+}

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/XSLTProcessor.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/XSLTProcessor.java?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/XSLTProcessor.java (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/XSLTProcessor.java Thu Jul 20 02:36:47 2006
@@ -0,0 +1,527 @@
+/*
+ * Copyright (C) MX4J.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.
+ *
+ */
+package org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.RuntimeMBeanException;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Document;
+
+import org.osgi.framework.ServiceReference;
+
+import org.osgi.service.log.LogService;
+
+import org.apache.felix.mosgi.jmx.httpconnector.HttpConnectorActivator;
+
+
+/**
+ * XSLTPostProcessor pass the document through an XSLT transformation
+ *
+ * @author <a href="mailto:tibu@users.sourceforge.net">Carlos Quiroz</a>
+ * @version $Revision: 1.1.1.1 $
+ * the HttpAdaptor through a XSL transformation" extends="mx4j.tools.adaptor.http.ProcessorMBean"
+ */
+public class XSLTProcessor
+	implements ProcessorMBean, XSLTProcessorMBean, URIResolver
+{
+	TransformerFactory factory = null;
+
+	private Map templatesCache = new HashMap();
+
+	private String path = "mx4j/tools/adaptor/http/xsl";
+
+	private File root = null;
+
+	private Map mimeTypes = new HashMap();
+
+	/** Indicated whether the file are read from a file */
+	private boolean useJar = true;
+
+	private boolean useCache = true;
+
+	private ClassLoader targetClassLoader = ClassLoader.getSystemClassLoader();
+
+	private String defaultPage = "serverbydomain";
+
+	/**
+	 * The locale is set with the default as en_US since it is the
+	 * one bundled
+	 */
+	private Locale locale = new Locale("en", "");
+
+	public XSLTProcessor()
+	{
+		factory = TransformerFactory.newInstance();
+		factory.setURIResolver(this);
+		mimeTypes.put(".gif", "image/gif");
+		mimeTypes.put(".jpg", "image/jpg");
+		mimeTypes.put(".png", "image/png");
+		mimeTypes.put(".tif", "image/tiff");
+		mimeTypes.put(".tiff", "image/tiff");
+		mimeTypes.put(".ico", "image/ico");
+		mimeTypes.put(".html", "text/html");
+		mimeTypes.put(".htm", "text/html");
+		mimeTypes.put(".txt", "text/plain");
+		mimeTypes.put(".xml", "text/xml");
+		mimeTypes.put(".xsl", "text/xsl");
+		mimeTypes.put(".css", "text/css");
+		mimeTypes.put(".js", "text/x-javascript");
+		mimeTypes.put(".jar", "application/java-archive");
+	}
+
+	public void writeResponse(HttpOutputStream out, HttpInputStream in, Document document) throws IOException
+	{
+		out.setCode(HttpConstants.STATUS_OKAY);
+		out.setHeader("Content-Type", "text/html");
+		// added some caching attributes to fornce not to cache
+		out.setHeader("Cache-Control", "no-cache");
+		out.setHeader("expires", "now");
+		out.setHeader("pragma", "no-cache");
+		out.sendHeaders();
+		Transformer transformer = null;
+		String path = preProcess(in.getPath());
+
+		if (in.getVariable("template") != null)
+		{
+			transformer = createTransformer(in.getVariable("template") + ".xsl");
+		}
+		else
+		{
+			transformer = createTransformer(path + ".xsl");
+		}
+
+		if (transformer != null)
+		{
+			// added so that the document() function works
+			transformer.setURIResolver(this);
+			// The variables are passed to the XSLT as (param.name, value)
+			Map variables = in.getVariables();
+			Iterator j = variables.keySet().iterator();
+			while (j.hasNext())
+			{
+				String key = (String)j.next();
+				Object value = variables.get(key);
+				if (value instanceof String) {
+					transformer.setParameter("request." + key, value);
+				}
+				if (value instanceof String[]) {
+					String[] allvalues = (String[])value;
+					// not a good solution, only the first one is presented
+					transformer.setParameter("request." + key, allvalues[0]);
+				}
+
+			}
+			if (!variables.containsKey("locale"))
+			{
+				transformer.setParameter("request.locale", locale.toString());
+			}
+			try
+			{
+				ByteArrayOutputStream output = new ByteArrayOutputStream();
+				XSLTProcessor.log(LogService.LOG_DEBUG,"transforming " + path,null);
+				transformer.transform(new DOMSource(document), new StreamResult(output));
+				output.writeTo(out);
+			}
+			catch (TransformerException e)
+			{
+				XSLTProcessor.log(LogService.LOG_ERROR,"Transformation exception ", e);
+			}
+		}
+		else
+		{
+			XSLTProcessor.log(LogService.LOG_WARNING,"Transformer for path " + path + " not found",null);
+		}
+	}
+
+	protected Transformer createTransformer(String path)
+	{
+		Transformer transformer = null;
+		try
+		{
+			if (useCache && templatesCache.containsKey(path))
+			{
+				transformer = ((Templates)templatesCache.get(path)).newTransformer();
+			}
+			else
+			{
+				InputStream file = getInputStream(path);
+				if (file != null)
+				{
+					XSLTProcessor.log(LogService.LOG_INFO,"Creating template for path "+path, null);
+					Templates template = factory.newTemplates(new StreamSource(file));
+					transformer = template.newTransformer();
+					if (useCache)
+					{
+						templatesCache.put(path, template);
+					}
+				}
+				else
+				{
+					XSLTProcessor.log(LogService.LOG_WARNING,"template for path "+path+" not found", null);
+				}
+			}
+		}
+		catch (TransformerConfigurationException e)
+		{
+			XSLTProcessor.log(LogService.LOG_ERROR,"Exception during template construction", e);
+		}
+		return transformer;
+	}
+
+	protected void processHttpException(HttpInputStream in, HttpOutputStream out, HttpException e) throws IOException
+	{
+		out.setCode(e.getCode());
+		out.setHeader("Content-Type", "text/html");
+		out.sendHeaders();
+		// hardcoded dir :-P
+		Transformer transformer = createTransformer("error.xsl");
+		transformer.setURIResolver(this);
+		Document doc = e.getResponseDoc();
+		if (doc != null)
+		{
+			try
+			{
+				if (!in.getVariables().containsKey("locale"))
+				{
+					transformer.setParameter("request.locale", locale.toString());
+				}
+				ByteArrayOutputStream output = new ByteArrayOutputStream();
+				transformer.transform(new DOMSource(doc), new StreamResult(output));
+				output.writeTo(out);
+			}
+			catch (TransformerException ex)
+			{
+				XSLTProcessor.log(LogService.LOG_ERROR,"Exception during error output", ex);
+			}
+		}
+	}
+
+	public void writeError(HttpOutputStream out, HttpInputStream in, Exception e) throws IOException
+	{
+		Exception t = e;
+		if (e instanceof RuntimeMBeanException)
+		{
+			t = ((RuntimeMBeanException)e).getTargetException();
+		}
+		XSLTProcessor.log(LogService.LOG_INFO,"Processing error " + t.getMessage(),null);
+		if (t instanceof HttpException)
+		{
+			processHttpException(in, out, (HttpException)e);
+		}
+		else if ((t instanceof MBeanException) && (((MBeanException)t).getTargetException() instanceof HttpException))
+		{
+			processHttpException(in, out, (HttpException)((MBeanException)t).getTargetException());
+		}
+		else if ((t instanceof ReflectionException) && (((ReflectionException)t).getTargetException() instanceof HttpException))
+		{
+			processHttpException(in, out, (HttpException)((ReflectionException)t).getTargetException());
+		}
+		else
+		{
+			out.setCode(HttpConstants.STATUS_INTERNAL_ERROR);
+			out.setHeader("Content-Type", "text/html");
+			out.sendHeaders();
+		}
+	}
+
+	public String preProcess(String path) {
+		if (path.equals("/"))
+		{
+			path = "/" + defaultPage;
+		}
+		return path;
+	}
+
+	public String notFoundElement(String path, HttpOutputStream out, HttpInputStream in) throws IOException, HttpException
+	{
+		File file = new File(this.path, path);
+		XSLTProcessor.log(LogService.LOG_INFO,"Processing file request " + file,null);
+		String name = file.getName();
+		int extensionIndex = name.lastIndexOf('.');
+		String mime = null;
+		if (extensionIndex < 0)
+		{
+			XSLTProcessor.log(LogService.LOG_WARNING,"Filename has no extensions " + file.toString(),null);
+			mime = "text/plain";
+		}
+		else
+		{
+			String extension = name.substring(extensionIndex, name.length());
+			if (mimeTypes.containsKey(extension))
+			{
+				mime = (String)mimeTypes.get(extension);
+			} else {
+				XSLTProcessor.log(LogService.LOG_WARNING,"MIME type not found " + extension,null);
+				mime = "text/plain";
+			}
+		}
+		try
+		{
+			XSLTProcessor.log(LogService.LOG_DEBUG,"Trying to read file " + file,null);
+			BufferedInputStream fileIn = new BufferedInputStream(getInputStream(path));
+			ByteArrayOutputStream outArray = new ByteArrayOutputStream();
+			BufferedOutputStream outBuffer = new BufferedOutputStream(outArray);
+			int piece = 0;
+			while ((piece = fileIn.read()) >= 0)
+			{
+				outBuffer.write(piece);
+			}
+			outBuffer.flush();
+			out.setCode(HttpConstants.STATUS_OKAY);
+			out.setHeader("Content-type", mime);
+			out.sendHeaders();
+			XSLTProcessor.log(LogService.LOG_DEBUG,"File output " + mime,null);
+			outArray.writeTo(out);
+			fileIn.close();
+		}
+		catch (Exception e)
+		{
+			XSLTProcessor.log(LogService.LOG_WARNING,"Exception loading file " + file, e);
+			throw new HttpException(HttpConstants.STATUS_NOT_FOUND, "file " + file + " not found");
+		}
+		return null;
+	}
+
+	protected InputStream getInputStream(String path)
+	{
+		InputStream file = null;
+		if (!useJar)
+		{
+			try
+			{
+				// load from a dir
+				file = new FileInputStream(new File(this.root, path));
+			}
+			catch (FileNotFoundException e)
+			{
+				XSLTProcessor.log(LogService.LOG_ERROR,"File not found", e);
+			}
+		}
+		else
+		{
+			// load from a jar
+			String targetFile = this.path;
+			// workaround, should tought of somehting better
+			if (path.startsWith("/"))
+			{
+				targetFile += path;
+			} else {
+				targetFile += "/" + path;
+			}
+			if (root != null)
+			{
+				file = targetClassLoader.getResourceAsStream(targetFile);
+			}
+			if (file == null)
+			{
+				ClassLoader cl=getClass().getClassLoader();
+				if (cl == null)
+				{
+					file = ClassLoader.getSystemClassLoader().getResourceAsStream(targetFile);
+				}
+				else
+				{
+					file = getClass().getClassLoader().getResourceAsStream(targetFile);
+				}
+				file = getClass().getClassLoader().getResourceAsStream(targetFile);
+			}
+		}
+
+		return file;
+	}
+
+	public Source resolve(String href, String base)
+	{
+		StreamSource source = new StreamSource(getInputStream(href));
+		// this works with saxon7/saxon6.5.2/xalan
+		source.setSystemId(href);
+		return source;
+	}
+
+	public void setFile(String file)
+	{
+		if (file != null)
+		{
+
+			File target = new File(file);
+			if (!target.exists())
+			{
+				XSLTProcessor.log(LogService.LOG_WARNING,"Target file " + file + " does not exist, defaulting to previous",null);
+				return;
+			}
+			if (target.isDirectory())
+			{
+				useJar = false;
+				XSLTProcessor.log(LogService.LOG_INFO, "Using " + file + " as the root dir", null);
+				this.root = target;
+				return;
+			}
+			if (target.isFile() && (target.getName().endsWith(".jar") ||
+				(target.getName().endsWith(".zip"))))
+			{
+				try {
+					URL url = target.toURL();
+					targetClassLoader = new URLClassLoader(new URL[] {url});
+					XSLTProcessor.log(LogService.LOG_INFO,"Using compressed file " + url + " as the root file",null);
+					this.root = target;
+					useJar = true;
+				} catch (MalformedURLException e) {
+					XSLTProcessor.log(LogService.LOG_WARNING,"Unable to create class loader", e);
+				}
+			}
+			else
+			{
+				XSLTProcessor.log(LogService.LOG_WARNING,"Target file " + file + " does not exist, defaulting to previous",null);
+			}
+		}
+	}
+
+	public String getFile()
+	{
+		return (root != null)?root.getName():null;
+	}
+
+	public String getPathInJar()
+	{
+		return path;
+	}
+
+	public void setPathInJar(String path)
+	{
+		this.path = path;
+	}
+
+	public String getDefaultPage()
+	{
+		return defaultPage;
+	}
+
+	public void setDefaultPage(String defaultPage)
+	{
+		this.defaultPage = defaultPage;
+	}
+
+	public boolean isUseJar()
+	{
+		return useJar;
+	}
+
+	public boolean isUsePath()
+	{
+		return !useJar;
+	}
+
+	public void addMimeType(String extension, String type)
+	{
+		if (extension != null && type != null)
+		{
+			XSLTProcessor.log(LogService.LOG_INFO,"Added MIME type " + type + " for extension " + extension,null);
+			mimeTypes.put(extension, type);
+		}
+	}
+
+	public void setUseCache(boolean useCache)
+	{
+		this.useCache = useCache;
+	}
+
+	public boolean isUseCache()
+	{
+		return useCache;
+	}
+
+	public String getName()
+	{
+		return "XSLT Processor";
+	}
+
+	public Locale getLocale() {
+		return locale;
+	}
+
+	public void setLocale(Locale locale) {
+		this.locale = locale;
+	}
+
+	public void setLocaleString(String locale) {
+		if (locale == null || locale.length()==0) {
+		  this.locale = new Locale("en", "");
+		}
+		else
+		{
+		  // split locale based on underbar
+		  StringTokenizer tknzr = new StringTokenizer(locale,"_");
+		  String language = tknzr.nextToken();
+		  String country = "";
+		  String variant = "";
+		  if (tknzr.hasMoreTokens())
+		    country = tknzr.nextToken();
+		  if (tknzr.hasMoreTokens())
+		    variant = tknzr.nextToken();
+		  this.locale = new Locale(language,country,variant);
+		}
+	}
+
+    private static void log(int prio, String message, Throwable t){
+    if (HttpConnectorActivator.bc!=null){
+    ServiceReference logSR=HttpConnectorActivator.bc.getServiceReference(LogService.class.getName());
+    if (logSR!=null){
+      ((LogService)HttpConnectorActivator.bc.getService(logSR)).log(prio, message, t);
+    }else{
+      System.out.println("No Log Service");
+    }
+    }else{
+      System.out.println("mx4j.tools.adapatoir.http.XSLTProcessor.log: No bundleContext");
+    }
+  }
+
+}

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/XSLTProcessorMBean.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/XSLTProcessorMBean.java?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/XSLTProcessorMBean.java (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/XSLTProcessorMBean.java Thu Jul 20 02:36:47 2006
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) MX4J.
+ * All rights reserved.
+ *
+ * This software is distributed under the terms of the MX4J License version 1.0.
+ * See the terms of the MX4J License in the documentation provided with this software.
+ */
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.
+ *
+ */
+package org.apache.felix.mosgi.jmx.httpconnector.mx4j.tools.adaptor.http;
+
+import java.util.Locale;
+
+/**
+ * Management interface for the XSLTProcessor MBean.
+ * @author <a href="mailto:tibu@users.sourceforge.net">Carlos Quiroz</a>
+ * @version $Revision: 1.1.1.1 $
+ */
+public interface XSLTProcessorMBean extends ProcessorMBean
+{
+   /**
+    * Sets the jar/zip file or the directory where to find the XSL files
+    * @see #getFile
+    */
+   public void setFile(String file);
+
+   /**
+    * Returns the jar/zip file or the directory where XSL files are loaded
+    * @see #setFile
+    */
+   public String getFile();
+
+   /**
+    * Returns the path of the XSL templates inside a jar file.
+    * @see #setPathInJar
+    */
+   public String getPathInJar();
+
+   /**
+    * Specifies the path of the XSL templates inside a jar file.
+    * @see #getPathInJar
+    */
+   public void setPathInJar(String path);
+
+   /**
+    * Returns the default start page
+    * @see #setDefaultPage
+    */
+   public String getDefaultPage();
+
+   /**
+    * Sets the default start page, serverbydomain as a default
+    * @see #getDefaultPage
+    */
+   public void setDefaultPage(String defaultPage);
+
+   /**
+    * Returns if the XSL files are contained in a jar/zip file.
+    * @see #isUsePath
+    * @see #setFile
+    */
+   boolean isUseJar();
+
+   /**
+    * Returns if the XSL files are contained in a path.
+    * @see #isUseJar
+    * @see #setFile
+    */
+   boolean isUsePath();
+
+   /**
+    * Maps a given extension with a specified MIME type
+    */
+   public void addMimeType(String extension, String type);
+
+   /**
+    * Sets the caching of the XSL Templates.
+    */
+   public void setUseCache(boolean useCache);
+
+   /**
+    * Returns if the XSL Templates are cached
+    */
+   boolean isUseCache();
+
+   /**
+    * Returns the Locale used to internationalize the output
+    */
+   public Locale getLocale();
+
+   /**
+    * Sets the locale used to internationalize the output
+    */
+   public void setLocale(Locale locale);
+
+   /**
+    * Sets the locale used to internationalize the output, as a string
+    */
+   public void setLocaleString(String locale);
+}

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/about.xsl
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/about.xsl?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/about.xsl (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/about.xsl Thu Jul 20 02:36:47 2006
@@ -0,0 +1,115 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (C) MX4J.
+ All rights reserved.
+
+ This software is distributed under the terms of the MX4J License version 1.0.
+ See the terms of the MX4J License in the documentation provided with this software.
+
+ Author: Carlos Quiroz (tibu@users.sourceforge.net)
+ Revision: $Revision: 1.1.1.1 $
+																																					-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 	version="1.0">
+	<xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>
+	<xsl:include href="common.xsl"/>
+	<xsl:include href="xalan-ext.xsl"/>
+
+	<xsl:param name="html.stylesheet">stylesheet.css</xsl:param>
+	<xsl:param name="html.stylesheet.type">text/css</xsl:param>
+	<xsl:param name="head.title">about.title</xsl:param>
+
+	<!-- Main template -->
+	<xsl:template match="/MBean">
+		<html>
+			<xsl:call-template name="head"/>
+			<body>
+				<table width="100%" cellpadding="0" cellspacing="0" border="0">
+					<tr width="100%">
+						<td>
+						<xsl:call-template name="toprow"/>
+						<xsl:call-template name="tabs">
+							<xsl:with-param name="selection">about</xsl:with-param>
+						</xsl:call-template>
+							<table width="100%" cellpadding="0" cellspacing="0" border="0">
+								<tr class="about">
+									<td colspan="2">
+										<h1 align="center" class="about">
+											<xsl:variable name="str.url">
+												<xsl:call-template name="str">
+													<xsl:with-param name="id">about.main.url</xsl:with-param>
+												</xsl:call-template>
+											</xsl:variable>
+											<xsl:call-template name="str">
+												<xsl:with-param name="id">about.main.title</xsl:with-param>
+												<xsl:with-param name="p0"><a href="{$str.url}">MX4J</a></xsl:with-param>
+											</xsl:call-template>
+										</h1>
+									</td>
+								</tr>
+								<tr class="about">
+									<td colspan="2">
+										<h2 align="center" class="about">
+											<xsl:variable name="str.url">
+												<xsl:call-template name="str">
+													<xsl:with-param name="id">about.main.url2</xsl:with-param>
+												</xsl:call-template>
+											</xsl:variable>
+											<xsl:call-template name="str">
+												<xsl:with-param name="id">about.main.line1</xsl:with-param>
+												<xsl:with-param name="p0"><a href="{$str.url}">JMX</a></xsl:with-param>
+											</xsl:call-template>
+										</h2>
+									</td>
+								</tr>
+								<tr class="about">
+									<td>
+										<h3 align="right" class="about">
+											<xsl:call-template name="str">
+												<xsl:with-param name="id">about.main.implementation</xsl:with-param>
+											</xsl:call-template>
+										</h3>
+									</td>
+									<td>
+										<h3 align="left" class="about">
+											<xsl:value-of select="./Attribute[@name='ImplementationName']/@value"/>
+										</h3>
+									</td>
+								</tr>
+								<tr class="about">
+									<td>
+										<h3 align="right" class="about">
+											<xsl:call-template name="str">
+												<xsl:with-param name="id">about.main.implementationversion</xsl:with-param>
+											</xsl:call-template>
+										</h3>
+									</td>
+									<td>
+										<h3 align="left" class="about">
+											<xsl:value-of select="./Attribute[@name='ImplementationVersion']/@value"/>
+										</h3>
+									</td>
+								</tr>
+								<tr class="about">
+									<td>
+										<h3 align="right" class="about">
+											<xsl:call-template name="str">
+												<xsl:with-param name="id">about.main.serverid</xsl:with-param>
+											</xsl:call-template>
+										</h3>
+									</td>
+									<td>
+										<h3 align="left" class="about">
+											<xsl:value-of select="./Attribute[@name='MBeanServerId']/@value"/>
+										</h3>
+									</td>
+								</tr>
+							</table>
+						<xsl:call-template name="bottom"/>
+						</td>
+					</tr>
+				</table>
+			</body>
+		</html>
+	</xsl:template>
+</xsl:stylesheet>
+

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/common.xsl
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/common.xsl?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/common.xsl (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/common.xsl Thu Jul 20 02:36:47 2006
@@ -0,0 +1,441 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (C) MX4J.
+ All rights reserved.
+
+ This software is distributed under the terms of the MX4J License version 1.0.
+ See the terms of the MX4J License in the documentation provided with this software.
+
+ Author: Carlos Quiroz (tibu@users.sourceforge.net)
+ Revision: $Revision: 1.1.1.1 $
+																																																																										-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<!-- Import xalan extensions -->
+		<xsl:import href="xalan-ext.xsl" />
+
+	<!-- Defin string variables -->
+	<xsl:param name="request.locale">en</xsl:param>
+
+	<xsl:variable name="strings" select="document(concat('strings_', $request.locale, '.xml'))" />
+
+	<!-- Common head template -->
+	<xsl:template name="head">
+		<xsl:if test="$head.title">
+			<title>
+				<xsl:call-template name="str">
+					<xsl:with-param name="id">
+						<xsl:value-of select="$head.title" />
+					</xsl:with-param>
+				</xsl:call-template>
+			</title>
+		</xsl:if>
+
+		<xsl:if test="$html.stylesheet">
+			<link rel="stylesheet" href="{$html.stylesheet}"
+			type="{$html.stylesheet.type}" />
+		</xsl:if>
+
+		<meta http-equiv="Expires" content ="0"/>
+		<meta http-equiv="Pragma" content="no-cache"/>
+		<meta http-equiv="Cache-Control" content="no-cache"/>
+		<meta name="generator" content="MX4J HttpAdaptor, JMX, JMX implementation" />
+
+	</xsl:template>
+
+	<!-- Common title template -->
+	<xsl:template name="toprow">
+		<table width="100%" cellpadding="0" cellspacing="0" border="0">
+			<tr>
+				<td class="darker" colspan="2"/>
+			</tr>
+
+			<tr>
+				<td class="topheading">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id">common.title</xsl:with-param>
+					</xsl:call-template>
+					<br/>
+					<div class="subtitle">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id">common.subtitle</xsl:with-param>
+					</xsl:call-template>
+					</div>
+				</td>
+
+				<td class="topheading" align="right">
+					<xsl:variable name="str.logo">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.logo</xsl:with-param>
+						</xsl:call-template>
+					</xsl:variable>
+					<xsl:variable name="str.logo.gif">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.logo.gif</xsl:with-param>
+							</xsl:call-template>
+					</xsl:variable>
+					<xsl:variable name="str.site">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.site</xsl:with-param>
+						</xsl:call-template>
+					</xsl:variable>
+					<xsl:variable name="str.logo.width">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.logo.width</xsl:with-param>
+						</xsl:call-template>
+					</xsl:variable>
+					<xsl:variable name="str.logo.height">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.logo.height</xsl:with-param>
+						</xsl:call-template>
+					</xsl:variable>
+					<a href="http://{$str.site}"><img src="{$str.logo.gif}" width="{$str.logo.width}" height="{$str.logo.height}" border="0" alt="{$str.logo}" />
+					</a>
+				</td>
+			</tr>
+
+			<tr>
+				<td class="darker" colspan="2" />
+			</tr>
+		</table>
+
+		<br />
+	</xsl:template>
+
+	<!-- Common bottom template -->
+	<xsl:template name="bottom">
+		<table width="100%" cellpadding="0" cellspacing="0" border="0">
+			<tr>
+				<td class="fronttab">&#160;</td>
+			</tr>
+
+			<tr>
+				<td class="darker" />
+			</tr>
+
+			<tr>
+				<td>
+					<div align="center" class="footer">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.bottom.banner</xsl:with-param>
+							<xsl:with-param name="p0">
+								<a href="http://mx4j.sourceforge.net">MX4J</a>
+							</xsl:with-param>
+						</xsl:call-template>
+					</div>
+				</td>
+			</tr>
+		</table>
+	</xsl:template>
+
+	<!-- Common tabs template -->
+	<xsl:template name="tabs">
+		<xsl:param name="selection" select="." />
+
+		<xsl:variable name="server.class">
+			<xsl:choose>
+				<xsl:when test="$selection='server'">fronttab</xsl:when>
+				<xsl:otherwise>backtab</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+
+		<xsl:variable name="timer.class">
+			<xsl:choose>
+				<xsl:when test="$selection='timer'">fronttab</xsl:when>
+				<xsl:otherwise>backtab</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+
+		<xsl:variable name="mbean.class">
+			<xsl:choose>
+				<xsl:when test="$selection='mbean'">fronttab</xsl:when>
+				<xsl:otherwise>backtab</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+
+		<xsl:variable name="monitor.class">
+			<xsl:choose>
+				<xsl:when test="$selection='monitor'">fronttab</xsl:when>
+				<xsl:otherwise>backtab</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+
+		<xsl:variable name="relation.class">
+			<xsl:choose>
+				<xsl:when test="$selection='relation'">fronttab</xsl:when>
+				<xsl:otherwise>backtab</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+
+		<xsl:variable name="mlet.class">
+			<xsl:choose>
+				<xsl:when test="$selection='mlet'">fronttab</xsl:when>
+				<xsl:otherwise>backtab</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+
+		<xsl:variable name="about.class">
+			<xsl:choose>
+				<xsl:when test="$selection='about'">fronttab</xsl:when>
+				<xsl:otherwise>backtab</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+
+		<table cellpadding="0" cellspacing="0" border="0">
+			<tr>
+				<td class="{$server.class}">
+					<xsl:if test="not ($selection='server')">
+						<a href="/serverbydomain" class="tabs">
+							<xsl:call-template name="str">
+								<xsl:with-param name="id">common.tabs.serverview</xsl:with-param>
+							</xsl:call-template>
+						</a>
+					</xsl:if>
+
+					<xsl:if test="$selection='server'">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.tabs.serverview</xsl:with-param>
+						</xsl:call-template>
+					</xsl:if>
+				</td>
+
+				<td width="2"/>
+
+				<td class="{$mbean.class}">
+					<a href="/empty?template=emptymbean" class="tabs">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.tabs.mbeanview</xsl:with-param>
+						</xsl:call-template>
+					</a>
+				</td>
+
+				<td width="2"/>
+
+				<td class="{$timer.class}">
+					<a href="/serverbydomain?instanceof=javax.management.timer.Timer&amp;template=timer" class="tabs">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.tabs.timerview</xsl:with-param>
+						</xsl:call-template>
+					</a>
+				</td>
+
+				<td width="2"/>
+
+				<td class="{$monitor.class}">
+					<a href="/serverbydomain?instanceof=javax.management.monitor.Monitor&amp;template=monitor" class="tabs">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.tabs.monitorview</xsl:with-param>
+						</xsl:call-template>
+					</a>
+				</td>
+
+				<td width="2"/>
+
+				<td class="{$relation.class}">
+					<a href="/relation?instanceof=javax.management.relation.Relation&amp;template=relation" class="tabs">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.tabs.relationview</xsl:with-param>
+						</xsl:call-template>
+					</a>
+				</td>
+
+				<td width="2"/>
+
+				<td class="{$mlet.class}">
+					<a href="/serverbydomain?instanceof=javax.management.loading.MLetMBean&amp;template=mlet" class="tabs">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.tabs.mletview</xsl:with-param>
+						</xsl:call-template>
+					</a>
+				</td>
+
+				<td width="2"/>
+
+				<td class="{$about.class}">
+					<a href="/mbean?objectname=JMImplementation%3Atype%3DMBeanServerDelegate&amp;template=about" class="tabs">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">common.tabs.about</xsl:with-param>
+						</xsl:call-template>
+					</a>
+				</td>
+			</tr>
+		</table>
+	</xsl:template>
+
+	<xsl:template name="serverview">
+		<tr>
+			<td class="darkline" align="right">
+				<a href="/">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id">common.serverview.return</xsl:with-param>
+					</xsl:call-template>
+				</a>
+			</td>
+		</tr>
+	</xsl:template>
+
+	<xsl:template name="mbeanview">
+		<xsl:param name="objectname" />
+		<xsl:param name="colspan">1</xsl:param>
+		<xsl:param name="text">common.mbeanview.return</xsl:param>
+
+		<tr>
+			<td class="darkline" align="right" colspan="{$colspan}">
+				<xsl:variable name="objectname-encode">
+					<xsl:call-template name="uri-encode">
+						<xsl:with-param name="uri" select="$objectname" />
+					</xsl:call-template>
+				</xsl:variable>
+
+				<a href="/mbean?objectname={$objectname-encode}">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id"><xsl:value-of select="$text" /></xsl:with-param>
+					</xsl:call-template>
+				</a>
+			</td>
+		</tr>
+	</xsl:template>
+
+	<xsl:template name="aggregation-navigation">
+		<xsl:param name="url"/>
+		<xsl:param name="total"/>
+		<xsl:param name="step"/>
+		<xsl:param name="start"/>
+		<xsl:param name="str.prefix">common</xsl:param>
+
+		<xsl:if test="$total&gt;$step">
+			<xsl:variable name="isfirst">
+				<xsl:choose>
+					<xsl:when test='$start=0'>true</xsl:when>
+					<xsl:when test='$start&gt;0'>false</xsl:when>
+				</xsl:choose>
+			</xsl:variable>
+			<xsl:variable name="islast">
+				<xsl:choose>
+					<xsl:when test='$total&lt;=($step + $start)'>true</xsl:when>
+					<xsl:otherwise>false</xsl:otherwise>
+				</xsl:choose>
+			</xsl:variable>
+			<tr><td/></tr>
+			<tr><td>
+				<xsl:choose>
+					<xsl:when test="$isfirst='false'">
+					<a href="{$url}&amp;start=0">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id"><xsl:value-of select="concat($str.prefix, '.navigation.first')"/></xsl:with-param>
+						</xsl:call-template>
+					</a>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:call-template name="str">
+								<xsl:with-param name="id"><xsl:value-of select="concat($str.prefix, '.navigation.first')"/></xsl:with-param>
+							</xsl:call-template>
+					</xsl:otherwise>
+				</xsl:choose>
+				 -
+				<xsl:choose>
+					<xsl:when test="$isfirst='false'">
+						<xsl:variable name="previndex" select="($start - $step)"/>
+						<a href="{$url}&amp;start={$previndex}">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id"><xsl:value-of select="concat($str.prefix, '.navigation.previous')"/></xsl:with-param>
+						</xsl:call-template>
+						</a>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:call-template name="str">
+							<xsl:with-param name="id"><xsl:value-of select="concat($str.prefix, '.navigation.previous')"/></xsl:with-param>
+						</xsl:call-template>
+					</xsl:otherwise>
+				</xsl:choose>
+				 -
+				<xsl:choose>
+					<xsl:when test="$islast='false'">
+						<xsl:variable name="nextindex" select="($start + $step)"/>
+						<a href="{$url}&amp;start={$nextindex}">
+							<xsl:call-template name="str">
+								<xsl:with-param name="id"><xsl:value-of select="concat($str.prefix, '.navigation.next')"/></xsl:with-param>
+							</xsl:call-template>
+						</a>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:call-template name="str">
+							<xsl:with-param name="id"><xsl:value-of select="concat($str.prefix, '.navigation.next')"/></xsl:with-param>
+						</xsl:call-template>
+					</xsl:otherwise>
+				</xsl:choose>
+				 -
+				<xsl:choose>
+					<xsl:when test="$islast='false'">
+						<xsl:variable name="lastindex" select="($total - ($total mod $step))"/>
+						<a href="{$url}&amp;start={$lastindex}">
+							<xsl:call-template name="str">
+								<xsl:with-param name="id"><xsl:value-of select="concat($str.prefix, '.navigation.last')"/></xsl:with-param>
+							</xsl:call-template>
+						</a>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:call-template name="str">
+							<xsl:with-param name="id"><xsl:value-of select="concat($str.prefix, '.navigation.last')"/></xsl:with-param>
+						</xsl:call-template>
+					</xsl:otherwise>
+				</xsl:choose>
+			</td>
+			</tr>
+		</xsl:if>
+	</xsl:template>
+
+	<!-- Finds a string in the strings file by id. It can replace two params -->
+	<xsl:template name="str">
+		<xsl:param name="id"/>
+		<xsl:param name="p0"/>
+		<xsl:param name="p1"/>
+
+		<xsl:variable name="str" select="$strings//str[@id=$id]" />
+
+		<!-- This is a bit lame, should be improved -->
+		<xsl:variable name="temp">
+			<xsl:call-template name="replace-param">
+				<xsl:with-param name="text" select="$str" />
+				<xsl:with-param name="paramText">{0}</xsl:with-param>
+				<xsl:with-param name="paramValue">
+					<xsl:copy-of select="$p0" />
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:variable>
+		<xsl:choose>
+			<xsl:when test="$p1">
+				<xsl:call-template name="replace-param">
+					<xsl:with-param name="text" select="$temp" />
+					<xsl:with-param name="paramText">{1}</xsl:with-param>
+					<xsl:with-param name="paramValue">
+						<xsl:copy-of select="$p1" />
+					</xsl:with-param>
+				</xsl:call-template>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:copy-of select="$temp"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+
+	<!-- Replaces paramText by paramValue in text -->
+	<xsl:template name="replace-param">
+		<xsl:param name="text"/>
+		<xsl:param name="paramText"/>
+		<xsl:param name="paramValue"/>
+
+		<xsl:choose>
+			<xsl:when test="contains($text, $paramText)">
+				<xsl:copy-of select="substring-before($text, $paramText)" />
+				<xsl:copy-of select="$paramValue" />
+				<xsl:copy-of select="substring-after($text, $paramText)" />
+			</xsl:when>
+
+			<xsl:otherwise>
+					<xsl:value-of select="$text" />
+			</xsl:otherwise>
+		</xsl:choose>
+</xsl:template>
+</xsl:stylesheet>
+
+

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/constructors.xsl
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/constructors.xsl?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/constructors.xsl (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/constructors.xsl Thu Jul 20 02:36:47 2006
@@ -0,0 +1,233 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (C) MX4J.
+ All rights reserved.
+
+ This software is distributed under the terms of the MX4J License version 1.0.
+ See the terms of the MX4J License in the documentation provided with this software.
+
+ Author: Carlos Quiroz (tibu@users.sourceforge.net)
+ Revision: $Revision: 1.1.1.1 $
+																																					-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<xsl:output method="html" indent="yes" encoding="UTF-8"/>
+
+	<xsl:param name="html.stylesheet">stylesheet.css</xsl:param>
+	<xsl:param name="html.stylesheet.type">text/css</xsl:param>
+	<xsl:param name="head.title">constructors.title</xsl:param>
+	<xsl:include href="common.xsl"/>
+	<xsl:include href="mbean_attributes.xsl"/>
+
+	<xsl:param name="request.objectname"/>
+
+	<!-- Constructor's parameters tempalte -->
+	<xsl:template name="parameters" match="Parameter">
+		<xsl:param name="class"/>
+
+		<tr>
+			<td colspan="3">
+				<p class="darklinebottom">
+				<xsl:call-template name="str">
+					<xsl:with-param name="id">constructors.parameters.title</xsl:with-param>
+				</xsl:call-template>
+				</p>
+			</td>
+		</tr>
+		<tr class="darkline">
+			<td width="3%">
+				<div class="tableheader">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id">constructors.parameters.id</xsl:with-param>
+					</xsl:call-template>
+				</div>
+			</td>
+			<td>
+				<div class="tableheader">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id">constructors.parameters.type</xsl:with-param>
+					</xsl:call-template>
+				</div>
+			</td>
+			<td align="right">
+				<div class="tableheader">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id">constructors.parameters.value</xsl:with-param>
+					</xsl:call-template>
+				</div>
+			</td>
+		</tr>
+		<xsl:for-each select="Parameter">
+			<xsl:sort data-type="text" order="ascending" select="@id"/>
+			<xsl:variable name="type.id" select="concat('type', position()-1)"/>
+			<xsl:variable name="name.id" select="concat('value', position()-1)"/>
+			<xsl:variable name="type" select="@type"/>
+			<tr class="{$class}">
+				<td align="left" class="constructorrow">
+					<div align="left"><xsl:value-of select="@id"/></div>
+				</td>
+				<td align="left" class="constructorrow">
+					<xsl:value-of select="@type"/>
+				</td>
+				<td align="right" width="15%" class="constructorrow">
+					<xsl:choose>
+						<xsl:when test="@type='java.lang.String'
+							or @type='java.lang.Double'
+							or @type='java.lang.Short'
+							or @type='java.lang.Integer'
+							or @type='java.lang.Long'
+							or @type='java.lang.Float'
+							or @type='java.lang.Byte'
+							or @type='java.lang.Character'
+							or @type='java.lang.Boolean'
+							or @type='java.lang.Number'
+							or @type='javax.management.ObjectName'
+							or @type='int'
+							or @type='long'
+							or @type='short'
+							or @type='boolean'
+							or @type='byte'
+							or @type='char'
+							or @type='double'
+							or @type='float'">
+							<xsl:attribute name="valid">
+								true
+							</xsl:attribute>
+						<xsl:call-template name="raw-input">
+							<xsl:with-param name="name" select="$name.id"/>
+							<xsl:with-param name="type" select="$type"/>
+							<xsl:with-param name="value"/>
+							<xsl:with-param name="strinit">false</xsl:with-param>
+						</xsl:call-template>
+						</xsl:when>
+						<xsl:when test="@strinit='true'">
+							<xsl:attribute name="valid">true</xsl:attribute>
+							<xsl:call-template name="raw-input">
+								<xsl:with-param name="name" select="$name.id"/>
+								<xsl:with-param name="type" select="$type"/>
+								<xsl:with-param name="value"/>
+								<xsl:with-param name="strinit">true</xsl:with-param>
+							</xsl:call-template>
+						</xsl:when>
+						<xsl:otherwise>
+							<xsl:attribute name="valid">
+								false
+							</xsl:attribute>
+							<xsl:call-template name="str">
+								<xsl:with-param name="id">constructors.parameters.unknowntype</xsl:with-param>
+							</xsl:call-template>
+						</xsl:otherwise>
+					</xsl:choose>
+					<input type="hidden" name="{$type.id}" value="{$type}"/>
+				</td>
+				</tr>
+		</xsl:for-each>
+	</xsl:template>
+
+	<!-- Template for a Constructor node -->
+	<xsl:template match="Constructor" name="constructors">
+		<xsl:for-each select="//Constructor">
+			<form action="create">
+			<table width="100%" cellpadding="0" cellspacing="0" border="0">
+
+					<xsl:variable name="classtype">
+						<xsl:if test="(position() mod 2)=1">clearline</xsl:if>
+						<xsl:if test="(position() mod 2)=0">darkline</xsl:if>
+					</xsl:variable>
+					<xsl:variable name="hasParameters">
+						<xsl:if test="count(Parameter)>0">true</xsl:if>
+						<xsl:if test="count(Parameter)=0">false</xsl:if>
+					</xsl:variable>
+					<xsl:variable name="classname"><xsl:value-of select="@name"/></xsl:variable>
+				<tr class="{$classtype}">
+					<td valign="top" class="constructorrow">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">constructors.constructors.intro</xsl:with-param>
+							<xsl:with-param name="p0"><xsl:value-of select="@name"/></xsl:with-param>
+						</xsl:call-template>
+					</td>
+				</tr>
+				<tr class="{$classtype}">
+					<td>
+						<table cellpadding="0" width="100%" cellspacing="0" border="0">
+							<xsl:if test="$hasParameters='true'">
+								<xsl:call-template name="parameters"/>
+							</xsl:if>
+							<xsl:if test="$hasParameters='false'">
+								<tr>
+									<td width="100%" colspan="3"></td>
+								</tr>
+							</xsl:if>
+						</table>
+					</td>
+				</tr>
+				<tr class="{$classtype}">
+					<td valign="bottom" align="right" class="constructorrow">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">constructors.constructors.objectnameinput</xsl:with-param>
+						</xsl:call-template>
+						<input type="input" name="objectname"/>
+					</td>
+				</tr>
+				<tr class="{$classtype}">
+					<td align="right" class="constructorrow">
+						<xsl:variable name="str.createnew">
+							<xsl:call-template name="str">
+								<xsl:with-param name="id">constructors.constructors.createnew</xsl:with-param>
+							</xsl:call-template>
+						</xsl:variable>
+
+						<input type="submit" value="{$str.createnew}"/>
+						<input type="hidden" name="class" value="{$classname}"/>
+					</td>
+				</tr>
+
+			</table>
+			</form>
+		</xsl:for-each>
+	</xsl:template>
+
+	<!-- Exception handling template -->
+	<xsl:template match="Exception" name="error">
+		<xsl:for-each select="Exception">
+			<table width="100%" cellpadding="0" cellspacing="0" border="0">
+				<tr>
+					<td class="fronttab">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">constructors.error.exception</xsl:with-param>
+							<xsl:with-param name="p0"><xsl:value-of select="@errorMsg"/></xsl:with-param>
+						</xsl:call-template>
+					</td>
+				</tr>
+			</table>
+		</xsl:for-each>
+	</xsl:template>
+
+	<!-- Main template -->
+	<xsl:template match="/" name="main">
+		<html>
+			<xsl:call-template name="head"/>
+			<body>
+				<xsl:call-template name="toprow"/>
+				<xsl:call-template name="tabs">
+					<xsl:with-param name="selection">mbean</xsl:with-param>
+				</xsl:call-template>
+				<xsl:for-each select="Class|Exception">
+					<table width="100%" cellpadding="0" cellspacing="0" border="0">
+						<tr>
+							<td width="100%" class="page_title">
+							<xsl:call-template name="str">
+								<xsl:with-param name="id">constructors.main.title</xsl:with-param>
+								<xsl:with-param name="p0"><xsl:value-of select="@classname"/></xsl:with-param>
+							</xsl:call-template>
+							</td>
+						</tr>
+					</table>
+				</xsl:for-each>
+				<xsl:call-template name="error"/>
+				<xsl:call-template name="constructors"/>
+				<xsl:call-template name="bottom"/>
+			</body>
+		</html>
+	</xsl:template>
+</xsl:stylesheet>
+

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/create.xsl
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/create.xsl?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/create.xsl (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/create.xsl Thu Jul 20 02:36:47 2006
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (C) MX4J.
+ All rights reserved.
+
+ This software is distributed under the terms of the MX4J License version 1.0.
+ See the terms of the MX4J License in the documentation provided with this software.
+
+ Author: Carlos Quiroz (tibu@users.sourceforge.net)
+ Revision: $Revision: 1.1.1.1 $
+																																					-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<xsl:output method="html" indent="yes" encoding="UTF-8"/>
+
+	<!-- Overall parameters -->
+	<xsl:param name="html.stylesheet">stylesheet.css</xsl:param>
+	<xsl:param name="html.stylesheet.type">text/css</xsl:param>
+	<xsl:param name="head.title">create.title</xsl:param>
+
+	<!-- Request parameters -->
+	<xsl:param name="request.objectname"/>
+	<xsl:param name="request.class"/>
+
+	<xsl:include href="common.xsl"/>
+
+	<!-- Operation processing template -->
+	<xsl:template name="operation" >
+		<xsl:for-each select="Operation">
+		<table width="100%" cellpadding="0" cellspacing="0" border="0">
+			<tr>
+				<td width="100%" class="page_title">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id">create.operation.title</xsl:with-param>
+						<xsl:with-param name="p0"><xsl:value-of select="$request.class"/></xsl:with-param>
+						<xsl:with-param name="p1"><xsl:value-of select="$request.objectname"/></xsl:with-param>
+					</xsl:call-template>
+				</td>
+			</tr>
+			<tr class="darkline">
+				<td>
+					<xsl:if test="@result='success'">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">create.operation.success</xsl:with-param>
+						</xsl:call-template>
+					</xsl:if>
+					<xsl:if test="@result='error'">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">create.operation.error</xsl:with-param>
+							<xsl:with-param name="p0"><xsl:value-of select="@errorMsg"/></xsl:with-param>
+						</xsl:call-template>
+					</xsl:if>
+				 </td>
+			</tr>
+			<xsl:call-template name="serverview"/>
+		</table>
+		</xsl:for-each>
+	</xsl:template>
+
+	<xsl:template match="MBeanOperation">
+		<html>
+			<xsl:call-template name="head"/>
+			<body>
+				<xsl:call-template name="toprow"/>
+				<xsl:call-template name="tabs">
+					<xsl:with-param name="selection">mbean</xsl:with-param>
+				</xsl:call-template>
+				<xsl:call-template name="operation"/>
+				<xsl:call-template name="bottom"/>
+			</body>
+	</html>
+</xsl:template>
+</xsl:stylesheet>
+

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/delete.xsl
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/delete.xsl?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/delete.xsl (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/delete.xsl Thu Jul 20 02:36:47 2006
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (C) MX4J.
+ All rights reserved.
+
+ This software is distributed under the terms of the MX4J License version 1.0.
+ See the terms of the MX4J License in the documentation provided with this software.
+
+ Author: Carlos Quiroz (tibu@users.sourceforge.net)
+ Revision: $Revision: 1.1.1.1 $
+																																					-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<xsl:output method="html" indent="yes" encoding="UTF-8"/>
+
+	<!-- Overall parameters -->
+	<xsl:param name="html.stylesheet">stylesheet.css</xsl:param>
+	<xsl:param name="html.stylesheet.type">text/css</xsl:param>
+	<xsl:param name="head.title">delete.title</xsl:param>
+
+	<!-- Request parameters -->
+	<xsl:param name="request.objectname"/>
+
+	<xsl:include href="common.xsl"/>
+
+	<xsl:template name="operation" >
+		<xsl:for-each select="Operation">
+		<table width="100%" cellpadding="0" cellspacing="0" border="0">
+			<tr>
+				<td colspan="2" width="100%" class="page_title">
+					<xsl:call-template name="str">
+						<xsl:with-param name="id">delete.operation.title</xsl:with-param>
+						<xsl:with-param name="p0"><xsl:value-of select="$request.objectname"/></xsl:with-param>
+					</xsl:call-template>
+				</td>
+			</tr>
+			<tr class="darkline">
+				<td>
+					<xsl:if test="@result='success'">
+						<xsl:call-template name="str">
+							<xsl:with-param name="id">delete.operation.success</xsl:with-param>
+						</xsl:call-template>
+					</xsl:if>
+					<xsl:if test="@result='error'">
+					<xsl:call-template name="str">
+							<xsl:with-param name="id">delete.operation.error</xsl:with-param>
+							<xsl:with-param name="p0"><xsl:value-of select="@errorMsg"/></xsl:with-param>
+						</xsl:call-template>
+					</xsl:if>
+				</td>
+			</tr>
+			<xsl:call-template name="serverview"/>
+		</table>
+		</xsl:for-each>
+	</xsl:template>
+
+	<xsl:template match="MBeanOperation">
+		<html>
+			<xsl:call-template name="head"/>
+			<body>
+				<xsl:call-template name="toprow"/>
+				<xsl:call-template name="tabs">
+					<xsl:with-param name="selection">mbean</xsl:with-param>
+				</xsl:call-template>
+				<xsl:call-template name="operation"/>
+				<xsl:call-template name="bottom"/>
+			</body>
+	</html>
+</xsl:template>
+</xsl:stylesheet>
+

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/emptymbean.xsl
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/emptymbean.xsl?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/emptymbean.xsl (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/emptymbean.xsl Thu Jul 20 02:36:47 2006
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (C) MX4J.
+ All rights reserved.
+
+ This software is distributed under the terms of the MX4J License version 1.0.
+ See the terms of the MX4J License in the documentation provided with this software.
+
+ Author: Carlos Quiroz (tibu@users.sourceforge.net)
+ Revision: $Revision: 1.1.1.1 $
+																																					-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 	version="1.0">
+	<xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>
+	<xsl:include href="common.xsl"/>
+	<xsl:include href="xalan-ext.xsl"/>
+
+	<xsl:param name="html.stylesheet">stylesheet.css</xsl:param>
+	<xsl:param name="html.stylesheet.type">text/css</xsl:param>
+	<xsl:param name="head.title">emptymbean.title</xsl:param>
+
+	<!-- Main template -->
+	<xsl:template match="/">
+		<html>
+			<xsl:call-template name="head"/>
+			<body>
+				<table width="100%" cellpadding="0" cellspacing="0" border="0">
+					<tr width="100%">
+						<td>
+						<xsl:call-template name="toprow"/>
+						<xsl:call-template name="tabs">
+							<xsl:with-param name="selection">mbean</xsl:with-param>
+						</xsl:call-template>
+							<table width="100%" cellpadding="0" cellspacing="0" border="0">
+								<tr>
+									<td class="page_title">
+										<xsl:call-template name="str">
+											<xsl:with-param name="id">emptymbean.title</xsl:with-param>
+										</xsl:call-template>
+									</td>
+								</tr>
+								<tr>
+									<form action="/constructors">
+										<td class="page_title">
+										<xsl:call-template name="str">
+											<xsl:with-param name="id">emptymbean.querycontructors</xsl:with-param>
+										</xsl:call-template>
+										<xsl:variable name="str.query">
+											<xsl:call-template name="str">
+												<xsl:with-param name="id">emptymbean.query</xsl:with-param>
+											</xsl:call-template>
+										</xsl:variable>
+										<input type="input" name="classname"/><input type="submit" value="{$str.query}"/>
+										</td></form></tr>
+							</table>
+						<xsl:call-template name="bottom"/>
+						</td>
+					</tr>
+				</table>
+			</body>
+		</html>
+	</xsl:template>
+</xsl:stylesheet>
+

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/error.xsl
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/error.xsl?rev=423855&view=auto
==============================================================================
--- incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/error.xsl (added)
+++ incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/error.xsl Thu Jul 20 02:36:47 2006
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (C) MX4J.
+ All rights reserved.
+
+ This software is distributed under the terms of the MX4J License version 1.0.
+ See the terms of the MX4J License in the documentation provided with this software.
+
+ Author: Carlos Quiroz (tibu@users.sourceforge.net)
+ Revision: $Revision: 1.1.1.1 $
+																																					-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<xsl:output method="html" indent="yes" encoding="UTF-8"/>
+
+	<xsl:param name="html.stylesheet">stylesheet.css</xsl:param>
+	<xsl:param name="html.stylesheet.type">text/css</xsl:param>
+	<xsl:param name="head.title">error.title</xsl:param>
+	<xsl:include href="common.xsl"/>
+
+	<xsl:template match="/" name="httpexception">
+		<html>
+			<xsl:call-template name="head"/>
+			<body>
+				<xsl:call-template name="toprow"/>
+					<table width="100%" cellpadding="0" cellspacing="0" border="0">
+						<tr>
+							<td width="100%" class="page_title">
+								<xsl:call-template name="str">
+									<xsl:with-param name="id">error.title</xsl:with-param>
+								</xsl:call-template>
+							</td>
+						</tr>
+						<xsl:for-each select="HttpException">
+							<tr>
+								<td>
+									<xsl:call-template name="str">
+										<xsl:with-param name="id">error.httpexception.code</xsl:with-param>
+										<xsl:with-param name="p0"><xsl:value-of select="@code"/></xsl:with-param>
+									</xsl:call-template>
+								</td>
+							</tr>
+							<tr>
+								<td>
+									<xsl:call-template name="str">
+										<xsl:with-param name="id">error.httpexception.message</xsl:with-param>
+										<xsl:with-param name="p0"><xsl:value-of select="@description"/></xsl:with-param>
+									</xsl:call-template>
+								</td>
+							</tr>
+						</xsl:for-each>
+					</table>
+				<xsl:call-template name="bottom"/>
+			</body>
+		</html>
+	</xsl:template>
+</xsl:stylesheet>
+

Added: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/favicon.ico
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/favicon.ico?rev=423855&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/felix/trunk/org.apache.felix.mosgi.jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/xsl/favicon.ico
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message