This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 229593 - Broker should have clear return codes
Summary: Broker should have clear return codes
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Cosmos (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Hubert Leung CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-30 07:30 EDT by Srinivas Reddy CLA
Modified: 2012-01-03 13:54 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Srinivas Reddy CLA 2008-04-30 07:30:18 EDT
Build ID: COSMOS-1.0.0-200804270312

Steps To Reproduce:
1.Install COSMOS Componets as per wiki http://wiki.eclipse.org/COSMOS_DEMO_i10#Installation
2.open <cosmos-demo>/bin/cosmos-client>cosmos-client.sh, register all DataManagers 
3.Now try to deregister with invalid host or non-existing datamanager

Result:
- No error message, instead it displays successful message as ""DataManager deregistered" 

Also, if we try to deregister multiple times again and again on same datamanager, also shows same message as "DataManager deregistered"


More information:
Comment 1 Srinivas Reddy CLA 2008-04-30 08:16:57 EDT
Also, de-registration doesn't work if we give IP address instead of hostname.

It work's only with the hostname that appears in the result of "broker getDataManagers"
Comment 2 Hubert Leung CLA 2008-04-30 11:55:03 EDT
I would characterize the problem as a need to have a better return code and message.  

Possible return states are:
1. data manager is deregistered
2. the data manager requested to be deregistered was not registered at the broker
3. (unexpected) errors occurred while deregistering data manager



For comment #1, the broker would not know the IP address of the data manager if it was registered with the host name.  
Comment 3 Ian Hayes CLA 2008-05-09 04:12:12 EDT
Java design patterns don't normally employ return codes. Instead failure states are implemented as custom exceptions.

For example...

   public void deRegisterManager(String aName) 
       throws UnknownDataManagerException,
              DeRegistrationFailedException,
              UnknownIPAddressException;

(In reply to comment #2)
> I would characterize the problem as a need to have a better return code and
> message.  
> Possible return states are:
> 1. data manager is deregistered
> 2. the data manager requested to be deregistered was not registered at the
> broker
> 3. (unexpected) errors occurred while deregistering data manager
> For comment #1, the broker would not know the IP address of the data manager if
> it was registered with the host name.  

Comment 4 Hubert Leung CLA 2008-05-09 09:27:22 EDT
I was referring to content of the SOAP message returned by the broker.  The client can throw exceptions when a fault is received.  
Comment 5 Hubert Leung CLA 2008-06-10 17:56:25 EDT
The broker now returns a web-defined constant in the SOAP response to indicate the status of the registration or deregistration operation.  

The broker client APIs have changed to indicate the operation results and exceptions. 

/**
 * Register a group of services with the broker.
 * @param group
 * @return true if the group is registered, 
 * false if a group with the same identity has already been registered.
 * @throws BrokerDatabaseException unexpected errors occurred
 */
public boolean registerGroup(Group group) throws BrokerException;

/**
 * Deregister a service group at the broker. 
 * @param hostname  Hostname of the server that hosts the service group
 * @param groupName The name of the service group.
 * @return true if deregistration is successful, false if the group identified does not exist on the broker. 
 * @throws BrokerDatabaseException unexpected error occurred
 */
public boolean deregisterGroup(String hostname, String groupName) throws BrokerException;


Comment 6 Srinivas Reddy CLA 2008-06-20 09:36:01 EDT
Hubert,

From my below testing, I can see proper broker return codes in SOAP Response messages, however I don't see proper messages on COSMOS Command Line Client console. Don't we need fix to COSMOS Client to display appropriate message based on SOAP response ?

Broker Registration:
===================
1) COSMOS> broker register ExampleMdr
Registering ExampleMdr

SOAP Response:
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:registerGroupResponse xmlns:ns="http://www.eclipse.org/cosmos/broker">REGISTRATION_SUCCESSFUL</ns:registerGroupResponse></soapenv:Body></soapenv:Envelope>

2) COSMOS> broker register ExampleMdr
Registering ExampleMdr

SOAP Response:
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:registerGroupResponse xmlns:ns="http://www.eclipse.org/cosmos/broker">REGISTRATION_DUPLICATED_SERVICE</ns:registerGroupResponse></soapenv:Body></soapenv:Envelope>


Broker Deregistration:
=====================
1) COSMOS> broker deregister domsr01-xp ExampleMdr
DataManager deregistered.

SOAP Response:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body><ns:deregisterGroupResponse xmlns:ns="http://www.eclipse.org/cosmos/broker">DEREGISTRATION_SUCCESSFUL</ns:deregisterGroupResponse>
</soapenv:Body></soapenv:Envelope>

2) COSMOS> broker deregister domsr01-xp mymdr 
DataManager deregistered.
COSMOS>

SOAP Response:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body><ns:deregisterGroupResponse 
xmlns:ns="http://www.eclipse.org/cosmos/broker">DEREGISTRATION_FAILED</ns:deregisterGroupResponse>
</soapenv:Body></soapenv:Envelope>
Comment 7 Hubert Leung CLA 2008-06-23 10:01:56 EDT
Srinivas, 

Yes, the command line client need to change to display a message that reflect the status of the operation.  I will open a bug for this problem.  

Thanks.
Comment 8 Srinivas Reddy CLA 2008-09-30 07:51:51 EDT
This is resolved and verified long back, Closing it as part of cleanup.