-
Notifications
You must be signed in to change notification settings - Fork 579
Introduce Helidon Pico #5141
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
Merged
Merged
Introduce Helidon Pico #5141
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cced307
Introduce Pico. Includes API and Types modules.
trentjeff 2d33c6a
add classes
trentjeff a4b4a24
review comments addressed
trentjeff f7d52be
more review comments addressed
trentjeff ad730f0
remove .gitignore
trentjeff cf34331
fix javadoc, remove .gitignore entry
trentjeff b9ed660
more review comments addressed
trentjeff b35abec
addressing more review comments
trentjeff 9130382
latest round of review comments
trentjeff d26c2dc
change to Optional<String> returns
trentjeff 7fa7180
fix javadoc
trentjeff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
|
||
Copyright (c) 2022 Oracle and/or its affiliates. | ||
|
||
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. | ||
|
||
--> | ||
<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"> | ||
<parent> | ||
<groupId>io.helidon.pico</groupId> | ||
<artifactId>helidon-pico-project</artifactId> | ||
<version>4.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>helidon-pico-api</artifactId> | ||
<name>Helidon Pico API</name> | ||
|
||
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2022 Oracle and/or its affiliates. | ||
* | ||
* 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 io.helidon.pico.api; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* The Contract annotation is used to relay significance to the type. While remaining optional in its use, it is typically placed | ||
* on an interface definition to signify that the given type can be used for lookup in the service registry, or otherwise be | ||
* eligible for injection via standard @Inject. It could also be used on other types (e.g., abstract class) as well. | ||
* <p> | ||
* | ||
* If the developer does not have access to the source to place this annotation on the interface definition then consider using | ||
* {@link ExternalContracts} instead - this annotation can be placed on the implementation class implementing the given interface. | ||
* See io.helidon.pico.spi.ServiceInfo#getContractsImplemented() | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(java.lang.annotation.ElementType.TYPE) | ||
public @interface Contract { | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
pico/api/src/main/java/io/helidon/pico/api/ExternalContracts.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2022 Oracle and/or its affiliates. | ||
* | ||
* 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 io.helidon.pico.api; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Placed on the implementation of a service as an alternative to using a {@link Contract}. | ||
* <p> | ||
* Use this annotation when it is impossible to place an annotation on the interface itself - for instance of the interface comes | ||
* from a 3rd party library/provider. | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
trentjeff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Target(java.lang.annotation.ElementType.TYPE) | ||
public @interface ExternalContracts { | ||
|
||
/** | ||
* The advertised contract type(s) for the service class implementation. | ||
* | ||
* @return the external contract(s) | ||
*/ | ||
Class<?>[] value(); | ||
|
||
/** | ||
* The optional set of module names where this contract is expected to reside. | ||
* | ||
* @return the optional module names | ||
*/ | ||
String[] moduleNames() default {}; | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2022 Oracle and/or its affiliates. | ||
* | ||
* 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 io.helidon.pico.api; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.TYPE; | ||
|
||
/** | ||
* Indicates the desired startup sequence for a service class. | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(TYPE) | ||
@Inherited | ||
public @interface RunLevel { | ||
|
||
/** | ||
* Represents an eager singleton. | ||
*/ | ||
int STARTUP = 0; | ||
|
||
/** | ||
* Anything > 0 is left to the underlying provider implementation's discretion for meaning; this is just a default for something | ||
* that is deemed "other than startup". | ||
*/ | ||
int NORMAL = 100; | ||
|
||
/** | ||
* The service ranking applied when not declared explicitly. | ||
* | ||
* @return the startup int value, defaulting to {@link #NORMAL} | ||
*/ | ||
int value() default NORMAL; | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
pico/api/src/main/java/io/helidon/pico/api/package-info.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) 2022 Oracle and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* Types that are Pico API/consumer facing. The Pico API provide types that are generally useful at compile time | ||
* to assign special meaning to the type. In this way it also helps with readability and intentions of the code itself. | ||
* <p> | ||
* <li> {@link io.helidon.pico.api.Contract} - signifies that the type can be used for lookup in the service registry. | ||
* <li> {@link io.helidon.pico.api.ExternalContracts} - same as Contract, but applied to the implementation class instead. | ||
* <li> {@link io.helidon.pico.api.RunLevel} - ascribes meaning for when the service should start. | ||
*/ | ||
package io.helidon.pico.api; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2022 Oracle and/or its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* Pico API module. | ||
trentjeff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
module io.helidon.pico.api { | ||
exports io.helidon.pico.api; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
|
||
Copyright (c) 2022 Oracle and/or its affiliates. | ||
|
||
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. | ||
|
||
--> | ||
|
||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.helidon</groupId> | ||
<artifactId>helidon-project</artifactId> | ||
<version>4.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<groupId>io.helidon.pico</groupId> | ||
<artifactId>helidon-pico-project</artifactId> | ||
<name>Helidon Pico Project</name> | ||
|
||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<!-- all pico modules should be backward compatible with 11 --> | ||
<version.java>11</version.java> | ||
|
||
<!-- pico supports legacy javax.inject and javax.annotations in tooling --> | ||
<javax.injection.version>1</javax.injection.version> | ||
tomas-langer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</properties> | ||
|
||
<!-- this will show the progression of what has come over, and what is left to come over --> | ||
<modules> | ||
<module>api</module> | ||
<!-- <module>spi</module>--> | ||
<module>types</module> | ||
<!-- <module>builder</module>--> | ||
<!-- <module>config</module>--> | ||
<!-- <module>pico</module>--> | ||
<!-- <module>tck</module>--> | ||
<!-- <module>tools</module>--> | ||
<!-- <module>processor</module>--> | ||
<!-- <module>maven-plugin</module>--> | ||
<!-- <module>test-support</module>--> | ||
<!-- <module>test-utils</module>--> | ||
<!-- <module>test-resources</module>--> | ||
<!-- <module>test-extended-resources</module>--> | ||
<!-- <module>test-pico</module>--> | ||
<!-- <module>test-tck-jsr330</module>--> | ||
<!-- <module>examples</module>--> | ||
</modules> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<configuration> | ||
<!-- This module is Java 11, we must remove enable-preview from parent project --> | ||
<additionalOptions combine.self="override"/> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
|
||
Copyright (c) 2022 Oracle and/or its affiliates. | ||
|
||
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. | ||
|
||
--> | ||
<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"> | ||
<parent> | ||
<groupId>io.helidon.pico</groupId> | ||
<artifactId>helidon-pico-project</artifactId> | ||
<version>4.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>helidon-pico-types</artifactId> | ||
<name>Helidon Pico Types</name> | ||
<description>Provides the runtime types (a subset of SPI) useful for Pico</description> | ||
|
||
</project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.