Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleSample using get-service.i
DEFINE VARIABLE oSettingsService AS Consultingwerk.Framework.ISettingsService NO-UNDO .
       
oSettingsService = {Consultingwerk/get-service.i Consultingwerk.Framework.ISettingsService} .

 

The get-service.i Include file uses the Progress.Lang.Class:GetClass() method up to OpenEdge 11.3 and the GET-CLASS function from OpenEdge 11.4 on. For this reason it is required to pass the full type name (not relying on any USING statement) up to OpenEdge 11.3. 

Adding Services to the Service Container

...

Code Block
titleSample loading Services from services.xml using ServiceLoader
USING Consultingwerk.Framework.* FROM PROPATH .

/* Load services using ServiceLoader */
DEFINE VARIABLE oLoader AS ServiceLoader NO-UNDO .
  
oLoader = NEW ServiceLoader () .
oLoader:Load ("Consultingwerk/SmartComponentsDemo/CustomerExplorer/services.xml":U) .  

 

The services.xml file has the following form: 

Code Block
languagexml
titleSample services.xml file
<?xml version="1.0"?>
<ttServiceLoader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ttServiceLoaderRow>
    <Order>1</Order>
    <ServiceTypeName>Consultingwerk.OERA.Context.IContextDatasetFactory</ServiceTypeName>
    <ServiceClassName>Consultingwerk.OERA.Context.ContextDatasetFactory</ServiceClassName>
  </ttServiceLoaderRow>

  <ttServiceLoaderRow>
    <Order>2</Order>
    <ServiceTypeName>Consultingwerk.RollbaseAdapter.IRollbaseCredentials</ServiceTypeName>
    <ServiceClassName>Consultingwerk.RollbaseAdapter.RollbaseCredentials</ServiceClassName>
  </ttServiceLoaderRow>
   
</ttServiceLoader>

...

At first request through IServiceCreator callback

Planned feature, see SCL-573.

In a future enhancemet we will implement a callback to a factory class to support lazy loading of services or loading of services with specific constructor parametersSee IServiceCreator factories to create Service instances at first usage for detailled instructions.

Related documentation

...