public String transform(String message) { String rv = message; try { log.debug("in=" + message); // decode the message org.jengine.tools.hl7.Message msg = org.jengine.tools.hl7.Message.read(new java.io.StringReader(message)); // pass the decoded message to beanshell interpreter.eval("org.jengine.tools.hl7.Message message"); interpreter.set("message", msg); // pass the logging category to beanshell interpreter.eval("org.apache.log4j.Category log"); interpreter.set("log", log); // call the script interpreter.eval(script); // encode the possibly modified message java.io.StringWriter sw = new java.io.StringWriter(); msg.write(sw); rv = sw.toString(); log.debug("out=" + rv); } catch (Exception e) { log.error("Problem processing transformation", e); } return rv; }
/** See if the data was correctly added. */ public void verifyDataTest() { int iCount = 0; cat.debug("Count records.\n"); try { // testTable.setKeyArea(Constants.MAIN_KEY_AREA); iCount = 0; testTable.close(); while (testTable.hasNext()) { testTable.next(); cat.debug(record.toString()); iCount++; this.verifyRecord(record, iCount); assertTrue(((Integer) record.getField(0).getData()).intValue() == iCount); } } catch (Exception e) { fail("Record count error"); } assertTrue(iCount == 6); cat.debug("Count records backwards.\n"); iCount = 6; try { // testTable.setKeyArea(Constants.MAIN_KEY_AREA); testTable.close(); while (testTable.hasPrevious()) { testTable.previous(); this.verifyRecord(record, iCount); cat.debug(record.toString()); assertTrue(((Integer) record.getField(0).getData()).intValue() == iCount); iCount--; } } catch (Exception e) { fail("Record count error"); } // assertTrue(iCount == 0); cat.debug("Seek records.\n"); iCount = 1; try { // testTable.setKeyArea(Constants.MAIN_KEY_AREA); while (iCount < 10) { record.getField(0).setData(new Integer(iCount)); boolean bSuccess = testTable.seek("="); if (bSuccess) { assertTrue(iCount <= 6); this.verifyRecord(record, iCount); cat.debug(record.toString()); assertTrue(((Integer) record.getField(0).getData()).intValue() == iCount); } else { cat.debug("" + iCount); cat.debug(record.toString()); assertTrue(iCount > 6); } iCount++; } } catch (Exception e) { fail("Record count error"); } }
/** * Executes this field expression. * * @param context AspContext under which to evaluate the expression. * @return return value of this expression * @throws AspException If an error occurs * @see Node#execute(AspContext) */ public Object execute(AspContext context) throws AspException { if (DBG.isDebugEnabled()) DBG.debug("execute"); Object value = expr.execute(context); while (value instanceof SimpleReference && !(value instanceof ObjectNode)) { if (DBG.isDebugEnabled()) DBG.debug("De-referencing " + value); value = ((SimpleReference) value).getValue(); } if (value instanceof ObjectNode) { ObjectNode obj = (ObjectNode) value; if (DBG.isDebugEnabled()) DBG.debug("Get field of " + ident + " from " + obj); return Types.coerceToNode(obj.getField(ident)); } else { throw new AspException("Invalid class for field get: " + value.getClass().getName()); } }
@Override public LinkedList<ShawnResult> runCommand(String cmd, String params) { String cmdLine = toCommandLine(cmd, params); storeCommandInHistory(cmdLine); log.debug("Sending line to shawn: " + cmdLine); return new LinkedList<ShawnResult>(); }
/** * This method returns all attributes of a given Classifier, including inherited * * @param classifier the classifier you want to have the attributes for * @return a collection of the attributes */ public Collection getAttributesInh(MClassifier classifier) { Collection result = new ArrayList(); result.addAll(getAttributes(classifier)); Iterator parents = classifier.getParents().iterator(); while (parents.hasNext()) { MClassifier parent = (MClassifier) parents.next(); cat.debug("Adding attributes for: " + parent); result.addAll(getAttributesInh(parent)); } return result; }
/** * Description of the Method * * @return Description of the Return Value */ public static synchronized BasicResidueData instance() { if (residueData == null) { if (logger.isDebugEnabled()) { logger.debug("Getting " + BasicResidueData.class.getName() + " instance."); } residueData = new BasicResidueData(); } return residueData; }
public synchronized String getNewUUID() { UID uid = new UID(); String s = ""; if (_address != null) { byte[] b = _address.getAddress(); for (int i = 0; i < b.length; i++) s += (new Byte(b[i])).longValue() + "-"; } s += uid.toString(); cat.debug("new UUID: " + s); return s; }
public static synchronized IdentifierExpertSystem instance() { if (chemistryKernel == null) { if (logger.isDebugEnabled()) { logger.debug("Getting " + IdentifierExpertSystem.class.getName() + " instance."); } chemistryKernel = new IdentifierExpertSystem(); } return chemistryKernel; }
public LogP() { if (logger.isDebugEnabled()) { logger.debug("Initialize " + this.getClass().getName()); } descInfo = FeatureHelper.generateFeatureInfo( this.getClass(), BasicFeatureInfo.TYPE_NO_COORDINATES, null, "joelib2.feature.result.DoubleResult"); }
public void testBookmarks() { boolean bSuccess = false; int iCount = 0; cat.debug("Now, Test the bookmark properties.\n"); cat.debug("First, read through the file using the non unique key and get a bookmark.\n"); Object bookmark = null; cat.debug("Read through the first copy\n"); try { // testTable.setKeyArea(Constants.MAIN_KEY_AREA); iCount = 0; testTable.close(); while (testTable.hasNext()) { testTable.next(); iCount++; } } catch (Exception e) { cat.debug("Error reading through file: Error" + e.getMessage() + "\n"); fail("Error reading through file"); } cat.debug("Primary Count: " + iCount + "\n"); cat.debug("Read through the first copy using hasNext\n"); try { testTable.close(); // testTable.setKeyArea(Constants.MAIN_KEY_AREA); iCount = 0; while (testTable.hasNext()) { testTable.next(); iCount++; cat.debug(testTable); } } catch (Exception e) { cat.debug("Error reading through file: Error" + e.getMessage() + "\n"); } cat.debug("Has Next Primary Count: " + iCount + "\n"); cat.debug("Test complete.\n"); }
/** * this method finds all paramters of the given operation which have the MParamterDirectionType * RETURN. If it is only one, it is returned. In case there are no return parameters, null is * returned. If there is more than one return paramter, first of them is returned, but a message * is written to System.out * * @param operation the operation you want to find the return parameter for * @return If this operation has only one paramter with Kind: RETURN, this is it, otherwise null */ public MParameter getReturnParameter(MOperation operation) { Vector returnParams = new Vector(); MParameter firstReturnParameter = null; Iterator params = operation.getParameters().iterator(); while (params.hasNext()) { MParameter parameter = (MParameter) params.next(); if ((parameter.getKind()).equals(MParameterDirectionKind.RETURN)) { returnParams.add(parameter); } } switch (returnParams.size()) { case 1: return (MParameter) returnParams.elementAt(0); case 0: cat.debug("No ReturnParameter found!"); return null; default: cat.debug("More than one ReturnParameter found, returning first!"); return (MParameter) returnParams.elementAt(0); } }
public static IShawnProcess create() throws Exception { log.debug("Creating shawn instance with default values"); IShawnProcess s = null; if (defaultValues.isDryRun()) { log.info("Creating dry run shawn instance"); s = new DryRunShawnProcess(); } else { log.info("Creating local process shawn instance"); s = new ShawnProcess(defaultValues.getShawnExecutable(), defaultValues.getWorkDir()); } shawns.add(s); return s; }
/** Process the start tag */ public int doStartTag() throws javax.servlet.jsp.JspException { // Look up the requested property value if (name != null) { Object beanValue = RequestUtils.lookup(pageContext, name, property, scope); if (cat.isDebugEnabled()) cat.debug("Value is : '" + beanValue + "'"); if (beanValue == null) return (EVAL_BODY_TAG); // set the property as value setValue(beanValue.toString()); } // Continue processing this page return (EVAL_BODY_TAG); }
public void addHardCodedKernel(IdentifierHardDependencies hardCodedKernel) { String kernelString = hardCodedKernel.getClass().getName() + " " + hardCodedKernel.getVendorInternal() + " " + hardCodedKernel.getReleaseVersionInternal() + " " + hardCodedKernel.getReleaseDateInternal(); if (logger.isDebugEnabled()) { logger.debug("hard dependencies: " + kernelString); } hardInfos.put(CML_HARD_KERNEL + ":" + hardCodedKernel.getClass().getName(), kernelString); }
public String doPost() throws Exception { TEMPLATE_NAME = "login.vm"; try { TEMPLATE_NAME = handleLogin(); } catch (Exception e) { log.debug(e); HttpSession session = request.getSession(); int loginFailureCount = getLoginFailureCount(session); session.setAttribute(ClientConstants.loginFailureCount, loginFailureCount + 1); if (loginFailureCount > 2) { ctx.put("showCaptcha", "yes"); } ctx.put(ClientConstants.errorTextVariableName + "-signin", e.getMessage()); TEMPLATE_NAME = "login.vm"; } return TEMPLATE_NAME; }
public String doGet() throws Exception { TEMPLATE_NAME = "login.vm"; HttpSession session = request.getSession(); int loginFailureCount = getLoginFailureCount(session); if (loginFailureCount > 2) { ctx.put("showCaptcha", "yes"); } if (session.getAttribute("userName") != null) { try { redirectToURL(request, response, ClientConstants.servletPageWithDefaultAction); } catch (IOException e) { log.debug(e); } } return TEMPLATE_NAME; }
public void addSoftCodedKernel(IdentifierSoftDependencies softCodedKernel) { String kernelString = softCodedKernel.getClass().getName() + " " + softCodedKernel.getVendorExternal() + " " + softCodedKernel.getResourceExternal() + " " + softCodedKernel.getReleaseVersionExternal() + " " + softCodedKernel.getReleaseDateExternal(); if (logger.isDebugEnabled()) { logger.debug("soft dependencies : " + kernelString); } softInfos.put(CML_SOFT_KERNEL + ":" + softCodedKernel.getClass().getName(), kernelString); }
public static void main(String[] args) { // Ensure to have all necessary drivers installed ! try { Driver d = (Driver) (Class.forName("oracle.jdbc.driver.OracleDriver").newInstance()); DriverManager.registerDriver(d); } catch (Exception e) { } // Set the priority which messages have to be logged cat.setPriority(Priority.INFO); // Configuration with configuration-file PropertyConfigurator.configure("log4jtestprops.txt"); // These messages with Priority >= setted priority will be logged to the database. cat.debug("debug"); // this not, because Priority DEBUG is less than INFO cat.info("info"); cat.error("error"); cat.fatal("fatal"); }
/** * Method engineResolvePublicKey * * @param element * @param BaseURI * @param storage * @return null if no {@link PublicKey} could be obtained * @throws KeyResolverException */ public PublicKey engineResolvePublicKey(Element element, String BaseURI, StorageResolver storage) throws KeyResolverException { if (this._rsaKeyElement == null) { boolean weCanResolve = this.engineCanResolve(element, BaseURI, storage); if (!weCanResolve || (this._rsaKeyElement == null)) { return null; } } try { RSAKeyValue rsaKeyValue = new RSAKeyValue(this._rsaKeyElement, BaseURI); return rsaKeyValue.getPublicKey(); } catch (XMLSecurityException ex) { cat.debug("XMLSecurityException", ex); } return null; }
public synchronized void createModelUUIDS(MNamespace model) { cat.info("NOTE: The temporary method 'createModelUUIDs' has been called."); Collection ownedElements = model.getOwnedElements(); Iterator oeIterator = ownedElements.iterator(); String uuid = model.getUUID(); if (uuid == null) model.setUUID(getNewUUID()); while (oeIterator.hasNext()) { MModelElement me = (MModelElement) oeIterator.next(); if (me instanceof MModel || // me instanceof MNamespace || me instanceof MClassifier || me instanceof MFeature || me instanceof MStateVertex || me instanceof MStateMachine || me instanceof MTransition || me instanceof MCollaboration || me instanceof MMessage || me instanceof MAssociation || me instanceof MAssociationEnd || me instanceof MGeneralization || me instanceof MDependency || me instanceof MStereotype || me instanceof MUseCase) { uuid = me.getUUID(); if (uuid == null) { me.setUUID(getNewUUID()); } } // recursive handling of namespaces, needed for Collaborations if (me instanceof MNamespace) { cat.debug("Found another namespace: " + me); createModelUUIDS((MNamespace) me); } } }
/** * Method engineCanResolve * * @param element * @param BaseURI * @param storage * @return */ public boolean engineCanResolve(Element element, String BaseURI, StorageResolver storage) { cat.debug("Can I resolve " + element.getTagName()); if (element == null) { return false; } boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE); boolean isRSAKeyValue = XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_RSAKEYVALUE); if (isKeyValue) { try { Element nscontext = XMLUtils.createDSctx(element.getOwnerDocument(), "ds", Constants.SignatureSpecNS); this._rsaKeyElement = (Element) XPathAPI.selectSingleNode(element, "./ds:" + Constants._TAG_RSAKEYVALUE, nscontext); if (this._rsaKeyElement != null) { return true; } } catch (TransformerException ex) { } } else if (isRSAKeyValue) { // this trick is needed to allow the RetrievalMethodResolver to eat a // ds:RSAKeyValue directly (without KeyValue) this._rsaKeyElement = element; return true; } return false; }
public void ejbPassivate() { log.debug("ejbPassivate"); }
public void ejbActivate() { log.debug("ejbActivate"); }
public void unsetSessionContext() { sessionCtx = null; log.debug("unsetSessionContext"); }
public void setSessionContext(SessionContext context) { sessionCtx = context; log.debug("setSessionContext"); }
public void ejbStore() { log.debug("ejbStore"); }
public void ejbRemove() { log.debug("ejbRemove"); }
public void ejbLoad() { log.debug("ejbLoad"); }
public void ejbCreate() { log.debug("ejbCreate: "); }
public void testSecondary() { boolean bSuccess = false; int iCount = 0; cat.debug("Now, let's seek a record in the SecondaryKey. (Not unique)\n"); try { // testTable.setKeyArea("TestKey"); testTable.addNew(); record.getField("TestKey").setString("B"); bSuccess = testTable.seek("="); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek secondary"); } if (bSuccess) { if ((record.getField("ID").getString().equals("2")) || (record.getField("ID").getString().equals("4")) || (record.getField("ID").getString().equals("5"))) { cat.debug("Good, found first key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error wrong key found"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error not found"); } cat.debug("Now, let's seek a record in the SecondaryKey that doesn't exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("X"); bSuccess = testTable.seek("="); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { cat.debug("Error, found key\n"); cat.debug(record.toString()); fail("Error on seek"); } else { cat.debug("Good, not found\n"); cat.debug(record.toString()); } cat.debug("Now, let's seek a the next >= record that does exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("B"); bSuccess = testTable.seek(">="); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { if ((record.getField("ID").getString().equals("2")) || (record.getField("ID").getString().equals("4")) || (record.getField("ID").getString().equals("5"))) { cat.debug("Success, found key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error on seek"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error on seek"); } cat.debug("Now, let's seek a the next >= record that doesn't exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("C"); bSuccess = testTable.seek(">="); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { if (record.getField("ID").getString().equals("6")) { cat.debug("Success, found key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error found wrong key"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error, not found"); } cat.debug("Now, let's seek a the next > record that does exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("B"); bSuccess = testTable.seek(">"); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { if (record.getField("ID").getString().equals("6")) { cat.debug("Success, found key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error, found wrong key"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error, not found"); } cat.debug("Now, let's seek a the next > record that doesn't exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("C"); bSuccess = testTable.seek(">"); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { if (record.getField("ID").getString().equals("6")) { cat.debug("Success, found key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error on seek"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error on seek"); } cat.debug("Now, let's seek a the next < record that does exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("B"); bSuccess = testTable.seek("<"); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { if (record.getField("ID").getString().equals("1")) { cat.debug("Success, found key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error on seek"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error on seek"); } cat.debug("Now, let's seek a the next < record that doesn't exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("C"); bSuccess = testTable.seek("<"); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { if (record.getField("ID").getString().equals("5")) { cat.debug("Success, found key\n"); cat.debug(record.toString()); } else if (record.getField("ID").getString().equals("1")) { cat.debug("Alternate Success, found key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error on seek"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error on seek"); } cat.debug("Now, let's seek a the next <= record that does exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("B"); bSuccess = testTable.seek("<="); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { if (record.getField("ID").getString().equals("2")) { cat.debug("Success, found key\n"); cat.debug(record.toString()); } else if (record.getField("ID").getString().equals("1")) { cat.debug("Alternate Success, found key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error on seek"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error on seek"); } cat.debug("Now, let's seek a the next <= record that doesn't exist\n"); try { testTable.addNew(); record.getField("TestKey").setString("C"); bSuccess = testTable.seek("<="); } catch (Exception e) { cat.debug("Error: " + e.getMessage() + "\n"); cat.debug(record.toString()); fail("Error on seek"); } if (bSuccess) { if (record.getField("ID").getString().equals("5")) { cat.debug("Success, found key\n"); cat.debug(record.toString()); } else if (record.getField("ID").getString().equals("1")) { cat.debug("Alternate Success, found key\n"); cat.debug(record.toString()); } else { cat.debug("Error, found wrong key\n"); cat.debug(record.toString()); fail("Error on seek"); } } else { cat.debug("Error, not found\n"); cat.debug(record.toString()); fail("Error on seek"); } }