SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Stephen Chin | Oracle      @steveonjava
       Andrew Phillips | jclouds   @jclouds




JavaFX and Scala in the Cloud
+
Heaven




Photo by Alberto Fernandez Fernandez
When This Architecture
        Makes Sense
•  Data is mostly read-only
  –  Transactional updates still require a server (but
     can be simpler/smaller)
•  User's view of data is small to medium
  –  Initial DB download of < 10K records is reasonable
  –  Not total DB size, but subset of data visible to user


             Conference App has 3K large
             records and compresses to
             only 330KB DB size
Cloud Data Advantages
•  Offline Operation
   –  Once DB is cached, application works 100% offline
•  Responsive Client Performance
   –  All DB queries are fast and local
•  High Availability & Scalability
   –  99.99% Availability
   –  Easily scales up to 100s of requests per second

          But, with proper hashes scales up
          to millions of requests per second!
Cloud Data Advantages (continued)
•  Insanely cheap server costs!
Number of Users                 Monthly Cost*
3,000                           Free (S3 free tier)


10,000                          $0.28


100,000                         $3.84


1,000,000                       $39.48


* For 330KB of hosted data in Amazon S3
Cloud Data Advantages (continued)
•  Insanely cheap server costs!
Number of Users                 Monthly Cost*
3,000                           Free (S3 free tier)


10,000                          $0.28


100,000                         $3.84


1,000,000                       $39.48


* For 330KB of hosted data in Amazon S3
Cloud Data Advantages (continued)
•  Insanely cheap server costs!
Number of Users                 Monthly Cost*
3,000                           Free (S3 free tier)


10,000                          $0.28


100,000                         $3.84


1,000,000                       $39.48


* For 330KB of hosted data in Amazon S3
Cloud Data Advantages (continued)
•  Insanely cheap server costs!
Number of Users                 Monthly Cost*
3,000                           Free (S3 free tier)


10,000                          $0.28


100,000                         $3.84


1,000,000                       $39.48


* For 330KB of hosted data in Amazon S3
UI
JavaFX 2.0 Platform
Immersive Application Experience

Leverage your Java skills with modern
JavaFX APIs

•  Cross-platform Animation, Video,
   Charting

•  Integrate Java, JavaScript, and HTML5
   in the same application

•  New graphics stack takes advantage of
   hardware acceleration for 2D and 3D
   applications

•  Use your favorite IDE: NetBeans,
   Eclipse, IntelliJ, etc.
What is Scala
     2001                               2006
     •  Scala Started                   •  Scala v2.0




                        2003/2004                       2011
                        •  Scala v1.0                   •  Scala 2.9.2 (latest)




•    Started in 2001 by Martin Odersky
•    Compiles to Java bytecodes
•    Pure object-oriented language
•    Also a functional programming language
Why Scala?
•  Shares many language features with
   JavaFX Script that make GUI
   programming easier:
  –  Static Type Checking – Catch your errors
     at compile time
  –  Closures – Wrap behavior and pass it by
     reference
  –  Declarative – Express the UI by describing
     what it should look like
Why Scala?           (continued)


•  Scala also supports Type Safe DSLs!
  –  Implicit Conversions – type safe class
     extension
  –  Operator Overloading – with standard
     precedence rules
  –  DelayedInit / @specialized – advanced
     language features
Java vs. Scala DSL
public	
  class	
  JavaFXEEDemo	
  extends	
  Application	
  {	
                                                                                                                                                                    object	
  ConferenceUI	
  extends	
  JFXApp	
  {	
  
	
                                                                                                                                                                                                                                  	
  	
  val	
  model	
  =	
  ConferenceModel	
  
	
  	
  	
  	
  public	
  static	
  void	
  main(String[]	
  args)	
  {	
                                                                                                                                                           	
  	
  stage	
  =	
  new	
  Stage	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  launch(JavaFXEEDemo.class,	
  args);	
                                                                                                                                                              	
  	
  	
  	
  width	
  =	
  625	
  
	
  	
  	
  	
  }	
                                                                                                                                                                                                                 	
  	
  	
  	
  height	
  =	
  700	
  
	
  	
  	
  	
  	
                                                                                                                                                                                                                  	
  	
  	
  	
  scene	
  =	
  new	
  Scene(new	
  StackPane())	
  {	
  
	
  	
  	
  	
  private	
  SpeakerModel	
  speakerModel	
  =	
  getInstance();	
                                                                                                                                                    	
  	
  	
  	
  	
  	
  fill	
  =	
  "#fcfcfc"	
  
	
  	
  	
  	
  private	
  TextField	
  filter;	
                                                                                                                                                                                   	
  	
  	
  	
  	
  	
  children	
  =	
  Seq(	
  
	
  	
  	
  	
  private	
  ChoiceBox<String>	
  items;	
                                                                                                                                                                            	
  	
  	
  	
  	
  	
  	
  	
  new	
  VBox	
  {	
  
	
  	
  	
  	
  	
                                                                                                                                                                                                                  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  children	
  =	
  Seq(	
  
	
  	
  	
  	
  @Override	
                                                                                                                                                                                                         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  ImageView	
  {	
  
	
  	
  	
  	
  public	
  void	
  start(Stage	
  primaryStage)	
  {	
                                                                                                                                                               	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  image	
  =	
  new	
  Image(getClass().getResourceAsStream("JavaOneLogo.png"))	
  
	
  	
  	
  	
  	
  	
  	
  	
  primaryStage.setTitle("JavaOne	
  Speaker	
  List");	
                                                                                                                                              	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  speakerModel.load();	
                                                                                                                                                                              	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  Rectangle	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  EventHandler<ActionEvent>	
  filterAction	
  =	
  new	
  EventHandler<ActionEvent>()	
  {	
                                                                                                         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  width	
  =	
  625	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  public	
  void	
  handle(ActionEvent	
  event)	
  {	
                                                                                                                               	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  height	
  =	
  50	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  String	
  field	
  =	
  items.selectionModelProperty().getValue().getSelectedItem();	
                                                                              	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  fill	
  =	
  new	
  LinearGradient(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  String	
  text	
  =	
  filter.getText();	
                                                                                                                          	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  endX	
  =	
  0,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  speakerModel.filter(field,	
  text);	
                                                                                                                              	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  stops	
  =	
  Stops(WHITE,	
  "#d0cbc8")	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
                                                                                                                                                                                 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  )	
  
	
  	
  	
  	
  	
  	
  	
  	
  };	
                                                                                                                                                                                                	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  primaryStage.setScene(SceneBuilder.create()	
                                                                                                                                                       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  )	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .width(625)	
                                                                                                                                                                       	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .height(700)	
                                                                                                                                                                      	
  	
  	
  	
  	
  	
  	
  	
  new	
  VBox	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .fill(Color.web("#fcfcfc"))	
                                                                                                                                                       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  padding	
  =	
  Insets(100,	
  20,	
  20,	
  20)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .root(StackPaneBuilder.create().children(	
                                                                                                                                         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  spacing	
  =	
  30	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  //	
  Background	
  image	
  and	
  gradient	
                                                                                                                      	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  children	
  =	
  Seq(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  VBoxBuilder.create().children(	
                                                                                                                                    	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  HBox	
  {	
  




                                                                                         83 Lines                                                                                                                                                                                                                   88 Lines
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ImageViewBuilder.create()	
                                                                                                                         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  val	
  filter	
  =	
  new	
  TextField();	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .image(new	
  Image(getClass().getResourceAsStream("JavaOneLogo.png"))).build(),	
                                                  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  val	
  items	
  =	
  new	
  ChoiceBox[ruco.TextField[Speaker]]()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  RectangleBuilder.create().width(625).height(50).fill(LinearGradientBuilder.create().endX(0).stops(	
                                                	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  items	
  =	
  ObservableBuffer(Speaker.firstName,	
  Speaker.lastName,	
  Speaker.jobTitle,	
  Speaker.company)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  StopBuilder.create().color(Color.WHITE).offset(0).build(),	
                                                                        	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  converter	
  =	
  StringConverter.toStringConverter({s:ruco.TextField[Speaker]	
  =>	
  s.name})	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  StopBuilder.create().color(Color.web("#d0cbc8")).offset(1).build()	
                                                                	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ).build()).build()	
                                                                                                                                	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  alignment	
  =	
  Pos.BASELINE_LEFT	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ).build(),	
                                                                                                                                                        	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  spacing	
  =	
  15	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  //	
  Foreground	
  controls	
                                                                                                                                      	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  children	
  =	
  Seq(	
  




                                                                                         2622 Characters                                                                                                                                                                                                            1452 Characters
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  VBoxBuilder.create()	
                                                                                                                                              	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  items,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .padding(new	
  Insets(100,	
  20,	
  20,	
  20))	
                                                                                                 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  filter,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .spacing(30)	
                                                                                                                                      	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  Button("Filter")	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .children(HBoxBuilder.create()	
                                                                                                                    	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  onAction	
  =	
  {	
  e:ActionEvent	
  =>	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .alignment(Pos.BASELINE_LEFT)	
                                                                                                     	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  model.filter(items.selectionModel().getSelectedItem(),	
  filter.text())	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .spacing(15)	
                                                                                                                      	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .children(	
                                                                                                                        	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  items	
  =	
  new	
  ChoiceBox<String>(	
                                                                           	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  Button("Clear")	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  FXCollections.observableArrayList(FIRST_NAME,	
  LAST_NAME,	
  JOB_TITLE,	
  COMPANY)	
             	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  onAction	
  =	
  {	
  e:ActionEvent	
  =>	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ),	
                                                                                                                	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  filter.text	
  =	
  ""	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  filter	
  =	
  TextFieldBuilder.create().prefColumnCount(20).onAction(filterAction).build(),	
                      	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  model.clear()	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ButtonBuilder.create().text("Filter").onAction(filterAction).build(),	
                                             	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ButtonBuilder.create().text("Clear").onAction(new	
  EventHandler<ActionEvent>()	
  {	
                             	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  public	
  void	
  handle(ActionEvent	
  event)	
  {	
                                               	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  Button("Reload")	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  speakerModel.clearFilter();	
                                                       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  onAction	
  =	
  {	
  e:ActionEvent	
  =>	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
                                                                                                 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  filter.text	
  =	
  ""	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }).build(),	
                                                                                                       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  model.load()	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ButtonBuilder.create().text("Reload").onAction(new	
  EventHandler<ActionEvent>()	
  {	
                            	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  public	
  void	
  handle(ActionEvent	
  event)	
  {	
                                               	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  speakerModel.load();	
                                                              	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  )	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
                                                                                                 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  items.selectionModel().selectFirst()	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }).build()	
                                                                                                        	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ).build(),	
                                                                                                                        	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  TableView[Speaker](model.filteredSpeakers)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TableViewBuilder.<Speaker>create().items(speakerModel.getFilteredData()).prefHeight(1000).columns(	
                                	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  columns	
  =	
  Seq(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TableColumnBuilder.<Speaker,	
  String>create()	
                                                                   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  TableColumn[Speaker,	
  String]	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .text(FIRST_NAME)	
                                                                                 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  text	
  =	
  "First	
  Name"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .cellValueFactory(new	
  PropertyValueFactory<Speaker,	
  String>(FIRST_NAME_FIELD)).build(),	
     	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  converter	
  =	
  {_.firstName()}	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TableColumnBuilder.<Speaker,	
  String>create()	
                                                                   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .text(LAST_NAME)	
                                                                                  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  TableColumn[Speaker,	
  String]	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .cellValueFactory(new	
  PropertyValueFactory<Speaker,	
  String>(LAST_NAME_FIELD)).build(),	
      	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  text	
  =	
  "Last	
  Name"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TableColumnBuilder.<Speaker,	
  String>create()	
                                                                   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  converter	
  =	
  {_.lastName()}	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .text(JOB_TITLE)	
                                                                                  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .prefWidth(200)	
                                                                                   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  TableColumn[Speaker,	
  String]	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .cellValueFactory(new	
  PropertyValueFactory<Speaker,	
  String>(JOB_TITLE_FIELD)).build(),	
      	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  text	
  =	
  "Job	
  Title"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TableColumnBuilder.<Speaker,	
  String>create()	
                                                                   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  converter	
  =	
  {_.jobTitle()}	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .text(COMPANY)	
                                                                                    	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  prefWidth	
  =	
  200	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .prefWidth(212)	
                                                                                   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .cellValueFactory(new	
  PropertyValueFactory<Speaker,	
  String>(COMPANY_FIELD)).build()	
         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  new	
  TableColumn[Speaker,	
  String]	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ).build()	
                                                                                                                         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  text	
  =	
  "Company"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ).build()	
                                                                                                                                         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  converter	
  =	
  {_.company()}	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ).build()	
                                                                                                                                                         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  prefWidth	
  =	
  212	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ).build()	
                                                                                                                                                                         	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  );	
                                                                                                                                                                                                	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  )	
  
	
  	
  	
  	
  	
  	
  	
  	
  items.getSelectionModel().selectFirst();	
                                                                                                                                                          	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  prefHeight	
  =	
  1000	
  
	
  	
  	
  	
  	
  	
  	
  	
  primaryStage.show();	
                                                                                                                                                                              	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  }	
                                                                                                                                                                                                                 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  )	
  
}	
                                                                                                                                                                                                                                 	
  	
  	
  	
  	
  	
  	
  	
  }	
  
                                                                                                                                                                                                                                    	
  	
  	
  	
  	
  	
  )	
  
                                                                                                                                                                                                                                    	
  	
  	
  	
  }	
  
                                                                                                                                                                                                                                    	
  	
  	
  	
  onCloseRequest	
  =	
  {_:Any	
  =>	
  Platform.exit}	
  
                                                                                                                                                                                                                                    	
  	
  }	
  
                                                                                                                                                                                                                                    }	
  
ScalaFX Application
object	
  ConferenceUI	
  extends	
  JFXApp	
  {	
  
	
  	
  val	
  model	
  =	
  ConferenceModel	
  
	
  	
  stage	
  =	
  new	
  Stage	
  {	
  
	
  	
  	
  	
  width	
  =	
  625	
  
	
  	
  	
  	
  height	
  =	
  700	
  
	
  	
  	
  	
  scene	
  =	
  new	
  Scene(new	
  StackPane())	
  {	
  
	
  	
  	
  	
  	
  	
  fill	
  =	
  "#fcfcfc"	
  
	
  	
  	
  	
  	
  	
  children	
  =	
  Seq(	
  
	
  	
  	
  	
  	
  	
  	
  	
  //	
  create	
  background	
  
	
  	
  	
  	
  	
  	
  	
  	
  //	
  create	
  foreground	
  
	
  	
  	
  	
  	
  	
  )	
  
	
  	
  	
  	
  }	
  
	
  	
  }	
  
}	
  
Loading Images
new	
  ImageView	
  {	
  
	
  	
  image	
  =	
  new	
  Image(	
  
	
  	
  	
  	
  getClass().getResourceAsStream(	
  
	
  	
  	
  	
  	
  	
  "JavaOneLogo.png"	
  
	
  	
  	
  	
  )	
  
	
  	
  )	
  
}	
  
Creating Buttons
new	
  Button("Filter")	
  {	
  
	
  	
  onAction	
  =	
  {	
  e:ActionEvent	
  =>	
  
	
  	
  	
  	
  model.filter(items.selectionModel().getSelectedItem(),	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  filter.text())	
  
	
  	
  }	
  
}	
  
	
  
new	
  Button("Clear")	
  {	
  
	
  	
  onAction	
  =	
  {	
  e:ActionEvent	
  =>	
  
	
  	
  	
  	
  filter.text	
  =	
  ""	
  
	
  	
  	
  	
  model.clear()	
  
	
  	
  }	
  
}	
  
ScalaFX Table Construction
new	
  TableView[Speaker](model.filteredSpeakers)	
  {	
  
	
  	
  columns	
  =	
  Seq(	
  
	
  	
  	
  	
  new	
  TableColumn[Speaker,	
  String]	
  {	
  
	
  	
  	
  	
  	
  	
  text	
  =	
  "First	
  Name"	
  
	
  	
  	
  	
  	
  	
  converter	
  =	
  {_.firstName()}	
  
	
  	
  	
  	
  },	
  
	
  	
  	
  	
  new	
  TableColumn[Speaker,	
  String]	
  {	
  
	
  	
  	
  	
  	
  	
  text	
  =	
  "Last	
  Name"	
  
	
  	
  	
  	
  	
  	
  converter	
  =	
  {_.lastName()}	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  …	
  
	
  	
  )	
  
	
  	
  prefHeight	
  =	
  1000	
  
}	
  
DATABASE
By RRZEicons (Own work) [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
Java DB / Apache Derby
•    Embedded Database
•    Small Footprint (2.7MB)
•    Standards Based (Java, JDBC, SQL)
•    Extremely Easy to Configure
     –  With JDBC 4 / SE 6, just drop in the jar!
Circumflex ORM
•  Scala-based ORM
   (Object-Relational
   Mapping)
•  SQL-based Query Syntax
•  DSL for Domain Object Definition
•  Lazy and Eager Fetch Strategies
Embedded DB Config
orm.connection.driver=	
  
	
  	
  org.apache.derby.jdbc.EmbeddedDriver	
  
orm.connection.url=jdbc:derby:conferenceData	
  
orm.connection.username=user1	
  
orm.connection.password=user1	
  
orm.defaultSchema=APP	
  
Speaker Domain Object
class	
  Speaker	
  extends	
  Record[String,	
  Speaker]	
  {	
  
	
  	
  val	
  id	
  =	
  "id".VARCHAR(255).NOT_NULL	
  
	
  	
  val	
  company	
  =	
  "company".VARCHAR(255)	
  
	
  	
  val	
  firstName	
  =	
  "firstName".VARCHAR(255)	
  
	
  	
  val	
  jobTitle	
  =	
  "jobTitle".VARCHAR(255)	
  
	
  	
  val	
  lastName	
  =	
  "lastName".VARCHAR(255)	
  
	
  
	
  	
  def	
  PRIMARY_KEY	
  =	
  id	
  
	
  	
  def	
  relation	
  =	
  Speaker	
  
}	
  
object	
  Speaker	
  extends	
  Speaker	
  with	
  Table[String,	
  
Speaker]	
  
	
  
Query the Database
def	
  clear()	
  {	
  
	
  	
  val	
  speakers	
  =	
  Speaker.criteria.list()	
  
	
  	
  filteredSpeakers.setAll(speakers)	
  
}	
  
	
  
def	
  filter(field:	
  TextField[Speaker],	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  filterString:	
  String)	
  {	
  
	
  	
  val	
  speakers	
  =	
  Speaker.criteria.add(	
  
	
  	
  	
  	
  field	
  LIKE	
  "%"	
  +	
  filterString	
  +	
  "%").list()	
  
	
  	
  filteredSpeakers.setAll(speakers)	
  
}	
  
CLOUD
An OSSM Persistence Store

 •  On-demand
 •  Self-service
 •  Scalable
 •  Measurable


 •  ™ Dave Nielsen, CloudCamp
@jclouds
open source"
simple: feels like java (and clojure)unit testable"
tested across multiple clouds"
vibrant community"
Portable APIs

      BlobStore	

      LoadBalancer	


      Compute	

     What do you want?	



Provider-Specific Hooks
Embeddable

                       github jclouds-examples
Anatomy of a BlobStore Project

1. Create context
2. Get BlobStore API
3. Do stuff
4. Close context


@jclouds
jclouds modularity"

APIs are software
focused Providers are
offering focused"
API + location + defaults
= Provider"
Cloud Access in Scala
val	
  context	
  =	
  ContextBuilder.newBuilder("aws-­‐s3")	
  
	
  	
  .credentials("identity",	
  "secret")	
  
	
  	
  .buildView(classOf[BlobStoreContext])	
  
	
  
def	
  loadFromCloud(container:String,	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  resource:String):InputStream	
  =	
  {	
  
	
  	
  val	
  blobStore	
  =	
  context.getBlobStore	
  
	
  	
  val	
  blob	
  =	
  blobStore.getBlob(container,	
  resource)	
  
	
  	
  blob.getPayload.getInput	
  
}	
  
	
  
def	
  close()	
  {	
  
	
  	
  context.close()	
  
}	
  
Why jclouds?
•  Data Portability
  o  APIs are not as compatible as they might appear
•  Code Portability
  o  Currently 33 cloud providers
•  Enterprise-grade
  o  Move petabytes of data
•  Parallel operations without threading
   concerns
  o  Outperforms many native SDKs
  o  GAE compatible
  o  Many tuning options

@jclouds
Why jclouds?
•  OSGi compatible
•  Clojure binding
•  “Invented” many standard SDK features
  o  e.g. sync/async APIs
•  Tested!
  o  “official” TCK for a number of cloud providers
  o  also supports offline/local testing


@jclouds
Why jclouds?
•  Location metadata
  o  Don’t get locked in to a provider’s deployment
     policy
•  Does the hard work so you don’t have to
  o  Multi-part in native SDKs vs. .multipart() in
     jclouds
•  Strong & active community
  o  ~65 contributors, commercial support

@jclouds
Conference App Demo
Stephen Chin <stephen.chin@oracle.com> | Oracle @steveonjava
Andrew Phillips <andrew@jclouds.org> | jclouds @jclouds


                   Thank You!

Weitere ähnliche Inhalte

Was ist angesagt?

Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghStuart Roebuck
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaDerek Chen-Becker
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorialKat Roque
 
Java Programming and J2ME: The Basics
Java Programming and J2ME: The BasicsJava Programming and J2ME: The Basics
Java Programming and J2ME: The Basicstosine
 
Demystifying Oak Search
Demystifying Oak SearchDemystifying Oak Search
Demystifying Oak SearchJustin Edelson
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapDave Orme
 
Responsive Facets with Apache Solr
Responsive Facets with Apache SolrResponsive Facets with Apache Solr
Responsive Facets with Apache SolrBrent Lemons
 
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...dotNet Miami
 
Modular programming Using Object in Scala
Modular programming Using Object in ScalaModular programming Using Object in Scala
Modular programming Using Object in ScalaKnoldus Inc.
 
What's new in Doctrine
What's new in DoctrineWhat's new in Doctrine
What's new in DoctrineJonathan Wage
 
Scala for scripting
Scala for scriptingScala for scripting
Scala for scriptingmichid
 
Build Widgets
Build WidgetsBuild Widgets
Build Widgetsscottw
 
Connect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast LaneConnect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast LaneHoward Greenberg
 
Hibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examplesHibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examplesEr. Gaurav Kumar
 

Was ist angesagt? (20)

Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to Scala
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
scala
scalascala
scala
 
Java Programming and J2ME: The Basics
Java Programming and J2ME: The BasicsJava Programming and J2ME: The Basics
Java Programming and J2ME: The Basics
 
Java beans
Java beansJava beans
Java beans
 
Demystifying Oak Search
Demystifying Oak SearchDemystifying Oak Search
Demystifying Oak Search
 
Kotlin talk
Kotlin talkKotlin talk
Kotlin talk
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 Recap
 
Responsive Facets with Apache Solr
Responsive Facets with Apache SolrResponsive Facets with Apache Solr
Responsive Facets with Apache Solr
 
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
 
Modular programming Using Object in Scala
Modular programming Using Object in ScalaModular programming Using Object in Scala
Modular programming Using Object in Scala
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
What's new in Doctrine
What's new in DoctrineWhat's new in Doctrine
What's new in Doctrine
 
Java Beans
Java BeansJava Beans
Java Beans
 
Scala for scripting
Scala for scriptingScala for scripting
Scala for scripting
 
Build Widgets
Build WidgetsBuild Widgets
Build Widgets
 
Connect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast LaneConnect 2016-Move Your XPages Applications to the Fast Lane
Connect 2016-Move Your XPages Applications to the Fast Lane
 
Hibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examplesHibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examples
 

Andere mochten auch

I Hate Process/I Love Process - Why designers are divided about process, and ...
I Hate Process/I Love Process - Why designers are divided about process, and ...I Hate Process/I Love Process - Why designers are divided about process, and ...
I Hate Process/I Love Process - Why designers are divided about process, and ...Joan Vermette
 
Don't Ride the Roller Coaster: create lasting design awarements in your organ...
Don't Ride the Roller Coaster: create lasting design awarements in your organ...Don't Ride the Roller Coaster: create lasting design awarements in your organ...
Don't Ride the Roller Coaster: create lasting design awarements in your organ...Joan Vermette
 
Mind-meld Across Teams, Tools and Time Zones With Eclipse Mylyn: Wesley Coelho
Mind-meld Across Teams, Tools and Time Zones With Eclipse Mylyn: Wesley CoelhoMind-meld Across Teams, Tools and Time Zones With Eclipse Mylyn: Wesley Coelho
Mind-meld Across Teams, Tools and Time Zones With Eclipse Mylyn: Wesley Coelhojaxconf
 
Organizational Parkour: the Negotiation Game for Designers
Organizational Parkour: the Negotiation Game for DesignersOrganizational Parkour: the Negotiation Game for Designers
Organizational Parkour: the Negotiation Game for DesignersJoan Vermette
 
Organizational Parkour for Seattle Infocamp, 10/2013
Organizational Parkour for Seattle Infocamp, 10/2013Organizational Parkour for Seattle Infocamp, 10/2013
Organizational Parkour for Seattle Infocamp, 10/2013Joan Vermette
 
Ielts writing task 1 sample line graph
Ielts writing task 1 sample line graphIelts writing task 1 sample line graph
Ielts writing task 1 sample line graphimadhawamdeh
 
Adjective clauses with subject relative pronouns
Adjective clauses   with subject relative pronounsAdjective clauses   with subject relative pronouns
Adjective clauses with subject relative pronounsimadhawamdeh
 
How to build a mobile app - Peter Bell
How to build a mobile app - Peter Bell How to build a mobile app - Peter Bell
How to build a mobile app - Peter Bell jaxconf
 
Revisiting the Six Degrees Problem with a Graph Database - Nick Quinn
Revisiting the Six Degrees Problem with a Graph Database - Nick QuinnRevisiting the Six Degrees Problem with a Graph Database - Nick Quinn
Revisiting the Six Degrees Problem with a Graph Database - Nick Quinnjaxconf
 
Nashorn - JavaScript on the JVM - Akhil Arora
Nashorn - JavaScript on the JVM - Akhil AroraNashorn - JavaScript on the JVM - Akhil Arora
Nashorn - JavaScript on the JVM - Akhil Arorajaxconf
 
What’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth LaddWhat’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth Laddjaxconf
 

Andere mochten auch (18)

I Hate Process/I Love Process - Why designers are divided about process, and ...
I Hate Process/I Love Process - Why designers are divided about process, and ...I Hate Process/I Love Process - Why designers are divided about process, and ...
I Hate Process/I Love Process - Why designers are divided about process, and ...
 
Don't Ride the Roller Coaster: create lasting design awarements in your organ...
Don't Ride the Roller Coaster: create lasting design awarements in your organ...Don't Ride the Roller Coaster: create lasting design awarements in your organ...
Don't Ride the Roller Coaster: create lasting design awarements in your organ...
 
Mind-meld Across Teams, Tools and Time Zones With Eclipse Mylyn: Wesley Coelho
Mind-meld Across Teams, Tools and Time Zones With Eclipse Mylyn: Wesley CoelhoMind-meld Across Teams, Tools and Time Zones With Eclipse Mylyn: Wesley Coelho
Mind-meld Across Teams, Tools and Time Zones With Eclipse Mylyn: Wesley Coelho
 
Nokesh
NokeshNokesh
Nokesh
 
We are not afraid to die
We are not afraid to dieWe are not afraid to die
We are not afraid to die
 
Phrasal verbs
Phrasal verbsPhrasal verbs
Phrasal verbs
 
Organizational Parkour: the Negotiation Game for Designers
Organizational Parkour: the Negotiation Game for DesignersOrganizational Parkour: the Negotiation Game for Designers
Organizational Parkour: the Negotiation Game for Designers
 
Organizational Parkour for Seattle Infocamp, 10/2013
Organizational Parkour for Seattle Infocamp, 10/2013Organizational Parkour for Seattle Infocamp, 10/2013
Organizational Parkour for Seattle Infocamp, 10/2013
 
Satellite
SatelliteSatellite
Satellite
 
Data types
Data typesData types
Data types
 
Ielts writing task 1 sample line graph
Ielts writing task 1 sample line graphIelts writing task 1 sample line graph
Ielts writing task 1 sample line graph
 
Adjective clauses with subject relative pronouns
Adjective clauses   with subject relative pronounsAdjective clauses   with subject relative pronouns
Adjective clauses with subject relative pronouns
 
We are not afraid to die
We are not afraid to dieWe are not afraid to die
We are not afraid to die
 
Causative verbs
Causative verbsCausative verbs
Causative verbs
 
How to build a mobile app - Peter Bell
How to build a mobile app - Peter Bell How to build a mobile app - Peter Bell
How to build a mobile app - Peter Bell
 
Revisiting the Six Degrees Problem with a Graph Database - Nick Quinn
Revisiting the Six Degrees Problem with a Graph Database - Nick QuinnRevisiting the Six Degrees Problem with a Graph Database - Nick Quinn
Revisiting the Six Degrees Problem with a Graph Database - Nick Quinn
 
Nashorn - JavaScript on the JVM - Akhil Arora
Nashorn - JavaScript on the JVM - Akhil AroraNashorn - JavaScript on the JVM - Akhil Arora
Nashorn - JavaScript on the JVM - Akhil Arora
 
What’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth LaddWhat’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth Ladd
 

Ähnlich wie JavaFX and Scala in the Cloud: Stephen Chin

Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffJAX London
 
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)Stephen Chin
 
BOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala appsBOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala appsPeter Pilgrim
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UITech OneStop
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Scripting with Java FX - Cédric Tabin - December 2007
Scripting with Java FX - Cédric Tabin - December 2007Scripting with Java FX - Cédric Tabin - December 2007
Scripting with Java FX - Cédric Tabin - December 2007JUG Lausanne
 
Scala in a wild enterprise
Scala in a wild enterpriseScala in a wild enterprise
Scala in a wild enterpriseRafael Bagmanov
 
How Scala promotes TDD
How Scala promotes TDDHow Scala promotes TDD
How Scala promotes TDDShai Yallin
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMarakana Inc.
 
Intro to Core Data
Intro to Core DataIntro to Core Data
Intro to Core DataMake School
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstackRoberto Polli
 
EclipseCon 2010 - JDT Fundamentals
EclipseCon 2010 - JDT FundamentalsEclipseCon 2010 - JDT Fundamentals
EclipseCon 2010 - JDT Fundamentalsdeepakazad
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryPray Desai
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryWilliam Candillon
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack ImplementationMert Çalışkan
 

Ähnlich wie JavaFX and Scala in the Cloud: Stephen Chin (20)

Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard Wolff
 
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
 
Scala and Spring
Scala and SpringScala and Spring
Scala and Spring
 
BOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala appsBOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala apps
 
Liferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for DevelopersLiferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for Developers
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Scripting with Java FX - Cédric Tabin - December 2007
Scripting with Java FX - Cédric Tabin - December 2007Scripting with Java FX - Cédric Tabin - December 2007
Scripting with Java FX - Cédric Tabin - December 2007
 
Scala in a wild enterprise
Scala in a wild enterpriseScala in a wild enterprise
Scala in a wild enterprise
 
How Scala promotes TDD
How Scala promotes TDDHow Scala promotes TDD
How Scala promotes TDD
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for Scala
 
Intro to Core Data
Intro to Core DataIntro to Core Data
Intro to Core Data
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstack
 
EclipseCon 2010 - JDT Fundamentals
EclipseCon 2010 - JDT FundamentalsEclipseCon 2010 - JDT Fundamentals
EclipseCon 2010 - JDT Fundamentals
 
JDT Fundamentals 2010
JDT Fundamentals 2010JDT Fundamentals 2010
JDT Fundamentals 2010
 
Spock
SpockSpock
Spock
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud Foundry
 
Advance Java
Advance JavaAdvance Java
Advance Java
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQuery
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
 

Kürzlich hochgeladen

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Kürzlich hochgeladen (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

JavaFX and Scala in the Cloud: Stephen Chin

  • 1. Stephen Chin | Oracle @steveonjava Andrew Phillips | jclouds @jclouds JavaFX and Scala in the Cloud
  • 2. +
  • 3. Heaven Photo by Alberto Fernandez Fernandez
  • 4.
  • 5.
  • 6. When This Architecture Makes Sense •  Data is mostly read-only –  Transactional updates still require a server (but can be simpler/smaller) •  User's view of data is small to medium –  Initial DB download of < 10K records is reasonable –  Not total DB size, but subset of data visible to user Conference App has 3K large records and compresses to only 330KB DB size
  • 7. Cloud Data Advantages •  Offline Operation –  Once DB is cached, application works 100% offline •  Responsive Client Performance –  All DB queries are fast and local •  High Availability & Scalability –  99.99% Availability –  Easily scales up to 100s of requests per second But, with proper hashes scales up to millions of requests per second!
  • 8. Cloud Data Advantages (continued) •  Insanely cheap server costs! Number of Users Monthly Cost* 3,000 Free (S3 free tier) 10,000 $0.28 100,000 $3.84 1,000,000 $39.48 * For 330KB of hosted data in Amazon S3
  • 9. Cloud Data Advantages (continued) •  Insanely cheap server costs! Number of Users Monthly Cost* 3,000 Free (S3 free tier) 10,000 $0.28 100,000 $3.84 1,000,000 $39.48 * For 330KB of hosted data in Amazon S3
  • 10. Cloud Data Advantages (continued) •  Insanely cheap server costs! Number of Users Monthly Cost* 3,000 Free (S3 free tier) 10,000 $0.28 100,000 $3.84 1,000,000 $39.48 * For 330KB of hosted data in Amazon S3
  • 11. Cloud Data Advantages (continued) •  Insanely cheap server costs! Number of Users Monthly Cost* 3,000 Free (S3 free tier) 10,000 $0.28 100,000 $3.84 1,000,000 $39.48 * For 330KB of hosted data in Amazon S3
  • 12. UI
  • 13. JavaFX 2.0 Platform Immersive Application Experience Leverage your Java skills with modern JavaFX APIs •  Cross-platform Animation, Video, Charting •  Integrate Java, JavaScript, and HTML5 in the same application •  New graphics stack takes advantage of hardware acceleration for 2D and 3D applications •  Use your favorite IDE: NetBeans, Eclipse, IntelliJ, etc.
  • 14. What is Scala 2001 2006 •  Scala Started •  Scala v2.0 2003/2004 2011 •  Scala v1.0 •  Scala 2.9.2 (latest) •  Started in 2001 by Martin Odersky •  Compiles to Java bytecodes •  Pure object-oriented language •  Also a functional programming language
  • 15. Why Scala? •  Shares many language features with JavaFX Script that make GUI programming easier: –  Static Type Checking – Catch your errors at compile time –  Closures – Wrap behavior and pass it by reference –  Declarative – Express the UI by describing what it should look like
  • 16. Why Scala? (continued) •  Scala also supports Type Safe DSLs! –  Implicit Conversions – type safe class extension –  Operator Overloading – with standard precedence rules –  DelayedInit / @specialized – advanced language features
  • 17. Java vs. Scala DSL public  class  JavaFXEEDemo  extends  Application  {   object  ConferenceUI  extends  JFXApp  {        val  model  =  ConferenceModel          public  static  void  main(String[]  args)  {      stage  =  new  Stage  {                  launch(JavaFXEEDemo.class,  args);          width  =  625          }          height  =  700                    scene  =  new  Scene(new  StackPane())  {          private  SpeakerModel  speakerModel  =  getInstance();              fill  =  "#fcfcfc"          private  TextField  filter;              children  =  Seq(          private  ChoiceBox<String>  items;                  new  VBox  {                                children  =  Seq(          @Override                          new  ImageView  {          public  void  start(Stage  primaryStage)  {                              image  =  new  Image(getClass().getResourceAsStream("JavaOneLogo.png"))                  primaryStage.setTitle("JavaOne  Speaker  List");                          },                  speakerModel.load();                          new  Rectangle  {                  EventHandler<ActionEvent>  filterAction  =  new  EventHandler<ActionEvent>()  {                              width  =  625                          public  void  handle(ActionEvent  event)  {                              height  =  50                                  String  field  =  items.selectionModelProperty().getValue().getSelectedItem();                              fill  =  new  LinearGradient(                                  String  text  =  filter.getText();                                  endX  =  0,                                  speakerModel.filter(field,  text);                                  stops  =  Stops(WHITE,  "#d0cbc8")                          }                              )                  };                          }                  primaryStage.setScene(SceneBuilder.create()                      )                          .width(625)                  },                          .height(700)                  new  VBox  {                          .fill(Color.web("#fcfcfc"))                      padding  =  Insets(100,  20,  20,  20)                          .root(StackPaneBuilder.create().children(                      spacing  =  30                                  //  Background  image  and  gradient                      children  =  Seq(                                  VBoxBuilder.create().children(                          new  HBox  {   83 Lines 88 Lines                                        ImageViewBuilder.create()                              val  filter  =  new  TextField();                                                  .image(new  Image(getClass().getResourceAsStream("JavaOneLogo.png"))).build(),                              val  items  =  new  ChoiceBox[ruco.TextField[Speaker]]()  {                                          RectangleBuilder.create().width(625).height(50).fill(LinearGradientBuilder.create().endX(0).stops(                                  items  =  ObservableBuffer(Speaker.firstName,  Speaker.lastName,  Speaker.jobTitle,  Speaker.company)                                                  StopBuilder.create().color(Color.WHITE).offset(0).build(),                                  converter  =  StringConverter.toStringConverter({s:ruco.TextField[Speaker]  =>  s.name})                                                  StopBuilder.create().color(Color.web("#d0cbc8")).offset(1).build()                              }                                          ).build()).build()                              alignment  =  Pos.BASELINE_LEFT                                  ).build(),                              spacing  =  15                                  //  Foreground  controls                              children  =  Seq(   2622 Characters 1452 Characters                                VBoxBuilder.create()                                  items,                                          .padding(new  Insets(100,  20,  20,  20))                                  filter,                                          .spacing(30)                                  new  Button("Filter")  {                                          .children(HBoxBuilder.create()                                      onAction  =  {  e:ActionEvent  =>                                                  .alignment(Pos.BASELINE_LEFT)                                          model.filter(items.selectionModel().getSelectedItem(),  filter.text())                                                  .spacing(15)                                      }                                                  .children(                                  },                                                          items  =  new  ChoiceBox<String>(                                  new  Button("Clear")  {                                                                  FXCollections.observableArrayList(FIRST_NAME,  LAST_NAME,  JOB_TITLE,  COMPANY)                                      onAction  =  {  e:ActionEvent  =>                                                          ),                                          filter.text  =  ""                                                          filter  =  TextFieldBuilder.create().prefColumnCount(20).onAction(filterAction).build(),                                          model.clear()                                                          ButtonBuilder.create().text("Filter").onAction(filterAction).build(),                                      }                                                          ButtonBuilder.create().text("Clear").onAction(new  EventHandler<ActionEvent>()  {                                  },                                                                  public  void  handle(ActionEvent  event)  {                                  new  Button("Reload")  {                                                                          speakerModel.clearFilter();                                      onAction  =  {  e:ActionEvent  =>                                                                  }                                          filter.text  =  ""                                                          }).build(),                                          model.load()                                                          ButtonBuilder.create().text("Reload").onAction(new  EventHandler<ActionEvent>()  {                                      }                                                                  public  void  handle(ActionEvent  event)  {                                  }                                                                          speakerModel.load();                              )                                                                  }                              items.selectionModel().selectFirst()                                                          }).build()                          },                                                  ).build(),                          new  TableView[Speaker](model.filteredSpeakers)  {                                                  TableViewBuilder.<Speaker>create().items(speakerModel.getFilteredData()).prefHeight(1000).columns(                              columns  =  Seq(                                                          TableColumnBuilder.<Speaker,  String>create()                                  new  TableColumn[Speaker,  String]  {                                                                  .text(FIRST_NAME)                                      text  =  "First  Name"                                                                  .cellValueFactory(new  PropertyValueFactory<Speaker,  String>(FIRST_NAME_FIELD)).build(),                                      converter  =  {_.firstName()}                                                          TableColumnBuilder.<Speaker,  String>create()                                  },                                                                  .text(LAST_NAME)                                  new  TableColumn[Speaker,  String]  {                                                                  .cellValueFactory(new  PropertyValueFactory<Speaker,  String>(LAST_NAME_FIELD)).build(),                                      text  =  "Last  Name"                                                          TableColumnBuilder.<Speaker,  String>create()                                      converter  =  {_.lastName()}                                                                  .text(JOB_TITLE)                                  },                                                                  .prefWidth(200)                                  new  TableColumn[Speaker,  String]  {                                                                  .cellValueFactory(new  PropertyValueFactory<Speaker,  String>(JOB_TITLE_FIELD)).build(),                                      text  =  "Job  Title"                                                          TableColumnBuilder.<Speaker,  String>create()                                      converter  =  {_.jobTitle()}                                                                  .text(COMPANY)                                      prefWidth  =  200                                                                  .prefWidth(212)                                  },                                                                  .cellValueFactory(new  PropertyValueFactory<Speaker,  String>(COMPANY_FIELD)).build()                                  new  TableColumn[Speaker,  String]  {                                                  ).build()                                      text  =  "Company"                                          ).build()                                      converter  =  {_.company()}                                  ).build()                                      prefWidth  =  212                          ).build()                                  }                  );                              )                  items.getSelectionModel().selectFirst();                              prefHeight  =  1000                  primaryStage.show();                          }          }                      )   }                  }              )          }          onCloseRequest  =  {_:Any  =>  Platform.exit}      }   }  
  • 18. ScalaFX Application object  ConferenceUI  extends  JFXApp  {      val  model  =  ConferenceModel      stage  =  new  Stage  {          width  =  625          height  =  700          scene  =  new  Scene(new  StackPane())  {              fill  =  "#fcfcfc"              children  =  Seq(                  //  create  background                  //  create  foreground              )          }      }   }  
  • 19. Loading Images new  ImageView  {      image  =  new  Image(          getClass().getResourceAsStream(              "JavaOneLogo.png"          )      )   }  
  • 20. Creating Buttons new  Button("Filter")  {      onAction  =  {  e:ActionEvent  =>          model.filter(items.selectionModel().getSelectedItem(),                                    filter.text())      }   }     new  Button("Clear")  {      onAction  =  {  e:ActionEvent  =>          filter.text  =  ""          model.clear()      }   }  
  • 21. ScalaFX Table Construction new  TableView[Speaker](model.filteredSpeakers)  {      columns  =  Seq(          new  TableColumn[Speaker,  String]  {              text  =  "First  Name"              converter  =  {_.firstName()}          },          new  TableColumn[Speaker,  String]  {              text  =  "Last  Name"              converter  =  {_.lastName()}          }          …      )      prefHeight  =  1000   }  
  • 22. DATABASE By RRZEicons (Own work) [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
  • 23. Java DB / Apache Derby •  Embedded Database •  Small Footprint (2.7MB) •  Standards Based (Java, JDBC, SQL) •  Extremely Easy to Configure –  With JDBC 4 / SE 6, just drop in the jar!
  • 24. Circumflex ORM •  Scala-based ORM (Object-Relational Mapping) •  SQL-based Query Syntax •  DSL for Domain Object Definition •  Lazy and Eager Fetch Strategies
  • 25. Embedded DB Config orm.connection.driver=      org.apache.derby.jdbc.EmbeddedDriver   orm.connection.url=jdbc:derby:conferenceData   orm.connection.username=user1   orm.connection.password=user1   orm.defaultSchema=APP  
  • 26. Speaker Domain Object class  Speaker  extends  Record[String,  Speaker]  {      val  id  =  "id".VARCHAR(255).NOT_NULL      val  company  =  "company".VARCHAR(255)      val  firstName  =  "firstName".VARCHAR(255)      val  jobTitle  =  "jobTitle".VARCHAR(255)      val  lastName  =  "lastName".VARCHAR(255)        def  PRIMARY_KEY  =  id      def  relation  =  Speaker   }   object  Speaker  extends  Speaker  with  Table[String,   Speaker]    
  • 27. Query the Database def  clear()  {      val  speakers  =  Speaker.criteria.list()      filteredSpeakers.setAll(speakers)   }     def  filter(field:  TextField[Speaker],                        filterString:  String)  {      val  speakers  =  Speaker.criteria.add(          field  LIKE  "%"  +  filterString  +  "%").list()      filteredSpeakers.setAll(speakers)   }  
  • 28. CLOUD
  • 29. An OSSM Persistence Store •  On-demand •  Self-service •  Scalable •  Measurable •  ™ Dave Nielsen, CloudCamp @jclouds
  • 30. open source" simple: feels like java (and clojure)unit testable" tested across multiple clouds" vibrant community"
  • 31. Portable APIs BlobStore LoadBalancer Compute What do you want? Provider-Specific Hooks Embeddable github jclouds-examples
  • 32. Anatomy of a BlobStore Project 1. Create context 2. Get BlobStore API 3. Do stuff 4. Close context @jclouds
  • 33. jclouds modularity" APIs are software focused Providers are offering focused" API + location + defaults = Provider"
  • 34. Cloud Access in Scala val  context  =  ContextBuilder.newBuilder("aws-­‐s3")      .credentials("identity",  "secret")      .buildView(classOf[BlobStoreContext])     def  loadFromCloud(container:String,                                      resource:String):InputStream  =  {      val  blobStore  =  context.getBlobStore      val  blob  =  blobStore.getBlob(container,  resource)      blob.getPayload.getInput   }     def  close()  {      context.close()   }  
  • 35. Why jclouds? •  Data Portability o  APIs are not as compatible as they might appear •  Code Portability o  Currently 33 cloud providers •  Enterprise-grade o  Move petabytes of data •  Parallel operations without threading concerns o  Outperforms many native SDKs o  GAE compatible o  Many tuning options @jclouds
  • 36. Why jclouds? •  OSGi compatible •  Clojure binding •  “Invented” many standard SDK features o  e.g. sync/async APIs •  Tested! o  “official” TCK for a number of cloud providers o  also supports offline/local testing @jclouds
  • 37. Why jclouds? •  Location metadata o  Don’t get locked in to a provider’s deployment policy •  Does the hard work so you don’t have to o  Multi-part in native SDKs vs. .multipart() in jclouds •  Strong & active community o  ~65 contributors, commercial support @jclouds
  • 39. Stephen Chin <stephen.chin@oracle.com> | Oracle @steveonjava Andrew Phillips <andrew@jclouds.org> | jclouds @jclouds Thank You!