Package mx4j.tools.adaptor.http

Examples of mx4j.tools.adaptor.http.HttpAdaptor


     
      int port = getInt("port", 9999);
      String host = get("host", "0.0.0.0");
      String adaptorName = get("adaptorName", "HttpAdaptorMX4J");
      MBeanServer server = global.getJmxWrapper().getMBeanServer();
      HttpAdaptor adapter = new HttpAdaptor();
      this.name = new ObjectName("Adaptor:name=" + adaptorName);
      server.registerMBean(adapter, name);
      adapter.setHost(host);
      adapter.setPort(port);
      this.authMethod = get("authenticationMethod", null);
      log.info("Authentication Method is '" + this.authMethod + "'");
      if (this.authMethod != null) {
         this.authMethod = this.authMethod.trim();
         if ("basic".equals(this.authMethod))
            adapter.setAuthenticationMethod(this.authMethod);
         else
            log.warning("Authentication method '" + authMethod + "' not recognized, will switch to 'basic'");
         log.info("Authentication Method is '" + this.authMethod + "'");
         Map users = InfoHelper.getPropertiesStartingWith("replication.monitor.user.", this, null);
         if (users != null && users.size() > 0) {
            Iterator iter = users.entrySet().iterator();
            while (iter.hasNext()) {
               Map.Entry entry = (Map.Entry)iter.next();
               String name = (String)entry.getKey();
               String val = (String)entry.getValue();
               log.fine("name='" + name + "' value='" + val + "'");
               int pos = val.indexOf(':');
               String pwd = null;
               String roles = USER_ROLE;
               if (pos > -1) {
                  pwd = val.substring(0, pos);
                  roles = val.substring(pos+1);
               }
               else
                  pwd = val;
               log.fine("registering monitor user '" + name + "' having roles : " + roles + "'");
               adapter.addAuthorization(name, pwd);
               this.roles.put(name, roles);
            }
         }
         else
            log.info("No Users found for the monitor");
      }
     
      String xsltProcessor = get("xsltProcessor", null);
      ObjectName processorName = null;
      if (xsltProcessor != null) {

         ContextNode contextNode = new ContextNode(ContextNode.CONTRIB_MARKER_TAG, "jmx" + ContextNode.SEP + xsltProcessor,
               this.global.getContextNode());
         processorName = new ObjectName(JmxWrapper.getObjectNameLiteral(this.global, contextNode));
        
         // XSLTProcessor processor = new XSLTProcessor();
         ContribXsltProcessor processor = new ContribXsltProcessor(this.roles, this.authMethod);
        
         server.registerMBean(processor, processorName);
        
         // set it to use a dir
         String xsltPath = get("xsltPath", null); // can be a directory or a jar file
         String xsltPathInJar = null;

         if (xsltPath != null) {
            processor.setFile(xsltPath);
         }
         boolean xsltCache = getBoolean("xsltCache", true);
         processor.setUseCache(xsltCache);
         // set not to use cache
         String xsltLocale = get("xsltLocale", null);
         if (xsltLocale != null) {
         }
         // adds a mime type
         // server.invoke(processorName, "addMimeType", new Object[] {".pdf", "application/pdf"}, new String[] {"java.lang.String", "java.lang.String"});
         log.info("Xslt Processor: " + xsltProcessor + "' on xsltPath='" + xsltPath + "' and xsltPathInJar='" + xsltPathInJar + "' and xsltCache='" + xsltCache + "' and xsltLocale='" + xsltLocale + "'");
         adapter.setProcessorName(processorName);
      }
     
      adapter.start();
      log.info("The adaptor '" + adaptorName + "' is running. You can access it at 'http://" + host + ":" + port + "'");
      return adapter;
   }
View Full Code Here


    protected HttpAdaptor createAdaptor() throws Exception
    {
        Log.redirectTo(new CommonsLogger());
        URI uri = new URI(StringUtils.stripToEmpty(jmxAdaptorUrl));
        adaptor = new HttpAdaptor(uri.getPort(), uri.getHost());

        // Set the XSLT Processor with any local overrides
        XSLTProcessor processor;
        try
        {
View Full Code Here

{
    public void testRedeploy() throws Exception
    {
        final String name = jmxSupport.getDomainName(muleContext) +
                            ":" + Mx4jAgent.HTTP_ADAPTER_OBJECT_NAME;
        mBeanServer.registerMBean(new HttpAdaptor(), jmxSupport.getObjectName(name));

        Mx4jAgent agent = new Mx4jAgent();
        agent.setMuleContext(muleContext);
        agent.initialise();
    }
View Full Code Here

        && adapter.getPort() == port) {
        return;
      }
      Log.redirectTo(new MX4JLoggerMonolog(logger));
      MBeanServer server = adminAtt.getRawMBeanServer();
      adapter = new HttpAdaptor();
      server.registerMBean(adapter, getObjectName());

      XSLTProcessor processor = new XSLTProcessor();
      processor.setPathInJar("org/objectweb/speedo/jmx/xsl");
      processor.setUseCache(false);
View Full Code Here

    protected HttpAdaptor createAdaptor() throws Exception
    {
        Log.redirectTo(new CommonsLogger());
        URI uri = new URI(StringUtils.stripToEmpty(jmxAdaptorUrl));
        adaptor = new HttpAdaptor(uri.getPort(), uri.getHost());

        // Set the XSLT Processor with any local overrides
        XSLTProcessor processor;
        try
        {
View Full Code Here

    @Test
    public void testRedeploy() throws Exception
    {
        final String name = jmxSupport.getDomainName(muleContext) +
                            ":" + Mx4jAgent.HTTP_ADAPTER_OBJECT_NAME;
        mBeanServer.registerMBean(new HttpAdaptor(), jmxSupport.getObjectName(name));

        Mx4jAgent agent = new Mx4jAgent();
        agent.setMuleContext(muleContext);
        agent.initialise();
    }
View Full Code Here

TOP

Related Classes of mx4j.tools.adaptor.http.HttpAdaptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.