0 Replies Latest reply on Oct 6, 2009 1:37 PM by wachtda.scsi.gmx.ch

    Implementing a sort of abstract factory with seam components

    wachtda.scsi.gmx.ch

      hello fans of seam!


      is it possible to implement a sort of abstract factory concept with some seam components?
      i can not get it to work...



      this is my scenario:



      public interface myService {
         public void checkAccess(someObjects);
      }
      



      public abstract class myServiceImpl implements myService {
         public void checkAccess(someObjects) {
         ...
         }
      }
      



      public class myServiceImplAdmin extends myServiceImpl {
         public void checkAccess(someObjects) {
         ... access check for admin users ...
         }
      }
      


      public class myServiceImplUser extends myServiceImpl {
         public void checkAccess(someObjects) {
         ... access check for customers ...
         }
      }
      



      upon login id like to check if the user is admin or a normal user. if the user is a admin the myServiceImplAdmin should be used, else the myServiceImplUser...


      i can do this with the @factory method and it works! but it works only for pojos, which means i can not access some seam components (for example Identity, Entitymanager) from the the @Factory method returned objects. (myServiceImplAdmin/myServiceImplUser)


      any hints, ideas how i can achieve this?

      thanks for helping