Package org.apache.oro.text.regex

Examples of org.apache.oro.text.regex.Perl5Matcher


    {
        if (_compiler == null)
            _compiler = new Perl5Compiler();

        if (_matcher == null)
            _matcher = new Perl5Matcher();
    }
View Full Code Here


    private boolean validateFormat(String input, String pattern)
    {
        if (_compiler == null)
        {
            _compiler = new Perl5Compiler();
            _matcher = new Perl5Matcher();
            _compiledPatterns = new HashMap();
        }

        Pattern compiled = (Pattern) _compiledPatterns.get(pattern);
        if (compiled == null)
View Full Code Here

        public boolean matches(String input) {
            if (input == null) {
                throw new NullPointerException();
            }
            return new Perl5Matcher().matches(input, pattern);
        }
View Full Code Here

     */
    public FTPFileListParserImpl(String regex)
    {
        try
        {
            _matcher_ = new Perl5Matcher();
            pattern   = new Perl5Compiler().compile(regex);
        }
        catch (MalformedPatternException e)
        {
            throw new IllegalArgumentException (
View Full Code Here

    {
        if (_compiler == null)
            _compiler = new Perl5Compiler();

        if (_matcher == null)
            _matcher = new Perl5Matcher();
    }
View Full Code Here

     */
    private JMeterTreeNode target;
   
    public ProxyControl()
    {
        matcher = new Perl5Matcher();
        setPort(DEFAULT_PORT);
        setExcludeList(new HashSet());
        setIncludeList(new HashSet());
        setCaptureHttpHeaders(true); // maintain original behaviour
    }
View Full Code Here

        HTTPSamplerBase newLink,
        HTTPSamplerBase config)
        throws MalformedPatternException
    {
        boolean ok = true;
        Perl5Matcher matcher = (Perl5Matcher) localMatcher.get();
        PropertyIterator iter = config.getArguments().iterator();

        String query = null;
        try
        {
            query = JOrphanUtils.decode(newLink.getQueryString(),"UTF-8");
        }
        catch (UnsupportedEncodingException e)
        {
            // UTF-8 unsupported? You must be joking!
            log.error("UTF-8 encoding not supported!");
            throw new Error("Should not happen: "+e.toString());
        }

        if (query == null && config.getArguments().getArgumentCount() > 0)
        {
            return false;
        }
       
        while (iter.hasNext())
        {
            Argument item = (Argument) iter.next().getObjectValue();
            if (query.indexOf(item.getName() + "=") == -1)
            {
                if (!(ok =
                    ok
                        && matcher.contains(
                            query,
                            patternCache.getPattern(
                                item.getName(),
                                Perl5Compiler.READ_ONLY_MASK))))
                {
                    return false;
                }
            }
        }

        if (config.getDomain() != null
            && config.getDomain().length() > 0
            && !newLink.getDomain().equals(config.getDomain()))
        {
            if (!(ok =
                ok
                    && matcher.matches(
                        newLink.getDomain(),
                        patternCache.getPattern(
                            config.getDomain(),
                            Perl5Compiler.READ_ONLY_MASK))))
            {
                return false;
            }
        }

        if (!newLink.getPath().equals(config.getPath())
            && !matcher.matches(
                newLink.getPath(),
                patternCache.getPattern(
                    "[/]*" + config.getPath(),
                    Perl5Compiler.READ_ONLY_MASK)))
        {
            return false;
        }

        if (!(ok =
            ok
                && matcher.matches(
                    newLink.getProtocol(),
                    patternCache.getPattern(
                        config.getProtocol(),
                        Perl5Compiler.READ_ONLY_MASK))))
        {
View Full Code Here

    public static synchronized boolean isArgumentMatched(
        Argument arg,
        Argument patternArg)
        throws MalformedPatternException
    {
        Perl5Matcher matcher = (Perl5Matcher) localMatcher.get();
        return (
            arg.getName().equals(patternArg.getName())
                || matcher.matches(
                    arg.getName(),
                    patternCache.getPattern(
                        patternArg.getName(),
                        Perl5Compiler.READ_ONLY_MASK)))
            && (arg.getValue().equals(patternArg.getValue())
                || matcher.matches(
                    (String) arg.getValue(),
                    patternCache.getPattern(
                        (String) patternArg.getValue(),
                        Perl5Compiler.READ_ONLY_MASK)));
    }
View Full Code Here

     * @see org.apache.jmeter.protocol.http.parser.HtmlParser#getEmbeddedResourceURLs(byte[], java.net.URL)
     */
    public Iterator getEmbeddedResourceURLs(byte[] html, URL baseUrl, URLCollection urls)
    {

        Perl5Matcher matcher= (Perl5Matcher)localMatcher.get();
        PatternMatcherInput input= (PatternMatcherInput)localInput.get();
        // TODO: find a way to avoid the cost of creating a String here --
        // probably a new PatternMatcherInput working on a byte[] would do
        // better.
        input.setInput(new String(html));
        while (matcher.contains(input, pattern))
        {
            MatchResult match= matcher.getMatch();
            String s;
            if (log.isDebugEnabled())
                log.debug("match groups " + match.groups());
            // Check for a BASE HREF:
            for (int g=1; g <= NUM_BASE_GROUPS && g <= match.groups(); g++)
View Full Code Here

        // Adapt loggerPattern for oro
        String realLoggerPattern = StringUtils
                .replace(loggerPattern, "" + WILDCARD, "." + WILDCARD);

        Perl5Compiler compiler = new Perl5Compiler();
        Perl5Matcher matcher = new Perl5Matcher();
        Pattern compiled;
        try
        {
            compiled = compiler.compile(realLoggerPattern);
        }
        catch (MalformedPatternException e)
        {
            throw new ApplicationRuntimeException("Malformed Logger Pattern:" + realLoggerPattern);
        }
        return matcher.matches(loggerName, compiled);

    }
View Full Code Here

TOP

Related Classes of org.apache.oro.text.regex.Perl5Matcher

Copyright © 2018 www.massapicom. 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.