cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Riedel <dennis_rie...@web.de>
Subject Re: Creating components - avalon component model
Date Mon, 01 Aug 2005 15:56:58 GMT
Ok. Well, it seems that I have a lack of knowledge about this component 
stuff. I printed out the serviceManager variable and it is null.

So why? How does my class get an instance of ServiceManager. Who must 
call service(ServiceManager serviceManager) on it?

####MyExampleClass

public class Example implements Serviceable {

   private ServiceManager serviceManager = null;
   
   public Example() {}
   
   public Hashtable getParts() {
      Collection partCollection = new ArrayList();
      Hashtable parts = new Hashtable();
      DataAccessorInt dataAccessor = null;
      
      try {
         System.out.println("Example: getParts() - try LookUp"+ 
serviceManager);
         dataAccessor = (DataAccessorInt) 
serviceManager.lookup(DataAccessorInt.ROLE);
         System.out.println("Example: LookedUp...");
         partCollection = dataAccessor.getAllParts();
         ...
         return parts;
      }catch(ServiceException e){
         System.out.println("Example: "+e);
         return parts;
      }finally{
         System.out.println("Example: Releasing component...");
         if(dataAccessor != null) {
            serviceManager.release(dataAccessor);
         }
      }
   }
   
   public void service(ServiceManager serviceManager) throws 
ServiceException {
      this.serviceManager = serviceManager;
   }

}

###END MyExampleClass

Thx for any help.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message