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

Difference between revisions of "Refactor of JavaFirst"

(Menu Customization)
(Extension Point)
Line 35: Line 35:
 
'''1). additional_project_wizard_page'''
 
'''1). additional_project_wizard_page'''
  
To specify runtime specific wizard page additional to the standard pages in java first project wizard. No limitation to this page. If it is not implemented by runtime provider, it will not display in the wizard.  
+
To specify runtime specific wizard pages added to the standard pages in java first project wizard. It's an optional extension point. And no limitation for this page. If defined, these pages will display in the project wizard.
  
'''2). project_property_page'''
+
'''2). ui_customization'''
  
To specify project property. STP will provide a default page. But runtime provider can overwrite this page by the extension point.
+
To customize the menu for specific runtime provider. For detailed information, please refer to the section: [http://wiki.eclipse.org/Refactor_of_JavaFirst#Ui_Customization]
 
+
'''3). menu_customization'''
+
 
+
To customize the menu for specific runtime provider. For detailed information, please refer to the section: [http://wiki.eclipse.org/Refactor_of_JavaFirst#Menu_Customization]
+
  
 
== Use Cases ==
 
== Use Cases ==

Revision as of 05:07, 8 October 2007

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 already has an runtime provider extension point. In this extension point, new items will be added.

1). additional_project_wizard_page

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

2). 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 display and the specified runtime will be used as default.

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 choose to create a empty project or to import existing source codes.

Customization: STP will provide a default page. And this page can be replaced through the extension point.

Rulse for the default page:

1). If user chooses the "Create an empty project." selection, all other items in the GUI will be disabled.

2). If user chooses an interface as the web service class, he should also point out the implementation class which can be generated automatically by STP or imported from the exsiting source codes.

Project-wizard-3-1.1.JPG


The last Page: STP will not provide default page. It's depend on the implementation of runtime provider. It could be implemented through the extension point. Customization: STP will not provide default page. It's depend on the implementation of runtime provider. If it is not provided by the runtime provider, this page will not display. The following picture is an example for CXF runtime:

Project-wizard-4.JPG

Preference Page

No change compared with current solution.(TBD)

Project Property Page

Customization: STP will provide a default page. And this page can be replaced through the extension point.

Property-page-1.1.JPG

Right Click Popup Menu

When user right click the project or the java file of this project in Package Viewer, the menu item [Generate WSDL] will be displayed in the popup menu. User can use this action [Generate WSDL] to invoke the java2wsdl generator. At that time, if the starting point is not defined, a wizard will display on which user should provide the starting point class.

Popup-menu-1.1.JPG

Menu Customization

1). Default Menu in Jaxws

Some default menu will 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. For example, if the runtime is CXF, it could like this snapshot in plugin.xml:

  <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

Generator Parameters

Different runtime has different generator parameters. STP framework will provide an extension point to support this. The following are CXF runtime parameters:

-databinding
-soap
-verbose
-createxsdimport
-wsdl
-server
-client

And the corresponding GUI provided by extension looks like:

Generator-parameters.JPG

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)

Back to the top