Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Refactor of JavaFirst

Revision as of 22:46, 9 October 2007 by Jonathan.huang.iona.com (Talk | contribs) (Ui Customization)

Problems of Current Solution

1). It is not flexible enough to support different runtime with different UI. For example: A runtime called RuntimeA adds an action(right-clic popup menu) called ActionA to the target wsdl file. Another runtime called RuntimeB adds an action called ActionB to the same target: wsdl file. When user right click the wsdl file, what will happen? For now, both ActionA and ActionB will be displayed in the popup menu. But it is not correct way. The right way should be: if the project that contains this wsdl file is associated with RuntimeA, then only ActionA should be displayed in the popup menu.


2). There are two steps for user to do his jobs. First is java2wsdl and second is wsdl2java. It’s too “complicated” for user. Actually, from user’s point of view, he does not care what the wsdl file looks like. He only and should only care about the SEI/IMPL. The wsdl file should be transparent for user. So, it needs to generate all artifacts including wsdl file and source codes from SEI/IMPL directly. Further more, it is very possible that user will modify the generated wsdl file after java2wsdl step. Then, the source codes generated by wsdl2java tool from this modified wsdl file may not match the original SEI/IMPL. As the result of this, the service may not work. So, if the wsdl and source codes are generated in only one step, user will have no chance to modify the wsdl file and the problem will not occur.


3). The java2wsdl generator will be invoked each time when building the project. Actually, at most of time, user does not want to invoke the generator. They just only want to modify his SEI/IMPL. And when they think the SEI/IMPL is finished they would want to use the generator to generate other artifacts. So, it needs to provide a selection for user to choose whether build process will invoke the generator or not.


4). Which class (SEI/IMPL) will be chosen to start the java2wsdl generator? In current solution, system will go through all the source codes and choose some of them to start the generator. It may be useful for user. But it is very possible that the system chooses a “wrong” class that the user does not want to choose. Actually, user knows his SEI/IMPL very clearly. And it is very easy for user to specify the java class to start the generator. So, why not let user point out which class to be start with?

New Solution for Java First Programming Model

Main Changes

1). Integrate the new code first tool called "java2ws" in CXF runtime. Using the new tool "java2ws", the webservice artifacts including wsdl, server, client and IMPL could be generated within one step. That is to say, the action [Generate Code] from wsdl will be no use and disabled for java first programming mode. Note that it is only effect in CXF runtime environment. For detail description about this integration, please refer to [1]


2). Introduce the "start point" conception which means the input java file(SEI or IMPL) from wich to generate other webservice artifacts.


3). Remove the java2wsdl procedure from the build process and add a new action (right click menu) called [Generate WSDL] for user to invoke the generator tool manually.


4). Introduce a mechanism to support different runtime use different UI. Basecally, for project wizard, project property and preference, we could use extension point just like "generator_parameter_page". But for menu, it will be a little bit more complicated. All the jaxws related menu will be divide into two groups: one is jaxws default menu and the other is runtime specific menu. In jaxws default menu, only a few stadandard menu items are defined, such as [Enable/Disable Jax-ws], [Generate Code], [Generate WSDL] and so on. And the specific runtime provider could add its own menu items and choose to reuse/hide the jaxws default menu partly or totally. That is to say, the menu will be changed as the selection of user. For example, if user has two project: ProjectA with CXF runtime and ProjectB with RI runtime, the menu for ProjectA is different from ProjectB. Further more, not only should different runtime have different UI, but also different development mode (java first or wsdl first) should have different UI. For example, the right-click menu item [Generate Code] from wsdl should be enabled in wsdl first project, but it should be disabled in java first project if the runtime is CXF. For more detailed information, please refer to the section: [2]

Extension Point

STP framework has already had an runtime provider extension point. In this extension point, there will be some new items to be added.

1). starting_point_page

To specify starting point page in project wizard.

2). additional_project_wizard_page

To specify runtime specific pages added to the standard pages in project wizard. It's an optional extension. And no limitation for this extension. If defined, these pages will display in the project wizard.

3). ui_customization

To customize the menu for specific runtime provider. For detailed information, please refer to the section: [3]

Use Cases

1). If user has nothing.

-User creates an JavaFirst empty project using project wizard.
-User creates interface and implementation. The implementation class can also be generated automatically by STP as user's selection.  
-User set the interface or the implementation as the starting class from which to start the generator in the project property page.
-User right click the project or the starting class and select the [Generator tool] to start the generator.
-STP will annotate the interface and implementation if these classes have not been annotated as webservice. And then STP will invoke the generater of the coresponding runtime type to generate all the artifacts for user. 

2). If user has an interface without implementation.

-User starts the JavaFirst project wizard.
-User specifies the existing interface as the starting class and chooses using the generated implementation in the wizard page. The dependend java file and libraries can also be added.
-STP will import all the existing java file and libraries to the new created project. And default webservice annnotations will be added to the interface. And also, an implementation will be created for user. If the runtime choosed by user can generate implementation, STP will use the generator of this rumtime to generate the implementation. Otherwise, STP will use default generator to generate the implementation.
-User modifies the implementation class.
-User right click the project or the starting class and select the [Generator tool] to start the generator.
-And then STP will invoke the generator of the coresponding runtime type to generate all the artifacts for user. 




3). If user has an interface with corresponding implementation.

-User starts the JavaFirst project wizard.
-User specifies the existing interface as the starting class and chooses to use the existing implementation in the wizard page. The dependend java file and libraries can also be added.
-STP will import all the existing java file and libraries to the new created project. And default webservice annnotations will be added to the interface and implementation.
-User modifies the implementation class.
-User right click the project or the starting class and select the [Generator tool] to start the generator.
-And then STP will invoke the generator of the coresponding runtime type to generate all the artifacts for user. 



4). If user has an IMPL/POJO with out interface

-User starts the JavaFirst project wizard.
-User specifies the existing IMPL/POJO as the starting class in the wizard page. The dependend java file and libraries can also be added.
-STP will import all the existing java file and libraries to the new created project. And default webservice annnotations will be added to implementation/pojo.
-User modifies the implementation class.
-User right click the project or the starting class and select the [Generator tool] to start the generator.
-And then STP will invoke the generator of the coresponding runtime type to generate all the artifacts for user.

GUI

Project Wizard

The First Page: User can enter the project name.

Customization: This page can not be customized.

Project-wizard-1.JPG


The Second Page: User can choose the runtime.

Customization: If the following two conditions are satisfied, this page will not be displayed in the wizard and the specified default runtime will be chose.

1. The value of [use_default_jaxws_runtime] in preference store is set to [true];
2. The value of [default_jaxws_runtime] in preference store is not null.

Project-wizard-2.JPG


The Third Page: User can specify the starting point (SEI/IMPL).

Customization: This page should be provided by runtime provider using the "starting_point_page" extension point. The following picture is an example in CXF runtime:

Project-wizard-3-1.2.JPG

Additional Pages: User can add any other pages to the project wizard using the "additional_wizard_pages" extension point.

Customization: These pages should be provided by runtime provider using the "additional_wizard_pages" extension point. The following picture is an example in CXF runtime.

Project-wizard-4.JPG

Preference Page

No change compared with current solution.

Project Property Page

No change compared with current solution.

Right Click Popup Menu

When user right click the project in Package Viewer, the menu item [Generate WSDL] will be displayed in the popup menu. User can use it to invoke the java2wsdl generator.

Popup-menu-1.1.JPG

Menu Customization

1). Default menu in Jaxws

Some default menu will be defined in jaxws plugin and categorized into 5 categories:

-ProjctNature: includes [Enable JAX-WS], [Disable JAX-WS]
-Annotation: includes [Create Web Service], [Create Web Method]
-Handler: includes [Create JAX-WS Handler]
-CodeGenerator: includes [Generate Code]
-WSDLGenerator: includes [Generate WSDL]

All kinds of these menu can all be reused(default) or hide using the attribute in the runtime provider extension point:

-enable_default_jaxws_menu_All: true(default) or false
-enable_default_jaxws_menu_ProjctNature: true(default) or false
-enable_default_jaxws_menu_Annotation: true(default) or false
-enable_default_jaxws_menu_Handler: true(default) or false
-enable_default_jaxws_menu_CodeGenerator: true(default) or false
-enable_default_jaxws_menu_WSDLGenerator: true(default) or false


2). Runtime Specific Menu

Runtime specific menu can be added. But at the same time, all the menu defined in this runtime should be categoried as one group using the extension point "org.eclipse.ui.activities" and tell STP the id of this category using the attribute in runtime provider extension point. The following is an example in CXF runtime:

  <extension point="org.eclipse.ui.activities">
        <category
               name="CXF Menu"
               description="Jax-ws Software Development"
               id="org.eclipse.categories.cxfCategory">
        </category>
        <activity
               name="CXF Activity"
               description="Developing CXF Software"
               id="org.eclipse.cxfdevelopment">
        </activity>
        <categoryActivityBinding
               activityId="org.eclipse.cxfdevelopment"
               categoryId="org.eclipse.categories.cxfCategory">
        </categoryActivityBinding>
        <activityPatternBinding
               activityId="org.eclipse.cxfdevelopment"
               pattern="org\.eclipse\.stp\.sc\.cxf/.*">
        </activityPatternBinding>
  </extension>

  <extension
        id="cxf"
        name="Apache CXF"
        point="org.eclipse.stp.sc.jaxws.runtimeProvider">
        ...
        <menu_customization
        -enable_default_jaxws_menu_All="false"
        category="org.eclipse.categories.cxfCategory"
        ...
        />
        ...
  </extension>

Using this, STP will know to hide all jaxws default menu if the current project uses CXF runtime. And if the current project does not use CXF runtime, the CXF specific menu will be hiden.


3). Different Menu for Different Programming Mode (Java First or WSDL First)

Two project natures will be introduced in STP: javaFirstNature and wsdlFirstNature. The project created by Java First wizard will have javaFirstNature and the same to wsdlFirstNature. STP will use the nature to distinguish the different menu. So, all the menu contributions should using this nature as the filter if needed. For example, the menu item [Generate Code] in jaxws default menu will use wsdlFirstNature as the filter.

CXF Integration

Project Wizard

Two additional wizard pages will be added.

1). Starting point page


2). Java2ws generator parameters page

Generator-parameters.JPG

Project Property

Right Click Menu

UI Customization

Simple FrontEnd

CXF runtime provides another frontend named "simple frontend". Using this frontend, user can easily generate service artifacts without adding webservice annotations to SEI/IMPL. But the generated service will not be a jax-ws compatible service. So, a new project wizard will be provided in CXF plugin rather than JAXWS plugin.

Simple-frontend-wizard-0.JPG

JAXWS-RI Runtime

No change compared with current solution. (TBD)

Copyright © Eclipse Foundation, Inc. All Rights Reserved.