com.sap.conn.jco

## Interface JCoCustomRepository

- All Superinterfaces:
    JCoRepository

      public interface JCoCustomRepository
      extends JCoRepository

  `JCoCustomRepository` is designed to be used for static/custom metadata. So, if an application works with its own definition of metadata, it can store them in a `JCoCustomRepository`.
  Each `JCoCustomRepository` has its own cache that won't be shared with other repository instances as it is the case with `JCoRepository` cache. Hence, the custom definition of metadata is available in one instance of `JCoCustomRepository` only.

  Furthermore, `JCoCustomRepository` allows to query data types containing generic structures (generic boxed components). Since the generic boxes vary depending on the SAP client, a standard `JCoRepository` always treats the generic structures as empty structures. The only way to handle generic boxed components via lookups is to use a `JCoCustomRepository`.

  Note: It is strongly recommended to make use of a repository connected to a back-end system to ensure the consistency of metadata. Only if you need to avoid additional repository connections or are working with a very limited set of function modules you should consider using a JCoCustomRepository.

  It is possible to define a destination and enable dynamic DDIC queries. The metadata fetched from an ABAP system is stored in the own cache of the `JCoCustomRepository`, and hence is mixed with the custom metadata already stored in the cache.

  The application may change the query type to achieve a specific behavior required in special scenarios.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `JCoCustomRepository.QueryMode` Enumeration that describes all modes to control the remote queries of a custom repository.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addClassMetaDataToCache(JCoClassMetaData meta)` Adds a class definition to the local cache.
    `void` | `addFunctionTemplateToCache(JCoFunctionTemplate meta)` Adds a function interface to the local cache.
    `void` | `addRecordMetaDataToCache(JCoRecordMetaData meta)` Adds a structure definition to the local cache.
    `void` | `setDestination(JCoDestination destination)` Set the destination for the remote queries.
    `void` | `setQueryMode(JCoCustomRepository.QueryMode queryMode)` Allow the application to control the repository query.

    - ### Methods inherited from interface com.sap.conn.jco.JCoRepository

      `clear, getCachedClassMetaDataNames, getCachedFunctionTemplateNames, getCachedRecordMetaDataNames, getClassMetaData, getFunction, getFunctionInterface, getFunctionTemplate, getMonitor, getName, getRecordMetaData, getRequest, getStructureDefinition, isUnicode, load, removeClassMetaDataFromCache, removeFunctionTemplateFromCache, removeRecordMetaDataFromCache, save`

- - ### Method Detail

    - #### addFunctionTemplateToCache

          void addFunctionTemplateToCache(JCoFunctionTemplate meta)

      Adds a function interface to the local cache.
      Implementations that do not use a cache just provide an empty method.
      Parameters:
        `meta` - the metadata of the interface to add to the cache

    - #### addRecordMetaDataToCache

          void addRecordMetaDataToCache(JCoRecordMetaData meta)

      Adds a structure definition to the local cache.
      Implementations that do not use a cache just provide an empty method.
      Parameters:
        `meta` - the metadata of a structure to add to the cache

    - #### addClassMetaDataToCache

          void addClassMetaDataToCache(JCoClassMetaData meta)

      Adds a class definition to the local cache.
      Implementations that do not use a cache just provide an empty method.
      Parameters:
        `meta` - the metadata of an ABAP class to add to the cache
      Since:
        JCo 3.0.10

    - #### setDestination

          void setDestination(JCoDestination destination)
                              throws JCoException,
                                     JCoRuntimeException

      Set the destination for the remote queries.

      If the requested metadata objects are not available in the repository cache, i.e. not set by the application, the remote query to the specified destination will be started.
      Default value is null meaning the remote queries are not allowed.

      Note: As soon the destination is provided, the repository can contain mixed metadata - set statically by the application and requested dynamically from the ABAP back-end.

      Parameters:
        `destination` - ABAP destination for remote queries
      Throws:
        `JCoException` - if the destination can not be initiated.
        `JCoRuntimeException` - on an illegal usage, see exception text

    - #### setQueryMode

          void setQueryMode(JCoCustomRepository.QueryMode queryMode)
                            throws JCoRuntimeException

      Allow the application to control the repository query.

      ABAP Systems from 6.10 onwards store metadata in unicode and non-unicode layout. A standard repository executes 2 remote queries to get the non-unicode and unicode enabled layout by default. If in a specific scenario the unicode layout is not required, it can be turned off by using the NON_UNICODE_LAYOUT_ONLY mode.
      Default value is ALL_AVAILABLE_LAYOUTS.

      Note: The query mode affects subsequent queries only. The cached metadata won't be changed. Use the remove APIs or clear the cache to force a new query.

      In very specific situations it is allowed to open maximal one connection. In such a situation repository must not use dedicated connections for queries. Set DISABLE_REPOSITORY_POOL mode in this case, before the destination is set.

      Parameters:
        `queryMode` - mode to control the remote queries
      Throws:
        `JCoRuntimeException` - on an illegal usage, see exception text

Copyright © 2020 SAP. All Rights Reserved.