Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[geclipse-dev] Get specific Services from info system

I have added one more method queryService. At this point I have implemented the two methods, queryServices and queryStorage. These methods don't just filter the results from the fetchServices and fetchComputing but instead it queries the ldap with specific/faster queries. The changes are not yet commited, I will do it tomorrow because of the tutorial.

The changes I made were almost trivial, that is why the implementation is done. Plus, I had almost finished bu the time I saw Mathias mail. The general fetchServices and fetchServices now call queryServices and queryStorage but pass some null arguments, thus forcing the query methods to get all existing services and storage. This way I didn't add two methods that are only used to retrieve the information that Mateusz needs.

Mathias solution looks indeed more extensible, but what troubles me is that services and storage elements are described by different glue schemas with different attributes, so we need to have code that  is specific for each one. (even if it is in one method/class). Moreover, I am reluctant to do a more complex/general implementation for something that is not needed and thus it will not be used. It might be needed in the future though.

I am waiting for your comments or thought.

Thanks,
Nick.

Stuempert, Mathias IWR wrote:
Hi Guys,

I have the feeling that we are currently discussing very specific use cases for a very general design pattern. I understand what Mateusz wants to have and I understand what Nick wants to provide. Nevertheless these are really special use cases. In my opinion we should not introduce one method for one use case but some very general new pattern. Therefore my suggestion would be something (but maybe not exactly since these are just the thoughts shooting to my brain):

class IGridInfoService {

[...]

  public IGridResource[] query( final Query params );

[...]

}

class Query {

  enum Field {
    NAME,
    HOST,
    SCHEME,
    [...]
  };

  private Class< T implements IGridResource > type;

  private Hashtable< Field, String > conditions;

  public Query( final Class< T implements IGridResource > type ) {
    [...]
  }

  public void addCondition( final Field field, final String value ) {
    this.conditions.put( field, value );
  }

  public boolean accept( final IGridResource resource ) {
    // This method will test if the specified resource does meet all 
    // conditions and can therefore directly be used by the info
    // service to filter all available resources
  }

}

As I said this is just a quick shot. But

1) It is much more general than providing a single method for each usecase.
2) It is easily extensible for future requirements.
3) It can also be extended to allow more complex boolean conditions like or'ing and not'ing etc.
4) It catches one central point of a info service, namely to provide the user with specific information out of a pool of general resources.
5) At least a very first version is straightforward to implement.

Cheers, Mathias


-----Ursprüngliche Nachricht-----
Von: geclipse-dev-bounces@xxxxxxxxxxx [mailto:geclipse-dev-bounces@xxxxxxxxxxx] Im Auftrag von Mateusz Pabis'
Gesendet: Mittwoch, 6. Februar 2008 08:37
An: Developer mailing list
Betreff: Re: [geclipse-dev] Get specific Services from info system

Nick Tsioutsias pisze:
  
Mateusz Pabis' wrote:
    
What I'm looking forward is to have an easy way to figure out what is 
the endpoint for the SRM service on host abc.somwhere.com.
      
I am thinking of adding the following method in the BDIIService class 
which is the info service for the projects with voms vo:

public IGridService[] queryService( final String serviceType,  // the 
type of the service for example SRM for srm 2.
                                                     final String 
hostName)  // the hostname.


The above method will return all the services with the specific 
serviceType that belong to the specific hostName and are supported by  
the  currentVO. If serviceType or hostName are null, they are not taken 
under account. For example by calling queryService(null, 
"plethon.grid.ucy.ac.cy") you will get all the two srm services of plethon.

You can get the endpoint of it with the following code:
IGridService[] resultArray;
resultArray = this.queryService( null, "plethon.grid.ucy.ac.cy" );
GridGlueService myService = (GridGlueService) resultArray[0];
String myEndpoint = myService.getGlueService().endpoint;

I don't think you will add any additional dependencies as 
GridGlueService is on eu.geclipse.info plugin and you should already a 
dependency to it. Is that satisfactory?
    
I need one more method, which is similar to this one, probably it looks 
like:
public IGridStorage queryStorage( final String hostname )

I need it, because only from storage I can get home directory, which is 
somehow essential to properly mount SRM service.

But this leads to the situation that I have to integrate these 
information in EFS plugin, which is not a problem, but I think it should 
be done somewhere between eu.geclipse.info and eu.geclipse.efs

  


Back to the top