Hi Harold,

See the comments.

On Fri, Feb 20, 2009 at 11:38 PM, Harold Carr <[email protected]> wrote:

> Hello all,
>
> In preparation for the Metro-based version of the stocktrader demo I have
> crawled around the Java code.  A first past plan is (no attempt to
> do any code sharing or refactoring at this time):
>
> - Create the service side Java artifacts from the WSDLs at
>  contrib/stocktrader/java/business_service/resources/META-INF
>  contrib/stocktrader/java/order_processor/processor-service/resources/[
> msec | nosec ]/META-INF/
>
> - Adapt hand-written code at
>  contrib/stocktrader/java/business_service/src/org/wso2/stocktrader/
>
>
> contrib/stocktrader/java/order_processor/processor-service/src/org/wso2/stocktrader/
>  to work with Metro (initially using MSSQL).
>
> In other words, create the services from WSDL then supplying the
> business/DB logic using hand-written code (and NOT attempting to use
> ANY of the generated code).
>
> Does that plan sound reasonable?



Yes. That is perfect.



>
>
> Also, can someone point out the place in the code where one service
> calls another, AND the initial client call that starts things moving?



business_service functionality is implemented in
contrib\stocktrader\java\business_service\src\org\wso2\stocktrader\services\TradeServiceImpl.java
. All the client calls will be handled by this class. The methods of the
class are the implementation of the operations. When client calls "buy"
operation, buy method of TradeServiceImpl.java is called (line 77). It calls
buy method of TraderServiceManager.java(line 130) and it calls placeOrder
(line 148)of the same class. This method uses order processor client stub to
send a request to order processor service.



>
>
> Finally, I have created a map of the Java code below.  Could someone
> comment on this map and answer the embedded questions?
>


Answers given...


>
> Thanks,
> Harold
>
> --------------------------------------------------
>
> contrib/stocktrader/java/business_service/resources/META-INF
>    *****
>    *.wsdl *.xsd
>    The service seems to be generated from WSDL (rather from Java).
>        Is that correct?


Yes, the service is generated from WSDL.



>
>    What is services.xml for?


It is used by axis2 services. It includes service name, operations, policy
etc. Again, it is a generated file.


>
>    Why checkin a generated file?


After generating the file, we might do some modifications (like giving
policy, giving service class name, etc.) Also, we don't generate code at the
compile time, rather generate beforehand and check in all the generated
files.


>
>
>
> contrib/stocktrader/java/business_service/src/com/ibm/websphere/samples/trade/
>    GENERATED CODE
>    Why checkin generated code rather than just building it?


Same as above. We thought generating once is enough, rather that generating
the code every time we compile. However, if there is a modification to WSDL
or the logic of generating the code, we have to generate these files and
check in again.


>
>
>
> contrib/stocktrader/java/business_service/src/com/microsoft/schemas/_2003/_10/serialization/
>    GENERATED CODE
>
> contrib/stocktrader/java/business_service/src/org/tempuri/
>    GENERATED CODE


This is the business service skeleton. You can either fill the logic, or
write another class which extends from here. Actual service class name is
given in service. xml.


>
>
> contrib/stocktrader/java/business_service/src/org/wso2/interop/stocktrader/
>    GENERATED CODE


This is a client to configuration service (a PHP service). Again, even
though it is code generated, you can hand modify some part (like changing
the end point etc. )


>
>
> contrib/stocktrader/java/business_service/src/org/wso2/stocktrader/
>    ***** The real "business" logic, connection to DB, services *****
>
> contrib/stocktrader/java/business_service/src/traderorderhost/trade/
>    GENERATED CODE


client stub to order processor service.



>
>
> --------------------------------------------------
>
> contrib/stocktrader/java/config_service/
>    ***** Configuration code written in Javascript *****



This is the front end which configures the combination of services (we have
PHP, WSAS, Ruby, Python, Perl implementation of FE, Business service, and
order processor service. NOTE that not all the implementations have all 3
components). It uses configuration service written using PHP as the back
end. This configuration service can run on WSO2 Mashup Server (
http://wso2.org/projects/mashup)



>
>
> --------------------------------------------------
>
> contrib/stocktrader/java/documents/
>    Config UI and Java StockTrader installation guides
>
> --------------------------------------------------
>
> contrib/stocktrader/java/order_processor/processor-service/resources
>    msec  : service with security
>    nosec : service without security
>
> contrib/stocktrader/java/order_processor/processor-service/resources/[ msec
> | nosec ]/META-INF/
>    *****
>    *.wsdl *.xsd
>    The service seems to be generated from WSDL (rather from Java).
>        Is that correct?


Correct.


>
>    Both msec and nosec/META-INF contain identical files except
>      nosec/META-INF/stock-trader.properties.  Why?


Actuall, stock-trader.properties is no longer used. However, service.xml,
WSDL files are different. Only the xsd files are same. msec is having
WS-SecurityPolicy in its service.xml.
we have put common files in a single place in trunk. You can see from
trunk\stocktrader\wsas\order_processor\resources\common\META-INF



>
>
>
> contrib/stocktrader/java/order_processor/processor-service/src/com/ibm/websphere/samples/trade/
>    GENERATED CODE
>    Seems to be identical with
>
>
> contrib/stocktrader/java/business_service/src/com/ibm/websphere/samples/trade/
>      Why have identical (generated) code?


Yes. Both of them were code generated from same WSDL. Again, when we are
moving them to trunk, I have put them in a common place. see
trunk\stocktrader\wsas\common


>
>
>
> contrib/stocktrader/java/order_processor/processor-service/src/com/microsoft/schemas/_2003/_10/serialization/
>    GENERATED CODE
>    Seems to be identical with
>
>
> contrib/stocktrader/java/business_service/src/com/microsoft/schemas/_2003/_10/serialization/


same as above


>
>
> contrib/stocktrader/java/order_processor/processor-service/src/org/tempuri/
>    GENERATED CODE
>
>
> contrib/stocktrader/java/order_processor/processor-service/src/org/wso2/stocktrader/
>    ***** The "real" business logic ****
>    Has much code that is duplicated from
>      contrib/stocktrader/java/business_service/src/org/wso2/stocktrader/


All the common code were moved to single place. see
trunk\stocktrader\wsas\common\src\org\wso2\stocktrader


>
>
>
> contrib/stocktrader/java/order_processor/processor-service/src/traderorderhost/trade/
>    GENERATED CODE
>
> ;;; End of file.
>

We have re-organised the WSAS code, when moving from contrib to trunk. All
the common code is moved to a single place. Please have a look at
https://svn.apache.org/repos/asf/incubator/stonehenge/trunk/stocktrader/wsas


Regards,
Shankar

-- 
S.Uthaiyashankar
Software Architect
WSO2 Inc.
http://wso2.com/ - "The Open Source SOA Company"

Reply via email to