You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by st...@locus.apache.org on 2000/03/17 17:49:45 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/framework Factory.java Manager.java

stefano     00/03/17 08:49:45

  Modified:    src/org/apache/cocoon/framework Factory.java Manager.java
  Log:
  back on good old getResource ... since the problem lies on JServ's AdaptiveClassLoader with jar repositories
  
  Revision  Changes    Path
  1.6       +2 -7      xml-cocoon/src/org/apache/cocoon/framework/Factory.java
  
  Index: Factory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/framework/Factory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Factory.java	2000/03/17 00:02:01	1.5
  +++ Factory.java	2000/03/17 16:49:44	1.6
  @@ -1,4 +1,4 @@
  -/*-- $Id: Factory.java,v 1.5 2000/03/17 00:02:01 stefano Exp $ --
  +/*-- $Id: Factory.java,v 1.6 2000/03/17 16:49:44 stefano Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -60,7 +60,7 @@
    * classes and the actors.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.5 $ $Date: 2000/03/17 00:02:01 $
  + * @version $Revision: 1.6 $ $Date: 2000/03/17 16:49:44 $
    */
   
   public interface Factory extends Actor {
  @@ -86,10 +86,5 @@
        * Create a vector of instances with given configurations.
        */
       Vector create(Vector names, Configurations conf);
  -
  -    /**
  -     * Creates a resource.
  -     */
  -    InputStream createResource(String resource);
   
   }
  
  
  
  1.8       +10 -19    xml-cocoon/src/org/apache/cocoon/framework/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/framework/Manager.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Manager.java	2000/03/17 00:02:01	1.7
  +++ Manager.java	2000/03/17 16:49:44	1.8
  @@ -1,4 +1,4 @@
  -/*-- $Id: Manager.java,v 1.7 2000/03/17 00:02:01 stefano Exp $ --
  +/*-- $Id: Manager.java,v 1.8 2000/03/17 16:49:44 stefano Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -57,7 +57,7 @@
    * This class is used to create and control software actors and resources.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.7 $ $Date: 2000/03/17 00:02:01 $
  + * @version $Revision: 1.8 $ $Date: 2000/03/17 16:49:44 $
    */
   
   public class Manager extends Hashtable implements Actor, Factory, Director {
  @@ -84,8 +84,15 @@
        */
       public Object create(String name, Configurations conf) throws RuntimeException {
           try {
  -            Object object = Class.forName(name).newInstance();
  +            Object object = null;
  +            ClassLoader cl = this.getClass().getClassLoader();
   
  +            if (cl != null) {
  +                object = cl.loadClass(name).newInstance();
  +            } else {
  +                object = Class.forName(name).newInstance();
  +            }
  +
               if (object instanceof Actor) {
                   ((Actor) object).init((Director) this);
               }
  @@ -141,22 +148,6 @@
        */
       public void setRole(String role, Object actor) {
           this.put(role, actor);
  -    }
  -
  -    /**
  -     * Creates the requested resource.
  -     */
  -    public InputStream createResource(String resource) {
  -        InputStream is = null;
  -
  -        if (this.classloader != null) {
  -            is = this.classloader.getResourceAsStream(resource);
  -        } else {
  -            is = ClassLoader.getSystemResourceAsStream(resource);
  -        }
  -
  -        if (is == null) throw new RuntimeException("resource " + resource + " was not found.");
  -        else return is;
       }
   
       /**