Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-52 Add com.adobe.aio.aem.event.management a Java OSGI bundle hosting OSGI Components wrapping aio-lib-java-events-mgmt #53

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This project is the multi-modules project hosting Adobe I/O Events and AEM conne
* [`com.adobe.aio.aem.core`](./core_aem) is a Java OSGI bundle hosting OSGI Components wrapping [`aio-lib-java-core`](../core) and [`aio-lib-java-ims`](../ims)
* [`com.adobe.aio.aem.event.management`](./events_mgmt_aem) is a Java OSGI bundle hosting OSGI Components wrapping [`aio-lib-java-events-mgmt`](../events_mgmt_aem)
* [`com.adobe.aio.aem.event.publish`](./events_ingress_aem) is a Java OSGI bundle hosting OSGI Components wrapping [`aio-lib-java-events-ingress`](../events_ingress)
* [`aio-aem-events`](./aio-aem-events)] is an AEM package containing all the OSGI bundles listed above, with their default configuration, enabling AEM and Adobe I/O Events integration.
* [`aio-aem-events`](./aio-aem-events) is an AEM package containing all the OSGI bundles listed above, with their default configuration, enabling AEM and Adobe I/O Events integration.

## Builds

Expand Down
20 changes: 20 additions & 0 deletions aem/events_mgmt_aem/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# `com.adobe.aio.aem.event.management`

`com.adobe.aio.aem.event.management` is a Java OSGI bundle hosting OSGI Components
wrapping [`aio-lib-java-events-mgmt`](../../events_mgmt_aem)

## Builds

This Library is build with [maven](https://maven.apache.org/)

### Contributing

Contributions are welcomed! Read the [Contributing Guide](../.github/CONTRIBUTING.md) for more
information.

### Licensing

This project is licensed under the Apache V2 License. See [LICENSE](../LICENSE.md) for more
information.


191 changes: 191 additions & 0 deletions aem/events_mgmt_aem/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2017 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.

-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>aio-aem</artifactId>
<groupId>com.adobe</groupId>
<relativePath>../pom.xml</relativePath>
<version>0.0.13-SNAPSHOT</version>
</parent>

<artifactId>com.adobe.aio.aem.event.management</artifactId>
<name>Adobe I/O - AEM Events Management - OSGI bundle</name>
<description>Adobe I/O - AEM Events Management - OSGI bundle</description>

<dependencies>
<dependency>
<artifactId>com.adobe.aio.aem.core</artifactId>
<groupId>com.adobe</groupId>
<scope>provided</scope>
<version>${project.version}</version>
</dependency>
<dependency>
<artifactId>aio-lib-java-events-mgmt</artifactId>
<groupId>com.adobe</groupId>
<scope>provided</scope>
<version>${project.version}</version>
</dependency>

<!-- AEM related -->
<dependency>
<artifactId>uber-jar</artifactId>
<classifier>apis</classifier>
<groupId>com.adobe.aem</groupId>
</dependency>
<dependency>
<artifactId>org.apache.sling.servlets.annotations</artifactId>
<groupId>org.apache.sling</groupId>
</dependency>
<dependency>
<artifactId>jcr</artifactId>
<groupId>javax.jcr</groupId>
</dependency>
<!-- osgi -->
<dependency>
<artifactId>org.osgi.service.metatype.annotations</artifactId>
<groupId>org.osgi</groupId>
</dependency>
<dependency>
<artifactId>org.osgi.service.component.annotations</artifactId>
<groupId>org.osgi</groupId>
</dependency>
<dependency>
<artifactId>org.osgi.service.component</artifactId>
<groupId>org.osgi</groupId>
</dependency>
<dependency>
<artifactId>org.osgi.service.cm</artifactId>
<groupId>org.osgi</groupId>
</dependency>
<dependency>
<artifactId>org.osgi.framework</artifactId>
<groupId>org.osgi</groupId>
</dependency>
<dependency>
<artifactId>org.osgi.annotation.versioning</artifactId>
<groupId>org.osgi</groupId>
</dependency>
<!-- EOF AEM related -->

<!-- various -->
<dependency>
<artifactId>javax.servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</dependency>
<dependency>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</dependency>
<dependency>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</dependency>
<dependency>
<artifactId>commons-text</artifactId>
<groupId>org.apache.commons</groupId>
</dependency>
<dependency>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</dependency>

<!-- test -->
<dependency>
<artifactId>junit-dep</artifactId>
<groupId>junit</groupId>
</dependency>
<dependency>
<artifactId>slf4j-simple</artifactId>
<groupId>org.slf4j</groupId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>sling-maven-plugin</artifactId>
<groupId>org.apache.sling</groupId>
</plugin>
<plugin>
<artifactId>bnd-maven-plugin</artifactId>
<dependencies>
<dependency>
<artifactId>org.apache.sling.caconfig.bnd-plugin</artifactId>
<groupId>org.apache.sling</groupId>
<version>1.0.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<configuration>
<bnd><![CDATA[
Bundle-Category: aio
Bundle-Vendor: Adobe
Bundle-SymbolicName: ${project.artifactId}
Import-Package: javax.annotation;version=0.0.0,com.fasterxml.jackson.*;version="[2.3.0, 3.0.0)",*
-exportcontents: ${packages;VERSIONED}
Export-Package: com.adobe.aio.aem.event.management
-snapshot: ${tstamp;yyyyMMddHHmmssSSS}
Bundle-DocURL:
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
]]></bnd>
</configuration>
<goals>
<goal>bnd-process</goal>
</goals>
<id>bnd-process</id>
</execution>
</executions>
<groupId>biz.aQute.bnd</groupId>
</plugin>
<plugin>
<artifactId>bnd-baseline-maven-plugin</artifactId>
<configuration>
<failOnMissing>false</failOnMissing>
</configuration>
<executions>
<execution>
<goals>
<goal>baseline</goal>
</goals>
<id>baseline</id>
</execution>
</executions>
<groupId>biz.aQute.bnd</groupId>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
</plugins>

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2017 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.adobe.aio.aem.event.management;

import com.adobe.aio.event.management.model.EventMetadata;

public class EventMetadataStatus {

private final EventMetadata configuredEventMetadata;
private final EventMetadata registeredEventMetadata;
private final Throwable error;

public EventMetadataStatus(final EventMetadataSupplier eventMetadataSupplier) {
configuredEventMetadata = eventMetadataSupplier.getConfiguredEventMetadata();
registeredEventMetadata = eventMetadataSupplier.getRegisteredEventMetadata();
error = eventMetadataSupplier.getError();
}

public EventMetadata getConfiguredEventMetadata() {
return configuredEventMetadata;
}

public boolean isUp() {
return (error == null && configuredEventMetadata != null && registeredEventMetadata != null);
}

public EventMetadata getRegisteredEventMetadata() {
return registeredEventMetadata;
}

public String getError() {
if (error != null) {
return error.getClass().getSimpleName() + ":" + error.getMessage();
} else {
return null;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2017 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.adobe.aio.aem.event.management;

import com.adobe.aio.aem.status.Status;
import com.adobe.aio.aem.status.StatusServlet;
import javax.servlet.Servlet;
import org.apache.sling.servlets.annotations.SlingServletPaths;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

@Component(immediate = true, service = Servlet.class)
@SlingServletPaths("/bin/aio/event_metadata.json")
public class EventMetadataStatusServlet extends StatusServlet {

@Reference
private EventMetadataStatusSupplier eventMetadataSupplier;

@Override
public Status getStatus() {
return eventMetadataSupplier.getStatus();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2017 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.adobe.aio.aem.event.management;


import com.adobe.aio.aem.status.StatusSupplier;

public interface EventMetadataStatusSupplier extends StatusSupplier {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2017 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.adobe.aio.aem.event.management;

import com.adobe.aio.event.management.model.EventMetadata;

public interface EventMetadataSupplier {

/**
* defined in aio-evem-events package default osgi cfg.json file: com.adobe.io.event.management.internal.EventMetadataSupplierImpl-ping.cfg.json
*/
String PING_EVENT_CODE = "ping";

EventMetadata getRegisteredEventMetadata();

EventMetadata getConfiguredEventMetadata();

Throwable getError();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2017 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.adobe.aio.aem.event.management;

import com.adobe.aio.aem.status.Status;
import com.adobe.aio.aem.status.StatusServlet;
import javax.servlet.Servlet;
import org.apache.sling.servlets.annotations.SlingServletPaths;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

@Component(immediate = true, service = Servlet.class)
@SlingServletPaths("/bin/aio/provider_config.json")
public class EventProviderConfigStatusServlet extends StatusServlet {

@Reference
private EventProviderConfigSupplier eventProviderInputModelSupplier;

@Override
public Status getStatus() {
return eventProviderInputModelSupplier.getStatus();
}
}

Loading