org.gcube.portlets.admin.resourcemanagement.server
Class ServiceProxyImpl

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
              extended by com.google.gwt.user.server.rpc.RemoteServiceServlet
                  extended by org.gcube.portlets.admin.resourcemanagement.server.ServiceProxyImpl
All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, ServiceProxy

public class ServiceProxyImpl
extends com.google.gwt.user.server.rpc.RemoteServiceServlet
implements ServiceProxy

Author:
Daniele Strollo, Massimiliano Assante (ISTI-CNR)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse
 
Constructor Summary
ServiceProxyImpl()
           
 
Method Summary
 org.gcube.resourcemanagement.support.shared.types.Tuple<String> addResourcesToScope(String resType, List<String> resourceIDs, String scope)
           
 org.gcube.resourcemanagement.support.shared.types.Tuple<String> checkDeployStatus(String scope, String deployID)
           
 String createGenericResource(String ID, String name, String description, String body, String subType)
           
 String deploy(List<String> ghnsID, List<String> servicesID)
           
 void doOperation(org.gcube.resourcemanagement.support.shared.operations.SupportedOperations opCode, String scope, List<org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor> resources)
          RESOURCE OPERATIONS
 void emptyCache()
           
 List<String> getAvailableAddScopes()
           
 List<String> getAvailableScopes()
           
 org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor getGenericResourceDescriptor(String scope, String resID)
          Used for generic resource editing form to retrieve the profile.
 Map<String,org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin> getGenericResourcePlugins()
           
 List<String> getRelatedResources(String type, String id, String scope)
          Given a type retrieves its related resources.
 org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile getResourceByID(String scope, String type, String resID)
          Retrieves the XML profiles and its HTML representation of a resource given its unique identifier and its type.
 List<String> getResourcesBySubType(String scope, String type, String subtype)
          Filters the resources in a given scope by their type and subtype.
 List<String> getResourcesByType(String scope, String type)
          For a given type returns all the resources defined in the IS having the chosen type.
 List<org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor> getResourcesModel(String scope, String type, String subType, List<org.gcube.resourcemanagement.support.shared.types.Tuple<String>> additionalMaps)
           
 HashMap<String,ArrayList<String>> getResourceTypeTree(String scope)
          Given a scope, provides the set of (Type, SubType) couples defining resources in the system.
 List<String> getWSResources(String scope)
          Returns the list of WSResources
 void initScopes(boolean doClean)
           
 org.gcube.resourcemanagement.support.client.utils.CurrentStatus initStatus()
          Called by portlet at module instantiation
 org.gcube.resourcemanagement.support.shared.types.Tuple<String> removeResourcesFromScope(String resType, List<String> resourceIDs, String scope)
          REMOVE FROM SCOPE
 void setCurrentScope(String scope)
          This way the servlet stores the scope in the session.
 void setSuperUser(boolean superUser)
           
 void setUseCache(boolean flag)
           
 void updateGenericResource(String ID, String name, String description, String body, String subType)
           
 
Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
checkPermutationStrongName, doGetSerializationPolicy, getSerializationPolicy, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processPost, shouldCompressResponse
 
Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost, doUnexpectedFailure, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceProxyImpl

public ServiceProxyImpl()
Method Detail

emptyCache

public final void emptyCache()
Specified by:
emptyCache in interface ServiceProxy

setUseCache

public final void setUseCache(boolean flag)
Specified by:
setUseCache in interface ServiceProxy

setSuperUser

public final void setSuperUser(boolean superUser)
Specified by:
setSuperUser in interface ServiceProxy

initStatus

public final org.gcube.resourcemanagement.support.client.utils.CurrentStatus initStatus()
Called by portlet at module instantiation

Specified by:
initStatus in interface ServiceProxy

initScopes

public final void initScopes(boolean doClean)
Specified by:
initScopes in interface ServiceProxy

addResourcesToScope

public final org.gcube.resourcemanagement.support.shared.types.Tuple<String> addResourcesToScope(String resType,
                                                                                                 List<String> resourceIDs,
                                                                                                 String scope)
                                                                                          throws Exception
Specified by:
addResourcesToScope in interface ServiceProxy
Returns:
the xml representation of the generated report (if not failed). it is a tuple consisting of:
0) the reportID
1) the resourceType
2) the xmlrepresentation
3) the html representation
Throws:
Exception

removeResourcesFromScope

public final org.gcube.resourcemanagement.support.shared.types.Tuple<String> removeResourcesFromScope(String resType,
                                                                                                      List<String> resourceIDs,
                                                                                                      String scope)
                                                                                               throws Exception
REMOVE FROM SCOPE

Specified by:
removeResourcesFromScope in interface ServiceProxy
Throws:
Exception

deploy

public final String deploy(List<String> ghnsID,
                           List<String> servicesID)
                    throws Exception
Specified by:
deploy in interface ServiceProxy
Throws:
Exception

checkDeployStatus

public final org.gcube.resourcemanagement.support.shared.types.Tuple<String> checkDeployStatus(String scope,
                                                                                               String deployID)
                                                                                        throws Exception
Specified by:
checkDeployStatus in interface ServiceProxy
Throws:
Exception

getAvailableScopes

public final List<String> getAvailableScopes()
Specified by:
getAvailableScopes in interface ServiceProxy
Returns:
the list of all available scopes.

getAvailableAddScopes

public final List<String> getAvailableAddScopes()
Specified by:
getAvailableAddScopes in interface ServiceProxy

getResourceTypeTree

public final HashMap<String,ArrayList<String>> getResourceTypeTree(String scope)
                                                            throws Exception
Description copied from interface: ServiceProxy
Given a scope, provides the set of (Type, SubType) couples defining resources in the system. The key of returned hashmap is the type and the associated value is a list of string representing its related sub-types.

Specified by:
getResourceTypeTree in interface ServiceProxy
Parameters:
scope - the scope of resources
Returns:
the hash of (type, list(subtypes))
Throws:
Exception
See Also:
org.gcube.portlets.admin.resourcemanagement.server.gcube.services.ISClientRequester#getResourcesTypes(org.gcube.common.core.scope.GCUBEScope)

getRelatedResources

public final List<String> getRelatedResources(String type,
                                              String id,
                                              String scope)
Description copied from interface: ServiceProxy
Given a type retrieves its related resources. E.g. for GHN returns the RunningInstances on it.

Specified by:
getRelatedResources in interface ServiceProxy
Returns:

getResourcesByType

public final List<String> getResourcesByType(String scope,
                                             String type)
Description copied from interface: ServiceProxy
For a given type returns all the resources defined in the IS having the chosen type.

Specified by:
getResourcesByType in interface ServiceProxy
Parameters:
scope - the scope of resources
type - the type of searched resources (e.g. GHN, RunningInstance, ...)
Returns:
list of XML profiles of resources found

getGenericResourceDescriptor

public final org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor getGenericResourceDescriptor(String scope,
                                                                                                                         String resID)
                                                                                                                  throws Exception
Description copied from interface: ServiceProxy
Used for generic resource editing form to retrieve the profile.

Specified by:
getGenericResourceDescriptor in interface ServiceProxy
Returns:
Throws:
Exception

getResourcesModel

public final List<org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor> getResourcesModel(String scope,
                                                                                                                    String type,
                                                                                                                    String subType,
                                                                                                                    List<org.gcube.resourcemanagement.support.shared.types.Tuple<String>> additionalMaps)
                                                                                                             throws Exception
Specified by:
getResourcesModel in interface ServiceProxy
Throws:
Exception

getWSResources

public final List<String> getWSResources(String scope)
Description copied from interface: ServiceProxy
Returns the list of WSResources

Specified by:
getWSResources in interface ServiceProxy
Parameters:
scope - the scope of resources
Returns:
list of XML profiles of resources found

getResourcesBySubType

public final List<String> getResourcesBySubType(String scope,
                                                String type,
                                                String subtype)
Description copied from interface: ServiceProxy
Filters the resources in a given scope by their type and subtype. For example it allows to retrieve in a scope all the GHN (type) defined in a domain (its subtype).

Specified by:
getResourcesBySubType in interface ServiceProxy
Parameters:
scope - the scope of resources
type - the type of searched resources (e.g. GHN, RunningInstance, ...)
subtype - the subtype of search resources (e.g. for GHN is its domain).
Returns:
list of XML profiles of resources found

getResourceByID

public final org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile getResourceByID(String scope,
                                                                                                                 String type,
                                                                                                                 String resID)
Description copied from interface: ServiceProxy
Retrieves the XML profiles and its HTML representation of a resource given its unique identifier and its type. Notice that the ID is ensured to be unique for resources of the same type.

Specified by:
getResourceByID in interface ServiceProxy
Parameters:
scope - the scope of the resource
type - the type of the searched resource (e.g. GHN, RunningInstance, ...)
resID - the unique identifier of the resource
Returns:
a couple of strings (XMLProfile, HTMLProfileRepresentation)

createGenericResource

public final String createGenericResource(String ID,
                                          String name,
                                          String description,
                                          String body,
                                          String subType)
                                   throws Exception
Specified by:
createGenericResource in interface ServiceProxy
Throws:
Exception

updateGenericResource

public final void updateGenericResource(String ID,
                                        String name,
                                        String description,
                                        String body,
                                        String subType)
                                 throws Exception
Specified by:
updateGenericResource in interface ServiceProxy
Throws:
Exception

setCurrentScope

public final void setCurrentScope(String scope)
Description copied from interface: ServiceProxy
This way the servlet stores the scope in the session.

Specified by:
setCurrentScope in interface ServiceProxy

getGenericResourcePlugins

public final Map<String,org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin> getGenericResourcePlugins()
                                                                                                                      throws Exception
Specified by:
getGenericResourcePlugins in interface ServiceProxy
Throws:
Exception

doOperation

public final void doOperation(org.gcube.resourcemanagement.support.shared.operations.SupportedOperations opCode,
                              String scope,
                              List<org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor> resources)
                       throws Exception
RESOURCE OPERATIONS

Specified by:
doOperation in interface ServiceProxy
Throws:
InvalidParameterException
Exception


Copyright © 2013. All Rights Reserved.