Package net.fortytwo.ripple

Examples of net.fortytwo.ripple.RippleException


            throws RippleException {
        rdfEquivalent = rdf;
        Value v = rdf.sesameValue();

        if (!(v instanceof Literal)) {
            throw new RippleException("value " + v.toString() + " is not numeric");
        }

        URI dataType = ((Literal) v).getDatatype();

        if (null == dataType) {
            throw new RippleException("value is untyped");
        } else if (dataType.equals(XMLSchema.INTEGER)
                || dataType.equals(XMLSchema.INT)) {
            try {
                type = Type.INTEGER;
                number = ((Literal) v).intValue();
            } catch (Throwable t) {
                throw new RippleException(t);
            }
        } else if (dataType.equals(XMLSchema.LONG)) {
            try {
                type = Type.LONG;
                number = (long) ((Literal) v).intValue();
            } catch (Throwable t) {
                throw new RippleException(t);
            }
        } else if (dataType.equals(XMLSchema.DOUBLE)) {
            try {
                type = Type.DOUBLE;
                number = doubleValue((Literal) v);
            } catch (Throwable t) {
                throw new RippleException(t);
            }
        } else if (dataType.equals(XMLSchema.FLOAT)) {
            try {
                type = Type.FLOAT;
                number = ((Literal) v).floatValue();
            } catch (Throwable t) {
                throw new RippleException(t);
            }
        } else if (dataType.equals(XMLSchema.DECIMAL)) {
            try {
                type = Type.DECIMAL;
                number = ((Literal) v).decimalValue();
            } catch (Throwable t) {
                throw new RippleException(t);
            }
        } else {
            throw new RippleException("not a recognized numeric data type: " + dataType);
        }
    }
View Full Code Here


        final RippleList rest = stack.getRest();

        Sink<RippleList> listSink = new Sink<RippleList>() {
            public void put(RippleList list) throws RippleException {
                if (list.isNil()) {
                    throw new RippleException("list index out of bounds: " + index);
                }

                if (index < 1) {
                    throw new RippleException("list index out of bounds (note: 'at' begins counting at 1): " + index);
                }

                for (int j = 1; j < index; j++) {
                    list = list.getRest();
                    if (list.isNil()) {
                        throw new RippleException("list index out of bounds: " + index);
                    }
                }

                solutions.put(
                        rest.push(list.getFirst()));
View Full Code Here

                        logger.debug("received quit event");
                        abortCommands();
                        // Note: exception handling used for control
                        throw new ParserQuitException();
                    default:
                        throw new RippleException(
                                "event not yet supported: " + event);
                }
            }
        };

        RecognizerAdapter ra = new RecognizerAdapter(
                querySink, continuingQuerySink, commandSink, eventSink, qe.getErrorPrintStream());

        Sink<Exception, RippleException> parserExceptionSink = new ParserExceptionSink(
                qe.getErrorPrintStream());

        // Pass input through a filter to watch for special byte sequences, and
        // another draw input through it even when the interface is busy.
        InputStream filter = new InputStreamEventFilter(is, ra);
        consoleReaderInput = new ThreadedInputStream(filter);

        // Create reader.
        try {
            reader = new ConsoleReader(consoleReaderInput,
                    new OutputStreamWriter(qe.getPrintStream()));
        } catch (Throwable t) {
            throw new RippleException(t);
        }
        jline.Terminal term = reader.getTerminal();
//System.out.println( "reader.getTerminal() = " + term );

        writeIn = new PipedIOStream();
View Full Code Here

                // This makes candidates from multiple completors available at once.
                Completor multiCompletor = new MultiCompletor(completors);

                reader.addCompletor(multiCompletor);
            } catch (Throwable t) {
                throw new RippleException(t);
            }
        } catch (RippleException e) {
            e.logError();
            logger.error("failed to update completors");
        }
View Full Code Here

        queryEngine = qe;
    }

    protected void executeProtected() throws RippleException {
        if (null == queryEngine) {
            throw new RippleException("null QueryEngine");
        }

        queryEngine.executeCommand(this);
    }
View Full Code Here

        try {
            result = mc.toString(s).replaceAll(mc.toString(regex), mc.toString(replacement));
        } catch (java.util.regex.PatternSyntaxException e) {
            // Hard fail (for now).
            throw new RippleException(e);
        }

        solutions.put(
                stack.push(StringLibrary.value(result, mc, replacement, regex, s)));
View Full Code Here

            evalSink.put(arg);
        }

        // Attempt to recover from stack overflow.
        catch (StackOverflowError e) {
            throw new RippleException(e);
        }
    }
View Full Code Here

            System.out.println("debug 1");
            try {
                s = new ANTLRInputStream(input, "UTF-8");
            } catch (IOException e) {
                throw new RippleException(e);
            }

            System.out.println("debug 2");
            RippleLexer lexer = new RippleLexer(s);
            System.out.println("debug a");
View Full Code Here

            int lim = is.available();
            for (int i = 0; i < lim; i++) {
                is.read();
            }
        } catch (IOException e) {
            throw new RippleException(e);
        }
    }
View Full Code Here

            throws RippleException {
        Collector<RippleList> sink = new Collector<RippleList>();
        uri.evaluate(sink, qe, mc);

        if (sink.size() == 0) {
            throw new RippleException("URI could not be constructed from " + uri);
        } else if (sink.size() > 1) {
            throw new RippleException("multiple values constructed from " + uri);
        }

        String ns = sink.iterator().next().getFirst().toString();

        mc.setNamespace(prefix, ns, true);
View Full Code Here

TOP

Related Classes of net.fortytwo.ripple.RippleException

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.