Skip to content

Commit

Permalink
MircoProfile LRA property support
Browse files Browse the repository at this point in the history
Signed-off-by: David Kwon <dakwon@redhat.com>
  • Loading branch information
dkwon17 authored and angelozerr committed Apr 8, 2020
1 parent ce8ff78 commit 8352573
Show file tree
Hide file tree
Showing 25 changed files with 1,205 additions and 30 deletions.
7 changes: 7 additions & 0 deletions microprofile.jdt/com.redhat.microprofile.jdt.core/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
<provider class="com.redhat.microprofile.jdt.internal.faulttolerance.properties.MicroProfileFaultToleranceProvider" />
</extension>

<!-- Microprofile LRA support -->

<extension point="com.redhat.microprofile.jdt.core.propertiesProviders">
<!-- Properties provider for MicroProfile LRA -->
<provider class="com.redhat.microprofile.jdt.internal.lra.properties.MicroProfileLRAProvider" />
</extension>

<!-- Microprofile Metrics support -->

<extension point="com.redhat.microprofile.jdt.core.propertiesProviders">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2020 Red Hat Inc. and others.
* All rights reserved. This program and the accompanying materials
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat Inc. - initial API and implementation
*******************************************************************************/
package com.redhat.microprofile.jdt.internal.lra;

/**
* MicroProfile LRA constants
*
* @author David Kwon
*
*/
public class MicroProfileLRAConstants{

public static final String LRA_ANNOTATION = "org.eclipse.microprofile.lra.annotation.ws.rs.LRA";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2020 Red Hat Inc. and others.
* All rights reserved. This program and the accompanying materials
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Red Hat Inc. - initial API and implementation
*******************************************************************************/
package com.redhat.microprofile.jdt.internal.lra.properties;

import static com.redhat.microprofile.jdt.internal.lra.MicroProfileLRAConstants.LRA_ANNOTATION;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;

import com.redhat.microprofile.jdt.core.AbstractStaticPropertiesProvider;
import com.redhat.microprofile.jdt.core.MicroProfileCorePlugin;
import com.redhat.microprofile.jdt.core.SearchContext;
import com.redhat.microprofile.jdt.core.utils.JDTTypeUtils;

/**
* Properties provider that provides static MicroProfile LRA properties
*
* @author David Kwon
*
* @see https://github.com/eclipse/microprofile-lra/blob/2d7b24b4bcb755eadb19c74dadd504cc41b0c094/spec/src/main/asciidoc/microprofile-lra-spec.adoc#322-configuration-parameters
*
*/
public class MicroProfileLRAProvider extends AbstractStaticPropertiesProvider {

public MicroProfileLRAProvider() {
super(MicroProfileCorePlugin.PLUGIN_ID, "/static-properties/mp-lra-metadata.json");
}

@Override
protected boolean isAdaptedFor(SearchContext context, IProgressMonitor monitor) {
IJavaProject javaProject = context.getJavaProject();
return (JDTTypeUtils.findType(javaProject, LRA_ANNOTATION) != null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"properties": [
{
"type": "java.lang.String",
"extensionName": "microprofile-lra-api",
"required": false,
"name": "mp.lra.propagation.active",
"description": "When a JAX-RS endpoint, or the containing class, is not annotated with `@LRA`, but it is called on a MicroProfile LRA compliant runtime, the system will propagate the LRA related HTTP headers when this parameter resolves to true.\r\n\r\nThe behaviour is similar to the `LRA.Type` `SUPPORTS` (when true) and `NOT_SUPPORTED` (when false) values but only defines the propagation aspect.\r\n\r\nIn other words the class does not have to be a participant in order for the LRA context to propagate, i.e. such propagation of the header does not imply that the LRA is in any particular state, and in fact the LRA may not even correspond to a valid LRA."
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"properties": [
{
"type": "java.lang.String",
"extensionName": "microprofile-metrics",
"extensionName": "microprofile-metrics-api",
"required": false,
"name": "mp.metrics.tags",
"description": "List of tag values.\r\nTag values set through `mp.metrics.tags` MUST escape equal symbols `=` and commas `,` with a backslash `\\`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-metrics",
"extensionName": "microprofile-metrics-api",
"required": false,
"name": "mp.metrics.appName",
"description": "The app name."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,78 @@
"properties": [
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.model.reader",
"description": "Configuration property to specify the fully qualified name of the OASModelReader implementation."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.filter",
"description": "Configuration property to specify the fully qualified name of the OASFilter implementation."
},
{
"type": "boolean",
"defaultValue": "false",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": false,
"name": "mp.openapi.scan.disable",
"description": "Configuration property to disable annotation scanning. Default value is `false`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.scan.packages",
"description": "Configuration property to specify the list of packages to scan.\r\nFor example, `mp.openapi.scan.packages=com.xyz.PackageA,com.xyz.PackageB`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.scan.classes",
"description": "Configuration property to specify the list of classes to scan.\r\nFor example, `mp.openapi.scan.classes=com.xyz.MyClassA,com.xyz.MyClassB`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.scan.exclude.packages",
"description": "Configuration property to specify the list of packages to exclude from scans.\r\nFor example, `mp.openapi.scan.exclude.packages=com.xyz.PackageC,com.xyz.PackageD`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.scan.exclude.classes",
"description": "Configuration property to specify the list of classes to exclude from scans.\r\nFor example, `mp.openapi.scan.exclude.classes=com.xyz.MyClassC,com.xyz.MyClassD`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.servers",
"description": "Configuration property to specify the list of global servers that provide connectivity information.\r\nFor example, `mp.openapi.servers=https://xyz.com/v1,https://abc.com/v1`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.servers.path.{*}",
"description": "Prefix of the configuration property to specify an alternative list of servers to service all operations in a path.For example, `mp.openapi.servers.path./airlines/bookings/{id}=https://xyz.io/v1`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.servers.operation.{*}",
"description": "Prefix of the configuration property to specify an alternative list of servers to service an operation.Operations that want to specify an alternative list of servers must define an `operationId`, a unique string used to identify the operation.For example, `mp.openapi.servers.operation.getBooking=https://abc.io/v1`."
},
{
"type": "java.lang.String",
"extensionName": "microprofile-openapi",
"extensionName": "microprofile-openapi-api",
"required": true,
"name": "mp.openapi.schema.{*}",
"description": "Prefix of the configuration property to specify a schema for a specific class, in JSON format.The remainder of the property key must be the fully-qualified class name.The value must be a valid OpenAPI schema object, specified in the JSON format.The use of this property is functionally equivalent to the use of the `@Schema` annotationon a Java class, but may be used in cases where the application developer does not have access to the source code of a class."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"properties": [
{
"type": "java.util.regex.Pattern",
"extensionName": "microprofile-opentracing",
"extensionName": "microprofile-opentracing-api",
"required": false,
"name": "mp.opentracing.server.skip-pattern",
"description": "Specifies a skip pattern to avoid tracing of selected REST endpoints."
},
{
"type": "\"http-path\" or \"class-method\"",
"defaultValue": "class-method",
"extensionName": "microprofile-opentracing",
"extensionName": "microprofile-opentracing-api",
"required": false,
"name": "mp.opentracing.server.operation-name-provider",
"description": "Specifies operation name provider for server spans. Possible values are `http-path` and `class-method`."
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Eclipse
# .project
# .classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
Loading

0 comments on commit 8352573

Please sign in to comment.