Closed scottslewis closed 10 months ago
Please see draft pull request #5633
Please see new pull request #5643 for simplification of new service wizard support
@kriegfrj I would appreciate your merging of the pr in bndtools.workspace repo here
https://github.com/bndtools/workspace/pull/18
All it does is add the bundle annotation bundle to the workspace template...so that the java wizard contribution (associated with this issue) will work as expected by users when using the bndtools.workspace workspace template.
@kriegfrj @pkriens
I've completed the technical work to close this issue except for two things:
1) The modification of the bndtools workspace to include the org.osgi.annotation.bundle (so that if the new java osgi service wizard is used, the wizard-create classes will all compile...since the @Version annotation is used by the wizard-created code). The pull request for this is change is here https://github.com/bndtools/workspace/pull/18 (in the bndtools/workspace repo).
2) I think it would be useful to add this same org.osgi.annotation.bundle (from maven central) to the workspace.minimal workspace template. However, currently this minimal template has absolutely nothing in it...meaning that I would have to add maven central repo and the inclusion of the org.osgi.annotation.bundle (as with the above workspace). This seems still pretty minimal (I don't see how anyone could actually use the current minimal workspace template for any real project)....but I leave this to the committers to decide. If you will approve a pull request for the minimal workspace template to add the necessary annotation classes then please let me know and I'll submit one.
3) Any further textual/wizard name changes desired, and/or code generalizations or refactoring to make extension easier/more useful for other osgi service wizard use cases.
BTW: I have another Eclipse plugin that adds 5 additional Remote Service wizards to create gRPC, sync, asyn, jaxrs distribution-based remote services. These are based upon the classes added to bndtools (no new java code, just plugin.xml). Currently this Eclipse plugin is in https://github.com/ECF/grpc-RemoteServicesProvider repo (p2 repo in build sub-directory). I may move it elsewhere but obviously it has to wait on bndtools 7 next release. When is that next bndtools 7 release expected?
Thanks.
@scottslewis the https://github.com/bndtools/workspace/pull/18 PR fails, can you fix?
About 2, I agree, please also add it to minimum
About 3, do you take action here? not sure I get it?
Next, release, I am going to work on it soon. July is likely
On Fri, May 26, 2023, 8:24 AM Peter Kriens @.***> wrote:
@scottslewis https://github.com/scottslewis the bndtools/workspace#18 https://github.com/bndtools/workspace/pull/18 PR fails, can you fix?
Hi Peter. I have no idea why they are failing. It appears random to me and unrelated to content of change...so don't have first idea of how to fix other than to try again. Will do that over weekend.
About 2, I agree, please also add it to minimum
Ok will produce issue +pr this coming weekend.
About 3, do you take action here? not sure I get it?
Next, release, I am going to work on it soon. July is likely
— Reply to this email directly, view it on GitHub https://github.com/bndtools/bnd/issues/5632#issuecomment-1564557073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABHB5FXKSNGZQZLSWYOYP3XIDDMXANCNFSM6AAAAAAWZPLK74 . You are receiving this because you were mentioned.Message ID: @.***>
We're discussing release process. Do we want that in here?
Yes.
One comment: To have the java service tutorial work 'out of the box' in bndtools 7.x, it requires updates to the two default workspace templates (i.e. bndtools.workspace and bndtools.workspace.minimal). That's why I opened the issues on those workspace template repos. I stated on one of them (can't remember which one now) what the needs/requirements are for the workspace templates (i.e. so that they include the annotations currently used in the tutorial [compile] as well as the runtime-required bundles...e.g. scr, framework, console, etc). Depending on what happens wrt those two templates (e.g. versions) I may need to make some small modifications to the tutorial...which includes generated bndrun files. I will be responsive on doing that work (and contributing to the workspace template changes if needed) to make the necessary and timely adjustments to the java service wizard.
I feel a bit daft but I cannot really figure out what I need to do to progress this. Can you give me an instruction list for an IQ 85? :-)
I am publishing RC1 end of the week and I'd like to get this in.
What remains to be done to have this work properly is to enhance the bndtools and bndtools.minimal workspace template projects so that they both
1) Reference OSGi R8 repos/bundles 2) Include references to the dependencies in the wizard-created code as per https://github.com/bndtools/bnd/issues/5632#issuecomment-1646067238
Here are is the OSGi R8 issue for bndtools.workspace
https://github.com/bndtools/workspace/issues/23
and bndtools.workspace.min
https://github.com/bndtools/bndtools.workspace.min/issues/7
In the workspace.min issue is the dependencies that the wizard-generated require:
he requirements of the generated projects are currently: Use of R8 org.osgi.annotation.bundle.Export and org.osgi.annotation.versioning.Version("1.0.0") annotations. Use of org.osgi.service.component.annotations.Component, org.osgi.service.component.annotations.Reference, org.osgi.service.component.annotations.Activate scr annotations. Use of R8 framework impl. Use of R8 SCR impl, Use of gogo (shell, command, runtime bundles).
I would request that the wizard's R8 dependencies as above be present for both min and the bndtools.workspace templates (annotations, scr, framework, gogo console). That way the new Java wizard (this issue) output will compile and run for either of the bndtools.workspace and bndtools.workspace.min templates.
I feel a bit daft but I cannot really figure out what I need to do to progress this.
I would interpret that
https://github.com/bndtools/workspace/blob/master/cnf/build.bnd
currenty points OSGi R7 (7.0.0) (org.osgi.enroute:osgi-api:7.0.0)
What I think @scottslewis is asking, is to increase that to R8?
Maybe https://mvnrepository.com/artifact/org.osgi/osgi.core/8.0.0 ?
Maybe @scottslewis could clarify more.
I think @pkriens started something here: https://github.com/bndtools/bndtools.workspace.min/pull/9
Is this related? Sorry for asking, but I get lost a bit with all the links to Issues and PRs :)
I can help testing, but I try to find out "what".
Maybe helpful:
org.osgi.enroute:osgi-api:7.0.0
in the Repository definition seems to be a POM bundling all single deps into one big thing and provide it as a repo (BndPomRepository)org.osgi:osgi.core:8.0.0
#org.osgi:osgi.cmpn:8.0.0
org.osgi:osgi.annotation:8.0.0
org.osgi:org.osgi.service.component.annotations:1.5.1
org.osgi:org.osgi.service.component:1.5.1
org.osgi:org.osgi.util.promise:1.3.0
org.osgi:org.osgi.service.http:1.2.2
org.apache.felix:org.apache.felix.scr:2.2.6
Sidenode (for people coming from google):
During it took me a while to figure out this error during startup:
Unresolved requirement: Require-Capability: osgi.extender; filter:="(&(osgi.extender=osgi.component)(version>=1.5.0)(!(version>=2.0.0)))"
Solution: upgrade from org.apache.felix:org.apache.felix.scr:2.1.28
to org.apache.felix:org.apache.felix.scr:2.2.6
because only org.apache.felix:org.apache.felix.scr:2.2.6
provides the Capability osgi.extender=osgi.component
in v 1.5.0. org.apache.felix:org.apache.felix.scr:2.1.28
just had 1.4.0
Slowly I am getting (used to) the Resolution View :)
@scottslewis I talked to @pkriens today and I started this PR. https://github.com/bndtools/bndtools.workspace.min/pull/11
I would need your help to verify if this solves what you are asking for. The PR contains steps to test this. Maybe this is similar to how you could test it with your new wizard.
Let me know in the PR if you want changes.
@chrisrueger I will give it a try now
I just merged the bndtools.workspace.min ...
Can we work from this because I understand that @chrisrueger has more confidence in this one than the workspace one.
I am also inclined to have only one from now on.
@scottslewis can you look and give back a list of things to do?
I just merged the bndtools.workspace.min ...
Can we work from this because I understand that @chrisrueger has more confidence in this one than the workspace one.
I am also inclined to have only one from now on.
@scottslewis can you look and give back a list of things to do?
@pkriens @chrisrueger
Yes. Today, I've tested using the Java OSGi service wizard using the min repo contents from main with bndtools snapshot (12/8).
Short story: The Java OSGi Service wizard now (R8 min workspace template) works as desired. Thanks @chrisrueger and @pkriens!
There is one small nit fixed by pr #5932. Without this fix, the after the 3 projects are created by the wizard the workspace is not refreshed and has errors because of dependencies between projects. With pr #5932 the workspace is refreshed and so everything is green once the wizard is finished.
I am also inclined to have only one from now on.
It's your call, but haven't there been two around for a while? Won't this be a bit of a surprise for bndtools users that have been using two for a while?
So if pr #5932 can be merged then I will close this issue. When is the next expected release of bndtools?
I would suggest some promotion of the existence of the Java OSGi Service Wizard in the next release...I'm not sure how/who does that, but if a couple of screenshots are desired I can easily create them now.
One other thing to make public: It's possible with the current code to create custom service wizards just by using the eclipse wizard extension point and providing a bndtools service template. For example, this markup creates a new Grpc Remote Service Wizard
<wizard
category="bndtools.serviceWizardCategory/org.eclipse.ecf.remoteservices.category"
finalPerspective="bndtools.perspective"
class="org.bndtools.core.ui.wizards.service.NewBndTemplateBasedServiceWizard:grpc"
icon="icons/grpc16x16.gif"
id="org.eclipse.ecf.bndtools.grpc.ui.grpc"
name="gRPC Remote Service (generated api, impl, consumer)"
preferredPerspectives="bndtools.perspective"
project="true">
</wizard>
I intend to use this so that I (or anyone) can introduce new OSGi service wizards for (e.g.) the wizard-based creation of Remote Services (like with the ECF grpc provider-based wizard as above).
I can/will produce more documentation for this, but can't right at the moment. But it is something that's already in the existing service wizard code.
couple of screenshots are desired I can easily create them now.
Oh yes please. Maybe just paste them here with a few bullet points of notes.
Once this pr is merged: https://github.com/bndtools/bnd/pull/5932
Then with bndtools snapshot or newer here are screenshots of the projects creation of the Java OSGi Service Wizard
Requirements: It's assumed that bndtools snapshot or better has been installed, and a new workspace has been created with the new bndtools.workspace.min (R8) template.
To open wizard, select File->New->Other...
Then select OSGi Services -> Java OSGi Service (api, impl, consumer) and Next>
Fill in desired values for the Project Name and the Service Name fields, and make any other desired changes to the execution environment or project set usage on the wizard page
Click Finish
There are three projects created org.myorg.test.hello (api), org.myorg.test.hello.impl, and org.myorg.test.hello.consumer.
The three Java classes created (in each of the projects) are shown in the edit window (HelloService, HelloServiceImpl, HelloServiceConsumer).
If desired, the user can use Eclipse refactoring to rename the default service method (named methodName) to (e.g.) hello, resulting in:
Included in the generated org.myorg.test.hello project is a Hello.bndrun file that can be used to launch a framework. register the HelloServiceImpl, inject (via SCR) into the HelloServiceConsumer and have the HelloServiceConsumer call the service.
To Run/Debug
Opening the bndrun file results in:
Then clicking Resolve and Update
Then clicking on Run OSGi (or Debug OSGi). Results in the service method being called and the console output
Thanks a lot @scottslewis for the screnshots and notes. I will create a PR for this.
Question: My initial suggestion would be to put it here on the bndtools website in a new UI-Section "Templates".
Thoughts? Or you know a better place? @pkriens
@scottslewis @pkriens I have created https://github.com/bndtools/bndtools.github.io/pull/146 for my website / documentation relevant additions for the next release. Feel free to provide feedback, additions and corrections there.
@scottslewis
One other thing to make public: It's possible with the current code to create custom service wizards just by using the eclipse wizard extension point and providing a bndtools service template. For example, this markup creates a new Grpc Remote Service Wizard
I have added a section "Creating custom OSGi service wizards" to the Developer Guide here
I've just tested the Java OSGi Service wizard in bndtools snapshot: 7.1.0.DEV-202312261441-gd759351. It's working as designed/expected, so I'm closing this issue. Please reopen if issues remain open until actually released.
As per discussion here
https://bnd.discourse.group/t/osgi-services-creation-wizards/218/12
It would be useful to for bndtools to support wizard-based creation of OSGi services.
As an initial contribution, I've created a new package/API: org.bndtools.core.ui.wizards.service for building wizards for creating OSGi services with (by default) three projects: a service-api project, a service-impl project, and service-consumer project. These wizard classes allow the use of named bndtools templates for creating the service-api, service-impl, and service-consumer projects via a single wizard.
Further, I've created a Java OSGi Service wizard in new package: org.bndtools.core.ui.wizards.service.java and referenced in _plugin.xml. This uses the new package/API above and 3 built-in templates (in new bundtools.core/resources/unprocessed/serviceTemplates) in bndtools.core.