git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@90987 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ba0938b2d0
commit
4a3ff9a531
|
@ -142,7 +142,10 @@ public class GenericResource implements GenericResourceInfoI {
|
||||||
*/
|
*/
|
||||||
protected List<ISGenericResource> getGenericResource(QueryString query)
|
protected List<ISGenericResource> getGenericResource(QueryString query)
|
||||||
{
|
{
|
||||||
return (List<ISGenericResource>) (CachesManager.getInstance().getGenericResourceCache().get(query).getValue());
|
List<ISGenericResource> resList = (List<ISGenericResource>) (CachesManager.getInstance().getGenericResourceCache().get(query).getValue());
|
||||||
|
if(resList.isEmpty())
|
||||||
|
logger.debug("no generic resources in cache "+query.get("name"));
|
||||||
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -344,7 +347,7 @@ public class GenericResource implements GenericResourceInfoI {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list containing pairs of (name, id) of the available generic resources
|
* @return a list containing all generic resources
|
||||||
* @throws RemoteException when an error has occurred while communicating with IS
|
* @throws RemoteException when an error has occurred while communicating with IS
|
||||||
*/
|
*/
|
||||||
public List<org.gcube.common.resources.gcore.GenericResource> getAllGenericResources() throws RemoteException {
|
public List<org.gcube.common.resources.gcore.GenericResource> getAllGenericResources() throws RemoteException {
|
||||||
|
@ -462,18 +465,21 @@ public class GenericResource implements GenericResourceInfoI {
|
||||||
query.put(CacheEntryConstants.vre, getDLName());
|
query.put(CacheEntryConstants.vre, getDLName());
|
||||||
return getGenericResource(query);
|
return getGenericResource(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name the name of the generic resource
|
* @param name the name of the generic resource
|
||||||
* @return a list containing the generic resources that have as name the given
|
* @return a list containing the generic resources that have as name the given
|
||||||
* @throws RemoteException when an error has occurred while communicating with IS
|
* @throws RemoteException when an error has occurred while communicating with IS
|
||||||
*/
|
*/
|
||||||
public List<ISGenericResource> getGenericResourceByName(String name)
|
public List<ISGenericResource> getGenericResourceByName(String name) throws RemoteException{
|
||||||
throws RemoteException {
|
//caching is done by (id,vre) as key pairs. so we cannot use cache to retrieve objects.
|
||||||
QueryString query = new QueryString();
|
List<org.gcube.common.resources.gcore.GenericResource> allRes = getAllGenericResources();
|
||||||
query.put(CacheEntryConstants.name, name);
|
List<ISGenericResource> results = new ArrayList<ISGenericResource>();
|
||||||
query.put(CacheEntryConstants.vre, getDLName());
|
for(org.gcube.common.resources.gcore.GenericResource res : allRes)
|
||||||
return getGenericResource(query);
|
if(res.profile().name().equalsIgnoreCase(name))
|
||||||
|
results.add(new ISGenericResource(res.id(),res.profile().name(),res.profile().description(),res.profile().bodyAsString(),res.profile().type()));
|
||||||
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue