In the face of rapidly increasing amounts of unstructured data, industry is investing heavily to turn machines into services and connect them to analytics engines that will extract an extraordinary amount of value and unleash a productivity revolution for both businesses and consumers.
In the health care, transportation and energy sectors alone, the combination of machine diagnostics software and analytics will eliminate as much as $150 billion in waste.
In his session at the 12th Internation...| By Jonas Jacobi | Article Rating: |
|
| August 27, 2012 05:47 PM EDT | Reads: |
3,155 |
Here’s the source for my Sample.fxml file:
<?xml version="1.0" encoding="UTF-8"?>
<?import fxmltableview.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.collections.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.control.cell.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafxapplication4.*?>
<AnchorPane id="AnchorPane" prefHeight="443.999755859375" prefWidth="656.9998779296875" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxapplication4.SampleController">
<children>
<BorderPane prefHeight="706.0" prefWidth="717.0" snapToPixel="false" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="0.0">
<right>
<TableView fx:id="tableView" editable="true" prefHeight="393.999755859375" prefWidth="555.9998779296875">
<columns>
<TableColumn prefWidth="240.0" text="Company" fx:id="company">
<cellValueFactory>
<PropertyValueFactory property="company" />
</cellValueFactory>
</TableColumn>
<TableColumn prefWidth="100.0" text="Ticker" fx:id="ticker">
<cellValueFactory>
<PropertyValueFactory property="ticker" />
</cellValueFactory>
</TableColumn>
<TableColumn prefWidth="100.0" text="Price" fx:id="price">
<cellValueFactory>
<PropertyValueFactory property="price" />
</cellValueFactory>
</TableColumn>
<TableColumn prefWidth="100.0" text="Change" fx:id="change">
<cellValueFactory>
<PropertyValueFactory property="change" />
</cellValueFactory>
</TableColumn>
</columns>
<BorderPane.margin>
<Insets bottom="50.0" left="50.0" right="50.0" top="50.0" />
</BorderPane.margin>
</TableView>
</right>
<top>
<Pane prefHeight="32.0" prefWidth="745.0">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" layoutX="14.0" layoutY="5.0" prefWidth="614.9998779296875" text="WebSocket Portfolio Demo" textAlignment="CENTER" textFill="#cc6200">
<font>
<Font name="System Bold" size="24.0" />
</font>
</Label>
</children>
</Pane>
</top>
</BorderPane>
</children>
</AnchorPane>
Then, I defined the data model driving my TableView. I created a JavaBean, called Stock, with four private variables. The first three: company, ticker, and price, represent the first three columns of my TableView. The fourth one is a computed value, displaying the change of the price of a stock.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javafxapplication4;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
/**
*
* @author pmoskovi
*/
public class Stock {
private SimpleStringProperty company;
private SimpleStringProperty ticker;
private SimpleStringProperty price;
private SimpleStringProperty change;
public Stock () {
setCompany("");
setTicker("");
setPrice("");
}
public Stock(String company, String ticker, String price, String shares, String value) {
setCompany(company);
setTicker (ticker);
setPrice (price);
}
public String getCompany() {
return companyProperty().get();
}
public void setCompany(String company) {
companyProperty().set(company);
}
public StringProperty companyProperty() {
if (company == null) {
company = new SimpleStringProperty(this, "company");
}
return company;
}
public String getTicker() {
return tickerProperty().get();
}
public void setTicker(String ticker) {
tickerProperty().set(ticker);
}
public StringProperty tickerProperty() {
if (ticker == null) {
ticker = new SimpleStringProperty(this, "ticker");
}
return ticker;
}
public String getPrice() {
return priceProperty().get();
}
public void setPrice(String price) {
priceProperty().set(price);
}
public StringProperty priceProperty() {
if (price == null) {
price = new SimpleStringProperty(this, "price");
}
return price;
}
public String getChange() {
return changeProperty().get();
}
public void setChange(String change) {
changeProperty().set(change);
}
public StringProperty changeProperty() {
if (change == null) {
change = new SimpleStringProperty(this, "change");
}
return change;
}
}
Step 3 – Feeding the application with data through WebSockets
Lastly, by simply following the How to Build Java Client Using Kaazing WebSocket Gateway I created the WebSocket connection, subscribed to the stock data feed, and updated my model which in turn refreshed the TableView in the screen.
The app uses the JMS Edition of Kaazing WebSocket Gateway, allowing you to invoke JMS APIs directly in the JavaFX application code.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javafxapplication4;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.Context;
import javax.naming.InitialContext;
/**
*
* @author pmoskovi
*/
public class SampleController implements Initializable {
private ObservableList data;
@FXML
private Label label;
@FXML
private TableView tableView;
@FXML
private TableColumn<Stock, String> change;
ListIterator it;
public void startRendering() {
addStock("3mCo", "MMM", "", "", "");
addStock("AT&T Inc", "T", "", "", "");
addStock("Boeing Co", "BA", "", "", "");
addStock("Citigroup", "C", "", "", "");
addStock("Hewlett-Packard Co", "HPQ", "", "", "");
addStock("Intel Corporation", "INTC", "", "", "");
addStock("International Business Machines", "IBM", "", "", "");
addStock("McDonald's Cororation", "MCD", "", "", "");
addStock("Microsoft Corporation", "MSFT", "", "", "");
addStock("Verizon Communications", "VZ", "", "", "");
addStock("Wal-Mart Stores Inc", "WMT", "", "", "");
doConnect();
}
protected void addStock(String company, String ticker, String price, String shares, String value) {
ObservableList data = tableView.getItems();
data.add(new Stock(company, ticker, price, shares, value));
}
@Override
public void initialize(URL url, ResourceBundle rb) {
startRendering();
}
protected void doConnect() {
Properties props = new Properties();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
"com.kaazing.gateway.jms.client.stomp.StompInitialContextFactory");
//WebSocket end-point
props.put(Context.PROVIDER_URL, "ws://demo.kaazing.com/jms");
InitialContext ctx;
final ObservableList data = tableView.getItems();
try {
ctx = new InitialContext(props);
ConnectionFactory connectionFactory;
connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
//Creating WebSocket connection
Connection connection = connectionFactory.createConnection(null, null);
connection.setExceptionListener(new ExceptionListener() {
@Override
public void onException(JMSException jmse) {
jmse.printStackTrace();
}
});
//Creating JMS session
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
//Creating JMS topic
Topic topic = (Topic) ctx.lookup("/topic/portfolioStock");
//Creating JMS consumer
MessageConsumer consumer = session.createConsumer(topic);
consumer.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message msg) {
it = data.listIterator();
try {
// Creating a String array out of the incoming message: ticker, company, price
String[] stockMsgArr = parseList(((TextMessage) msg).getText(), ":");
// System.out.println(stockMsgArr[0] + ":" + stockMsgArr[1] + ":" + stockMsgArr[2]);
// Loop through all the elements of the viewTable model
while (it.hasNext()) {
// st holds the current row of tableView
Stock st = (Stock)it.next();
// System.out.println("st.getTicker() " + st.getTicker() + " | " + "stockMsgArr[1] " + stockMsgArr[1]);
if (st.getTicker().equals(stockMsgArr[1])) {
Float oldValue, newValue;
newValue = Float.parseFloat(stockMsgArr[2]);
oldValue = Float.parseFloat((st.getPrice().equals("")) ? "0" : st.getPrice());
// System.out.println ("oldValue: " + oldValue + " | newValue: " + newValue);
((Stock)(it.previous())).setChange(new DecimalFormat("#.##").format((newValue-oldValue)));
st.setPrice (newValue.toString());
break;
}
}
} catch (JMSException e) {
e.printStackTrace();
}
}
});
connection.start();
} catch (Exception ex) {
Logger.getLogger(SampleController.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static String[] parseList(String list, String delim) {
List result = new ArrayList();
StringTokenizer tokenizer = new StringTokenizer(list, delim);
while (tokenizer.hasMoreTokens()) {
result.add(tokenizer.nextToken());
}
return (String[]) result.toArray(new String[0]);
}
}
If you’re attending JavaOne this year, come to our session for goodies and cool demos on WebSockets.
To learn more about the JMS APIs exposed to Web clients, or if you want to see step-by-step instructions on building a true HTML5 WebSocket app using the JavaScript API, check out these Kaazing tutorials.
Read the original blog entry...
Published August 27, 2012 Reads 3,155
Copyright © 2012 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jonas Jacobi
Jonas Jacobi is President and CEO of Kaazing, a privately held company that delivers next generation high-performance Web communication platform providing distribution of live data to the online financial trading, betting, gaming, auction, social, and media industries. Before co-founding Kaazing Jonas served as VP of Product Management for Brane Corporation, a leader in platform and technology independent solutions for any type of application software technology, automating the entire application development process required to maximize the business value of software. Prior to Brane Corporation, he spent over 8 years at Oracle where he served as a Java EE and open source Evangelist, and product manager responsible for the product management of JavaServer Faces, Oracle ADF Faces, and Oracle ADF Faces Rich Client in the Oracle Application Server division. Jonas is a frequent speaker at international conferences and has written numerous articles for leading IT magazines such as Java Developer's Journal, JavaPro, AjaxWorld, and Oracle Magazine. Mr. Jacobi is co-author of the best-selling book Pro JSF and Ajax: Building Rich Internet Components, (Apress).
- Cloud People: A Who's Who of Cloud Computing
- AMD and Adobe Collaborate on Upcoming Version of Adobe Premiere Pro Software to Enable Breakthrough Video Editing Performance Through Open Standards
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Predixion Software Announces General Availability of the Latest Version of its Predictive Analytics Platform
- Social Loginwall Failure
- Five Big Data Features in SQL Server
- GoBank Announces Timing of General Availability and National Distribution Relationships at FinovateSpring
- MicroStrategy Announces General Availability of MicroStrategy 9.3.1
- Cloud Expo NY: Cloud & Location-Aware Big Data Is Changing Our World
- How Bon-Ton Stores Align Business Goals with IT Requirements
- WordsEye Announces Upcoming Beta of a First-of-Its-Kind Text-to-Scene Application
- MicroStrategy Announces General Availability of MicroStrategy 9.3.1
- Cloud People: A Who's Who of Cloud Computing
- AMD and Adobe Collaborate on Upcoming Version of Adobe Premiere Pro Software to Enable Breakthrough Video Editing Performance Through Open Standards
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Predixion Software Announces General Availability of the Latest Version of its Predictive Analytics Platform
- Red Hat Reinforces Java Commitment
- Social Loginwall Failure
- VCE Revisited, Now and Zen
- Five Steps Toward Achieving Better Compliance with Identity Analytics
- Five Big Data Features in SQL Server
- Big Data Is Not Just About Marketing: Don’t Forget the IT Department’s Needs
- GoBank Announces Timing of General Availability and National Distribution Relationships at FinovateSpring
- MicroStrategy Announces General Availability of MicroStrategy 9.3.1
- Building a Drag-and-Drop Shopping Cart with AJAX
- What Is AJAX?
- Google Maps! AJAX-Style Web Development Using ASP.NET
- Flashback to January 2006: Exclusive SYS-CON.TV Interviews on "OpenAjax Alliance" Announcement
- How and Why AJAX, Not Java, Became the Favored Technology for Rich Internet Applications
- Where Are RIA Technologies Headed in 2008?
- AJAXWorld Conference & Expo to Take Place October 2-4, 2006, at the Santa Clara Convention Center, California
- "Real-World AJAX" One-Day Seminar Arrives in Silicon Valley
- AJAX Sponsor Webcasts Are Now Available at AJAXWorld Website
- AJAXWorld University Announces AJAX Developer Bootcamp
- AJAX Support In JadeLiquid WebRenderer v3.1
- Struts Validations Framework Using AJAX
In the face of rapidly increasing amounts of unstructured data, industry is investing heavily to turn machines into services and connect them to analytics engines that will extract an extraordinary amount of value and unleash a productivity revolution for both businesses and consumers.
In the health care, transportation and energy sectors alone, the combination of machine diagnostics software and analytics will eliminate as much as $150 billion in waste.
In his session at the 12th Internation...May. 21, 2013 05:00 AM EDT Reads: 2,935 |
By Jeremy Geelan The economics of business are radically changing due to the way in which software and services are being delivered thanks to cloud computing. In his session at 12th Cloud Expo | Cloud Expo New York [10-13 June, 2013], Mike Kavis will cover six reasons for the disruption.May. 21, 2013 04:00 AM EDT Reads: 4,597 |
By Pat Romanski “Open source has always provided a number of benefits, including easing adoption costs, propagating a better understanding of the technology, and allowing for faster evolution and commercialization of products and services based on it,” noted Terry Woloszyn, Founder & CEO, Leeward Security Ltd., in this exclusive Q&A with Cloud Expo Conference Chair Jeremy Geelan. “This is clearly evident with the OpenStack and CloudStack,” Woloszyn continued, “and others that have been quickly commercialized as...May. 20, 2013 02:41 PM EDT Reads: 765 |
By Jeremy Geelan New, "Super-Sized" 4-Day Cloud Computing Bootcamp is a brief introduction to cloud computing carefully created and devised to help you keep up with evolving trends like Big Data, PaaS, APIs, Mobile, Social and Data Analytics. Solutions built around these topics require a sound cloud computing infrastructure to be successful while assisting customers harvest real benefits from this transformational change that is happening in the IT ecosystem.May. 20, 2013 10:30 AM EDT Reads: 931 |
By Elizabeth White As enterprises deploy private IaaS clouds into production they are reevaluating their future application delivery models. SUSE and WSO2 believe that private PaaS will leverage the automation and scalability of Private IaaS solutions, such as OpenStack-based SUSE Cloud, to deliver the secure, standardized development environments that will make migrating to an agile, serviceoriented delivery model possible.
In their session at the 12th International Cloud Expo, Chris Haddad, VP of Technology Ev...May. 20, 2013 10:07 AM EDT Reads: 651 |
By Liz McMillan “Trust is an ongoing journey and sits at the foundation of any vendor relationship – the companies that don’t consistently earn trust won’t be around long,” noted Henrik Rosendahl, Senior VP of Cloud Solutions at Quantum, in this exclusive Q&A with Cloud Expo Conference Chair Jeremy Geelan. “As they do more with cloud, trust will organically grow – maybe it’s just about meeting SLAs or seeing firsthand that data is there when you need it,” Rosendahl continued.
Cloud Computing Journal: The move ...May. 20, 2013 09:00 AM EDT Reads: 1,893 |
By Jeremy Geelan May. 20, 2013 08:15 AM EDT Reads: 3,000 |
By Jeremy Geelan
Cloud enables SMBs to access new, scalable resources – previously only available to enterprises – in flexible and cost-effective ways. McKinsey’s SMB Cloud Report projects the public cloud market to reach $40-$50 billion by 2015, with SMBs comprising 65% of public cloud spending in 2015. But selling cloud to SMBs raises the questions of who, what and how.
In this session Manjula Talreja, VP of Cisco’s Global Cloud Business Development Team, will discuss the importance of knowing who SMB...May. 20, 2013 08:00 AM EDT Reads: 1,269 |
By Jeremy Geelan Analyzing Hadoop jobs and speeding them up is often a tedious and time consuming effort that requires experts. In his upcoming session at 12th Cloud Expo | Cloud Expo New York [10-13 June, 2013], Michael Kopp will be showing how proven APM techniques can be used to speed up Hadoop jobs at the core, without going through tons of log files, beyond just adding more hardware and within minutes instead of hours or days. May. 20, 2013 08:00 AM EDT Reads: 1,767 |
By Jeremy Geelan Our more interconnected planet is accelerating the adoption and convergence of next-generation architectures, in the form of cloud, mobile and instrumented physical assets. Organizations that can effectively balance optimization and innovation, will be in a position to leverage new systems of engagement, out maneuver their peers and achieve desired outcomes. In the Opening Keynote at 12th Cloud Expo | Cloud Expo New York, IBM GM & Next Generation Platform CTO Dr Danny Sabbah will detail the crit...May. 20, 2013 08:00 AM EDT Reads: 2,977 |









The economics of business are radically changing due to the way in which software and services are being delivered thanks to cloud computing. In his session at 12th Cloud Expo | Cloud Expo New York [10-13 June, 2013], Mike Kavis will cover six reasons for the disruption.
“Open source has always provided a number of benefits, including easing adoption costs, propagating a better understanding of the technology, and allowing for faster evolution and commercialization of products and services based on it,” noted Terry Woloszyn, Founder & CEO, Leeward Security Ltd., in this exclusive Q&A with Cloud Expo Conference Chair Jeremy Geelan. “This is clearly evident with the OpenStack and CloudStack,” Woloszyn continued, “and others that have been quickly commercialized as...
New, "Super-Sized" 4-Day Cloud Computing Bootcamp is a brief introduction to cloud computing carefully created and devised to help you keep up with evolving trends like Big Data, PaaS, APIs, Mobile, Social and Data Analytics. Solutions built around these topics require a sound cloud computing infrastructure to be successful while assisting customers harvest real benefits from this transformational change that is happening in the IT ecosystem.
As enterprises deploy private IaaS clouds into production they are reevaluating their future application delivery models. SUSE and WSO2 believe that private PaaS will leverage the automation and scalability of Private IaaS solutions, such as OpenStack-based SUSE Cloud, to deliver the secure, standardized development environments that will make migrating to an agile, serviceoriented delivery model possible.
In their session at the 12th International Cloud Expo, Chris Haddad, VP of Technology Ev...
“Trust is an ongoing journey and sits at the foundation of any vendor relationship – the companies that don’t consistently earn trust won’t be around long,” noted Henrik Rosendahl, Senior VP of Cloud Solutions at Quantum, in this exclusive Q&A with Cloud Expo Conference Chair Jeremy Geelan. “As they do more with cloud, trust will organically grow – maybe it’s just about meeting SLAs or seeing firsthand that data is there when you need it,” Rosendahl continued.
Cloud Computing Journal: The move ...
Cloud enables SMBs to access new, scalable resources – previously only available to enterprises – in flexible and cost-effective ways. McKinsey’s SMB Cloud Report projects the public cloud market to reach $40-$50 billion by 2015, with SMBs comprising 65% of public cloud spending in 2015. But selling cloud to SMBs raises the questions of who, what and how.
In this session Manjula Talreja, VP of Cisco’s Global Cloud Business Development Team, will discuss the importance of knowing who SMB...
Analyzing Hadoop jobs and speeding them up is often a tedious and time consuming effort that requires experts. In his upcoming session at 12th Cloud Expo | Cloud Expo New York [10-13 June, 2013], Michael Kopp will be showing how proven APM techniques can be used to speed up Hadoop jobs at the core, without going through tons of log files, beyond just adding more hardware and within minutes instead of hours or days.
Our more interconnected planet is accelerating the adoption and convergence of next-generation architectures, in the form of cloud, mobile and instrumented physical assets. Organizations that can effectively balance optimization and innovation, will be in a position to leverage new systems of engagement, out maneuver their peers and achieve desired outcomes. In the Opening Keynote at 12th Cloud Expo | Cloud Expo New York, IBM GM & Next Generation Platform CTO Dr Danny Sabbah will detail the crit...
New technologies allow schools, colleges and universities to analyze absolutely everything that happens. From student behavior, testing results, career development of students as well as educational needs based on changing societies. A lot of this data has already been stored and is used for statist...
A recent Gartner study states that the function of the modern CIO is in flux and that his or her future focus must incorporate digital assets (aka cloud-based data and applications) to remain relevant. Towards the goal of riding the sea change a compiler of stacks to a broker of business needs, secu...
In the coming years, big data will change the way organisations and societies are operated and managed. Big data however, is not the only trend that will impact significantly how organisations operate. Another major trend at the moment is gamification. Gamification will change the way organisations ...
We all talk about cloud differently, but is there a way we should be speaking about this tech?
Cloud computing is now a widely reported, if not accepted, IT movement that, depending on who you talk to, has changed or is changing the way businesses utilize infrastructure.
The age of data center automation is upon us. Whether it's cloud or SDN or devops in general, automation as a means to achieve efficiency and, one hopes, free up resources that can be then redirected to focus on innovation.
As is always the case when we begin to move further upwards, abstracting ...
Windows Azure Virtual Networks offers the power to open up several cross-premises use case scenarios, including Active Directory Disaster Recovery, SQL Database Replication, Windows Server 2012 DFS-R File Replication, Accelerated Cloud File Services with BranchCache, Hybrid Web Applications and MORE...
As the infrastructure cloud market (IaaS and PaaS) continues to grow rapidly, we are seeing quite a few customers who are delivering an application – whether it is a mission-critical or SaaS application – and basing their solution on VMware.
VMware Security Cloud Encryption cloud keyboard Cloud Enc...
Have you heard of products like IBM’s InfoSphere Streams, Tibco’s Event Processing product, or Oracle’s CEP product? All good examples of commercially available stream processing technologies which help you process events in real-time.
I’ve been asked what I consider as “Big Data” versus “Small Dat...
My fellow Technical Evangelists and I have authored a content series that steps through building your very own Private Cloud by leveraging Windows Server 2012, our FREE Hyper-V Server 2012, Windows Azure Infrastructure Services ( IaaS ) and System Center 2012 Service Pack 1.
Week-by-week, we walk ...













