ebook img

Java Magazine 2015 01-02 PDF

18.9 MB·English
by  Oracle
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Java Magazine 2015 01-02

return conferences; package agenda.simple; //JANUARY/FEBRUARY 2015 / public class Activator extends DependencyActivatorBase @Override public void destroy(BundleContext ctx, DependencyManager dm) throws Exception @Override public void init(BundleContext ctx, DependencyManager dm) throws Exception dm.add(createComponent() .setInterface(Agenda.class.getName(), null) .setImplementation(SimpleAgendaService.class)); package agenda.rest; @Path("agenda") public class AgendaResource private volatile Agenda agenda; @ @Produces(MediaType.APPLICATION_ public List<Conference> listConferences() package agenda.rest; return agenda.listConferences(); @Path("agenda") public class AgendaResource { private volatile Agenda agenda; @ @GET @Produces(MediaType.APPLICATION_JSON) public List<Conference> listConferences() { @Consumes(MediaType.APPLICATION_ return agenda.listConferences(); } public void addConference(Conference conference) @POST agenda.addConference(conference.getName(), @Consumes(MediaType.APPLICATION_JSON) public void addConference(Conference conference) { conference.getLocation()); agenda.addConference(conference.getName(), conference.getLocation()); package agenda.rest; public class Activator extends DependencyActivatorBase @Override ORACLE CLOUD public void destroy(BundleContext ctx, DependencyManager dm) throws Exception Platform for Innovation @Override public void init(BundleContext ctx, DependencyManager dm) throws Exception dm.add(createComponent() .setInterface(Object.class.getName(), null) Java-based services provide flexible tools for developing .setImplementation(AgendaResource.class) .add(createServiceDependency() and deploying new applications in the cloud .setService(Agenda.class))); ORACLE.COM/JAVAMAGAZINE //table of contents / Y T NI U M M O C 05 20 32 PLATFORM FOR MAKING GET STARTED N O INNOVATION WATER SAFE WITH ORACLE TI C A Java-based mobile DEVELOPER A app helps Safe Water CLOUD SERVICE N I Kenya provide clean A Harshad Oak shows you V Oracle’s Mike Lehmann discusses water to rural families. A how to run your enire J Java-based cloud services for the development environ- full development lifecycle. ment in the cloud. H C E T A Cloud V A Computing J New theme icon. See how it works. COVER ART BY I-HUA CHEN S U T U O B A COMMUNITY JAVA TECH 37 47 03 25 Enterprise Java Rich Client From the Editor Career Building Modular Cloud Cloud-Based Monitoring Three Steps to Applications in Java of IoT Devices 11 Improve Your Career Add, replace, or remove modules Johan Vos demonstrates a performant and Java Nation Bruno Souza and Edson Yanaga share while keeping the architecture scalable cloud-based monitoring system for News, people, events, and books tips to boost your skills and network. intact and maintainable. collecting data from embedded devices. JAVA IN ACTION 28 42 52 18 New to Java Enterprise Java Embedded IoT Developer Code Java on the Concurrent Programming Get Started with Oracle Java ME blog Challenge Winner Raspberry Pi, Part 2 with Java EE 7 and Java SE 8 Embedded 8 on Microcontrollers Bot-So Access Raspberry Pi hardware Adam Bien shows you how to run Access peripherals using the Device I/O interactively with BlueJ. Java EE 7 applications on Java SE 8. API of Oracle Java ME Embedded. 01 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2015 Y T I N U M EDITORIAL PUBLISHING M Editor in Chief Publisher O Caroline Kvitka Jennifer Hamilton +1.650.506.3794 C 3 Billion Community Editor Associate Publisher and Audience Yolande Poirier Development Director Java in Action Editor Karin Kinnear +1.650.506.1985 Michelle Kovac N ADVERTISING SALES O Technology Editor President, Sprocket Media TI Tori Wieldt Kyle Walkenhorst +1.323.340.8585 C Contributing Writer A Kevin Farnham Western and Central US, LAD, and N Canada, Sprocket Media I Contributing Editors Tom Cometa +1.510.339.2403 A Devices Run Java V Claire Breen, Blair Campbell, Eastern US and EMEA/APAC, A Kay Keppler, Karen Perkins J Sprocket Media DESIGN Mark Makinney +1.805.709.4745 Senior Creative Director Advertising Sales Assistant Francisco G Delgadillo Cindy Elhaj +1.626.396.9400 x 201 H Senior Design Director Mailing-List Rentals C Suemi Lam Contact your sales representative. E T Design Director RESOURCES A Richard Merchán V Oracle Products A Contributing Designers +1.800.367.8674 (US/Canada) J Jaime Ferrand, Diane Murray, ATMs, Smartcards, POS Terminals, Blu-ray Players, Oracle Services Arianna Pucherelli +1.888.283.0591 (US) Production Designers Set Top Boxes, Multifunction Printers, PCs, Servers, Sheila Brennan, Kathy Cygnarowicz Oracle Press Books oraclepressbooks.com S U Routers, Switches, Parking Meters, Smart Meters, T U Lottery Systems, Airplane Systems, IoT Gateways, O B ARTICLE SUBMISSION A Programmable Logic Controllers, Optical Sensors, If you are interested in submitting an article, please e-mail the editors. SUBSCRIPTION INFORMATION Wireless M2M Modules, Access Control Systems, Subscriptions are complimentary for qualified individuals who complete the subscription form. Medical Devices, Building Controls, Automobiles… MAGAZINE CUSTOMER SERVICE [email protected] Phone +1.847.763.9635 PRIVACY Oracle Publishing allows sharing of its mailing list with selected third parties. If you prefer that your mailing address or e-mail address not be included in this program, contact Customer Service. Copyright © 2015, Oracle and/or its affiliates. All Rights Reserved. No part of this publication may be reprinted or otherwise reproduced without permission from the editors. JAVA MAGAZINE IS PROVIDED ON AN “AS IS” BASIS. ORACLE EXPRESSLY DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ORACLE BE LIABLE FOR ANY #1 Development Platform DAMAGES OF ANY KIND ARISING FROM YOUR USE OF OR RELIANCE ON ANY INFORMATION PROVIDED HEREIN. The information is intended to outline our general product direction. It is intended for information purposes only, and may not be blog incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Oracle and Java are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Java Magazine is published bimonthly with a free subscription price by Oracle, 500 Oracle Parkway, MS OPL-3C, Redwood City, CA 94065-1600. Digital Publishing by GTxcel 02 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2015 //from the editor / Y T I N U M M O C N O I T T C A N I A V A J H ools make the cloud. To support modern development, today’s cloud development environments C E must support the full sotware development lifecycle. Developers working in the cloud need tools for builds, T A coninuous integraion, source control, and team collaboraion. With those tools at the V A Cloud J ready, they can take advantage of the cloud as a platform for innovaion. Computing In our interview with Mike Lehmann, vice president of product management for Oracle Cloud Applicaion Foundaion, we explore Oracle’s Java-based cloud services for developers, and the beneits S they ofer. “Taking a new business idea and building an applicaion to support it can be done much more quickly U T and with lower risk than in the past,” says Lehmann. Read the interview for his insights on Oracle Java Cloud U O Service, Oracle Developer Cloud Service, and other services that give developers an end-to-end Java develop- B A ment and deployment environment. Ready to test out these services? Don’t miss Hardshad Oak’s aricle, “Get Started with Oracle Developer Cloud Service.” Plus, Bert Ertman shows you how to build modular cloud applicaions in Java. It’s a new year, and a ime when people tradiionally think about self-improvement. //send us your feedback / If you are looking to raise your job prospects and expand your network, Bruno Souza and Edson Yanaga have just the plan for you, and it includes code, community, and— We’ll review all suggesions for future yes—cloud. Their acion items will help you to raise your possibiliies for the future. improvements. Finally, this will be my last issue as editor in chief of Java Magazine. I want to thank Depending on volume, you, the readers, for your enthusiasic support of the magazine. Lots of great content some messages might is in the works for 2015, so please keep reading (and coding). not get a direct reply. blog Caroline Kvitka, Editor in Chief BIO PHOTOGRAPH BY BOB ADLER 03 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2015 Y T NI U M M O C N O I PLATFORM T C A N I A V FOR INNOVATION A J H C E The Oracle Cloud platform’s Java-based services provide T A flexible tools for developing and deploying new applications. V A J BY CAROLINE KVITKA S U Cloud T U Computing O B A C loud compuing presents a vaion, cost savings, and producivity growing number of oppor- for Java developers? tuniies and services for Lehmann: The emergence of the developers, especially in cloud is changing how develop- terms of simplicity, producivity, ers and administrators work with and innovaion. We sat down with sotware and hardware. Efecively Mike Lehmann, vice president of what you’re able to get now in a Mike Lehmann, product management for Oracle dramaically simpliied fashion is vice president Cloud Applicaion Foundaion, to instant access to compute capacity of product talk about what’s new in the Oracle and enterprise sotware in the cloud. management blog Cloud platform for developers. That changes the equaion for devel- for Oracle Cloud opers and companies building appli- Application Java Magazine: What does the rise caions. Taking a new business idea Foundation of cloud compuing mean for inno- and building an applicaion to sup- 05 ART BY I-HUA CHEN; PHOTOGRAPHY BY BOB ADLER/GETTY IMAGES ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2015 Y T NI U M M O C THE FLEXIBILITY TO INNOVATE “ You have a true end-to-end Java development and deployment N O I T environment with a huge amount of flexibility and opportunity C A N to build innovative applications.” I A V A J H C E T cally was called middleware Oracle Developer Cloud Service, A on premises. With Oracle which works hand in hand with Oracle V A J Cloud, developers can focus Java Cloud Service, provides a full devel- on building and deploy- opment lifecycle platform. It includes ing rather than deciding on a Git repository and a Hudson build platform infrastructure and system, for source code management S U trying to get it installed and to support a coninuous integraion T set up. approach. It’s integrated with standard U Anand Kothari, director of product management at Oracle, and Lehmann work O Java Magazine: What Oracle development tools such as Eclipse and B on cloud architecture documents. A Cloud services are available Oracle JDeveloper, and it features col- for developers? laboraion tools including a built-in wiki, port it can be done much more quickly Lehmann: Our Java-based cloud ofer- issue tracking, and team management. and with lower risk than in the past. ings start with Oracle Java Cloud We are also complemening Oracle The cloud is also changing how Service, which enables developers Java Cloud Service with several core developers architect applicaions. For to get a Java EE server provisioned in platform services. example, suppose I want to build a Java minutes. The resuling server is a user- First, Oracle Messaging Cloud Service applicaion with a mobile front end, use deined cluster of Java infrastructure, enables you to build messaging appli- caching for performance and queuing with lifecycle management cloud tools caions based on JMS [Java Message services for integraion, and include a that enable backups, recovery, patch- Service] queues and topics in the cloud. standard SQL back end for persistence. ing, scale-in, and scale-out. The under- It can be used in client applicaions blog Already today, that is simply a col- lying infrastructure is Oracle WebLogic through a REST API as well as a naive lecion of services available in Oracle Server, our standards-based, market- Java API. Cloud for developers to use as needed. leading applicaion server. And you can Next, the Oracle Coherence caching It is a next-generaion paradigm for plug directly into Oracle Database Cloud capability caches Java objects in mem- what we used to do in what histori- Service for persistence. ory. This is a new extension of Oracle 06 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2015 Y T NI U M M O C Java Cloud Service using a capability of business intelligence, you have a true Lehmann: We’re building out the full Oracle WebLogic Server called Managed end-to-end Java development and applicaion lifecycle management N Coherence Servers and will be available deployment environment with a huge infrastructure with Oracle Developer O I T in 2015. amount of lexibility and opportunity to Cloud Service, to answer the quesions C A In 2015, we’ll also have Oracle Java build innovaive applicaions. “How do I build?,” “How do I manage N SE Cloud Service, which is the Java Java Magazine: Would you say that the source code?,” and “How do I man- A I V Virtual Machine [JVM] in the cloud, Oracle is trying to give developers age my development team?” On the A J because many of our customers want everything they need for the way that deployment side, with our Java cloud to build standard JVM-based applica- they want to work? services, we’re providing a very rich, ions. They might be using a popular H C Java framework such as Spring on Java, E T or they might even be using one of the A V popular emerging Java-based scriping A J languages such as Play. Oracle Java SE MODERN THINKING “ [The cloud] Cloud Service, like Oracle Java Cloud Service, enables direct integraion into definitely is the large Oracle Cloud ecosystem with S U changing how Oracle Developer Cloud Service, Oracle T Java Cloud Service, Oracle Database U people construct O Cloud Service, and other services. B A applications We are also very aware of the rise of server-side JavaScript soluions such as because they have Node.js and so, in parallel with Oracle an integrated team Java SE Cloud Service, we are build- environment that ing out Oracle Node Cloud Service, for availability in 2015. This will bring can provision a a irst-class JavaScript server and, test environment with Oracle Developer Cloud Service, a JavaScript development soluion to incredibly fast.” Oracle Cloud, making it easy to build and deploy such soluions paired with blog our Java cloud services and integrated with our database cloud service. As you can see, even without going into the higher-level services for mobil- Nilesh Junnarkar, director of software development at Oracle, talks with Lehmann about ity, integraion, and document and load balancer provisioning. 07 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2015 Y T NI U M M O C N O I T chosen to add in a caching layer, then trends and styles for doing develop- C A you’ll get a mulinode Oracle Coherence ment for some ime. It’s giving a con- N cluster. And inally, you’re backed by an inuous integraion soluion out of the A I V Oracle database. So for a developer you box and enabling you to even consider A J get both sides—team development; coninuous delivery models. coninuous integraion; and a full- What is a litle bit diferent now in the ledged, producion-quality deployment cloud is that previously you had to set H C infrastructure. that up. And there was complexity with E T A classic example that you would use it. In the cloud, we give you that envi- A even in that scenario is you might have ronment out of the box. It deinitely is V A J a layer in front of your Java applicaion changing how people construct applica- layer, perhaps using a Node.js front end ions, because they have an integrated where you’re shaping some of the JSON team environment that can provision objects that you want for your front-end a test environment incredibly fast—or, S U HTML5 applicaions. Architecturally, more likely, in a test environment they T without a lot of efort, you can bring can provision, test, and tear down very U O these muliier architectures together quickly. These capabiliies are simply B A in interesing ways that previously part of the environment versus being would have taken weeks or maybe even something you spend a huge amount of months, depending on the complexity investment seing up. It truly is a mod- of your IT environment. Now it’s basi- ern development paradigm. cally on demand. So it really changes Java Magazine: Are people more com- how you think about your applicaions fortable these days moving to public and how you architect your applicaions. cloud? You’re geing an enterprise-quality Lehmann: There has been the sort of Oracle is building muliiered topology that you typically soluion out of the box from Oracle. ongoing debate around public cloud out a full application have in an applicaion but doing it in Java Magazine: How do these services versus private cloud, and my sense is development lifecycle an almost transparent way. When you support modern development? that this debate will slowly go away. I management blog ask for a mulinode Oracle Java Cloud Lehmann: The use of build integraions can see already in our customers when infrastructure with Service cluster for high availability and systems such as Hudson, combined we talk about the cloud that more and Oracle Developer higher throughput, what you also typi- with Maven for dependency manage- more people are becoming very com- Cloud Service, says Lehmann. cally get is a sotware load balancer in ment and Git for source code manage- fortable with moving development front of this environment. If you’ve ment, has been an emerging set of and test to the cloud, but keeping their 08 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2015 Y T NI U M M O C N O I T producion workloads on premises. I the Java Community Process around it Lehmann: I think it’s an exciing C A think that’s just part of the shit. Two for standardizing it and managing the change how all these services can be so N years ago, they weren’t going to do any- overall technical standards. There is easily used together to build new types A I V thing in the public cloud. Now, it’s dev industry consensus around Java, that it of applicaions that simply weren’t pos- A J and test. In another couple of years, as is the standard programming language sible or were enormously complex in people start trusing and believing that and programming environment that the past. When you start bringing in these are secure, scalable, enterprise- most people use in the cloud. That is big data, social, and mobile services to H C class environments, they’ll start moving complemented by a compeiive server- the cloud as standard irst-class, easily E T producion workloads. side industry. So as a customer, you accessible services, it gets even more A Java Magazine: Why is Java the best lan- have both innovaion and a compeiive interesing. Rather than building appli- V Kothari and Lehmann A J work on an Oracle guage and platform for the cloud? marketplace. And that simply carries caions centered around one service, Java Cloud Service Lehmann: Java is efecively a commu- over into the cloud. If you look at most modern applicaions will be built on top component diagram. nity standard. The Java language has of the cloud environments, the vast of a collecion of cloud services in stan- majority of them are building infra- dard architectural paterns. And to me S U structure on Java because that is the this new style of applicaion develop- T lingua franca of most developers today. ment and applicaion architecture based U O Java Magazine: What makes Oracle’s on paterns of services working together B A cloud platform unique? is going to rapidly emerge as the most Lehmann: I think the big diferenia- exciing space to be in for the future. tor is that we bring two things together. Very diferent and unique applicaions First, we are the steward of Java so doing things that have never been done we are fairly aggressively bringing the in the past will emerge out of this. I most-recent releases of the Java plat- know I am prety excited to paricipate form into the cloud. and watch it happen! </article> Second, one of the cool things that’s diferent about what Oracle does in MORE ON TOPIC: the cloud is that we are not only taking Cloud enterprise-class sotware to the cloud Computing blog that our customers run mission-criical businesses on, but we’re making doing LEARN MORE that super simple in the cloud. Java Magazine: What’s your vision for • Oracle Java Cloud Service cloud development? • Oracle Developer Cloud Service 09 ORACLE.COM/JAVAMAGAZINE ////////////////////////////////// JANUARY/FEBRUARY 2015

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.