Examples of Acceptor


Examples of com.sun.msv.verifier.Acceptor

            acceptor.isAcceptState(ref);
            context.reportEvent(target,ref.str);
        }
       
        // pop the acceptor
        Acceptor child = acceptor;
        acceptor = (Acceptor)stack.pop();
        if(!acceptor.stepForward( child, null )) {
            // some required elements are missing.
            // report an error
            StringRef ref = new StringRef();
View Full Code Here

Examples of com.sun.msv.verifier.Acceptor

            intfName/*just pass the local name as QName.*/,
            emptyAttributes,
            this );
       
           
        Acceptor child = acceptor.createChildAcceptor(sti,null);
        if(child==null) {
            // some required elements were missing. report errors
            StringRef ref = new StringRef();
            child = acceptor.createChildAcceptor(sti,ref);
            context.reportEvent(target,ref.str);
        }
       
        if(o instanceof RIElement) {
            RIElement rie = (RIElement)o;
            if(!child.onAttribute(
                rie.____jaxb_ri____getNamespaceURI(),
                rie.____jaxb_ri____getLocalName(),
                rie.____jaxb_ri____getLocalName(),
                "",
                null, null, null ))
               
                // this object is not a valid member of the wildcard
                context.reportEvent(target,
                    Messages.format( Messages.INCORRECT_CHILD_FOR_WILDCARD,
                        rie.____jaxb_ri____getNamespaceURI(),
                        rie.____jaxb_ri____getLocalName() ));
        }
       
        child.onEndAttributes(sti,null);
       
       
        if(!acceptor.stepForward(child,null)) {
            // this can't be possible, as the dummy element was
            // generated by XJC.
View Full Code Here

Examples of com.sun.msv.verifier.Acceptor

        // Very first thing: do we have text collected?
        if (mTextAccumulator.hasText()) {
            doValidateText(mTextAccumulator);
        }

        Acceptor acc = (Acceptor)mAcceptors.remove(mAcceptors.size()-1);
        if (acc != null) { // may be null during error recovery? or not?
            if (!acc.isAcceptState(mErrorRef) || mErrorRef.str != null) {
                reportError(mErrorRef);
            }
        }
        int len = mAcceptors.size();
        if (len == 0) { // root closed
View Full Code Here

Examples of com.sun.msv.verifier.Acceptor

    }
   
    public void endElement( String namespaceUri, String localName, String qName )
        throws SAXException {
       
        Acceptor child = current;
       
        super.endElement(namespaceUri,localName,qName);
       
        {// report to the handler
            ElementExp type;
View Full Code Here

Examples of org.drools.grid.io.Acceptor

            public void exceptionReceived(Conversation conversation, ExceptionMessage msg) {
            }

        };

        Acceptor acc = new MinaAcceptor();
        acc.open( new InetSocketAddress( "127.0.0.1",
                                         8000 ),
                  accHandler,
                  l );


        ConversationManager cm = new ConversationManagerImpl( new GridImpl("peer"),
                                                              l );

        Conversation cv = cm.startConversation( "s1",
                                                new InetSocketAddress( "127.0.0.1",
                                                                       8000 ),
                                                                       "r1" );

        BlockingMessageResponseHandler blockHandler = new BlockingMessageResponseHandler();

        cv.sendMessage( "hello",
                        blockHandler );

        Message msg = blockHandler.getMessage(100, 5000 );
        System.out.println( msg.getBody() );

        cv.endConversation();
        if ( acc.isOpen() ) {
            acc.close();
        }
        assertEquals( false,
                      acc.isOpen() );
    }
View Full Code Here

Examples of org.drools.grid.io.Acceptor

                                         Object object ) {
        if ( logger.isDebugEnabled() ) {
            logger.debug( " ### Trying to add a service -> " + id + " @ " + this.ip + ":" + port + " >> " + object + " [[ " + (object instanceof MessageReceiverHandlerFactoryService ));
        }
        MessageReceiverHandlerFactoryService handlerFactory = ( MessageReceiverHandlerFactoryService ) object;
        Acceptor acc = this.acceptors.get( port );

        MessageReceiverHandler h = handlerFactory.getMessageReceiverHandler();

        if ( acc == null ) {
            acc = factory.newAcceptor();

            MultiplexSocket ms = new MultiplexSocket();
            if ( logger.isDebugEnabled() ) {
                logger.debug( " ### Opening new Acceptor for -> " + this.ip + ":" + port + " >> " + object );
            }
            acc.open( new InetSocketAddress( this.ip,
                                             port ),
                                             ms,
                                             this.l );


            this.acceptors.put( port,
                                acc );
        } else {
            if ( logger.isDebugEnabled() ) {
                logger.debug( " ### Found existing Acceptor: " + this.ip + ":" + port + " >> " + object );
            }
        }

        MultiplexSocket ms = (MultiplexSocket) acc.getMessageReceiverHandler();
        ms.getHandlers().put( id, h );
        handlerFactory.registerSocketService( this.grid, id, this.ip, port );
    }
View Full Code Here

Examples of org.drools.grid.io.Acceptor

    /* (non-Javadoc)
     * @see org.drools.grid.impl.SocketServer#removeService(int, java.lang.String)
     */
    public synchronized void removeService(int socket,
                                           String id) {
        Acceptor acc = this.acceptors.get( socket );
        if ( acc != null ) {
            MultiplexSocket ms = (MultiplexSocket) acc.getMessageReceiverHandler();
            ms.getHandlers().remove( id  );
            if ( ms.getHandlers().isEmpty() ) {
                // If there are no more services on this socket, then close it
                acc.close();
            }
        }
    }
View Full Code Here

Examples of org.drools.planner.core.localsearch.decider.acceptor.Acceptor

    public Acceptor buildAcceptor(EnvironmentMode environmentMode, ScoreDefinition scoreDefinition) {
        List<Acceptor> acceptorList = new ArrayList<Acceptor>();
        if (acceptorClassList != null) {
            for (Class<? extends Acceptor> acceptorClass : acceptorClassList) {
                Acceptor acceptor = ConfigUtils.newInstance(this, "acceptorClass", acceptorClass);
                acceptorList.add(acceptor);
            }
        }
        if ((acceptorTypeList != null && acceptorTypeList.contains(AcceptorType.PLANNING_ENTITY_TABU))
                || planningEntityTabuSize != null || fadingPlanningEntityTabuSize != null) {
View Full Code Here

Examples of org.drools.planner.core.localsearch.decider.acceptor.Acceptor

public class GreatDelugeAcceptorTest {

    @Test
    public void testIsAccepted() {
        // Setup
        Acceptor acceptor = new GreatDelugeAcceptor(1.20, 0.01);
        LocalSearchSolverPhaseScope localSearchSolverPhaseScope = createLocalSearchSolverPhaseScope();
        acceptor.phaseStarted(localSearchSolverPhaseScope);
        LocalSearchStepScope localSearchStepScope = new LocalSearchStepScope(localSearchSolverPhaseScope);
        localSearchStepScope.setStepIndex(0);
        acceptor.beforeDeciding(localSearchStepScope);
        // Pre conditions
        MoveScope a1 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-2000));
        MoveScope a2 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-1300));
        MoveScope a3 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-1200));
        MoveScope b1 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-1200));
        MoveScope b2 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-100));
        MoveScope c1 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-1100));
        MoveScope c2 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-120));
        // Do stuff
        assertEquals(false, acceptor.isAccepted(a1));
        assertEquals(false, acceptor.isAccepted(a2));
        assertEquals(true, acceptor.isAccepted(a3));
        // TODO reable a thorough test of great deluge
//        acceptor.stepTaken(localSearchStepScope);
//        assertEquals(false, acceptor.isAccepted(b1));
//        assertEquals(true, acceptor.isAccepted(b2));
//        acceptor.stepTaken(localSearchStepScope);
View Full Code Here

Examples of org.drools.planner.core.localsearch.decider.acceptor.Acceptor

public class GreatDelugeAcceptorTest {

    @Test
    public void testIsAccepted() {
        // Setup
        Acceptor acceptor = new GreatDelugeAcceptor(1.20, 0.01);
        LocalSearchSolverPhaseScope localSearchSolverPhaseScope = createLocalSearchSolverPhaseScope();
        acceptor.phaseStarted(localSearchSolverPhaseScope);
        LocalSearchStepScope localSearchStepScope = new LocalSearchStepScope(localSearchSolverPhaseScope);
        localSearchStepScope.setStepIndex(0);
        acceptor.stepStarted(localSearchStepScope);
        // Pre conditions
        LocalSearchMoveScope a1 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-2000));
        LocalSearchMoveScope a2 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-1300));
        LocalSearchMoveScope a3 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-1200));
        LocalSearchMoveScope b1 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-1200));
        LocalSearchMoveScope b2 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-100));
        LocalSearchMoveScope c1 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-1100));
        LocalSearchMoveScope c2 = createMoveScope(localSearchStepScope, DefaultSimpleScore.valueOf(-120));
        // Do stuff
        assertEquals(false, acceptor.isAccepted(a1));
        assertEquals(false, acceptor.isAccepted(a2));
        assertEquals(true, acceptor.isAccepted(a3));
        // TODO reable a thorough test of great deluge
//        acceptor.stepEnded(localSearchStepScope);
//        assertEquals(false, acceptor.isAccepted(b1));
//        assertEquals(true, acceptor.isAccepted(b2));
//        acceptor.stepEnded(localSearchStepScope);
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.