1 13 21 package org.jahia.engines; 22 23 import java.util.Hashtable ; 24 25 26 public class EngineParams { 27 28 public static final String PARAM_TOKEN = "���"; 29 public static final String VALUE_TOKEN = "***"; 30 31 34 private Hashtable theParams = new Hashtable (); 35 36 37 40 public EngineParams (String paramStr) { 41 decomposeParams (paramStr); 42 } 44 45 48 private void decomposeParams (String tempStr) { 49 if (tempStr != null) { 50 String paramStr = tempStr; 51 int startpos = paramStr.indexOf (VALUE_TOKEN); 52 int endpos = -1; 53 while (startpos != -1) { 54 endpos = paramStr.indexOf (PARAM_TOKEN); 55 if (endpos == -1) { 56 endpos = paramStr.length (); 57 } 58 String keyStr = paramStr.substring (0, startpos); 59 String valStr = paramStr.substring (startpos + VALUE_TOKEN.length (), endpos); 60 if ((keyStr != "") && (valStr != "")) { 61 theParams.put (keyStr, valStr); 62 } 63 paramStr = paramStr.substring (endpos, paramStr.length ()); 64 startpos = paramStr.indexOf (VALUE_TOKEN); 65 } 66 } 67 } 69 70 73 public String getParameter (String keyStr) { 74 return (String ) theParams.get (keyStr); 75 } 77 78 } | Popular Tags |