Package net.sf.jz3950.query

Examples of net.sf.jz3950.query.Query


         */
        logger.debug("Connecting to " + getTarget());
        this.connection = new Socket(this.host, this.port);
        this.connection.setSoTimeout(this.serverTimeout * 1000);
        this.inputThread = new ProtocolInputThread("<--" + getTarget(), this.connection.getInputStream());
        this.outputThread = new ProtocolOutputThread("-->" + getTarget(), this.connection.getOutputStream());

        /*
         * INIT-Handshake
         */
        try
View Full Code Here


        logger.debug("Disconnecting association with " + getTarget());

        try
        {
            request(new CloseOperation(this, this.associationReferenceId, message));
        }
        catch (ProtocolException e)
        {
            logger.debug("Ignoring protocol error while closing association", e);
        }
View Full Code Here

         */
        try
        {
            logger.debug("Initializing association");

            InitOperation initHandler = new InitOperation(this, authenticationMethod);
            requestResponse(initHandler);

            this.targetInformation = initHandler.getTargetInformation();
            this.associationReferenceId = initHandler.getReferenceId();
            logger.debug("Association " + ((this.associationReferenceId == null) ? "" : ("(" + this.associationReferenceId + ") ")) + "initialized (" + this.targetInformation + ")");
        }
        catch (ProtocolException e)
        {
            disconnect("INIT error");
View Full Code Here

            synchronized (this.pendingOperations)
            {
                for (Iterator<Operation> pendingIt = this.pendingOperations.iterator();
                        pendingIt.hasNext();)
                {
                    Operation pending = pendingIt.next();

                    if (pending.processes(pdu))
                    {
                        logger.debug("Dispatching received PDU to " + pending);

                        synchronized (pending)
                        {
                            try
                            {
                                pending.terminatingResponseHasBeenReceived();
                                pending.process(pdu);
                            }
                            catch (ProtocolException e)
                            {
                                pending.setError(e);
                            }
                            finally
                            {
                                pendingIt.remove();
                                pending.notifyAll();
                            }
                        }
                    }
                }
            }
View Full Code Here

    }

    @Override
    public void doRegularTask()
    {
        Operation protocolHandler = null;

        try
        {
            protocolHandler = outgoingQueue.take();

            if (protocolHandler instanceof EndOfOperationProtocolHandler)
            {
                logger.debug("Signal received; ending PDU sending");

                signalEndOfThread();

                return;
            }

            logger.debug("Sending request of " + protocolHandler);

            synchronized (protocolHandler)
            {
                try
                {
                    PDU_type pdu = protocolHandler.produceInitializingRequest();

                    logger.debug("Sending " + ToStringBuilder.reflectionToString(pdu));

                    BEROutputStream encoder = new BEROutputStream(DEFAULT_BUFFER_SIZE, charsetEncoding, ProtocolOIDRegister.getInstance());
                    PDU_codec.getCodec().serialize(encoder, protocolHandler.produceInitializingRequest(), false, "PDU");
                    encoder.flush();
                    encoder.writeTo(outputStream);
                    this.outputStream.flush();
                    protocolHandler.initializingRequestSubmitted();
                }
                catch (ProtocolException e)
                {
                    protocolHandler.setError(e);
                }
                catch (IOException e)
                {
                    logger.debug("I/O error while sending PDU", e);
                    signalEndOfThread();
                }
                finally
                {
                    protocolHandler.notifyAll();
                }
            }
        }
        catch (InterruptedException e)
        {
View Full Code Here

    {
        logger.debug("Fetching " + fetchSize + " record(s) for result set \"" + resultSetName + "\"; offset: " + (nextResultNum - 1));

        checkConnection();

        PresentOperation presentProtocolHandler = new PresentOperation(this, resultSetName, nextResultNum, fetchSize);
        requestResponse(presentProtocolHandler);

        return presentProtocolHandler.getRecords();
    }
View Full Code Here

    {
        logger.debug("Search on target with " + query);

        checkConnection();

        SearchOperation searchProtocolHandler = new SearchOperation(this, query);
        requestResponse(searchProtocolHandler);

        return new RecordResultSet(this, generateResultSetName(), searchProtocolHandler.getNumOfResults(), searchProtocolHandler.getNextResult());
    }
View Full Code Here

        super(name);
    }

    public void testQueryModelBuilding() throws Exception
    {
        new PrefixQuery("Voyager", "@attrset bib-1 @attr 1=4 \"brain\"").toQueryModel().toString();
    }
View Full Code Here

    }

    public void testSearchIndexData() throws Exception
    {
        association.connect("bagel.indexdata.dk", 210);
        iterateOverPartOfResultSet(association.search(new PrefixQuery("marc", "@attrset bib-1 @attr 1=4 \"Indexdata\"")));
        association.disconnect();
    }
View Full Code Here

    }

    public void testSearchLOC() throws Exception
    {
        association.connect("z3950.loc.gov", 7090);
        iterateOverPartOfResultSet(association.search(new PrefixQuery("Voyager", "@attrset bib-1 @attr 1=4 \"Schiller\"")));
        association.disconnect();
    }
View Full Code Here

TOP

Related Classes of net.sf.jz3950.query.Query

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.