9 AEM As Cloud Service - Create OSGi Configurations - Part 1

Опубликовано: 25 Июнь 2021
на канале: AEM Tutorials
3,058
17

#CreateOSGiConfigOnCloud
This video helps to configure Osgi config on AEM As Cloud sdk locally.

OSGi is a fundamental element in the technology stack of AEM
OSGi specification: https://www.osgi.org/Specifications/H...


There are two ways create OSGi configurations
JSON formatted OSGi configuration files can be written by hand directly in the AEM project.
Generating OSGi Configurations using the AEM SDK Quickstart

OSGI Configuration

As mentioned above, OSGI configuration should be committed to source control rather than through the web console. Techniques to do so include:

Making the necessary changes on the developer’s local AEM environment with the AEM web console’s configuration manager and then exporting the results to the AEM project on the local file system
Creating the OSGI configuration manually in the AEM project on the local file system, the referencing the AEM console’s configuration manager for the property names.

What Changed?

1)You cannot modify directly
2) Old formats are superceded by new one format (old : .cfg., .config and as XML sling:OsgiConfig resource definitions| New: cfg.json)

OSGi configurations target OSGi components via their Persistent Identity (PID), which defaults to the OSGi component’s Java class name

For example, You have a project 'myproject', to provide OSGi configuration for an OSGi service implemented by class:

com.myproject.workflow.impl.EventWorkflow.java


/apps/example/config.@author|publish@.@dev|stage|prod@/com.myproject.workflow.impl.EventWorkflow.cfg.json


For dev author, it becomes
/apps/example/config.author.dev/com.myproject.workflow.impl.EventWorkflow.cfg.json


Types of OSGi Configuration Values
Inline values - Anything of type our own custom java package related configuration. For eg. "my_var1": "some value"
Secret values - when server secrets to be provided. For eg. "my_var2" : "$[env:my_var1]"
Environment-specific values - Where server details are to be fetched : vary between Development environment. For eg: "my_var3": $[secret:SECRET_VAR_NAME]


Variables names Restriction
Must be within range of 2 to 100 characters
Must match regex: [a-zA-Z_][a-zA-Z_0-9]*
Variables value Restriction
Values for the variables must not exceed 2048 characters.

Default Values

"my_var2" : "$[env:my_var1]";default=@value@]


use angle bracket in position of @



a text file named server_password must be created. All these secret files must be stored in the same directory and the framework property org.apache.felix.configadmin.plugin.interpolation.secretsdir must be configured with that local directory.

a simple bash script is written which sets the environment variables used in the configurations and to execute it before starting AEM


Смотрите видео 9 AEM As Cloud Service - Create OSGi Configurations - Part 1 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь AEM Tutorials 25 Июнь 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,058 раз и оно понравилось 17 людям.