Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Faceted Project Framework » Library Provider Framework (shared library support)
Library Provider Framework [message #484822] Wed, 09 September 2009 12:56 Go to next message
Eric Peters is currently offline Eric Peters
Messages: 27
Registered: July 2009
Junior Member
Hi,

I want to be able to listen to selection events on InstallLibraryPanel's "Include libraries with this application" option as well as have the ability to disable the action associated with this option.

I am looking to integrate a WTP 3.0 based facet to Library Provider Framework in WTP 3.2 (similar to what was done for JPA & JSF facet- e.g. https://bugs.eclipse.org/bugs/show_bug.cgi?id=250208). One of the requirements of the WTP 3.2 facet is to provide shared library support- if the user selects "User Library" as the facets Implementation library, user is able to define options to both "Include libraries with this application", as well as a related option provided by our facet to add the library as a "Shared Library" (if the projects targeted EAR/server supports shared libraries). So, our facet needs to detect if option "Include libraries with this application" has been selected/deselected and enable the "User Library" option appropriately. Idealy the new option would appear as part of the InstallLibraryPanel right below (and indented) "Include libraries with this application" option, but we may be able to live with the new option just below the InstallLibraryPanel if we can listen for selection/deselection events. Further, we would like to disable the actions of "Include libraries with this application" option when "Shared Library" is also selected (the alternative would be to remove the classpath entries added by the action which is not as nice).

Can I get this working in WTP 3.2? Can you please point me to API I can use?
I looked at API's and classes below and did not see anything useful (I was looking at WTP 3.1 but WTP 3.2 would be fine). -org.eclipse.jst.common.project.facet.ui.libprov.LibraryProv iderFrameworkUi.createInstallLibraryPanel(Composite, LibraryInstallDelegate, String)
-org.eclipse.jst.common.project.facet.core.libprov.LibraryPr oviderFramework
-org.eclipse.jst.common.project.facet.core.libprov.ILibraryP rovider
Re: Library Provider Framework [message #484956 is a reply to message #484822] Wed, 09 September 2009 21:56 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
Hi Eric,

Thanks for re-posting to this forum. Glad to see outside interest in using the Library Provider Framework. Unfortunately, good documentation that brings all of the API together is still on the todo list. All that we have currently is Java API and extension point docs.

There are two important things to understand about the library provider framework:

1. Providers are enabled typically on per-facet basis. There are no providers (at least that ship out of the box) that are enabled globally. This can be annoying at times, when you have to re-declare say the user library provider for you facet, but gives you (the facet author) a lot more control. You can choose to not include some providers or more to the point about your usecase, you can choose to substitute a provider that behaves similar to a generic one but has been customized for whatever extra behavior that you require.

2. It is easy to create new providers by extending existing ones and just changing the aspects that need to be changed.

The Library Provider Framework includes the user libraries provider (id = user-library-provider). The base user library provider is usable as is in basic Java projects, but it does not have "Include libraries with this application" functionality as that's WTP specific. This functionality is added somewhere else in WTP by extending the base user library provider to create a WTP-specific version (id = wtp-user-library-provider).

Here is the definition of the base user library provider:

<extension point="org.eclipse.jst.common.project.facet.core.libraryProviders">
  <provider id="user-library-provider" abstract="true">
    <label>%userLibraryProviderLabel</label>
    <priority>500</priority>
    <action type="INSTALL">
      <config class="org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderInstallOperationConfig"/>
      <operation class="org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderInstallOperation"/>
    </action>
    <action type="UNINSTALL">
      <operation class="org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderUninstallOperation"/>
    </action>
  </provider>
</extension>

<extension point="org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels">
  <panel 
    provider="user-library-provider"
    class="org.eclipse.jst.common.project.facet.ui.libprov.user.UserLibraryProviderInstallPanel"/>
</extension>


And here is how it is extended to add support for WTP-specific functionality.

<extension point="org.eclipse.jst.common.project.facet.core.libraryProviders">
  <provider id="wtp-user-library-provider" abstract="true" extends="user-library-provider">
    <action type="INSTALL">
      <config class="org.eclipse.jst.j2ee.internal.common.classpath.WtpUserLibraryProviderInstallOperationConfig"/>
      <operation class="org.eclipse.jst.j2ee.internal.common.classpath.WtpUserLibraryProviderInstallOperation"/>
    </action>
  </provider>
</extension>

<extension point="org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels">
  <panel 
    provider="wtp-user-library-provider"
    class="org.eclipse.jst.j2ee.internal.ui.WtpUserLibraryProviderInstallPanel"/>
</extension>


Based on my understanding of the scenario that you described, I think you will want to extend wtp-user-library-provider to add support for your shared library option. Poke around the classes referenced in the above extension points. Worst case scenario is that wtp-user-library-provider doesn't give you enough control over the "Include libraries with this application" option, in which case you can just derive from user-library-provider directly and re-build this functionality (should be pretty trivial to do).

- Konstantin
Re: Library Provider Framework [message #485120 is a reply to message #484956] Thu, 10 September 2009 14:41 Go to previous messageGo to next message
Snjezana Peco is currently offline Snjezana Peco
Messages: 789
Registered: July 2009
Senior Member
Konstantin Komissarchik wrote:

> 1. Providers are enabled typically on per-facet basis. There are no
> providers (at least that ship out of the box) that are enabled globally.

except runtime-library-provider that will appear for every facet if there is a classpath entry in Target Runtime.
I am creating Maven Library provider for the JBoss Portlet feature and would like to exclude this provider when the Runtime doesn't
have any portlet component. As far as I could see, that is impossible.

Snjeza
Re: Library Provider Framework [message #485194 is a reply to message #485120] Thu, 10 September 2009 19:07 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
>> 1. Providers are enabled typically on per-facet basis. There are no
>> providers (at least that ship out of the box) that are enabled globally.
>
> except runtime-library-provider that will appear for every facet if
> there is a classpath entry in Target Runtime.
> I am creating Maven Library provider for the JBoss Portlet feature
> and would like to exclude this provider when the Runtime doesn't
> have any portlet component. As far as I could see, that is
> impossible.

You are quite right. The runtime-library-provider is global, but it only turns on when the runtime declares that it can provide classpath for a particular facet.

It sounds to me like there is a bug in JBoss plugin in that the runtime responds as capable of supplying classpath for the portal facet when the runtime in fact does not have the portal component.

- Konstantin
Re: Library Provider Framework [message #499906 is a reply to message #484822] Tue, 24 November 2009 14:05 Go to previous messageGo to next message
Keith Chong is currently offline Keith Chong
Messages: 64
Registered: July 2009
Member
Hi Konstantin,

I have extended the wtp-user-library-provider and the libraryProviderActionPanels. I see my 'panel' in my

org.eclipse.wst.common.project.facet.ui.FacetsPropertyPage

and

org.eclipse.wst.common.project.facet.ui.wizardPages (which extends DataModelWizardPage)

The wizardPage's constructor creates the IDataModel and passes it to super.

Do you know how I can get the IDataModel from the actionPanel? I need to access its properties.

[Updated on: Tue, 24 November 2009 14:16]

Report message to a moderator

Re: Library Provider Framework [message #523523 is a reply to message #484956] Fri, 26 March 2010 17:03 Go to previous message
Eric Peters is currently offline Eric Peters
Messages: 27
Registered: July 2009
Junior Member
Hi Konstantin,

Thanks for your help thus far!

I was trying to get a define complex enablement expression like below with 2 facet requirements , but seemed only the first requirement was being recognized. It is entirely possible my enablement expression is not correctly formed.

What we actually want though is support for e.g. a Project PropertyTester and associated class in our enablement expression , so the class would get called with a handle to the project to glean information like what runtime is it targeting, does that runtime support our library (having some logic in the class to determine that.

So, can you tell me if the extension point supports more or less an arbitrarily complex enablement expression with property testers etc like we are looking for?

Thanks in advance for your help,


<extension point="org.eclipse.jst.common.project.facet.core.libraryProviders ">
<provider id="com.library.id">
<enablement>
<and>
<with variable="requestingProjectFacet">
<test property="org.eclipse.wst.common.project.facet.core.projectFacet " value="jst.jaxrs:1.0" forcePluginActivation="true" />
</with>
<with variable="requestingProjectFacet">
<test property="org.eclipse.wst.common.project.facet.core.projectFacet " value="jst.jsf:" forcePluginActivation="true" />
</with>
</and>
</enablement>
<action type="INSTALL">
<config class="someclass"/>
<operation class="someclass"/>
</action>

<label>a library</label>
<priority>10000</priority>
</provider>
</extension>




org.eclipse.jst.common.project.facet.core.libprov.user.UserL ibraryProviderInstallOperationConfig
Re: Library Provider Framework [message #572069 is a reply to message #485120] Thu, 10 September 2009 19:07 Go to previous message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
>> 1. Providers are enabled typically on per-facet basis. There are no
>> providers (at least that ship out of the box) that are enabled globally.
>
> except runtime-library-provider that will appear for every facet if
> there is a classpath entry in Target Runtime.
> I am creating Maven Library provider for the JBoss Portlet feature
> and would like to exclude this provider when the Runtime doesn't
> have any portlet component. As far as I could see, that is
> impossible.

You are quite right. The runtime-library-provider is global, but it only turns on when the runtime declares that it can provide classpath for a particular facet.

It sounds to me like there is a bug in JBoss plugin in that the runtime responds as capable of supplying classpath for the portal facet when the runtime in fact does not have the portal component.

- Konstantin
Previous Topic:Extending presets
Next Topic:Library Provider Framework
Goto Forum:
  


Current Time: Tue Sep 16 23:45:00 GMT 2014

Powered by FUDForum. Page generated in 0.01908 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software