Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Creating a new Module Type
Creating a new Module Type [message #231917] Wed, 27 May 2009 07:44 Go to next message
Anders Olsson is currently offline Anders Olsson
Messages: 21
Registered: July 2009
Junior Member
Hello,

I'm in the process of defining a new Module Type, that will be publishable
through my custom Server Adapter.

What I've done so far is to add the extensions:
<extension point="org.eclipse.wst.server.core.moduleTypes">
<moduleType id="my.type" name="MY TYPE">
</moduleType>
</extension>

<extension point="org.eclipse.wst.server.core.runtimeTypes">
<runtimeType...>
<moduleType types="jst.ear" versions="1.2,1.3,1.4,5.0"/>
<moduleType types="my.type" versions="1.0">
</moduleType>
</runtimeType>
</extension>

<extension point="org.eclipse.wst.common.project.facet.core.runtimes">
<runtime-component-type.../>
<runtime-component-version.../>
<adapter>
<runtime-component.../>
<factory.../>
<type.../>
</adapter>
<supported>
<runtime-component.../>
<facet
id="my.type"
version="1.0">
</facet>
</supported>
</extension>


Also, in my Serverdef I have:
<module>
<type>my.type</type>
<publishDir>${deploy.dir}</publishDir>
<publisherReference>org.eclipse.jst.server.generic.antpublisher </publisherReference>
</module>

I've added the natures:
"org.eclipse.wst.common.project.facet.core.nature" - For the ability to
use facet dependencies
and
"org.eclipse.wst.common.modulecore.ModuleCoreNature" - To be able to be
used as a module, to add to a Server Adapter.
to my project type.

My problem is that most of this is just figured out by taking from
different examples. But I've found no example as a whole, how to create a
new Module Type. I've tried reading the sources of WST/JST, but they're
not really written in a way that makes it easy to follow.

What more do I need to do in order to make this work? Are there any
examples of this? I have found no help in the book "Eclipse Web Tools
Platform".

Thanks in advance,

Anders Olsson
Re: Creating a new Module Type [message #231925 is a reply to message #231917] Thu, 28 May 2009 22:09 Go to previous message
Eclipse User
Originally posted by: rstryker.redhat.com

I assume you're making a project-type module, meaning where each project
is represented by one module. You could also theoretically turn anything
at all into a module via the module factory. You'll need to look into
the avialable extension points in the servertools server.core plugin.

Specifically, to actually turn your project (or any item) into a module,
you need have a module factory.

For example:
<extension
point="org.eclipse.wst.server.core.moduleFactories">
<moduleFactory
class="com.example.my.Modulefactory"
id="com.example.my.ModuleFactoryID"
projects="true">
<moduleType
types="my.module.type"
versions="1.0">
</moduleType>
</moduleFactory>
</extension>

It seems (because you're using a serverdef) that you're trying to use
the GenericServer Framework. If you wanted to have more control over the
publishing operation, you should also create a server type yourself
through the org.eclipse.wst.server.core.serverTypes extension point. In
this extension point you can also set a ServerBehaviourDelegate, which
can handle publishing of new or unusual modules.

But, of course, this added control with a lot more responsibility.
If you don't want that level of work, I believe the generic server
framework also includes a publisher's extension point, where you can
provide your own publisher for this new module type. I don't have the
extension point for that available off hand and I'm not familiar with
the process for this.

If, on the other hand, you really are trying to create a complete
module, very similar to WTP projects, with a content folder, the virtual
component framework in the project, a way to link projects together via
a page similar to the JEE Module dependency page, well, all I can say
is that you've got quite a task ahead of you, and good luck ;) That kind
of endeavor requires knowledge of the Component Core and Virtual
Component frameworks, how to add references, etc. There's currently no
generic module dependency page available. The current one is very
limited to JEE projects and has a lot of built in assumptions.

- Rob Stryker





Anders Olsson wrote:
> Hello,
>
> I'm in the process of defining a new Module Type, that will be
> publishable through my custom Server Adapter.
>
> What I've done so far is to add the extensions:
> <extension point="org.eclipse.wst.server.core.moduleTypes">
> <moduleType id="my.type" name="MY TYPE">
> </moduleType>
> </extension>
>
> <extension point="org.eclipse.wst.server.core.runtimeTypes">
> <runtimeType...>
> <moduleType types="jst.ear" versions="1.2,1.3,1.4,5.0"/>
> <moduleType types="my.type" versions="1.0">
> </moduleType>
> </runtimeType>
> </extension>
>
> <extension
> point="org.eclipse.wst.common.project.facet.core.runtimes">
> <runtime-component-type.../>
> <runtime-component-version.../>
> <adapter>
> <runtime-component.../>
> <factory.../>
> <type.../>
> </adapter>
> <supported>
> <runtime-component.../>
> <facet
> id="my.type"
> version="1.0">
> </facet>
> </supported>
> </extension>
>
>
> Also, in my Serverdef I have:
> <module>
> <type>my.type</type>
> <publishDir>${deploy.dir}</publishDir>
> <publisherReference>org.eclipse.jst.server.generic.antpublisher </publisherReference>
>
> </module>
>
> I've added the natures:
> "org.eclipse.wst.common.project.facet.core.nature" - For the ability to
> use facet dependencies
> and
> "org.eclipse.wst.common.modulecore.ModuleCoreNature" - To be able to be
> used as a module, to add to a Server Adapter.
> to my project type.
>
> My problem is that most of this is just figured out by taking from
> different examples. But I've found no example as a whole, how to create
> a new Module Type. I've tried reading the sources of WST/JST, but
> they're not really written in a way that makes it easy to follow.
>
> What more do I need to do in order to make this work? Are there any
> examples of this? I have found no help in the book "Eclipse Web Tools
> Platform".
>
> Thanks in advance,
>
> Anders Olsson
>
Previous Topic:Serializing namespaces on the xsd schema level
Next Topic:Tomcat start fails with syntax error
Goto Forum:
  


Current Time: Fri Aug 22 15:52:32 EDT 2014

Powered by FUDForum. Page generated in 0.01726 seconds