org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.resourceManagement
Class ResourceManager

java.lang.Object
  extended by org.gcube.portlets.admin.irbootstrapperportlet.gwt.server.resourceManagement.ResourceManager

public class ResourceManager
extends Object

Author:
Spyros Boutsis, NKUA

Constructor Summary
ResourceManager()
           
 
Method Summary
static String constructQueryExpressionForResource(Resource template)
          Constructs the IS query to be sent to the ISClient, describing the given resource.
static
<T extends Resource>
ResourceExpression<T>
generateExpressionForResourceTempate(T template, boolean ignoreTemplateAttributes)
          Creates a ResourceExpression object, which represents a query for resources matching the given template resource.
static org.gcube.common.core.resources.GCUBEGenericResource retrieveGenericResource(String resourceID, org.gcube.common.core.scope.GCUBEScope scope)
          Retrieves a specific generic resource from the IS and returns its payload as as string.
static
<T extends Resource>
List<T>
retrieveResourcesFromIS(ResourceExpression<T> resExpression)
          Retrieves all the resources in the given scope that match the given ResourceExpression.
static
<T extends Resource>
List<T>
retrieveResourcesFromIS(T template, boolean ignoreTemplateAttributes)
          Retrieves all the resources in the given scope that match the defined attributes of the resource given as a template.
static void updateGenericResource(org.gcube.common.core.resources.GCUBEGenericResource resource, org.gcube.common.core.scope.GCUBEScope scope)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceManager

public ResourceManager()
Method Detail

retrieveResourcesFromIS

public static <T extends Resource> List<T> retrieveResourcesFromIS(T template,
                                                                   boolean ignoreTemplateAttributes)
                                                        throws Exception
Retrieves all the resources in the given scope that match the defined attributes of the resource given as a template. The type of the returned resources is the same as that of the template. If the 'ignoreTemplateAttributes' parameter is set to true, then the attributes of the given template are not matched against the fetched resources. In this case, all resources whose type is that of the template are returned, regardless of their property values.

Type Parameters:
T -
Parameters:
template -
ignoreTemplateAttributes -
Returns:
Throws:
Exception

retrieveResourcesFromIS

public static <T extends Resource> List<T> retrieveResourcesFromIS(ResourceExpression<T> resExpression)
                                                        throws Exception
Retrieves all the resources in the given scope that match the given ResourceExpression.

Type Parameters:
T -
Parameters:
resExpression -
Returns:
Throws:
Exception

generateExpressionForResourceTempate

public static <T extends Resource> ResourceExpression<T> generateExpressionForResourceTempate(T template,
                                                                                              boolean ignoreTemplateAttributes)
                                                                                   throws Exception
Creates a ResourceExpression object, which represents a query for resources matching the given template resource. Once you create such an object, you can use it to retrieve resources through subsequent calls to retrieveResourcesFromIS(). It is highly recommended to use this technique when the same template will be used more than once for resource retrieval, because once the expression is generated, the retrieval will be a lot faster than using the form of retrieveResourcesFromIS() that does not accept a ResourceExpression many times.

Type Parameters:
T -
Parameters:
template -
ignoreTemplateAttributes -
Returns:
Throws:
Exception

constructQueryExpressionForResource

public static String constructQueryExpressionForResource(Resource template)
Constructs the IS query to be sent to the ISClient, describing the given resource. The query will contain sub-conditions for every attribute that has a value in the given resource.

Parameters:
template - the resource which to construct a query for
Returns:

retrieveGenericResource

public static org.gcube.common.core.resources.GCUBEGenericResource retrieveGenericResource(String resourceID,
                                                                                           org.gcube.common.core.scope.GCUBEScope scope)
                                                                                    throws Exception
Retrieves a specific generic resource from the IS and returns its payload as as string.

Parameters:
resourceID - the ID of the generic resource. If resourceID starts with '$', then the name of the generic resource follows instead of its ID.
Returns:
an object representing the generic resource
Throws:
Exception

updateGenericResource

public static void updateGenericResource(org.gcube.common.core.resources.GCUBEGenericResource resource,
                                         org.gcube.common.core.scope.GCUBEScope scope)
                                  throws Exception
Throws:
Exception


Copyright © 2013. All Rights Reserved.