Hi all,

I have found in a couple of places when writing listeners for the 
catalog doing stuff like this:

   public void handleModifyEvent(CatalogModifyEvent event) {
     if ( event.getSource() instanceof DataStoreInfo ) {

     }
     else if ( event.getSource() instanceof FeatureTypeInfo ) {

     }
     else if ( ... )

   }

And the list goes on. What would be nice is a visitor for catalog 
objects. So I could do somethign like this:

   public void handleModifyEvent(CatalogModifyEvent event) {
      CatalogVisitor visitor = new CatlaogVisitgor() {
          void visitDataStoreInfo( DataStoreInfo ) {
          }

          void visitDataStoreInfo( FeatureTypeInfo ) {
          }

          ...
      }

      event.getSource().accept( visitor );
   }

And ideally a CatalogVisitorAdapter which stubs all the visitor methods 
so that a listener can implement only the methods of relevance.

To do this I think we will probably want to add a root interface for all 
catalog objects. Say CatalogInfo. It will define the single method:

CatalogInfo {

   void accept( CatalogVisitor );

}

Thoughts? Comments? Objections?

-Justin

-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to