Package org.xmlBlaster.engine.runlevel

Examples of org.xmlBlaster.engine.runlevel.PluginConfig


   public void testPluginConfig() {
      String me = ME + "-testPluginConfig";
      try {
         log.info("start");
         PluginConfig config = new PluginConfig(this.glob, "queueJDBC", true, "org.xmlBlaster.util.queue.jdbc.JDBCQueueCommonTablePlugin");
         config.addAttribute("url", "jdbc:oracle:thin:@localhost:1521:noty");
         config.addAttribute("user", "joe");
         config.addAttribute("password", "secret");
         config.addAttribute("connectionBusyTimeout", "90000");
         config.addAttribute("maxWaitingThreads", "300");
         RunLevelAction action = new RunLevelAction(this.glob, "LOAD", 3, -1, ErrorCode.toErrorCode("internal.unknown"), 5);
         config.addAction(action);
         action = new RunLevelAction(this.glob, "STOP", -1, 2, null, 4);
         config.addAction(action);
    
         String xml = config.toXml();
         log.info(xml);
    
         PluginConfigSaxFactory factory = new PluginConfigSaxFactory(this.glob);
         config = factory.readObject(xml);
         RunLevelAction[] actions = config.getActions();
         assertEquals(me + " number of actions", 2, actions.length);
      }
      catch (XmlBlasterException e) {
         fail(ME + " failed: " + e.toString());
      }
View Full Code Here


      String xml = "<plugin id='FilePollerPlugin' className='org.xmlBlaster.client.filepoller.FilePollerPlugin'>\n" +
                   "  <attribute id='qosTest'>" + attrVal + "</attribute>\n" +
                   "  <action do='LOAD' onStartupRunlevel='9' sequence='6' onFail='resource.configuration.pluginFailed'/>\n" +
                   "  <action do='STOP' onShutdownRunlevel='6' sequence='5'/>\n" +
                   "</plugin>\n";
      PluginConfig config = factory.readObject(xml);
      Properties prop = config.getPluginInfo().getParameters();
      String txt = prop.getProperty("qosTest", null);
      if (txt == null) {
         prop.list(System.err);
         assertTrue("the qosTest is null when it should not", false);
      }
View Full Code Here

      try {
         log.info("start");

         PluginHolder holder = new PluginHolder(this.glob);
        
         PluginConfig tmp = new PluginConfig(this.glob, "queueJDBC", true, "org.xmlBlaster.util.queue.jdbc.JDBCQueueCommonTablePlugin");
         holder.addDefaultPluginConfig(tmp);
         tmp = new PluginConfig(this.glob, "queueRAM", true, "org.xmlBlaster.util.queue.ram.RAMQueuePlugin");
         holder.addPluginConfig("avalon", tmp);

         tmp = holder.getPluginConfig("avalon", "queueRAM");
         if (tmp == null) assertTrue(me + " getting 'avalon queueRAM'", false);
         log.info(tmp.toXml());

         tmp = holder.getPluginConfig("avalon", "queueJDBC");
         if (tmp == null) assertTrue(me + " getting 'avalon queueJDBC'", false);
         log.info(tmp.toXml());

         PluginConfig[] help = holder.getAllPluginConfig("avalon");
         assertEquals(me + " get all plugins for avalon", 2, help.length);


         String xml = new String();
         xml += "<xmlBlaster>\n" +
                "   <!-- A typical plugin which is loaded by client request -->\n" +
                "   <plugin id='dispatchPriority'\n" +
                "           className='org.xmlBlaster.util.dispatch.plugins.prio.PriorizedDispatchPlugin'\n" +
                "           jar='/tmp/my.jar'>\n" +
                "      <attribute id='config'>\n" +
                "         <![CDATA[\n" +
                "         <msgDispatch defaultStatus='64k' defaultAction='send'>\n" +
                "         <onStatus oid='_bandwidth.status' content='64k' defaultAction='destroy'>\n" +
                "            <action do='send'  ifPriority='7-9'/>\n" +
                "            <action do='queue'  ifPriority='2-6'/>\n" +
                "         </onStatus>\n" +
                "         <onStatus oid='_bandwidth.status' content='2M'>\n" +
                "            <action do='send'  ifPriority='0-9'/>\n" +
                "         </onStatus>\n" +
                "         </msgDispatch>\n" +
                "         ]]>\n" +
                "      </attribute>\n" +
                "   </plugin>\n" +
                "\n" +
                "   <plugin id='queueCACHE' className='org.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin'>\n" +
                "      <attribute id='transientQueue'>queueRAM</attribute>\n" +
                "      <attribute id='persistentQueue'>queueJDBC</attribute>\n" +
                "   </plugin>\n" +
                "   \n" +
                "  <plugin id='queueRAM' className='org.xmlBlaster.util.queue.ram.RamQueuePlugin'/>\n" +
                "\n" +
                "   <plugin id='storage:CACHE' className='org.xmlBlaster.engine.msgstore.cache.PersistenceCachePlugin'>\n" +
                "      <attribute id='transientQueue'>storage:RAM</attribute>\n" +
                "      <attribute id='persistentQueue'>storage:JDBC</attribute>\n" +
                "   </plugin>\n" +
                "   \n" +
                "   <plugin id='storage:RAM' className='org.xmlBlaster.engine.msgstore.ram.MapPlugin'/>\n" +
                "   \n" +
                "   <!-- and here the declarations which are specific to the given nodes -->\n" +
                "   <node id='heron'>\n" +
                "      <plugin id='protocol:SOCKET:admin' \n" +
                "              className='org.xmlBlaster.protocol.socket.SocketDriver'>\n" +
                "         <attribute id='port'>69000</attribute>\n" +
                "      </plugin>\n" +
                "     \n" +
                "      <!-- /node/heron/plugin/protocol:SOCKET:users/attribute/port=6901 -->\n" +
                "      <!-- /node/heron/plugin/protocol:SOCKET:users/action/LOAD/onStartupRunlevel=3 -->\n" +
                "      <!-- /node/heron/plugin/protocol:SOCKET:users/action/LOAD/sequence=5 -->\n" +
                "      <plugin id='protocol:SOCKET:users' className='org.xmlBlaster.protocol.socket.SocketDriver'>\n" +
                "         <attribute id='port'>6901</attribute>\n" +
                "         <action do='LOAD' onStartupRunlevel='3' sequence='5' onFail='resource.configuration.pluginFailed'/>\n" +
                "         <action do='STOP' onShutdownRunlevel='2' sequence='4'/>\n" +
                "      </plugin>\n" +
                "     \n" +
                "      <plugin id='queueJDBC' className='org.xmlBlaster.util.queue.jdbc.JDBCQueueCommonTablePlugin'>\n" +
                "         <attribute id='url'>jdbc:oracle:thin:@localhost:1521:noty</attribute>\n" +
                "         <attribute id='user'>joe</attribute>\n" +
                "         <attribute id='password'>secret</attribute>\n" +
                "         <attribute id='connectionBusyTimeout'>90000</attribute>\n" +
                "         <attribute id='maxWaitingThreads'>300</attribute>\n" +
                "      </plugin>\n" +
                "     \n" +
                "      <plugin id='storage:JDBC' className='org.xmlBlaster.engine.msgstore.cache.PersistenceCachePlugin'>\n" +
                "         <attribute id='url'>jdbc:oracle:thin:@localhost:1521:noty</attribute>\n" +
                "         <attribute id='user'>joe</attribute>\n" +
                "         <attribute id='password'>secret</attribute>\n" +
                "         <attribute id='connectionBusyTimeout'>90000</attribute>\n" +
                "         <attribute id='maxWaitingThreads'>300</attribute>\n" +
                "      </plugin>\n" +
                "    </node> <!-- heron -->\n" +
                " \n" +
                "    <node id='avalon'>\n" +
                "       ...\n" +
                "      <plugin id='queueJDBC' className='org.xmlBlaster.util.queue.jdbc.JDBCQueueCommonTablePlugin'>\n" +
                "         <attribute id='url'>jdbc:oracle:thin:@localhost:1521:noty</attribute>\n" +
                "         <attribute id='user'>joe</attribute>\n" +
                "         <attribute id='password'>secret</attribute>\n" +
                "         <attribute id='connectionBusyTimeout'>90000</attribute>\n" +
                "         <attribute id='maxWaitingThreads'>300</attribute>\n" +
                "        <attribute id='tableNamePrefix'>AVALON_</attribute>\n" +
                "      </plugin>\n" +
                "      ...\n" +
                "    </node>\n" +
                "</xmlBlaster>\n"

         PluginHolderSaxFactory factory = new PluginHolderSaxFactory(this.glob);
         PluginHolder pluginHolder = null;
         for (int i=0; i < 2; i++) {
            log.info("looping through the loop. sweep '" + i + "'");
            pluginHolder = factory.readObject(xml);
            PluginConfig[] plugins = pluginHolder.getAllPluginConfig("avalon");
            assertEquals(me + " number of plugins for 'avalon' in plugin holder", 6, plugins.length);

            PluginConfig pluginConfig = null;
            pluginConfig = pluginHolder.getPluginConfig("avalon","dispatchPriority");
            if (pluginConfig == null)
               assertTrue(me + " getting plugin 'dispatchPriority' for avalon gives null", false);
            String id = pluginConfig.getId();
            assertEquals(me + " id for avalon/dispatchPriority", "dispatchPriority", id);
            String className = pluginConfig.getClassName();
            assertEquals(me + " className for avalon/dispatchPriority", "org.xmlBlaster.util.dispatch.plugins.prio.PriorizedDispatchPlugin", className);

            pluginConfig = pluginHolder.getPluginConfig("avalon","queueCACHE");
            pluginConfig = pluginHolder.getPluginConfig("avalon","queueRAM");
            pluginConfig = pluginHolder.getPluginConfig("avalon","queueJDBC");
View Full Code Here

      log.info("start");

      PluginConfigComparator upComparator = new PluginConfigComparator(this.glob, true);
      PluginConfigComparator downComparator = new PluginConfigComparator(this.glob, false);

      PluginConfig config1 = new PluginConfig(this.glob, "test:PLUGIN1", true, "org.universe.Plugin1");
      RunLevelAction action = new RunLevelAction(this.glob, "LOAD", 3, -1, null, 5);
      config1.addAction(action);
      action = new RunLevelAction(this.glob, "STOP", -1, 2, null, 4);
      config1.addAction(action);
    
      PluginConfig config2 = new PluginConfig(this.glob, "test:PLUGIN2", true, "org.universe.Plugin2");
      action = new RunLevelAction(this.glob, "LOAD", 3, -1, null, 5);
      config2.addAction(action);
      action = new RunLevelAction(this.glob, "STOP", -1, 2, null, 4);
      config2.addAction(action);
    
      int cmp = upComparator.compare(config1, config2);
      assertTrue(me + " number of actions", cmp < 0);

      cmp = downComparator.compare(config1, config2);
      assertTrue(me + " number of actions", cmp > 0);

      PluginConfig config3 = new PluginConfig(this.glob, "test:PLUGIN3", true, "org.universe.Plugin3");
      action = new RunLevelAction(this.glob, "LOAD", 2, -1, null, 3);
      config3.addAction(action);
      action = new RunLevelAction(this.glob, "STOP", -1, 1, null, 3);
      config3.addAction(action);
      cmp = upComparator.compare(config1, config3);
      assertTrue(me + " number of actions", cmp > 0);
      cmp = downComparator.compare(config1, config3);
      assertTrue(me + " number of actions", cmp < 0);

      PluginConfig config4 = new PluginConfig(this.glob, "test:PLUGIN4", true, "org.universe.Plugin4");
      action = new RunLevelAction(this.glob, "LOAD", 2, -1, null, 4);
      config4.addAction(action);
      action = new RunLevelAction(this.glob, "STOP", -1, 1, null, 4);
      config4.addAction(action);
      cmp = upComparator.compare(config3, config4);
      assertTrue(me + " number of actions", cmp < 0);
      cmp = downComparator.compare(config3, config4);
      assertTrue(me + " number of actions", cmp < 0);
View Full Code Here

    * @param pluginInfo
    * @return
    */
   private PluginInfo checkPluginInfoInRunLevelInfos(PluginInfo pluginInfo) throws XmlBlasterException {
      if (this.glob.isServerSide() && this.glob instanceof ServerScope) {
         PluginConfig config = ((ServerScope)this.glob).getPluginHolder().getPluginConfig(this.glob.getStrippedId(), pluginInfo.getId());
         if (config == null) // normally it is stored as Type without the version information.
            config = ((ServerScope)this.glob).getPluginHolder().getPluginConfig(this.glob.getStrippedId(), pluginInfo.getType());
         if (config == null)
            return pluginInfo;
         PluginInfo runLevelPluginInfo = config.getPluginInfo();
         if (runLevelPluginInfo == null || runLevelPluginInfo == pluginInfo)
            return pluginInfo;
         if (pluginInfo.getParameters() == null || pluginInfo.getParameters().size() < 1)
            return runLevelPluginInfo;
         if (pluginInfo.getParameters() == runLevelPluginInfo.getParameters())
View Full Code Here

TOP

Related Classes of org.xmlBlaster.engine.runlevel.PluginConfig

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.