/** * @param quid * @return "Start" if the service is stopped, "Stop" if the service is started and "" if the * service is not among the deployed ones. */ public static String displayQueryStatusAction(String quid) { String actionToReturn = "Stop"; if (quid == null || IndexOfQueries.getIndexOfQueries() == null || IndexOfQueries.getIndexOfQueries().getQueryDefinitionById(quid) == null) { actionToReturn = ""; } else { int currStatus = IndexOfQueries.getIndexOfQueries().getQueryDefinitionById(quid).getRunningStatus(); if (currStatus == QueryDefinition.STATUS_PAUSED) actionToReturn = "Start"; else if (currStatus == QueryDefinition.STATUS_RUNNING) actionToReturn = "Stop"; } return actionToReturn; }
/** * Method createFunctionInfoInDocument: * * @param document the desired MIME type representation for the query. * @param parElement the parent element in the given XML document * @param verboseflag sets whether we want to list the results info inside the XML or not at all. */ public void createInfoInDocument( SMOutputDocument document, SMOutputElement parElement, boolean verboseflag) { SMOutputElement tmpElementOuter = null; SMOutputElement tmpElement1; try { if (parElement != null) { tmpElementOuter = parElement.addElement(IndexOfQueries.getQueryDefTag()); } else { tmpElementOuter = document.addElement( IndexOfQueries.getQueryDefTag()); // special case for PublicResponseAggrMsg creation } tmpElement1 = tmpElementOuter.addElement(QueryDefinition.myQuidTag); tmpElement1.addCharacters(this.getuQid()); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.myFriendlyNameTag); tmpElement1.addCharacters(this.getFriendlyName()); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.mycreationTSTag); tmpElement1.addCharacters(Long.toString(this.getInitCreationTS())); if (this.getQContent() != null && !this.getQContent().isEmptyQueryContent()) { this.getQContent().createInfoInDocument(document, tmpElementOuter); } tmpElement1 = tmpElementOuter.addElement(QueryDefinition.periodTag); tmpElement1.addCharacters(Integer.toString(this.getDesiredPeriod())); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.historyTag); tmpElement1.addCharacters(Integer.toString(this.getDesiredHistory())); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.aggregateTag); tmpElement1.addCharacters(Boolean.toString(this.isAggregateQueryFlag())); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.continuationTag); tmpElement1.addCharacters(Boolean.toString(this.isContinuationEnabledFlag())); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.asynchronousTag); tmpElement1.addCharacters(Boolean.toString(this.isAsynchronousFlag())); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.dtnTag); tmpElement1.addCharacters(Boolean.toString(this.isDtnEnabledFlag())); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.securityTag); tmpElement1.addCharacters(Boolean.toString(this.isSecurityEnabledFlag())); tmpElement1 = tmpElementOuter.addElement(QueryDefinition.encryptionTag); tmpElement1.addCharacters(Boolean.toString(this.isEncryptionEnabledFlag())); if (verboseflag && this.getFilesVec() != null && this.getFilesVec().size() > 0) { for (int i = 0; i < this.getFilesVec().size(); i++) { this.getFilesVec() .elementAt(i) .createInfoInDocument(document, tmpElementOuter, false, false); } } } catch (Exception e) { return; } return; }