Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] how do I create a P2P SearchView?

I am trying to reuse existing classes as much as possible. What I currently
have is as follows:

public class GDMSSearchView extends SearchPart

this is pretty much a copy of
net.refractions.udig.catalog.ui.search.SearchView with the only difference
that it holds an instance of GDMSCatalog declared as (public class
GDMSCatalog extends ICatalog).  
I pass this instance of GDMSCatalog to GDMSCatalogTreeViewer.
GDMSCatalogTreeViewer is declared like this:
public class GeoPeersCatalogTreeViewer extends TreeViewer implements
ISelectionChangedListener
Internally it's a copy of net.refractions.udig.catalog.ui.CatalogTreeViewer
with the only difference that CatalogTreeViwer does
setInput(CatalogPlugin.getDefault().getLocalCatalog()) while I do
setInput(<my instance of GDMSCatalog>). 

I take it that original SearchView only let's you search the metadata of the
services that are currently open in the catalog, while what I need is to
create an empty catalog, execute P2P search and fill it in with the found
services and show it in the view. 

My GDMSCatalog is  declared as follows:
public class GDMSCatalog extends ICatalog 

and basically it is a copy of
net.refractions.udig.catalog.internal.CatalogImpl with the alternative
implementation of the search method (going into the P2P network instead of
searching metadata of the services that are currently open). 

Even from the design perspective this is not a very nice solution for my
purposes as P2P search that I have is asynchronous. Basically you send a
request to the network and a listener would get the results if any. I should
be able to make catalog to listen for my events and show found services as
soon as the corresponding messages arrive. However it would do for now, as I
can make it to be "synchronous" by sending out a request and waiting for a
little while before returning the result.

Unfortunately, I can't get it to work. I get a NullPointerException from
inside of uDig. It appears that there are some dependencies inside
SearchPart (or maybe it's superclass ViewPart) on the default catalog. That
would mean that I need to reimplement the entire part. It gets a little bit
too much for me as I am doing it in my spare time.

I hope my explanations make sense. Thanks for the help.

Leon 




Jody Garnett-3 wrote:
> 
> Leon wrote:
>> Hello everybody,
>>
>> I am writing a P2P application which should let one search for maps,
>> layers
>> services etc. I am thinking of using uDig as a client. Essentially I
>> should
>> have a view similar to the Search view with the input string for the
>> query
>> above and the tree panel for the found results below.
> That would be great! I started making a similar suggestion for google 
> summer of code students here. If you want a wiki page to hack up design 
> documents for discussion here it is:
> -
>> I already spent some
>> time trying to copy and modify
>> net.refractions.udig.catalog.ui.search.SearchView,
>>   
> One possibility here is:
> 
> Location View is what you need hack up; what is needed is a search 
> plugin (so you can add new kinds of searches). But we have a policy of 
> not adding API until someone (ie you) ask for it on the list. Now I had 
> a customer ask for this last month but I have since switched 
> organizations and have lost touch. Let me drag up the API as I remember 
> it and we can talk about it on the list here ...
>> public interface Location {
>>     public List<SimpleFeature> search( String text, Envelope bbox, 
>> IProgressMonitor monitor )
>>             throws IOException;
>> }
> Not very complicated.
>> net.refractions.udig.catalog.ui.CatalogTreeViewer,
>> net.refractions.udig.catalog.internal.CatalogImpl but I am not getting
>> too
>> far. It appears that SearchView is not suitable for my purposes as it
>> does a
>> synchronous search on the on the IServices that are currently open in the
>> catalog while I need to do sent a query to my P2P network and
>> asynchronously
>> add found services to the catalog.
>>
>> Could anybody suggest how I should go about creating such a
>> P2PSearchView? Unfortunately I could find very little architectural
>> documents concerning uDig's catalog and you can get only so far by
>> reading concurrent OO code.
> That is fine; you need to create a *new* catalog; one that represents an 
> external source of IService and IGeoResource information. As people find 
> and select information from this catalog it will be added to the local
> one.
> 
> I have recast this idea of local and remote catalogs to be more clear in 
> uDig 1.2 (ie udig trunk). Here it is
> 
> ISearch <- IRepository <- ICatalog
> 
> Where:
> - ISearch represents a remote service you can search for spatial
> information
> - IRepository represents live connections to spatial information
>  -ICatalog - origional interface started off very pure but developed new 
> features over time (hense the need to seperate out the above two).
> 
> If you would like to look at an implementation - please review the 
> GoogleCatalog implementation - it is no longer included in the build 
> since google turned off their SOAP access which was used to populate the 
> database this thing connects to.
>>  Also SearchView seems to be using a lot of classes in internal packages
>> that I can't/shouldn't be using.
>>   
> Once again; if you see something you want to use let us know and we will 
> try and make it public for you. It is not worth making public api until 
> someone needs it enough to be willing to talk about it (the best public 
> API needs a couple of user stories to make it good anyways).
>> Thanks,
>> Leon
>>   
> Cheers,
> Jody
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
> 
> 

-- 
View this message in context: http://www.nabble.com/how-do-I-create-a-P2P-SearchView--tp20628583p20676048.html
Sent from the udig-devel mailing list archive at Nabble.com.



Back to the top