Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Faceted Project Framework » Headless facet installation
Headless facet installation [message #548693] Thu, 22 July 2010 16:44 Go to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
Received by e-mail. Moving thread to the forum...

==========

Hello Konstantin,

I have noticed that you wrote most of the facet stuff in the mentioned package. I try to create a new facet headless via WTP to a new project.
I add the nature with WtpUtils.addNatures(project); I like to create a dynamic web project with only a base facet like IJ2EEFacetConstants.DYNAMIC_WEB_24, but even trying 2 days, I fail.
Do you have a hint, how to do this with only a few lines?

Thank You in advance!

Barry
Re: Headless facet installation [message #548700 is a reply to message #548693] Thu, 22 July 2010 17:00 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
Hi Barry,

You haven't indicated what you have tried or what failures you are getting. Note that the Dynamic Web Module facet (id jst.web) requires Java facet (id jst.java).

Here is a standalone snippet...

IProjectFacet javaFacet = ProjectFacetsManager.getProjectFacet( "jst.java" );
IProjectFacet webFacet = ProjectFacetsManager.getProjectFacet( "jst.web" );

Set<IProjectFacet> fixedFacets = new HashSet<IProjectFacet>();
fixedFacets.add( javaFacet );
fixedFacets.add( webFacet );

IFacetedProject fproj = ProjectFacetsManager.create( "my-project", null, null );
fproj.addTargetedRuntime( ..., null );
fproj.installProjectFacet( javaFacet.getVersion( "1.4" ) );
fproj.installProjectFacet( webFacet.getVersion( "2.4" ) );
fproj.setFixedProjectFacets( fixedFacets );

There are various versions of ProjectFacetsManager.create() method that are appropriate for different cases. There is no need to call WtpUtils.addNatures(). That's encapsulated in installation of the web facet.

You can substitute constants for appropriate IProjectFacet and IProjectFacetVersion objects from IJ2EEFacetConstants class.

Hope that helps. Let us know here if you have further questions.

- Konstantin

[Updated on: Thu, 22 July 2010 17:02]

Report message to a moderator

Re: Headless facet installation [message #549095 is a reply to message #548700] Sat, 24 July 2010 10:14 Go to previous messageGo to next message
Barry  is currently offline Barry Friend
Messages: 13
Registered: July 2010
Junior Member
Hi Konstantin,

it finally works, but how do I use
fproj.addTargetedRuntime( ..., null );
... how do I create a Runtime for this api call?

Thank You!

Barry
Re: Headless facet installation [message #549432 is a reply to message #549095] Mon, 26 July 2010 15:43 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
> it finally works, but how do I use
> fproj.addTargetedRuntime( ..., null );
> ... how do I create a Runtime for this api call?

You can retrieve an IRuntime instance using RuntimeManager.getRuntime( name ) API. Note that the runtime must already be defined by the time you make this call.

Faceted project framework does not deal with actually defining runtimes. That's up to technologies that use the framework. For Java EE servers, you should use API in org.eclipse.wst.server.core plugin to define a runtime.

- Konstantin
Re: Headless facet installation [message #572723 is a reply to message #548700] Sat, 24 July 2010 10:14 Go to previous messageGo to next message
Barry  is currently offline Barry Friend
Messages: 13
Registered: July 2010
Junior Member
Hi Konstantin,

it finally works, but how do I use
fproj.addTargetedRuntime( ..., null );
... how do I create a Runtime for this api call?

Thank You!

Barry
Re: Headless facet installation [message #572738 is a reply to message #572723] Mon, 26 July 2010 15:43 Go to previous message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
> it finally works, but how do I use
> fproj.addTargetedRuntime( ..., null );
> ... how do I create a Runtime for this api call?

You can retrieve an IRuntime instance using RuntimeManager.getRuntime( name ) API. Note that the runtime must already be defined by the time you make this call.

Faceted project framework does not deal with actually defining runtimes. That's up to technologies that use the framework. For Java EE servers, you should use API in org.eclipse.wst.server.core plugin to define a runtime.

- Konstantin
Previous Topic:Re: Headless facet installation
Next Topic:org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'web-app'.
Goto Forum:
  


Current Time: Tue Apr 16 19:23:01 GMT 2024

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

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

Back to the top