Skip to content
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
6 changes: 6 additions & 0 deletions cdi-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.jax.rs</groupId>
<artifactId>org.apache.aries.jax.rs.whiteboard</artifactId>
<version>1.0.6</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.spifly</groupId>
<artifactId>org.apache.aries.spifly.dynamic.framework.extension</artifactId>
Expand Down
7 changes: 0 additions & 7 deletions cdi-extension-mp-metrics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,6 @@
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
</dependency>

<dependency>
<groupId>org.apache.aries.jax.rs</groupId>
<artifactId>org.apache.aries.jax.rs.whiteboard</artifactId>
<version>1.0.6</version>
<scope>runtime</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* Copyright (c) OSGi Alliance (2018). All Rights Reserved.
*
* 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.aries.cdi.extra;

import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;
import static org.apache.aries.cdi.extra.RequireCDIExtension.EFFECTIVE_MACRO;
import static org.apache.aries.cdi.extra.RequireCDIExtension.RESOLUTION_MACRO;
import static org.apache.aries.cdi.extra.RequireCDIExtension.VALUE_MACRO;
import static org.apache.aries.cdi.extra.RequireCDIExtension.VERSION_MACRO;
import static org.osgi.service.cdi.CDIConstants.CDI_EXTENSION_PROPERTY;

import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import org.osgi.annotation.bundle.Requirement;

@Retention(CLASS)
@Target({
PACKAGE, TYPE
})
@Repeatable(RequireCDIExtensions.class)
@Requirement(namespace = CDI_EXTENSION_PROPERTY, name = VALUE_MACRO, attribute = {
VERSION_MACRO, EFFECTIVE_MACRO, RESOLUTION_MACRO
})
public @interface RequireCDIExtension {

public static final String VALUE_MACRO = "${#value}";

public static final String EFFECTIVE_MACRO = "${if;${size;${#effective}};effective:=${#effective}}";

public static final String RESOLUTION_MACRO = "${if;${is;${#resolution};DEFAULT};;resolution:=${#resolution}}";

public static final String VERSION_MACRO = "${if;${size;${#version}};version=${#version}}";

/**
* The name of the required extension.
*/
String value();

/**
* The version of the required extension.
* <p>
* If not specified, the {@code version} directive is omitted from the
* requirement clause.
*/
String version() default "";

/**
* The effective time of the {@code osgi.extender} requirement.
* <p>
* Specifies the time the {@code osgi.extender} requirements are available.
* The OSGi framework resolver only considers requirements without an
* effective directive or {@code effective:=resolve}. Requirements with
* other values for the effective directive can be considered by an external
* agent.
* <p>
* If not specified, the {@code effective} directive is omitted from the
* requirement clause.
*/
String effective() default "";

/**
* The resolution policy of the {@code osgi.extender} requirement.
* <p>
* A mandatory requirement forbids the bundle to resolve when this
* requirement is not satisfied; an optional requirement allows a bundle to
* resolve even if this requirement is not satisfied.
* <p>
* If not specified, the {@code resolution} directive is omitted from the
* requirement clause.
*/
Resolution resolution() default Resolution.DEFAULT;

public enum Resolution {
/**
* A mandatory requirement forbids the bundle to resolve when the
* requirement is not satisfied.
*/
MANDATORY("mandatory"), // Namespace.RESOLUTION_MANDATORY

/**
* An optional requirement allows a bundle to resolve even if the
* requirement is not satisfied.
*/
OPTIONAL("optional"), // Namespace.RESOLUTION_OPTIONAL

/**
* Default element value for annotation. This is used to distinguish the
* default value for an element and should not otherwise be used.
*/
DEFAULT("<<default>>");

private final String value;

Resolution(String value) {
this.value = value;
}

@Override
public String toString() {
return value;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) OSGi Alliance (2018). All Rights Reserved.
*
* 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.aries.cdi.extra;

import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

@Retention(CLASS)
@Target({
PACKAGE, TYPE
})
public @interface RequireCDIExtensions {
RequireCDIExtension[] value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) OSGi Alliance (2018). All Rights Reserved.
*
* 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.
*/

@org.osgi.annotation.bundle.Export
@org.osgi.annotation.versioning.Version("1.0.0")
package org.apache.aries.cdi.extra;
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -43,6 +44,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -40,6 +41,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardFilterPattern {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -40,6 +41,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardFilterRegex {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -40,6 +41,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardFilterServlet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -40,6 +41,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -41,6 +42,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardResource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -40,6 +41,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardServletErrorPage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -40,6 +41,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardServletName {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.enterprise.util.AnnotationLiteral;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.osgi.service.cdi.annotations.BeanPropertyType;
import org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;

Expand All @@ -40,6 +41,7 @@
*/
@BeanPropertyType
@RequireHttpWhiteboard
@RequireCDIExtension("aries.cdi.http")
@Retention(RUNTIME)
@Target({FIELD, METHOD, TYPE})
public @interface HttpWhiteboardServletPattern {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
*/

@org.osgi.annotation.bundle.Export
@org.osgi.annotation.versioning.Version("1.0.0")
@org.osgi.annotation.versioning.Version("1.1.0")
package org.apache.aries.cdi.extra.propertytypes;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.osgi.service.cdi.CDIConstants.CDI_EXTENSION_PROPERTY;

import java.io.InputStream;
import java.util.Dictionary;
Expand All @@ -34,6 +33,7 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;

import org.apache.aries.cdi.extra.RequireCDIExtension;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
Expand Down Expand Up @@ -65,22 +65,10 @@
filter = "(objectClass=org.osgi.service.cm.ConfigurationAdmin)",
namespace = ServiceNamespace.SERVICE_NAMESPACE
)
@Requirement(
namespace = CDI_EXTENSION_PROPERTY,
name = "aries.cdi.http"
)
@Requirement(
namespace = CDI_EXTENSION_PROPERTY,
name = "aries.cdi.jndi"
)
@Requirement(
namespace = CDI_EXTENSION_PROPERTY,
name = "eclipse.microprofile.config"
)
@Requirement(
namespace = CDI_EXTENSION_PROPERTY,
name = "eclipse.microprofile.metrics"
)
@RequireCDIExtension("aries.cdi.http")
@RequireCDIExtension("aries.cdi.jndi")
@RequireCDIExtension("eclipse.microprofile.config")
@RequireCDIExtension("eclipse.microprofile.metrics")
@RequireConfigurator
public abstract class AbstractTestCase {

Expand Down
Loading