avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/merlin-spi/src/java/org/apache/avalon/merlin/block Block.java
Date Tue, 15 Apr 2003 14:33:43 GMT
mcconnell    2003/04/15 07:33:43

  Modified:    merlin/assembly/src/java/org/apache/avalon/assembly/appliance
                        DefaultApplianceRepository.java
               merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl
                        DefaultBlock.java DefaultBlockLoader.java
               merlin/merlin-extensions/merlin-servlet/src/java/org/apache/avalon/merlin/jsp/tag
                        TargetTag.java
               merlin/merlin-extensions/merlin-servlet/src/java/org/apache/avalon/merlin/servlet
                        TestServlet.java
               merlin/merlin-extensions/merlin-servlet/src/webapp
                        header.jsp index.jsp
               merlin/merlin-extensions/merlin-servlet/src/webapp/WEB-INF
                        web.xml
               merlin/merlin-extensions/merlin-servlet/src/webapp/css
                        merlin.css
               merlin/merlin-smp/src/examples/afs/simple/conf block.xml
               merlin/merlin-smp/src/examples/afs/simple/src/test/org/apache
                        AbstractTestCase.java
               merlin/merlin-smp/src/examples/afs/simple/src/test/org/apache/bank
                        BankTestCase.java
               merlin/merlin-smp/src/examples/afs/simple-servlet/src/webapp/WEB-INF
                        web.xml
               merlin/merlin-spi/src/java/org/apache/avalon/merlin/block
                        Block.java
  Log:
  Global project commit before seperation of repository from engine.
  
  Revision  Changes    Path
  1.9       +3 -1      avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultApplianceRepository.java
  
  Index: DefaultApplianceRepository.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultApplianceRepository.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultApplianceRepository.java	15 Apr 2003 02:52:12 -0000	1.8
  +++ DefaultApplianceRepository.java	15 Apr 2003 14:33:39 -0000	1.9
  @@ -359,6 +359,8 @@
           {
               final String key = appliance.getURL().getPath().substring( local.length() );
               m_appliances.put( key, appliance );
  +            //System.out.println( 
  +            //  "## ADD: " + appliance + ", KEY: '" + key + "', in: " + getURL() );
           } else
           {
               final String error =
  
  
  
  1.11      +14 -3     avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlock.java
  
  Index: DefaultBlock.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlock.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultBlock.java	15 Apr 2003 04:43:55 -0000	1.10
  +++ DefaultBlock.java	15 Apr 2003 14:33:39 -0000	1.11
  @@ -472,9 +472,20 @@
       * Return the set of locally managed appliance instances.
       * @return the set of appliance instances local to this block.
       */
  -    private Appliance[] getAppliances()
  +    public Appliance[] getAppliances()
       {
  -        return m_engine.getApplianceRepository().getAppliances();
  +        ArrayList list = new ArrayList();
  +        Appliance[] appliances = 
  +          m_engine.getApplianceRepository().getAppliances();
  +        for( int i=0; i<appliances.length; i++ )
  +        {
  +            Appliance appliance = appliances[i];
  +            if( appliance != this )
  +            {
  +                list.add( appliance );
  +            }
  +        }
  +        return (Appliance[]) list.toArray( new Appliance[0] );
       }
   
      /**
  @@ -934,7 +945,7 @@
       {
           if( getURL().getPath().equals("") )
           {
  -            return "[block://ROOT"]";
  +            return "[block://ROOT]";
           }
           return "[block:/" + getURL().getPath() + "]";
       }
  
  
  
  1.13      +5 -2      avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlockLoader.java
  
  Index: DefaultBlockLoader.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlockLoader.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultBlockLoader.java	15 Apr 2003 04:43:55 -0000	1.12
  +++ DefaultBlockLoader.java	15 Apr 2003 14:33:39 -0000	1.13
  @@ -699,7 +699,10 @@
   
           try
           {
  -            return (Block) engine.createAppliance( context, true );
  +            System.out.println("## -------------- creating block ------------------");
  +            Block result = (Block) engine.createAppliance( context, true );
  +            System.out.println("## -------------- created block -------------------");
  +            return result;
           }
           catch( Throwable e )
           {
  
  
  
  1.3       +3 -1      avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/java/org/apache/avalon/merlin/jsp/tag/TargetTag.java
  
  Index: TargetTag.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/java/org/apache/avalon/merlin/jsp/tag/TargetTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TargetTag.java	15 Apr 2003 03:09:12 -0000	1.2
  +++ TargetTag.java	15 Apr 2003 14:33:40 -0000	1.3
  @@ -4,6 +4,7 @@
   import java.util.List;
   import java.util.Iterator;
   import java.util.Enumeration;
  +import java.util.Arrays;
   import java.net.URL;
   import java.io.IOException;
   import java.lang.reflect.Method;
  @@ -235,6 +236,7 @@
   		    //
   
   		    m_adapter = invoke( m_adapter, m_keyword );
  +System.out.println("## DELAGATING: " + m_keyword + ", " + m_adapter );
   	  	    if( m_adapter != null )
                   {
   		        return BodyTag.EVAL_BODY_BUFFERED;
  @@ -479,7 +481,7 @@
   
               if( object instanceof Object[] )
               {
  -                return Arrays.asList( (Object[]) object )
  +                return Arrays.asList( (Object[]) object );
               }
               else
               {
  
  
  
  1.2       +30 -0     avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/java/org/apache/avalon/merlin/servlet/TestServlet.java
  
  Index: TestServlet.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/java/org/apache/avalon/merlin/servlet/TestServlet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestServlet.java	7 Apr 2003 16:48:17 -0000	1.1
  +++ TestServlet.java	15 Apr 2003 14:33:40 -0000	1.2
  @@ -53,6 +53,7 @@
   import java.net.URL;
   import java.io.IOException;
   import java.io.PrintWriter;
  +import java.util.Enumeration;
   
   import javax.servlet.ServletException;
   import javax.servlet.ServletRequest;
  @@ -117,6 +118,35 @@
   	writer.println( getRootBlock().toString() );
   	writer.println("</td>");
   	writer.println("</tr>");
  +	writer.println("</table>");
  +	writer.println("<hr/>");
  +
  +	writer.println("<h1>Request Deconstructor</h1>");
  +	writer.println("<table border=\"0\">");
  +	writer.println("<tr><td>Path info:</td><td>" + request.getPathInfo()
+ "</td></tr>");
  +	writer.println("<tr><td>Translated:</td><td>" + request.getPathTranslated()
+ "</td></tr>");
  +	Enumeration names = request.getHeaderNames();
  +	while (names.hasMoreElements()) {
  +	    String name = (String) names.nextElement();
  +	    writer.println("<tr>");
  +	    writer.println("  <td>" + name + ":</td>");
  +	    writer.println("  <td>" + request.getHeader(name) + "</td>");
  +	    writer.println("</tr>");
  +	}
  +	writer.println("</table>");
  +	writer.println("<hr/>");
  +
  +	writer.println("<h1>Context Deconstructor</h1>");
  +	writer.println("<table border=\"0\" width=\"100%\">");
  +	names = getServletContext().getAttributeNames();
  +	while (names.hasMoreElements()) 
  +      {
  +	    String name = (String) names.nextElement();
  +	    writer.println("<tr>");
  +	    writer.println("  <td>" + name + ":</td>");
  +	    writer.println("  <td>" + request.getHeader(name) + "</td>");
  +	    writer.println("</tr>");
  +	}
   	writer.println("</table>");
   
   	writer.println("</body>");
  
  
  
  1.2       +1 -1      avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/webapp/header.jsp
  
  Index: header.jsp
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/webapp/header.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- header.jsp	13 Apr 2003 05:43:04 -0000	1.1
  +++ header.jsp	15 Apr 2003 14:33:42 -0000	1.2
  @@ -18,7 +18,7 @@
       if( m_banner == null ) m_banner = "";
   
       m_home = (String) request.getAttribute("urn:merlin:page.home");
  -    if( m_home == null ) m_home = "/index.jsp";
  +    if( m_home == null ) m_home = request.getContextPath() + "/index.jsp";
   %>
   
   <html>
  
  
  
  1.3       +26 -9     avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/webapp/index.jsp
  
  Index: index.jsp
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/webapp/index.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- index.jsp	15 Apr 2003 03:09:12 -0000	1.2
  +++ index.jsp	15 Apr 2003 14:33:42 -0000	1.3
  @@ -1,20 +1,37 @@
   
  -<%@ taglib uri="/WEB-INF/merlin.tld" prefix="merlin" %>
  +<%@ taglib uri="/WEB-INF/merlin.tld" prefix="m" %>
   <%@ page errorPage="exception.jsp" %>
   <%! Object m_adapter; %>
  +<%! String m_base; %>
  +<%! String m_info; %>
   <% 
       request.setAttribute("urn:merlin:page.title", "Merlin Index" );
       pageContext.include("header.jsp");
  +    m_base = request.getContextPath();
  +    if( request.getPathInfo() == null )
  +    {
  +       m_info = "/";
  +    }
  +    else
  +    {
  +        m_info = request.getPathInfo();
  +    }
   %>
   
  -  <merlin:target url="/">
  -    <p>BLOCK: <merlin:target feature="this"/></p>
  -    <p>Activation: <merlin:target feature="activationPolicy"/></p>
  -    <p>Name: <merlin:target feature="name"/></p>
  -    <p>Partition: <merlin:target feature="partitionName"/></p>
  -    <p>Path: <merlin:target feature="path"/></p>
  -    <p>URL: <merlin:target feature="URL"/></p>
  -  </merlin:target>
  +  <m:target url="<%=m_info%>">
  +    <p>INFO: <%=m_info%></p>
  +    <p>BLOCK: <m:target feature="this"/></p>
  +    <p>Activation: <m:target feature="activationPolicy"/></p>
  +    <p>Name: <m:target feature="name"/></p>
  +    <p>Partition: <m:target feature="partitionName"/></p>
  +    <p>Path: <m:target feature="path"/></p>
  +    <m:target resolve="contextProvider">
  +      <p>Name: <m:target feature="name"/></p>
  +      <p>Context Provider: <a href="<%=m_base%>/navigator/<m:target feature="path"/>"><m:target
feature="name"/></a></p>
  +    </m:target>
  +    <p>Base: <%=m_base%></p>
  +    <p>URL: <a href="<%=m_base%>/navigator/<m:target feature="path"/>"><m:target
feature="URL"/></a></p>
  +  </m:target>
   
   <% 
       pageContext.include("footer.jsp");
  
  
  
  1.3       +14 -9     avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/webapp/WEB-INF/web.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- web.xml	13 Apr 2003 05:42:05 -0000	1.2
  +++ web.xml	15 Apr 2003 14:33:42 -0000	1.3
  @@ -4,10 +4,10 @@
   
   <web-app>
   
  -  <display-name>Merlin Servlet</display-name>
  +  <display-name>Merlin</display-name>
   
     <description>
  -    Merlin Servlet Test Page.
  +    Merlin Naviation.
     </description>
   
     <servlet>
  @@ -20,16 +20,21 @@
       <load-on-startup>1</load-on-startup>
     </servlet>
   
  +  <servlet>
  +    <servlet-name>navigator</servlet-name>
  +    <display-name>Navigator</display-name>
  +    <description>Navigation page.</description>
  +    <jsp-file>/index.jsp</jsp-file>
  +  </servlet>
  +
  +  <servlet-mapping>
  +    <servlet-name>navigator</servlet-name>
  +    <url-pattern>/navigator/*</url-pattern>
  +  </servlet-mapping>
  +
     <taglib>
       <taglib-uri>/WEB-INF/merlin.tld</taglib-uri>
       <taglib-location>/WEB-INF/merlin.tld</taglib-location>
     </taglib>
  -
  -  <!--
  -  <servlet-mapping>
  -    <servlet-name>merlin</servlet-name>
  -    <url-pattern>/merlin/*</url-pattern>
  -  </servlet-mapping>
  -  -->
   
   </web-app>
  
  
  
  1.2       +1 -1      avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/webapp/css/merlin.css
  
  Index: merlin.css
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-extensions/merlin-servlet/src/webapp/css/merlin.css,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- merlin.css	13 Apr 2003 05:42:05 -0000	1.1
  +++ merlin.css	15 Apr 2003 14:33:42 -0000	1.2
  @@ -9,7 +9,7 @@
   }
   
   .caption { 
  -  font-size: 60%;
  +  font-size: 70%;
     margin-top: 2px; margin-bottom: 2px;
     text-transform: uppercase
   }
  
  
  
  1.6       +2 -0      avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/conf/block.xml
  
  Index: block.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/conf/block.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- block.xml	15 Apr 2003 03:07:03 -0000	1.5
  +++ block.xml	15 Apr 2003 14:33:42 -0000	1.6
  @@ -10,6 +10,8 @@
   
       <container name="banking">
   
  +      <container name="xxx"/>
  +
         <component name="bank" class="org.apache.bank.impl.BankProvider">
           <configuration>
             <name>Apache Financial Services</name>
  
  
  
  1.3       +1 -1      avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/test/org/apache/AbstractTestCase.java
  
  Index: AbstractTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/test/org/apache/AbstractTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractTestCase.java	11 Apr 2003 19:39:19 -0000	1.2
  +++ AbstractTestCase.java	15 Apr 2003 14:33:42 -0000	1.3
  @@ -95,7 +95,7 @@
           context.put( "urn:merlin:classloader.common", loader );
           context.put( "urn:merlin:classloader.system", loader );
           context.put( "urn:merlin:debug", "WARN" );
  -        context.put( "urn:merlin:logging.priority", "INFO" );
  +        context.put( "urn:merlin:logging.priority", "DEBUG" );
           context.put( "urn:merlin:block.url", classes.toURL() );
           context.makeReadOnly();
   
  
  
  
  1.6       +28 -0     avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/test/org/apache/bank/BankTestCase.java
  
  Index: BankTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/test/org/apache/bank/BankTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BankTestCase.java	15 Apr 2003 03:07:03 -0000	1.5
  +++ BankTestCase.java	15 Apr 2003 14:33:42 -0000	1.6
  @@ -52,6 +52,34 @@
           super( name );
       }
   
  +    public void testBlock() throws Exception
  +    {
  +        System.out.println( "-------------------------------------" );
  +        Block block = super.getRootBlock();
  +        printBlock( "  ", block );
  +        System.out.println( "-------------------------------------" );
  +    }
  +
  +    private void printBlock( String lead, Block block )
  +    {
  +        System.out.println( lead + "block: " + block );
  +        System.out.println( lead + "context: " + block.getContextProvider() );
  +        Appliance[] appliances = block.getAppliances();
  +        System.out.println( lead + "appliances: " + appliances.length );
  +        for( int i=0; i<appliances.length; i++ )
  +        {
  +            Appliance appliance = appliances[i];
  +            if( appliance instanceof Block )
  +            {
  +                printBlock( lead + " ", (Block) appliance );
  +            }
  +            else
  +            {
  +                System.out.println( lead + "--> appliance: " + appliance );
  +            }
  +        }
  +    }
  +
       public void testRoot() throws Exception
       {
           try
  
  
  
  1.2       +0 -5      avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple-servlet/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple-servlet/src/webapp/WEB-INF/web.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- web.xml	7 Apr 2003 16:59:28 -0000	1.1
  +++ web.xml	15 Apr 2003 14:33:43 -0000	1.2
  @@ -25,9 +25,4 @@
   
      </servlet>
   
  -   <servlet-mapping>
  -        <servlet-name>simple</servlet-name>
  -        <url-pattern>/*</url-pattern>
  -   </servlet-mapping>
  -
   </web-app>
  
  
  
  1.4       +7 -1      avalon-sandbox/merlin/merlin-spi/src/java/org/apache/avalon/merlin/block/Block.java
  
  Index: Block.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-spi/src/java/org/apache/avalon/merlin/block/Block.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Block.java	13 Apr 2003 02:40:47 -0000	1.3
  +++ Block.java	15 Apr 2003 14:33:43 -0000	1.4
  @@ -70,6 +70,12 @@
       public static final String BLOCK_KEY = "urn:merlin:block";
   
      /**
  +    * Return the set of locally managed appliance instances.
  +    * @return the set of appliance instances local to this block.
  +    */
  +    Appliance[] getAppliances();
  +
  +   /**
       * Deploy the block during which appliances managed by the block
       * will be established as executing components.
       *
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message