/**
  * @param counter
  * @param queryId can be null and then the id of the query will be set to the counter name
  * @param style
  */
 public SingleCounterQueryDef(ResourceId counter, String queryId, Style style) {
   super();
   // Add a timestamp resource and the counter resource to the query
   List<ResourceDef> listResources = new LinkedList<ResourceDef>();
   ResourceId ridTimestamp =
       new ResourceId(
           counter.getHostId(),
           counter.getAgentId(),
           counter.getEntityId(),
           CounterDescriptor.TIMESTAMP_ID);
   listResources.add(new ResourceDef(ridTimestamp));
   ResourceDef resourceDef;
   if (style == null) {
     resourceDef = new ResourceDef(counter);
     resourceDef.setIName("$counter");
   } else {
     resourceDef = new ResourceDef(counter, style.getStyleDef());
     if (Utils.isEmptyString(style.getIName())) {
       resourceDef.setIName(queryId);
     }
   }
   listResources.add(resourceDef);
   String counterName = counter.getCounterId().toString();
   // set up
   if (!Utils.isEmptyString(queryId)) {
     this.id = queryId;
   } else {
     this.id = counterName;
   }
   this.resources.addAll(listResources);
 }
 /**
  * NOTE: this method will change the context of the calling thread and the caller must insure that
  * prepareThreadOnExit(String) is invoked at the end of the operation.
  *
  * @param identifier plugin instance identifier
  * @param classToLoad the class to load
  * @param jars jars with entity code and resources; path relative to application.home property
  * @param pluginData
  * @return
  * @throws AppException
  * @throws ClassNotFoundException
  * @throws MalformedURLException
  * @throws URISyntaxException
  */
 public Class<?> getClass(
     String identifier, String classToLoad, String[] jars, PluginDescriptor pluginData)
     throws AppException, ClassNotFoundException, MalformedURLException, URISyntaxException {
   Class<?> clazz = null;
   String classpath = null;
   if (pluginData != null) {
     classpath = pluginData.getClasspath();
     if (classpath != null) {
       // if cutom classpath is specified, the jars are mandatory
       if (jars == null) {
         AppException e = new AppException("Code location information is missing");
         e.setIsInternalAppError();
         throw e;
       }
     }
   }
   if (jars != null) {
     List<String> pathList = new LinkedList<String>();
     for (int i = 0; i < jars.length; i++) {
       // now complete jars information
       pathList.add(Utils.getPath(jars[i]));
     }
     if (classpath != null) {
       pathList.add(classpath);
     }
     // check class loader id
     String classLoaderId = pluginData.getClassLoaderId();
     RegexClassLoader loader;
     if (Utils.isEmptyString(classLoaderId)) {
       loader =
           new RegexClassLoader(
               pathList.toArray(new String[pathList.size()]),
               pluginData.useParentLastClassloader());
     } else {
       // check if a classloader with the same id already created
       loader = fLoadersPerId.get(classLoaderId);
       String[] path = pathList.toArray(new String[pathList.size()]);
       if (loader == null) {
         // add it to the map
         loader = new RegexClassLoader(path, pluginData.useParentLastClassloader());
         fLoadersPerId.put(classLoaderId, loader);
       } else {
         // check for consistency: the classpath must be the same
         if (!loader.isCompatibleWithClasspath(path)) {
           throw new IncompatibleClassloaderError(
               classLoaderId,
               loader.getClasspathAsString(),
               RegexClassLoader.convertClasspathToString(path));
         }
       }
     }
     fLoadersPerExternalId.put(identifier, loader);
     prepareThreadOnEnter(identifier);
     clazz = Class.forName(classToLoad, true, loader);
   }
   if (clazz == null) {
     clazz = Class.forName(classToLoad);
   }
   return clazz;
 }
 /** @see com.ixora.common.xml.XMLExternalizable#fromXML(org.w3c.dom.Node) */
 public void fromXML(Node node) throws XMLException {
   Node n = XMLUtils.findChild(node, "class");
   if (n == null) {
     throw new XMLNodeMissing("class");
   }
   this.fBoardClass = XMLUtils.getText(n);
   n = XMLUtils.findChild(node, "counterFilterClass");
   if (n != null) {
     this.fBoardCounterFilterClass = XMLUtils.getText(n);
   }
   n = XMLUtils.findChild(node, "name");
   if (n == null) {
     throw new XMLNodeMissing("name");
   }
   this.fBoardName = XMLUtils.getText(n);
   n = XMLUtils.findChild(node, "viewName");
   if (n == null) {
     throw new XMLNodeMissing("viewName");
   }
   this.fViewName = XMLUtils.getText(n);
   n = XMLUtils.findChild(node, "component");
   if (n == null) {
     throw new XMLNodeMissing("component");
   }
   this.fBoardComponenName = XMLUtils.getText(n);
   n = XMLUtils.findChild(node, "icon");
   if (n == null) {
     throw new XMLNodeMissing("icon");
   }
   this.fBoardIcon = XMLUtils.getText(n);
   n = XMLUtils.findChild(node, "allowUserToCreateView");
   if (n != null) {
     fAllowUserToCreateView = Boolean.parseBoolean(XMLUtils.getText(n));
   } else { // default
     fAllowUserToCreateView = true;
   }
   n = XMLUtils.findChild(node, "preference");
   if (n == null) {
     throw new XMLNodeMissing("preference");
   }
   this.fPreferenceIndex = Integer.parseInt(XMLUtils.getText(n));
   n = XMLUtils.findChild(node, "samples");
   if (n != null) {
     List<Node> lst = XMLUtils.findChildren(n, "sample");
     if (lst != null) {
       this.fSamples = new LinkedList<DataViewBoardSampleData>();
       for (Node n1 : lst) {
         String fileName = XMLUtils.getText(n1);
         if (!Utils.isEmptyString(fileName)) {
           fSamples.add(new DataViewBoardSampleData(fileName));
         }
       }
     }
   }
 }
 private void handleChangeInLogNameTextField(Document document) {
   if (document == fTextFieldLogOne.getDocument()) {
     String txt = fTextFieldLogOne.getText().trim();
     if (!Utils.isEmptyString(txt)) {
       fLogOne = txt;
       fActionOk.setEnabled(true);
     } else {
       fActionOk.setEnabled(false);
     }
   }
 }
  /** @see com.ixora.rms.agents.impl.jmx.JMXAbstractAgent#getJMXConnectionURL() */
  protected String getJMXConnectionURL() {
    // pass credentials if present
    String username =
        fConfiguration.getAgentCustomConfiguration().getString(Configuration.USERNAME);
    if (!Utils.isEmptyString(username)) {
      String password =
          fConfiguration.getAgentCustomConfiguration().getString(Configuration.PASSWORD);
      if (password == null) {
        password = "";
      }
      String[] credentials = new String[] {username, password};
      fEnvMap.put(JMXConnector.CREDENTIALS, credentials);
    }

    return ((Configuration) this.fConfiguration.getCustom()).getString(Msg.JMX_CONNECTION_STRING);
  }