Comments
yourfanat wrote: I am using another tool for Oracle developers - dbForge Studio for Oracle. This IDE has lots of usefull features, among them: oracle designer, code competion and formatter, query builder, debugger, profiler, erxport/import, reports and many others. The latest version supports Oracle 12C. More information here.
Cloud Expo on Google News

2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


Revisitng Java SE 6 Features! @CloudExpo #Java #Cloud #OpenSource
A tutorial series on Java as we all eagerly await the official release of Java SE 9

I have provided some of the most important core language enhancements for JDK 6.0, along with code samples. The examples provided below can be directly pasted into your IDE and you may name the class as provided.

Integrated Web Services
From JDK6, Java allows the creation, publishing and lookup of web services through a mixture of annotations and command-line utilities. The below is located in package 'jdk6.features'
 package jdk6.features;  
 import javax.jws.WebMethod;  
 import javax.jws.WebService;  
 import javax.xml.ws.Endpoint;  

 /**  
  * @author sumith_puri  
  *  
  * credits: https://weblogs.java.net/blog/vivekp/archive/2006/12/webservices_in.html  
  *   
  * apt -d sample jdk6_WebServices.java  
  * java -cp sample jdk6.features.jdk6_WebServices  
  * wsimport -p client -keep http://localhost:8080/calculator?wsdl  
  */  
 @WebService  
 public class jdk6_WebServices {  
      @WebMethod  
      public int add(int a, int b) {  
           return (a+b);  
      }  
      public static void main(String[] args) {  
           jdk6_WebServices calculator = new jdk6_WebServices();  
           Endpoint endpoint = Endpoint.publish("http://localhost:8080/calculator", calculator);  
      }  
 }  

In the same folder as the root of the above source file/package, you should type the following:
apt -d sample jdk6_WebServices.java

Then type the following, to deploy the Web Service at the specified URL.
java -cp sample jdk6.features.jdk6_WebServices

Now, it is time to create the client. You may use the following command to create the client stubs.
wsimport -p client -keep http://localhost:8080/calculator?wsdl

We can import the generated sources from the 'client' folder now to Eclipse. Using the imported client stubs, you can create client application using the following. Execute it either on command-line or from Eclipse (Run As > Java Application)
 package client;  

 public class JDK6WebServicesClientApp {  
      public static void main(String[] args) {          
           Jdk6WebServicesService service = new Jdk6WebServicesService();  
           Jdk6WebServices serviceProxy = service.getJdk6WebServicesPort();  
           int result = serviceProxy.add(12, 12);  
           System.out.println("Sum: " + result);  
      }  
 }  


Java Compiler API
A powerful feature in JDK6 that will be of really help to create artifacts such as plugins, filters, extensions for dynamic (customer based or client based) execution - is Dynamic Compilation using the Java Compiler API.
 public class jdk6_DynamicCompilation {  

      public static void main(String[] args) throws Exception {            
           System.out.println("Testing Dynamic Compilation....");  
           System.out.println("plugin\\Plugin.java");       
           String fileToStream = "plugin" + java.io.File.separator + "Plugin.java";  
           JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();                 
           FileOutputStream fileOutputStream = new FileOutputStream("errors.txt");  
           int compilationResult = javaCompiler.run(null, null, fileOutputStream,   
                                                          "-verbose", fileToStream);            
           System.out.println("Compilation Result..." + compilationResult);  
      }  
 }  

The following code should be provided under 'plugin'. You may name it as 'Plugin.java'
 package plugin;  
   
 public class Plugin {  
      public boolean filter(String data) {            
           boolean flag=false;  
           if(data.contains("fish")) {                 
                flag=true;  
           }  
           return flag;  
      }  
 
     public static void main(String[] args) {  
      }  
 }  

You may now run the jdk6_DynamicCompilation and obtain Plugin.class as dynamically compiled class under the 'plugin' folder.  Now execute the generated class either using reflection (which you may use in real-world products or solutions) or from the command-line.
java -cp . plugin.Plugin


Scripting Language Support
With JDK6, you may execute JavaScript (Tcl, Ruby, Groovy, etc.) from within Java. This is possible through ScriptingEngine. The example below shows the usage of JavaScript within Java.

 package jdk6.features;  
 import java.io.File;  
 import java.io.FileReader;  
 import javax.script.Invocable;  
 import javax.script.ScriptEngine;  
 import javax.script.ScriptEngineManager;  
   
 public class jdk6_Scripting {  
      public void todaysLogic() throws Exception {            
        // dynamically change script - invoke code in groovy, js - even tcl!  
        ScriptEngineManager manager = new ScriptEngineManager();  
        ScriptEngine jsEngine = manager.getEngineByName("JavaScript");  
        System.out.println(jsEngine.toString());  
        if (jsEngine instanceof Invocable) {  
             try {  
                  File file = new File("market.js");  
             } catch (Throwable e) {  
                  e.printStackTrace();  
             }              
             FileReader reader = new FileReader("market.js");              
             jsEngine.eval(reader);              
             ((Invocable) jsEngine).invokeFunction("current");  
         }  
      }  
      public static void main(String[] args) throws Exception {  
           jdk6_Scripting scripting = new jdk6_Scripting();  
           scripting.todaysLogic();  
      }  
 }  


You must place the following JavaScript code in your classpath, maybe within the root folder of your Eclipse Project. You should name it 'market.js'
 function current() {  
   var x = "", i;  
   for (i=0; i<100; i++) {  
        x="";  
        x = x + "The Number Is " + i;  
        println(x);  
   }    
 }  



Happy Programming with JDK6!

About Sumith Kumar Puri
Sumith Kumar Puri, an author (Java/JEE) at Packt Publishing, has close to 14 years of experience in entrepreneurship, conceptualization, architecture, design and development of software products and solutions. He also holds multiple certifications in Core Java, JEE, C, C++, Algorithms and Data Structures. He is an open source contributor and likes competitive programming and hackathons. He has 11 publications to his name in international and national conferences, journals and magazines. He is an active member of the IEEE/Computer Society, ACM and CSI.

He holds a Bachelor of Engineering [Information Science and Engineering] from Sri Revana Siddeshwara Institute of Technology, Bangalore, India. He has also completed the Executive Programme [Data Mining and Analytics] from the Indian Institute of Technology, Roorkee, India and the Executive Certificate Programme [Entrepreneurship] from the Indian Institute of Management, Kashipur, India. His current interests are in data mining, machine learning, Big Data and artificial intelligence. He is based out of Bangalore, India.

Enterprise Open Source Magazine Latest Stories . . .
First, let's outline a frame of reference for multithreading and why we may need to use a thread pool. A thread is an execution context that can run a set of instructions within a process - aka a running program. Multithreaded programming refers to using threads to execute multiple ta...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud t...
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a fu...
In his opening keynote at 20th Cloud Expo, Michael Maximilien, Research Scientist, Architect, and Engineer at IBM, discussed the full potential of the cloud and social data requires artificial intelligence. By mixing Cloud Foundry and the rich set of Watson services, IBM's Bluemix is t...
The goal of Continuous Testing is to shift testing left to find defects earlier and release software faster. This can be achieved by integrating a set of open source functional and performance testing tools in the early stages of your software delivery lifecycle. There is one process t...
As organizations abandon the waterfall method of software development for Agile, many are stuck in what Hasan Yasar terms Water-Scrum-Fall. That is, the organization has not effectively embraced Agile and DevOps principles and remains in silos with no links to business goals. Enter Dev...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021




SYS-CON Featured Whitepapers
ADS BY GOOGLE