Package java.util

Examples of java.util.ListIterator


         // only one iteration should be necessary, but we won't sweat it.
         // 2 iterations are needed by cmp...jdbc/bridge/JDBCCMRFieldBridge which
         // assumes persistence managers are all set up for every
         // bean in the relationship!
         ListIterator iter = containerOrdering.listIterator();
         while (iter.hasNext())
         {
            Container con = (Container) iter.next();
            ObjectName jmxName = con.getJmxName();
            /*
             * Add the container mbean to the deployment mbeans so the state of the deployment can be tracked.
             */
            server.registerMBean(con, jmxName);
View Full Code Here


    */
   @Override
   protected void startService() throws Exception
   {
      // before EntityContainer returns from the startService, its PM should be usable
      ListIterator iter = containerOrdering.listIterator();
      while (iter.hasNext())
      {
         Container con = (Container) iter.next();
         if (con.getBeanMetaData().isEntity())
         {
            ClassLoader oldCl = SecurityActions.getContextClassLoader();
            SecurityActions.setContextClassLoader(con.getClassLoader());
            con.pushENC();
            try
            {
               ((EntityContainer) con).getPersistenceManager().start();
            }
            finally
            {
               con.popENC();
               // Reset classloader
               SecurityActions.setContextClassLoader(oldCl);
            }
         }
      }

      iter = containerOrdering.listIterator();
      while (iter.hasNext())
      {
         Container con = (Container) iter.next();
         log.debug("startService, starting container: " + con.getBeanMetaData().getEjbName());
         serviceController.start(con.getJmxName());
      }
   }
View Full Code Here

    * Stops all the containers of this application.
    */
   @Override
   protected void stopService() throws Exception
   {
      ListIterator iter = containerOrdering.listIterator(containerOrdering.size());
      while (iter.hasPrevious())
      {
         Container con = (Container) iter.previous();
         try
         {
            ObjectName jmxName = con.getJmxName();
            // The container may already be destroyed so validate metaData
            BeanMetaData metaData = con.getBeanMetaData();
View Full Code Here

      WebServiceMBean webServer = null;
      if (webServiceName != null)
      {
         webServer = (WebServiceMBean) MBeanProxyExt.create(WebServiceMBean.class, webServiceName);
      }
      ListIterator iter = containerOrdering.listIterator(containerOrdering.size());
      while (iter.hasPrevious())
      {
         Container con = (Container) iter.previous();
         ObjectName jmxName = con.getJmxName();
         int conState = con.getState();
         boolean destroyContainer = true;
         log.debug("Looking to destroy container: " + jmxName + ", state: " + con.getStateString() + ", destroy: "
               + destroyContainer);
View Full Code Here

     * @param fieldName The name of the field
     * @return The depth for this field name
     */
    public int getObjectDepthForType(String fieldName)
    {
        ListIterator iter = fetchFieldNames.listIterator(fetchFieldNames.size()); // Start at the end
        int number = 0;
        while (iter.hasPrevious())
        {
            String field = (String)iter.previous();
            if (field.equals(fieldName))
            {
                number++;
            }
            else
View Full Code Here

     */
    protected ScalarExpression(String functionName, List args)
    {
        st.append(functionName).append('(');
        ScalarExpression arg = null;
        ListIterator i = args.listIterator();
        Object expr = i.next();
        if (expr instanceof String)
        {
            st.append(expr.toString());
        }
        else
        {
            arg = (ScalarExpression)expr;
            st.append(arg);
        }


        while (i.hasNext())
        {
            expr = i.next();
            if (expr instanceof String)
            {
                st.append(',').append(expr.toString());
            }
            else
View Full Code Here

     */
    protected ScalarExpression(String functionName, List args, List types)
    {
        st.append(functionName).append('(');

        ListIterator i = args.listIterator();
        ListIterator iTypes = types.listIterator();
        ScalarExpression arg = (ScalarExpression)i.next();
        st.append(arg);
        st.append(" AS ");
        Object type = iTypes.next();
        if (type instanceof ScalarExpression)
        {
            st.append((ScalarExpression)type);
        }
        else
        {
            st.append(type.toString());
        }
        this.qs = arg.qs;

        while (i.hasNext())
        {
            arg = (ScalarExpression)i.next();
            st.append(',').append(arg);
            st.append(" AS ");
            type = iTypes.next();
            if (type instanceof ScalarExpression)
            {
                st.append((ScalarExpression)type);
            }
            else
View Full Code Here

        if (distinct)
        {
            st.append("DISTINCT ");
        }

        ListIterator i = args.listIterator();
        ScalarExpression arg = (ScalarExpression)i.next();
        te = arg.getLogicSetExpression(); //just delegate table expr to one arg.
        st.append(arg);

        while (i.hasNext())
        {
            arg = (ScalarExpression)i.next();
            st.append(',').append(arg);
        }

        st.append(')');
        this.expressionList.addExpression(this);
View Full Code Here

      * or previous().
      * @param list List List to compare to fullView
      */
     public void nextAndPreviousTest( List list )
     {
       ListIterator listIter = list.listIterator();

       assertTrue( "hasNext", listIter.hasNext() );
       assertEquals( "next index", 0, listIter.nextIndex() );
       assertEquals( "next", fullView[0], listIter.next() );

       assertTrue( "hasNext", listIter.hasNext() );
       assertEquals( "next index", 1, listIter.nextIndex() );
       assertEquals( "next", fullView[1], listIter.next() );

       assertTrue( "hasNext", listIter.hasNext() );
       assertEquals( "next index", 2, listIter.nextIndex() );
       assertEquals( "next", fullView[2], listIter.next() );

       assertFalse( "hasNext", listIter.hasNext() );

       // We are at the end of the list. Go back
       assertTrue( "hasPrevious", listIter.hasPrevious() );
       assertEquals( "previous index", 2, listIter.previousIndex() );
       assertEquals( "previous", fullView[2], listIter.previous() );

       assertTrue( "hasPrevious", listIter.hasPrevious() );
       assertEquals( "previous index", 1, listIter.previousIndex() );
       assertEquals( "previous", fullView[1], listIter.previous() );

       assertTrue( "hasPrevious", listIter.hasPrevious() );
       assertEquals( "previous index", 0, listIter.previousIndex() );
       assertEquals( "previous", fullView[0], listIter.previous() );

       assertFalse( "hasPrevious", listIter.hasPrevious() );
       assertEquals( "previous index", -1, listIter.previousIndex() );
     }
View Full Code Here

      public void testNextAndPrevious()
      {
        List col = createFilterColl(middleView);
        assertEquals( "view list size", 3, col.size() );

        ListIterator listIter = col.listIterator();

        assertTrue( "hasNext", listIter.hasNext() );
        assertEquals( "next index", 0, listIter.nextIndex() );
        assertEquals( "next", fullView[0], listIter.next() );

        assertTrue( "hasNext", listIter.hasNext() );
        assertEquals( "next index", 1, listIter.nextIndex() );
        assertEquals( "next", fullView[1], listIter.next() );

        assertTrue( "hasNext", listIter.hasNext() );
        assertEquals( "next index", 2, listIter.nextIndex() );
        assertEquals( "next", fullView[2], listIter.next() );

        assertFalse( "hasNext", listIter.hasNext() );

        // We are at the end of the list. Go back
        assertTrue( "hasPrevious", listIter.hasPrevious() );
        assertEquals( "previous index", 2, listIter.previousIndex() );
        assertEquals( "previous", fullView[2], listIter.previous() );

        assertTrue( "hasPrevious", listIter.hasPrevious() );
        assertEquals( "previous index", 1, listIter.previousIndex() );
        assertEquals( "previous", fullView[1], listIter.previous() );

        assertTrue( "hasPrevious", listIter.hasPrevious() );
        assertEquals( "previous index", 0, listIter.previousIndex() );
        assertEquals( "previous", fullView[0], listIter.previous() );

        assertFalse( "hasPrevious", listIter.hasPrevious() );
        assertEquals( "previous index", -1, listIter.previousIndex() );
       }
View Full Code Here

TOP

Related Classes of java.util.ListIterator

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.