Yes I think Facade layer is good idea and i am planning to work on this.We
can not simply flip to other implementation from the web.composite.Facade
layer helps in switching between different providers.

Right now we have two different types of dataproviders .. JCR based and
DataStore(for google apps Engine  JPA/JDO..Not Implemented Yet).

Here is code snippet.
-----------------------------------------

// This class go in Photark Module
interface DataProvider
{
       public AlbumRepository  getAlbumRepository();

       public UserRepository getUserRepository();
}


//JCR Based Implementation
// Photark JCR module
public class JCRDataProvider implements DataProvider
{
       private JCRRepositoryManager repositoryManager;

       public JCRDataProvider(JCRRepositoryManager repositoryManager)
       {
           this.repositoryManager = repositorymanger
      }

       public AlbumRepository  getAlbumRepository()
       {
         AlbumRepository albumRepositry = new
JCRALbumReposiroty(repositoryManager);
         return albumRepositry;
       }
}

//DataStore Based Implementation
// PhotaArk FileSystem module.
public class DataStoreProvider implements DataProvider
{
       private JDOPersistence jdoPersistenceManager;

       public JCRDataProvider(JCRRepositoryManager jdoPersistenceManager)
       {
           this.repositoryManager = repositorymanger
      }

       public AlbumRepository  getAlbumRepository()
       {
         AlbumRepository albumRepositry = new
JDOALbumReposiroty(jdoPersistenceManager);
         return albumRepositry;
       }
}

//Photark Module
public interface AlbumRepository
{

public String findCoverImage(String albumName) ;

public String addAlbum(String album);

...................

}


// Photark JCR Module
public class JCRAlbumRepository implements AlbumRepository
{
      private JCRRepositoryManager repositoryManager;

      public String findCoverImage(String albumName)
      {
          // use the repository manager and fetch the data from the
repository

      }
}



similary we have seprate implementation from DataStore Based
// Photark FileSystem Module
public class DataStoreAlbumRepository implements AlbumRepository
{
      private JDORepositoryManager repositoryManager;

      public String findCoverImage(String albumName)
      {
          // use the repository manager and fetch the data from the
repository

      }
}

This way we separate the Data Access from the Model objects and Services.

This API also helpful in developing the Security Module.In security module
we need to fetch the data for users and also save the permissions,
etc.Security module should not be dependent on the Implementation other we
can not deploy it on the google apps engine.The propose facade layer help in
achieving this by injecting the  the interface DataProvider instead of
concreate implementation and i would work with both Google apps engine and
Tomcat.

If all are agree on this I would like to work on this

Thought/Suggestions welcome

-- 
Avdhesh Yadav
http://www.avdheshyadav.com
http://twitter.com/yadavavdhesh

On Thu, May 13, 2010 at 4:30 AM, Luciano Resende <[email protected]>wrote:

> On Wed, May 12, 2010 at 3:46 PM, Henry Saputra <[email protected]>
> wrote:
> > Actually there are some missing implementation for the SCA components in
> the
> > filesystem which supported in JCR:
> >
> > ImageServiceComponent
> > ImageUploadServiceComponent
> > RepositoryManager
> >
> > so I cant simply change the composite file to flip the component
> > implementation.
> >
> > - Henry
>
> RepositoryManager was created more like for JCR, and the other two
> should be somewhat independent of the store... let me take a look at
> this tonight to check the current status, but feel free to send
> patches if you make any progress.
>
> --
> Luciano Resende
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>

Reply via email to