geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "gunsnroz" <gunsn...@hotmail.com>
Subject duplicate code in EWS and AXIS
Date Thu, 19 Feb 2004 18:39:00 GMT
Hi, ews and axis people!

After comparing the codes in EWS and AXIS, I found that many of them are
duplicated.
Specially, the following codes are very similar.

  - J2eeEmitter <--> org.apache.axis.wsdl.tojava.Emitter
  - J2eeGeneratorFactory <-->
org.apache.axis.wsdl.tojava.JavaGeneratorFactory

The other codes such as J2eexxxWriter are deprecated in EWS because the
equivalent ones in Axis 
can be used. Like this, some modification in the axis Emitter and
JavaGeneratorFactory
makes the Axis code reusable and ews code simpler.

The basic idea is adding some codes that override the Axis' default Java
<--> wsdl nampping in derived classes.
Here is the example, (details omitted for brevity)

JavaGeneratorFactory.java from Axis

protected void determineInterfaceName(SymbolTable symbolTable) {
	// ...
	if (entry instanceof BindingEntry) {

		PortTypeEntry = ...
		seiName = ptEntry.getName();
		bEntry.setDynamicVar(JavaBindingWriter.INTERFACE_NAME,
seiName);
	}
	// ...
}

If we add some way to override Axis' default name mapping (ptEntry.getName()
in above example) like this:


///////////////////// JavaGeneratorFactory in Axis
protected void determineInterfaceName(SymbolTable symbolTable) {
	// ...
	if (entry instanceof BindingEntry) {

		PortTypeEntry = ...
		seiName = getServiceEndpointInterfaceJavaNameHook(ptEntry,
bEntry);
		if (seiName == null) {
			seiName = ptEntry.getName();
		}
		bEntry.setDynamicVar(JavaBindingWriter.INTERFACE_NAME,
seiName);
	}
	// ...
}	

protected String getServiceEndpointInterfaceJavaNameHook(PortTypeEntry
ptEntry, BindingEntry bEntry) {
	return null;
}

The J2eeGeneratorFactory in ews look like this:

/////////////////////// J2eeGeneratorFactory in EWS

class J2eeGeneratorFactory extends
org.apache.axis.wsdl.tojava.JavaGeneratorFactory {
// determinedInterfaceName() : no more needed.

// add new method
protected String getServiceEndpointInterfaceJavaNameHook(PortTypeEntry
ptEntry, BindingEntry bEntry) {
	if (mapper == null)
		return null;
	return mapper.getServiceEndpointInterfaceName(ptEntry, bEntry);
}
// ...
}

I have modified the codes in ews and axis and 
it seems that almost duplicate codes in J2eeEmitter and J2eeGeneratorFactory
can be removed.

Uhm... I think there are pros and cons in this way.
The cons:
  - Tightly coupling in the Axis code and ews (or other) codes
 
The pros:
  - Simpler ews codes
  - The Axis code can be reused in other Java <--> WSDL mapping case (like
JSR-181)

I will discuss it more with Ias who is the Axis and ews committer. (He and I
are working in the same company)
I think that the code change in Axis like this should be with the consent of
other Axis committers.

Any comment?

Jongjin/

---------------------------------------------------
Webservices Team in Tmax Soft.
JSR-208 EG member.
---------------------------------------------------

Mime
View raw message