Examples of StringTokenizer


Examples of java.util.StringTokenizer

   */
  public static Properties parseAttributes(String string) {
    Properties result = new Properties();
    if (string == null)
      return result;
    StringTokenizer keyValuePairs = new StringTokenizer(string, ";");
    StringTokenizer keyValuePair;
    String key;
    String value;
    while (keyValuePairs.hasMoreTokens()) {
      keyValuePair = new StringTokenizer(keyValuePairs.nextToken(), ":");
      if (keyValuePair.hasMoreTokens())
        key = keyValuePair.nextToken().trim();
      else
        continue;
      if (keyValuePair.hasMoreTokens())
        value = keyValuePair.nextToken().trim();
      else
        continue;
      if (value.startsWith("\""))
        value = value.substring(1);
      if (value.endsWith("\""))
View Full Code Here

Examples of java.util.StringTokenizer

  public static synchronized void addInterceptors(String listInterceptorClassName, List interceptors) throws Exception {
    if (listInterceptorClassName != null && interceptors != null) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "addInterceptors(" + listInterceptorClassName + ", " + interceptors + ')');
      String error = null;
      StringTokenizer token = new StringTokenizer(listInterceptorClassName, INTERCEPTOR_CLASS_NAME_SEPARATOR);
      while (token.hasMoreTokens()) {
        String interceptorClassName = token.nextToken();
        try {
          interceptors.add((MessageInterceptor)Class.forName(interceptorClassName).newInstance());
        } catch(Throwable t) {
          if (logger.isLoggable(BasicLevel.WARN))
            logger.log(BasicLevel.WARN, "addInterceptors", t);
View Full Code Here

Examples of java.util.StringTokenizer

  public static synchronized void removeInterceptors(String listInterceptorClassName, List interceptors) throws Exception {
    if (listInterceptorClassName != null && interceptors != null) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "removeInterceptors(" + listInterceptorClassName + ", " + interceptors + ')');
      String error = null;
      StringTokenizer token = new StringTokenizer(listInterceptorClassName, INTERCEPTOR_CLASS_NAME_SEPARATOR);
      while (token.hasMoreTokens()) {
        String interceptorClassName = token.nextToken();
        try {
          removeInterceptor(interceptorClassName, interceptors);
        } catch(Throwable t) {
          if (logger.isLoggable(BasicLevel.WARN))
            logger.log(BasicLevel.WARN, "removeInterceptors", t);
View Full Code Here

Examples of java.util.StringTokenizer

  public final String getOptions() {
    return options;
  }
  public final void setOptions(String options) {
    this.options = options;
    StringTokenizer st = new StringTokenizer(options, ";");
    while(st.hasMoreElements()){
      String tk = st.nextToken();
      if("bookmark".equalsIgnoreCase(tk))
        this.setBookmark(1);
      else if("elite".equalsIgnoreCase(tk))
        this.setElite(1);
      else if("top".equalsIgnoreCase(tk))
View Full Code Here

Examples of java.util.StringTokenizer

   * @return
   */
  public List list_songs(String mids){
    if(mids == null)
      return null;
    StringTokenizer st = new StringTokenizer(mids,",");
    List ids = new ArrayList();
    while(st.hasMoreElements()){
      String sid = st.nextToken();
      try{
        ids.add(new Integer(sid));
      }catch(Exception e){}
    }
    return MusicDAO.listSongs(ids);
View Full Code Here

Examples of java.util.StringTokenizer

   * path="/images/test.gif" <br />
   * context="/test/index.html"<br />
   * result="../images/test.gif"
   */
  private String localizePath(String path, String context) {
    StringTokenizer st = new StringTokenizer(context,"/");
    int depth = st.countTokens();
    if (! context.endsWith("/")) {
      depth--;
    }     

    StringBuffer sb = new StringBuffer();
View Full Code Here

Examples of java.util.StringTokenizer

    public IPathElement getChildElement(String name) {
        return getNode(name);
    }

    public INode getSubnode(String name) {
        StringTokenizer st = new StringTokenizer(name, "/");
        TransientNode retval = this;
        TransientNode runner;

        while (st.hasMoreTokens() && (retval != null)) {
            runner = retval;

            String next = st.nextToken().trim().toLowerCase();

            if ("".equals(next)) {
                retval = this;
            } else {
                retval = (runner.nodeMap == null) ? null
View Full Code Here

Examples of java.util.StringTokenizer

   * @return An array of substrings of the given text
   */
  protected String[] parts( String text, String delimiters, boolean all )
  {
    ArrayList result          = null ;
    StringTokenizer tokenizer = null ;

    if ( text == null )
      return null ;

    if ( ( delimiters == null ) || ( delimiters.length() == 0 ) )
    {
      String[] resultArray = { text } ;
      return resultArray ;
    }

    if ( text.length() == 0 )
    {
      return new String[0] ;
    }
    else
    {
      result = new ArrayList() ;
      tokenizer = new StringTokenizer( text, delimiters, all ) ;

      if ( all )
        this.collectParts( result, tokenizer, delimiters ) ;
      else
        this.collectParts( result, tokenizer ) ;
View Full Code Here

Examples of java.util.StringTokenizer

            OMElement timeoutCodes = markAsTimedOut.getFirstChildWithName(new QName(
                SynapseConstants.SYNAPSE_NAMESPACE,
                XMLConfigConstants.ERROR_CODES));
            if (timeoutCodes != null && timeoutCodes.getText() != null) {
                StringTokenizer st = new StringTokenizer(timeoutCodes.getText().trim(), ", ");
                while (st.hasMoreTokens()) {
                    String s = st.nextToken();
                    try {
                        definition.addTimeoutErrorCode(Integer.parseInt(s));
                    } catch (NumberFormatException e) {
                        handleException("The timeout error codes should be specified " +
                            "as valid numbers separated by commas : " + timeoutCodes.getText(), e);
                    }
                }
            }

            OMElement retriesBeforeSuspend = markAsTimedOut.getFirstChildWithName(new QName(
                SynapseConstants.SYNAPSE_NAMESPACE,
                XMLConfigConstants.RETRIES_BEFORE_SUSPENSION));
            if (retriesBeforeSuspend != null && retriesBeforeSuspend.getText() != null) {
                try {
                    definition.setRetriesOnTimeoutBeforeSuspend(
                        Integer.parseInt(retriesBeforeSuspend.getText().trim()));
                } catch (NumberFormatException e) {
                    handleException("The retries before suspend [for timeouts] should be " +
                        "specified as a valid number : " + retriesBeforeSuspend.getText(), e);
                }
            }

            OMElement retryDelay = markAsTimedOut.getFirstChildWithName(new QName(
                SynapseConstants.SYNAPSE_NAMESPACE,
                XMLConfigConstants.RETRY_DELAY));
            if (retryDelay != null && retryDelay.getText() != null) {
                try {
                    definition.setRetryDurationOnTimeout(
                        Integer.parseInt(retryDelay.getText().trim()));
                } catch (NumberFormatException e) {
                    handleException("The retry delay for timeouts should be specified " +
                        "as a valid number : " + retryDelay.getText(), e);
                }
            }
        }

        // support backwards compatibility with Synapse 1.2 - for suspendDurationOnFailure
        OMElement suspendDurationOnFailure = elem.getFirstChildWithName(new QName(
            SynapseConstants.SYNAPSE_NAMESPACE, "suspendDurationOnFailure"));
        if (suspendDurationOnFailure != null && suspendDurationOnFailure.getText() != null) {

            log.warn("Configuration uses deprecated style for endpoint 'suspendDurationOnFailure'");
            try {
                definition.setInitialSuspendDuration(
                        1000 * Long.parseLong(suspendDurationOnFailure.getText().trim()));
                definition.setSuspendProgressionFactor((float) 1.0);
            } catch (NumberFormatException e) {
                handleException("The initial suspend duration should be specified " +
                    "as a valid number : " + suspendDurationOnFailure.getText(), e);
            }
        }

        OMElement suspendOnFailure = elem.getFirstChildWithName(new QName(
            SynapseConstants.SYNAPSE_NAMESPACE,
            XMLConfigConstants.SUSPEND_ON_FAILURE));

        if (suspendOnFailure != null) {

            OMElement suspendCodes = suspendOnFailure.getFirstChildWithName(new QName(
                SynapseConstants.SYNAPSE_NAMESPACE,
                XMLConfigConstants.ERROR_CODES));
            if (suspendCodes != null && suspendCodes.getText() != null) {

                StringTokenizer st = new StringTokenizer(suspendCodes.getText().trim(), ", ");
                while (st.hasMoreTokens()) {
                    String s = st.nextToken();
                    try {
                        definition.addSuspendErrorCode(Integer.parseInt(s));
                    } catch (NumberFormatException e) {
                        handleException("The suspend error codes should be specified " +
                            "as valid numbers separated by commas : " + suspendCodes.getText(), e);
                    }
                }
            }

            OMElement initialDuration = suspendOnFailure.getFirstChildWithName(new QName(
                SynapseConstants.SYNAPSE_NAMESPACE,
                XMLConfigConstants.SUSPEND_INITIAL_DURATION));
            if (initialDuration != null && initialDuration.getText() != null) {
                try {
                    definition.setInitialSuspendDuration(
                        Integer.parseInt(initialDuration.getText().trim()));
                } catch (NumberFormatException e) {
                    handleException("The initial suspend duration should be specified " +
                        "as a valid number : " + initialDuration.getText(), e);
                }
            }

            OMElement progressionFactor = suspendOnFailure.getFirstChildWithName(new QName(
                SynapseConstants.SYNAPSE_NAMESPACE,
                XMLConfigConstants.SUSPEND_PROGRESSION_FACTOR));
            if (progressionFactor != null && progressionFactor.getText() != null) {
                try {
                    definition.setSuspendProgressionFactor(
                        Float.parseFloat(progressionFactor.getText().trim()));
                } catch (NumberFormatException e) {
                    handleException("The suspend duration progression factor should be specified " +
                        "as a valid float : " + progressionFactor.getText(), e);
                }
            }

            OMElement maximumDuration = suspendOnFailure.getFirstChildWithName(new QName(
                SynapseConstants.SYNAPSE_NAMESPACE,
                XMLConfigConstants.SUSPEND_MAXIMUM_DURATION));
            if (maximumDuration != null && maximumDuration.getText() != null) {
                try {
                    definition.setSuspendMaximumDuration(
                        Long.parseLong(maximumDuration.getText().trim()));
                } catch (NumberFormatException e) {
                    handleException("The maximum suspend duration should be specified " +
                        "as a valid number : " + maximumDuration.getText(), e);
                }
            }
        }

        OMElement retryConfig = elem.getFirstChildWithName(new QName(
            SynapseConstants.SYNAPSE_NAMESPACE, XMLConfigConstants.RETRY_CONFIG));

        if (retryConfig != null) {

            OMElement retryDisabledErrorCodes = retryConfig.getFirstChildWithName(new QName(
                SynapseConstants.SYNAPSE_NAMESPACE, "disabledErrorCodes"));
            if (retryDisabledErrorCodes != null && retryDisabledErrorCodes.getText() != null) {

                StringTokenizer st = new StringTokenizer(
                        retryDisabledErrorCodes.getText().trim(), ", ");
                while (st.hasMoreTokens()) {
                    String s = st.nextToken();
                    try {
                        definition.addRetryDisabledErrorCode(Integer.parseInt(s));
                    } catch (NumberFormatException e) {
                        handleException("The suspend error codes should be specified as valid " +
                                "numbers separated by commas : "
View Full Code Here

Examples of java.util.StringTokenizer

   */
  public void setKeys(String keys){
 
    m_Keys = keys;
    m_orderBy.clear();
    StringTokenizer st = new StringTokenizer(keys, ",");
    while (st.hasMoreTokens()) {
        String column = st.nextToken();
        column = column.replaceAll(" ","");
        m_orderBy.add(column);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.