Code Monkey home page Code Monkey logo

aem-osgi-annotation-demo's Introduction

AEM OSGi Declarative Services Annotations

This project demonstrates the basics of using the OSGi Declarative Services annotations along side the more familiar Felix SCR annotations.

Examples are given for both annotation styles in each of a servlet, service, filter, scheduler and an event handler / listener. These five examples are common AEM project requirements and the examples can be extrapolated out for anything else such as MBeans, Adapters, Workflow Process Steps, Replication Preprocessors, etc...

Note the service example creates the Configuration as a separate class while the other examples create the Configuration as a subclass.

View the associated blog post at http://www.nateyolles.com/blog/2017/05/osgi-declarative-services-annotations-in-aem.

How to build

This project has been built and tested in AEM 6.2.

To build all the modules run in the project root directory the following command with Maven 3:

mvn clean install

Or to deploy the bundle to the author, run

mvn clean install -PautoInstallBundle

Test

Below are a some cURL commands to help you test the components. Navigate to the Felix Configuration console to update component properties.

Servlets and Services

Make a GET request to the servlets which consume the services and respond back with plain text:

curl -u admin:admin http://localhost:4502/bin/felix
curl -u admin:admin http://localhost:4502/bin/osgi

Event Handler

Create a new node under /content and watch the logs:

curl -u admin:admin http://localhost:4502/content/foo -F"myproperty=bar"

Scheduler

View the logs to see the scheduler running every 60 seconds by default.

Filters

Make a request to a resouce under /content and watch the logs:

curl -u admin:admin http://localhost:4502/content/geometrixx/en/products/triangle.html

Maven settings

The project comes with the auto-public repository configured. To setup the repository in your Maven settings, refer to:

http://helpx.adobe.com/experience-manager/kb/SetUpTheAdobeMavenRepository.html

aem-osgi-annotation-demo's People

Contributors

nateyolles avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.