Monday, May 9, 2016

Create Dynamic extension point in Eclipse plugins



private void createDynamicExtension(){
        
         try{
             Bundle bundle = plugin.getBundle();
             InputStream inputStream = bundle.getEntry("extention.xml").openStream();
      
             String bundleIdStr = ""+bundle.getBundleId();//Get bundle ID as a String
             IContributor contributor = new RegistryContributor(bundleIdStr, bundle.getSymbolicName(),
                        null, null);
             ExtensionRegistry extensionRegistry = (ExtensionRegistry) Platform.getExtensionRegistry();
             
             Field declaredField = ExtensionRegistry.class.getDeclaredField("masterToken");
                declaredField.setAccessible(true);
                Object masterToken = declaredField.get(extensionRegistry); 
                          
             boolean addContribution = extensionRegistry.addContribution(inputStream, contributor, false, bundle.getSymbolicName(), null, masterToken);
                                  
System.out.println(addContribution);
}catch(Exception ex){ ex.printStackTrace(); } }


Here I have provided the extension content inside the "extention.xml" file. 

Thursday, March 17, 2016

WebTec4GE (Developing next generation Graphical Editors in Eclipse IDE)

While the support extended by eclipse graphical framework is rich, development of a fine tuned graphical editor, competing with applications developed using HTML5 and javascript support using this framework is strenuous. Further the framework requires a secluded knowledge base which is specific to eclipse domain Hence, building a rich graphical editor in eclipse requires a lot of effort which is a major drawback for rich graphical editor development in eclipse plugins.


What is WebTec4GE ?


This framework was designed with the goal of providing access to ubiquitous knowledge in UI and graphical editor design into eclipse editors, the ubiquitous knowledge base being web technologies for UI design. Web technologies are evolving at a rapid phase giving developers simplistic solutions to generate most complex UIs. 

Architecture overview of WebTec4GE



The core of this framework is the interface that provides access to Eclipse IDE eventing. The web based application running on top of the browser widget, which is embedded to the eclipse editor will have access to all eclipse ide events via a REST eventing module written to bridge the two domains.

Using the JS interface web editors can send and receive various editor events. At the page load, javascript components of the interface are injected to each web editor using which they can interact with IDE and act as a plain-old Eclipse Editor. It contains methods to interact with workspace. It is the main communication channel for interacting with Eclipse workbench.Capture the all the IDE events notify to the Web Editor such as Menu event (save , copy, cut, undo, redo etc..and Key bindings

By default SWT uses default Web Rendering Engine available on each platform (WebKit, XULRunner or IE) ,Since this creates an inconsistency when using the same editor in different platforms.This module will package XULRunner engine for each platform within the WebTec4GE framework itself and makes rendering of the editor pages will be unique across the platforms.

Saturday, September 26, 2015

How to restart eclipse programmatically

If you want to restart  eclipse programmatically then  you have restart the eclipse workbench . You can use following code snippets



String message = "You must restart eclipse to apply these changes, Restart Now ?";
if(MessageDialog.openQuestion(Display.getCurrent().getActiveShell(),"Developer Studio Info", message)){
   
  PlatformUI.getWorkbench().restart();

}


Sunday, August 17, 2014

How to use "Uri-template" with WSO2 API Manager

In this post I am going to develop a small use case which has used the "Uri-template " to find the correct resources

Pre-requires

WSO2 Developer studio - (version 3.5.0 or later)
WSO2 API Manager - (version 1.5.0 or later)
WSO2 Application server - (version 5.2.0 or later)

Contents
  1. Create a sample production service called Temperature-Reporter(TR).
  2. Host the TR service in the Application server.
  3. Create & Publish the API for TR service 
  4. Subscribe to the API
  5. Invoke the TR service via API (using curl ).

Create sample production service called Temperature-Reporter(TR).

Start the Developer Studio and go the dashboard. Create a JAX-RS service called TR ,this will the our production service , this a REST service. This service provides the average temperature of major cities in the world during the major seasons. As a example NYC average temperature  in the march is 4.5 in Celsius. likewise users will be able to check the avg temp by providing the city name. This is service class for the TR production service

1:  package com.blogspot.jasyz.tr.service;  
2:  import javax.ws.rs.*;  
3:  import javax.ws.rs.core.Response;  
4:  import javax.ws.rs.core.MediaType;  
5:  @Path("/temp")  
6:  public class TemperatureReporter {  
7:        @GET  
8:        @Path("{type}")  
9:        @Produces(MediaType.TEXT_PLAIN)  
10:        public Response getTempature(@PathParam("type") String type,  
11:                  @QueryParam("city") String city,  
12:                  @QueryParam("month") String month){  
13:             double temp=0.0;  
14:             if("NYC".equals(city)){  
15:                 if("jan".equals(month)){  
16:                       if("cel".equals(type)){  
17:                                temp = (4.0-3.0)/2.0;  
18:                           }else{  
19:                                temp =(39.0+26.0)/2.0;  
20:                           }  
21:                 }else if("feb".equals(month)){  
22:                      if("cel".equals(type)){  
23:                           temp = (5.0-3.0)/2.0;  
24:                      }else{  
25:                           temp =(40.0+27.0)/2.0;  
26:                      }  
27:                 }else if("mar".equals(month)){  
28:                      if("cel".equals(type)){  
29:                           temp = (8.0-1.0)/2.0;  
30:                      }else{  
31:                           temp =(48.0+34.0)/2.0;  
32:                      }  
33:                 }   
34:                 // Continue the logic   
35:             }else{  
36:                  return Response.status(200).entity("Sorry, Currently Information not avilable").build();  
37:             }  
38:            return Response.status(200).entity("tempareture of the "+city+" is "+temp+" in "+type).build();  
39:        }  
40:  }  

Now , right click on the project and export the project  then war file[1] will be created.

Host the TR service in the Application server

Start WSO2 Application Server , select the add jax RS/jax WS  menu from the left side bar. Then upload the previously created war file. Then if you check the server console you will see the following message in the server console.




 Try out the Raw TR service 

Before create the API lets try out the TR service directly , I am going to try out this service using curl , Open the terminal and paste the following command.(Curl is already installed)

 curl -v "http://10.100.1.102:9764/TR_1.0.0/services/temperature_reporter/temp/cel?month=Jan&city=NYC"  

result will be

  temperature of the NYC is 0.5 in cel  

Create & Publish the API 

Start the WSO2 API Manager and login to the publisher portal. Create the API by entering the following details




Friday, January 31, 2014

Application Development Life Cycle Management with WSO2 App Factory (AF)

WSO2 App Factory(AF)  is an enterprise-grade Platform as a Service (PaaS), providing flexibility, completeness, reliability, scalability, security and application life-cycle management (ALM) options that an enterprise needs to encourage business innovation. 

Following Diagram illustrate different stages pass by the application in it's life cycle and interested working group of each stage.






I have list down the key steps in a Application Development Life Cycle Management(LCM) in the AF.
  • Create a application in the trunk(1.0.0)- done by application owner  
  • Start development in the trunk- developers start developments 
  • Create the branch (1.0.0) - create the branch by developer or app owner 
  • Do the developer testing.
  • Promote to  QA - by developers 
  • Start the QA - by QA engineers 
  • report issues (bugs, improvements..etc ) - by QA 
  • demote the Application 
  • Developers fix the issues and do the developer testing - by developer 
  • Again promote to QA - by developers 
  • verify the reported issues and do other testing as well
  • Promote the application into  production (most of the time via staging) 

Creating  the Application 


first create a App in the AF.Once you done this, trunk will be created for that App, then the developers can start working on the application.Person who created Application has the app owner role. Basically app owner has all the permission related to this application in any stage of the application.


Develop the Application



WSO2 Developer Studio provide a unique support for developers to develop, deploy and build application in a single environment. please refer the Working with App Factory Applications to learn how to use developer studio with AF





Basically Developers checkout the trunk and start working in the application. once they finish a task, developer will commit the changes into trunk then deploy and build the trunk. After stable the current trunk, branch will be created. If this is the first branch usually it will be named as 1.0.0 branch. Once branch created developers start working on branch do the developer testing and fix the issues. After completing following three key points application can be promote into the QA stage from Development-Stage. 
  • Code complete 
  • Design review done 
  • Code review done 

Important :-
Developers cannot do any kind of code level changes after promoting the application, Only QA people can access the code.


QA the Application




Now application is running in the QA environment. Then QA people start working on the application, test case will be executed against the code ,if they find bugs they will create issues using  the AF issue tracker. QA person only can test the application he or she cannot do any code level changes when the application in the QA stage.

Found a Issue ! :-(

If  issues are reported then the application will be demote into the Dev Stage again.Those issues are added into the issue cracker and assign into relevant developers.Developer star fixing the issues reported by  QA. After closing all reported issues, application is promoted to QA again likewise this small cycle between QA and DevS happen until bug free the application. 

No Issues ! :-)

If  the application  does not having any issues  the application will be promoted to staging. In real world this step cannot reach at first time, most of the time application will be demoted several time and finally reach this step.Once Application promoted to the staging then the active branch will be frozen no body do code level changes after that. 


Application In Staging  

Now application is ready to go into production. Dev Ops will apply production environment related changes(change the database,Change the LDAP settings..... etc ) . Finally application will be  promoted into production.If any issue  occurs app will be demote into QA.  


Application In Action (Production)

Now the application is live and target users and groups can be used the application. After some times this application might not be covering all the business needs at that time new version of the application will be come to production and this will be retired !. 



Sunday, January 27, 2013

How to get IFile from File object

In eclipse world you need IFile object is very import to IO operation in plugin. Following code sample shows how get IFile from File object 

  IWorkspace workspace= ResourcesPlugin.getWorkspace(); 
  Bundle bundle = FrameworkUtil.getBundle(Activator.class);
URL fileURL = bundle.getEntry("resouces/TestFile");
File file = new File(FileLocator.resolve(fileURL).toURI());
IPath location= Path.fromOSString(file.getAbsolutePath()); 
  IFile ifile= workspace.getRoot().getFile(location);

Following code sample shows how to get ICompilation unit using IFile ,
  
ICompilationUnit createCompilationUnitFrom = JavaCore. createCompilationUnitFrom(ifile);
Good Luck !!

Friday, August 24, 2012

Dell Studio xps 16 ,No sound in Ubuntu

Dell Studio xps ,has a problem with sound in Ubuntu.
Actually machine detects the sound card properly
but cannot hear the sound.So you have to manually
edit the following file

Go to your Terminal and type:
$sudo gedit /etc/modprobe.d/alsa-base.conf

Then add following line at the end of the file
options snd-hda-intel model = dell-m6

Then reboot the system
When next Login you will hear the Ubuntu Login sound

Thank you
Jasintha