You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gg...@apache.org on 2021/02/16 09:36:54 UTC
[karaf] 02/02: Revert "[KARAF-6434] Add CDI example" - it required
OSGi Core R7 (Felix 6)
This is an automated email from the ASF dual-hosted git repository.
ggrzybek pushed a commit to branch karaf-4.2.x
in repository https://gitbox.apache.org/repos/asf/karaf.git
commit 729b2fbd59894606efbf21e791c8e72da4064dd0
Author: Grzegorz Grzybek <gr...@gmail.com>
AuthorDate: Tue Feb 16 10:35:46 2021 +0100
Revert "[KARAF-6434] Add CDI example" - it required OSGi Core R7 (Felix 6)
This reverts commit c93475a7258b69b178e9821a253455358f9668a8.
---
.../features/standard/src/main/feature/feature.xml | 1 -
examples/karaf-cdi-example/README.md | 68 ---------------
.../karaf-cdi-example-consumer/pom.xml | 74 ----------------
.../examples/cdi/consumer/MyConsumerBean.java | 37 --------
.../karaf-cdi-example-features/pom.xml | 99 ----------------------
.../src/main/feature/feature.xml | 33 --------
.../karaf-cdi-example-provider/pom.xml | 69 ---------------
.../karaf/examples/cdi/provider/MyServiceBean.java | 30 -------
examples/karaf-cdi-example/pom.xml | 41 ---------
examples/pom.xml | 2 +-
.../karaf/itests/examples/CdiExampleTest.java | 41 ---------
11 files changed, 1 insertion(+), 494 deletions(-)
diff --git a/assemblies/features/standard/src/main/feature/feature.xml b/assemblies/features/standard/src/main/feature/feature.xml
index 50544af..69ae837 100644
--- a/assemblies/features/standard/src/main/feature/feature.xml
+++ b/assemblies/features/standard/src/main/feature/feature.xml
@@ -112,7 +112,6 @@ pax-wicket=mvn:org.ops4j.pax.wicket/pax-wicket-features/RELEASE/xml/features
ecf=http://download.eclipse.org/rt/ecf/RELEASE/site.p2/karaf-features.xml
decanter=mvn:org.apache.karaf.decanter/apache-karaf-decanter/RELEASE/xml/features
eclipsesource-jaxrs=mvn:com.eclipsesource.jaxrs/features/RELEASE/xml/features
-aries-cdi=mvn:org.apache.aries.cdi/aries-cdi-feature/RELEASE/xml/features
aries-jpa=mvn:org.apache.aries.jpa/jpa-features/RELEASE/xml/features
aries-rsa=mvn:org.apache.aries.rsa/rsa-features/RELEASE/xml/features
hibernate=mvn:org.hibernate/hibernate-osgi/RELEASE/xml/karaf
diff --git a/examples/karaf-cdi-example/README.md b/examples/karaf-cdi-example/README.md
deleted file mode 100644
index 35b7f90..0000000
--- a/examples/karaf-cdi-example/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- 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 CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-# Apache Karaf CDI Example
-
-## Abstract
-
-It's possible to use CDI in your applications, including sharing bean between bundles using the Karaf service registry.
-
-In addition of supporting the regular CDI annotations (`@ApplicationScoped`, `@Inject`, etc), Karaf CDI also supports
-couple of new OSGi CDI annotations: `@Service` and `@Reference`.
-
-In this example, we are using Aries CDI and OpenWebBeans as CDI container.
-
-## Artifacts
-
-* `karaf-cdi-example-provider` provides an application scope bean and using the `@Service` annotation to register the bean in the Karaf service registry (can be used in another bundle).
-* `karaf-cdi-example-consumer` creates another bean and inject the provider bean from the registry (thanks to the `@Reference` annotation).
-* `karaf-cdi-example-features` provides a Karaf features XML to easily install the example application.
-
-##Build
-
-Simply use:
-
-```
-mvn clean install
-```
-
-##Feature and Deployment
-
-On a running Karaf instance, you register the CDI example features repository with:
-
-```
-karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-cdi-example-features/LATEST/xml
-```
-
-Then you can install the `karaf-cdi-example-provider` feature:
-
-```
-karaf@root()> feature:install karaf-cdi-example-provider
-```
-
-Then, you can install the `karaf-cdi-example-consumer` feature:
-
-```
-karaf@root()> feature:install karaf-cdi-example-consumer
-```
-
-When you install the consumer feature, you will see:
-
-```
-Hello world
-```
\ No newline at end of file
diff --git a/examples/karaf-cdi-example/karaf-cdi-example-consumer/pom.xml b/examples/karaf-cdi-example/karaf-cdi-example-consumer/pom.xml
deleted file mode 100644
index acad1ae..0000000
--- a/examples/karaf-cdi-example/karaf-cdi-example-consumer/pom.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file 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 CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.karaf.examples</groupId>
- <artifactId>karaf-cdi-example</artifactId>
- <version>4.2.11-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>karaf-cdi-example-consumer</artifactId>
- <name>Apache Karaf :: Examples :: CDI :: Consumer</name>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.karaf.examples</groupId>
- <artifactId>karaf-cdi-example-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.cdi</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <version>1.2</version>
- </dependency>
- <dependency>
- <groupId>jakarta.enterprise</groupId>
- <artifactId>jakarta.enterprise.cdi-api</artifactId>
- <version>2.0.2</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <!-- Waiting https://issues.apache.org/jira/browse/FELIX-6337 -->
- <version>4.2.1</version>
- <configuration>
- <instructions>
- <_cdiannotations>*;discover=annotated</_cdiannotations>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/examples/karaf-cdi-example/karaf-cdi-example-consumer/src/main/java/org/apache/karaf/examples/cdi/consumer/MyConsumerBean.java b/examples/karaf-cdi-example/karaf-cdi-example-consumer/src/main/java/org/apache/karaf/examples/cdi/consumer/MyConsumerBean.java
deleted file mode 100644
index c8ef478..0000000
--- a/examples/karaf-cdi-example/karaf-cdi-example-consumer/src/main/java/org/apache/karaf/examples/cdi/consumer/MyConsumerBean.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file 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 CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.examples.cdi.consumer;
-
-import org.apache.karaf.examples.cdi.provider.MyServiceBean;
-import org.osgi.service.cdi.annotations.Reference;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.Initialized;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
-
-@ApplicationScoped
-public class MyConsumerBean {
-
- @Reference
- @Inject
- private MyServiceBean service;
-
- public void onStart(@Observes @Initialized(ApplicationScoped.class) Object start) {
- System.out.println(service.greeting("world"));
- }
-
-}
diff --git a/examples/karaf-cdi-example/karaf-cdi-example-features/pom.xml b/examples/karaf-cdi-example/karaf-cdi-example-features/pom.xml
deleted file mode 100644
index dfd68c4..0000000
--- a/examples/karaf-cdi-example/karaf-cdi-example-features/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file 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 CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.karaf.examples</groupId>
- <artifactId>karaf-cdi-example</artifactId>
- <version>4.2.11-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>karaf-cdi-example-features</artifactId>
- <packaging>pom</packaging>
- <name>Apache Karaf :: Examples :: CDI :: Features</name>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/feature</directory>
- <filtering>true</filtering>
- <targetPath>${project.build.directory}/feature</targetPath>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>resources</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!--
- <plugin>
- <groupId>org.apache.karaf.tooling</groupId>
- <artifactId>karaf-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>verify</id>
- <phase>process-resources</phase>
- <goals>
- <goal>verify</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>file:${project.build.directory}/feature/feature.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <file>target/feature/feature.xml</file>
- <type>xml</type>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/examples/karaf-cdi-example/karaf-cdi-example-features/src/main/feature/feature.xml b/examples/karaf-cdi-example/karaf-cdi-example-features/src/main/feature/feature.xml
deleted file mode 100644
index e7fbbbb..0000000
--- a/examples/karaf-cdi-example/karaf-cdi-example-features/src/main/feature/feature.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file 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 CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<features name="karaf-cdi-example-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.4.0">
-
- <repository>mvn:org.apache.aries.cdi/aries-cdi-feature/1.1.3/xml/features</repository>
-
- <feature name="karaf-cdi-example-provider" version="${project.version}">
- <feature prerequisite="true">osgi-cdi-owb</feature>
- <bundle>mvn:org.apache.karaf.examples/karaf-cdi-example-provider/${project.version}</bundle>
- </feature>
-
- <feature name="karaf-cdi-example-consumer" version="${project.version}">
- <feature prerequisite="true">karaf-cdi-example-provider</feature>
- <bundle>mvn:org.apache.karaf.examples/karaf-cdi-example-consumer/${project.version}</bundle>
- </feature>
-
-</features>
diff --git a/examples/karaf-cdi-example/karaf-cdi-example-provider/pom.xml b/examples/karaf-cdi-example/karaf-cdi-example-provider/pom.xml
deleted file mode 100644
index b6633e3..0000000
--- a/examples/karaf-cdi-example/karaf-cdi-example-provider/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file 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 CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.karaf.examples</groupId>
- <artifactId>karaf-cdi-example</artifactId>
- <version>4.2.11-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>karaf-cdi-example-provider</artifactId>
- <name>Apache Karaf :: Examples :: CDI :: Provider</name>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.cdi</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <version>1.2</version>
- </dependency>
- <dependency>
- <groupId>jakarta.enterprise</groupId>
- <artifactId>jakarta.enterprise.cdi-api</artifactId>
- <version>2.0.2</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <!-- Waiting https://issues.apache.org/jira/browse/FELIX-6337 -->
- <version>4.2.1</version>
- <configuration>
- <instructions>
- <_cdiannotations>*;discover=annotated</_cdiannotations>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/examples/karaf-cdi-example/karaf-cdi-example-provider/src/main/java/org/apache/karaf/examples/cdi/provider/MyServiceBean.java b/examples/karaf-cdi-example/karaf-cdi-example-provider/src/main/java/org/apache/karaf/examples/cdi/provider/MyServiceBean.java
deleted file mode 100644
index 8a5b141..0000000
--- a/examples/karaf-cdi-example/karaf-cdi-example-provider/src/main/java/org/apache/karaf/examples/cdi/provider/MyServiceBean.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file 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 CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.examples.cdi.provider;
-
-import org.osgi.service.cdi.annotations.Service;
-
-import javax.enterprise.context.ApplicationScoped;
-
-@Service
-@ApplicationScoped
-public class MyServiceBean {
-
- public String greeting(String message) {
- return "Hello " + message;
- }
-
-}
diff --git a/examples/karaf-cdi-example/pom.xml b/examples/karaf-cdi-example/pom.xml
deleted file mode 100644
index 75f35d2..0000000
--- a/examples/karaf-cdi-example/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file 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 CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.karaf.examples</groupId>
- <artifactId>apache-karaf-examples</artifactId>
- <version>4.2.11-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>karaf-cdi-example</artifactId>
- <name>Apache Karaf :: Examples :: CDI</name>
- <packaging>pom</packaging>
-
- <modules>
- <module>karaf-cdi-example-provider</module>
- <module>karaf-cdi-example-consumer</module>
- <module>karaf-cdi-example-features</module>
- </modules>
-
-</project>
diff --git a/examples/pom.xml b/examples/pom.xml
index d41455f..427fa1a 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -38,7 +38,7 @@
<module>karaf-branding-example</module>
<module>karaf-bundle-example</module>
<module>karaf-camel-example</module>
- <module>karaf-cdi-example</module>
+ <!-- <module>karaf-cdi-example</module> -->
<module>karaf-command-example</module>
<module>karaf-config-example</module>
<module>karaf-deployer-example</module>
diff --git a/itests/test/src/test/java/org/apache/karaf/itests/examples/CdiExampleTest.java b/itests/test/src/test/java/org/apache/karaf/itests/examples/CdiExampleTest.java
deleted file mode 100644
index 9493b0b..0000000
--- a/itests/test/src/test/java/org/apache/karaf/itests/examples/CdiExampleTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed 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 CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.itests.examples;
-
-import org.apache.karaf.itests.BaseTest;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class CdiExampleTest extends BaseTest {
-
- @Test
- public void test() throws Exception {
- addFeaturesRepository("mvn:org.apache.karaf.examples/karaf-cdi-example-features/" + System.getProperty("karaf.version") + "/xml");
-
- installAndAssertFeature("karaf-cdi-example-provider");
-
- Object object = getOsgiService("org.apache.karaf.examples.cdi.provider.MyServiceBean");
-
- Assert.assertNotNull(object);
-
- installAndAssertFeature("karaf-cdi-example-consumer");
- }
-
-}