Class ResourceRegistryContextClientImpl

  • All Implemented Interfaces:
    org.gcube.informationsystem.resourceregistry.api.request.RequestInfo, ResourceRegistryContextClient

    public class ResourceRegistryContextClientImpl
    extends org.gcube.informationsystem.resourceregistry.api.request.BaseRequestInfo
    implements ResourceRegistryContextClient
    Author:
    Luca Frosini (ISTI - CNR)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String address  
      protected org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache contextCache  
      protected org.gcube.informationsystem.resourceregistry.api.contexts.ContextCacheRenewal contextCacheRenewal  
      protected Map<String,​String> headers  
      • Fields inherited from class org.gcube.informationsystem.resourceregistry.api.request.BaseRequestInfo

        allMeta, DEFAULT_LIMIT, DEFAULT_OFFSET, hierarchicalMode, includeContexts, includeMeta, limit, offset, UNBOUNDED_LIMIT
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceRegistryContextClientImpl​(String address)
      This client does not use the shared context cache because it is used by managers to manipulate contexts.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addHeader​(String name, String value)  
      List<org.gcube.informationsystem.contexts.reference.entities.Context> all()  
      String create​(String context)  
      org.gcube.informationsystem.contexts.reference.entities.Context create​(org.gcube.informationsystem.contexts.reference.entities.Context context)  
      boolean delete​(String uuid)  
      boolean delete​(UUID uuid)  
      boolean delete​(org.gcube.informationsystem.contexts.reference.entities.Context context)  
      boolean exist​(String uuid)  
      boolean exist​(UUID uuid)  
      boolean existFromServer​(String uuid)  
      List<org.gcube.informationsystem.contexts.reference.entities.Context> getAllContextFromServer()
      It reads all the contexts from server.
      protected List<org.gcube.informationsystem.contexts.reference.entities.Context> getAllContextFromServer​(boolean includeMeta, Integer offset, Integer limit)  
      org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache getContextCache()  
      protected org.gcube.common.gxhttp.request.GXHTTPStringRequest getGXHTTPStringRequest()  
      protected String internalCreate​(org.gcube.informationsystem.contexts.reference.entities.Context context)  
      String internalUpdate​(org.gcube.informationsystem.contexts.reference.entities.Context context)  
      String read​(String uuid)  
      org.gcube.informationsystem.contexts.reference.entities.Context read​(UUID uuid)  
      org.gcube.informationsystem.contexts.reference.entities.Context read​(org.gcube.informationsystem.contexts.reference.entities.Context context)  
      org.gcube.informationsystem.contexts.reference.entities.Context readCurrentContext()  
      String readFromServer​(String uuid)  
      String update​(String context)  
      org.gcube.informationsystem.contexts.reference.entities.Context update​(org.gcube.informationsystem.contexts.reference.entities.Context context)  
      • Methods inherited from class org.gcube.informationsystem.resourceregistry.api.request.BaseRequestInfo

        allMeta, getLimit, getOffset, includeContexts, includeMeta, isHierarchicalMode, setAllMeta, setHierarchicalMode, setIncludeContexts, setIncludeMeta, setLimit, setOffset
    • Field Detail

      • address

        protected final String address
      • contextCache

        protected org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache contextCache
      • contextCacheRenewal

        protected org.gcube.informationsystem.resourceregistry.api.contexts.ContextCacheRenewal contextCacheRenewal
    • Constructor Detail

      • ResourceRegistryContextClientImpl

        public ResourceRegistryContextClientImpl​(String address)
        This client does not use the shared context cache because it is used by managers to manipulate contexts. The shared cache has only minimal context information available to any users.
        Parameters:
        address -
    • Method Detail

      • getGXHTTPStringRequest

        protected org.gcube.common.gxhttp.request.GXHTTPStringRequest getGXHTTPStringRequest()
      • getAllContextFromServer

        public List<org.gcube.informationsystem.contexts.reference.entities.Context> getAllContextFromServer()
                                                                                                      throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        It reads all the contexts from server. The cache used for contexts is bypassed and not updated.
        Returns:
        All Contexts read from server
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • getAllContextFromServer

        protected List<org.gcube.informationsystem.contexts.reference.entities.Context> getAllContextFromServer​(boolean includeMeta,
                                                                                                                Integer offset,
                                                                                                                Integer limit)
                                                                                                         throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • all

        public List<org.gcube.informationsystem.contexts.reference.entities.Context> all()
                                                                                  throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        all in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • internalCreate

        protected String internalCreate​(org.gcube.informationsystem.contexts.reference.entities.Context context)
                                 throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextAlreadyPresentException,
                                        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextAlreadyPresentException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • create

        public org.gcube.informationsystem.contexts.reference.entities.Context create​(org.gcube.informationsystem.contexts.reference.entities.Context context)
                                                                               throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextAlreadyPresentException,
                                                                                      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        create in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextAlreadyPresentException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • create

        public String create​(String context)
                      throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextAlreadyPresentException,
                             org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        create in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextAlreadyPresentException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • existFromServer

        public boolean existFromServer​(String uuid)
                                throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                                       org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • exist

        public boolean exist​(String uuid)
                      throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        exist in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • exist

        public boolean exist​(UUID uuid)
                      throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        exist in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • read

        public org.gcube.informationsystem.contexts.reference.entities.Context read​(org.gcube.informationsystem.contexts.reference.entities.Context context)
                                                                             throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                                                                                    org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        read in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • read

        public org.gcube.informationsystem.contexts.reference.entities.Context read​(UUID uuid)
                                                                             throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                                                                                    org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        read in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • readCurrentContext

        public org.gcube.informationsystem.contexts.reference.entities.Context readCurrentContext()
                                                                                           throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                                                                                                  org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        readCurrentContext in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • read

        public String read​(String uuid)
                    throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                           org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        read in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • readFromServer

        public String readFromServer​(String uuid)
                              throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                                     org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • internalUpdate

        public String internalUpdate​(org.gcube.informationsystem.contexts.reference.entities.Context context)
                              throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                                     org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • update

        public org.gcube.informationsystem.contexts.reference.entities.Context update​(org.gcube.informationsystem.contexts.reference.entities.Context context)
                                                                               throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                                                                                      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        update in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • update

        public String update​(String context)
                      throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                             org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        update in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • delete

        public boolean delete​(org.gcube.informationsystem.contexts.reference.entities.Context context)
                       throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                              org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        delete in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • delete

        public boolean delete​(UUID uuid)
                       throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                              org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        delete in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      • delete

        public boolean delete​(String uuid)
                       throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException,
                              org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Specified by:
        delete in interface ResourceRegistryContextClient
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException