Hi Imesh,
Also in below methods entityName is used only for printing messages. We can
remove them, right?
1. public Object getEntity(String serviceEndpoint, Class
responseJsonClass, String identifier, String entityName) {
2. try {
3. return executeGet(serviceEndpoint.replace("{id}",
identifier), responseJsonClass);
4. } catch (Exception e) {
5. String message = String.format("Error in getting %s",
entityName);
6. System.out.println(message);
7. logger.error(message, e);
8. return null;
9. }
10. }
11.
12. public Object listEntity(String serviceEndpoint, Class
responseJsonClass, String entityName) {
13. try {
14. return executeGet(serviceEndpoint, responseJsonClass);
15. } catch (Exception e) {
16. String message = String.format("Error in listing %s",
entityName);
17. System.out.println(message);
18. logger.error(message, e);
19. return null;
20. }
21. }
On Sat, Nov 8, 2014 at 10:13 PM, Imesh Gunaratne <[email protected]> wrote:
> I have now fixed this with commit
> revision: 414a93b7394de6eb3494f7d164e599006032ffcf
>
> On Sat, Nov 8, 2014 at 10:04 PM, Imesh Gunaratne <[email protected]> wrote:
>
>> Hi,
>>
>> I noticed following domain classes introduced recently in the CLI:
>>
>>
>>
>> It seems like the naming convention used in above classes Applications,
>> Clusters, Groups and SubGroups is not correct. These classes look like
>> collection types but they are single object types.
>>
>> Class: RestCommandLineService
>> public void describeApplication (String applicationID) {
>> try {
>> ApplicationBean list = (ApplicationBean)
>> restClient.listEntity(ENDPOINT_LIST_APPLICATION.replace("{appId}",
>> applicationID),
>> ApplicationBean.class, "applications");
>>
>> if ((list == null) || (list.getApplications() == null)) {
>> System.out.println("Application not found: " +
>> applicationID);
>> return;
>> }
>>
>> System.out.println("Application : " + applicationID);
>> System.out.println(getGson().toJson(list.getApplications()));
>> } catch (Exception e) {
>> String message = "Error in describing application: " +
>> applicationID;
>> System.out.println(message);
>> log.error(message, e);
>> }
>> }
>>
>> - ApplicationBean class used in the above method has exposed a method
>> called getApplications() but it only returns an application.
>> - The above method defines a local variable called list but it only
>> contains one application object.
>>
>> Thanks
>>
>> --
>> Imesh Gunaratne
>>
>> Technical Lead, WSO2
>> Committer & PMC Member, Apache Stratos
>>
>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>
--
Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware
web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897