SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
Java(EE)OPENSHIFT
MongoDB Applications
in the Cloud
Workshop

PRESENTED
BY

Shekhar
Gulati
WHO AM I?

• 

	
  
• 

	
  
• 

	
  
• 

• 

Shekhar	
  Gula+	
  -­‐-­‐	
  OpenShi1	
  Developer	
  Evangelist	
  
Java	
  /	
  JavaScript	
  /	
  Python	
  /	
  NoSQL	
  /	
  Cloud	
  Guy	
  

TwiEer	
  Handle	
  :	
  shekhargula*	
  
Github	
  :	
  h,ps://github.com/shekhargula*	
  
Author	
  of	
  30	
  technologies	
  in	
  30	
  days	
  blog	
  series	
  
h,ps://www.openshi9.com/blogs/learning-­‐30-­‐
technologies-­‐in-­‐30-­‐days-­‐a-­‐developer-­‐challenge	
  
AGENDA


l 

Get	
  started	
  with	
  OpenShi1	
  

l 

Develop	
  a	
  loca+on	
  aware	
  applica+on	
  
- 

Java	
  EE	
  6	
  –	
  Middleware	
  
l 

JAX-­‐RS	
  1.1	
  –	
  Java	
  API	
  for	
  REST	
  WS	
  

l 

CDI	
  –	
  Context	
  and	
  Dependency	
  Injec+on	
  

- 

Eclipse	
  Kepler	
  –	
  IDE	
  

- 

MongoDB	
  –	
  Database	
  

- 

OpenShi1	
  –	
  Deployment	
  choice	
  
http://sharemylocation-shekhargulati.rhcloud.com/
CODE DU JOUR

https://github.com/shekhargulati/sharemylocation-demo
OpenShift

OPENSHIFT	
  OVERVIEW	
  
OpenShift
is

PaaS by Red Hat

Multi-language,
Auto-Scaling,
Self-service,
Elastic,
Cloud Application Platform
WHY OPENSHIFT?


l 

l 

Supports	
  MongoDB	
  ,	
  PostgreSQL	
  ,and	
  MySQL	
  
Mul+-­‐language	
  support.	
  Supports	
  Java,	
  Node.js,	
  Perl,	
  Python,	
  
PHP	
  and	
  Ruby	
  

l 

Extensible	
  via	
  DIY	
  and	
  cartridges	
  

l 

No	
  need	
  to	
  learn	
  anything	
  new	
  

l 

Open	
  source	
  –	
  OpenShi1	
  Origin	
  

l 

Scalable	
  

l 

FREE!	
  

l 

Produc+on	
  Ready	
  
OUR STACK


8
FLAVORS OF OPENSHIFT

Open
Source
Project

Public
Cloud
Service

origin

Onpremise
or Private
Cloud
Software
OPENSHIFT – GETTING
STARTED


Go to
https://openshift.redhat.com/app/account/new

Promo code is JUDCON-IN14

Verify Email

10
TOOLS REQUIRED

1.  Eclipse for Java EE
(Kepler)
2.  Git
3.  Modern browser

11
LAB 1 : HELLO OPENSHIFT

1.  Install OpenShift Eclipse plugin
2.  Create new application with JBoss EAP and MongoDB
cartridges.
1. 

Sign up for OpenShift(if not already)

2. 

Create domain name or namespace

3. 

Upload SSH keys to OpenShift

4. 

Fill application creation wizard

5. 

Finish

3.  Show OpenShift Explorer View and Server’s View
4. Make a change in index.html
1. 
2. 
12

Commit the change using Git Staging view
Publish the change
LAB 2 : HOT DEPLOYMENT

1.  Right click on your project and then go to
OpenShift > Configure Markers
2.  Choose Hot Deploy marker
3.  Commit to git repository
4.  Go to servers view and publish your changes.

13
LAB 3 : SET UP JAX RS

14
LAB 3 : REST INTRODUCTION

1.  HTTP used right
2.  Defines set of RESTful constraints
1. 

Everything is a resource
1. 

2. 

Eg. Post , Tweet , User , etc.

Every resource has an identifier
1.  Eg. http://api/twitter.com/tweets/1000011111

3. 

Resource can have multiple representations
1.  JSON , XML , YAML , etc.

4. 

All resources expose a uniform interface
1.  GET , POST , PUT , DELETE

15
LAB 3 JAX-RS INTRODUCTION

1.  Java API for REST Services
2.  POJO based
3.  Annotation heavy
4.  HTTP Centric
5.  Format independent
6.  Container independent
7.  Included with Java EE 6
In this workshop we will be talking about JAX-RS 1.1

16
LAB 3 : SET UP JAX RS

1.  Update to Java 7
2.  Delete web.xml
3.  Update Maven war plugin to 2.3
4.  Create JAX-RS configuration class.
5.  Write PingResource

17
LAB 3 : ADDING GIT REMOTE

git remote add upstream -m master https://github.com/
shekhargulati/sharemylocation-demo.git
git fetch –all
git reset --hard upstream/lab3

18
LAB 4 : CONFIGURE CDI AND
MONGODB 

19
CDI


1.  CDI stands for Context and Dependency Injection
2.  CDI simplifies and sanitizes the API for DI and AOP
like JPA did for ORM -- CDI Tutorial by Rick Hightower
3.  Type safe approach to Dependency Injection
4.  Strong typing and loose coupling
5.  To configure CDI add beans.xml to
1. 

WEB-INF of WAR

2. 

META-INF of JAR

6.  Beans can be injected at method , field , or constructor.

20
CDI EXAMPLE


21
MONGODB
WHAT IS MONGODB


l 

Open Source NoSQL document datastore
– 

l 

JSON style documents

Schema-less
– 

Each document is heterogeneous, and may have completely
unique structure compared to other documents

l 
l 

Rich query language

l 

Rich documents

l 

Easy to get running

l 

23

Fast and horizontally scalable

Geospatial indexing
MONGODB TERMINOLOGY

	
  
Database	
  	
  	
  →

	
  	
  Database	
  

Table	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  →	
  	
  	
  	
  	
  Collec+on	
  
Row	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  →

	
  	
  Document	
  

Index	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  →	
  	
  	
  	
  	
  	
  Index	
  
SOME QUERIES


// Find all the jobs with skill as mongodb

db.jobs.find({"skills":"mongodb"})
// Find all the jobs with python as skill and
near to given location

db.jobs.find({"lngLat":{$near :
[139.69 , 35.68]},
"skills":"python"})
// Find all the python or mongodb jobs
near to given location

db.jobs.find({"lngLat":{$near :
[139.69 , 35.68]},
"skills":{$in :
["mongodb","python"]}})

25
LAB 4 : ENABLE CDI AND
MONGODB CONFIGURATION

1.  Create beans.xml in src/main/WEB-INF folder
2.  Create ApplicationScoped bean for configuring
MongoDB
3.  PingResource writes a document to dummy collection
4.  Open Eclipse Remote System Explorer perspective
and connect to gear.
Right click on project
1. 

26

Team > Reset > Remote Tracking > upstream/lab4
LAB 5 : IMPLEMENT CREATE
AND FIND ALL STATUS

1.  Create Status domain class
2.  Create converter for Status to DBObject and vice versa
3.  Create StatusResource with create and find all
endpoints.
4.  Create ApplicationDao with create and findAll methods.
5.  Create Twitter Bootstrap and Backbonejs front end for
create and find all functionalities.
Right click on project
- 

27

Team > Reset > Remote Tracking > upstream/lab5
LAB 6 : IMPLEMENT NEAR AND
GEONEAR FEATURES

1.  Create findNear and findGeoNear methods in
ApplicationDao
2.  Create near and geonear search REST endpoints in
StatusResource
3.  Implement backbone views for search endpoints
4.  Create Index
1. 

db.statuses.ensureIndex({“location”:”2dsphere”})

Right click on project
- 

28

Team > Reset > Remote Tracking > upstream/lab6
QUESTIONS?
DONE!
STEP 1 : CHOOSE OPENSHIFT
TOOLS

31
STEP 1 : SEARCH JBOSS
TOOLS

32
GEOSPATIAL INDEXING
BASICS


What is it for?

l 

l 
l 

l 

Find all the MongoDB jobs near me – Proximity Queries
Find all the MongoDB jobs within Bangalore – Bounded
Queries
Find all the MongoDB job at this location – Exact Queries

l 

Supports only two dimensional indexes.

l 

You can only have one geospatial index per collection.
By default, 2d geospatial indexes assume longitude
and latitude have boundaries of -180 inclusive and 180
non-inclusive (i.e. [-180, 180))

l 

33
HOW TO MAKE IT WORK


1)  Put your coordinates into an array
{ loc : [ 50 , 30 ] } //SUGGESTED OPTION
{ loc : { x : 50 , y : 30 } }
{ loc : { foo : 50 , y : 30 } }
1)  { loc : { lon : 40.739037, lat: 73.992964 } }
2)  Make a 2d index
db.places.ensureIndex( { loc : "2d" } )
3)

34

If you use latitude and longitude as your coordinate system, always
store longitude first. MongoDB’s 2d spherical index operators only
recognize [ longitude, latitude] ordering.

Mais conteúdo relacionado

Mais procurados

Spring - CDI Interop
Spring - CDI InteropSpring - CDI Interop
Spring - CDI InteropRay Ploski
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Mihail Stoynov
 
Play Framework workshop: full stack java web app
Play Framework workshop: full stack java web appPlay Framework workshop: full stack java web app
Play Framework workshop: full stack java web appAndrew Skiba
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play appsYevgeniy Brikman
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Ryan Cuprak
 
Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Yevgeniy Brikman
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Saeed Zarinfam
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissAndres Almiray
 
Java11 New Features
Java11 New FeaturesJava11 New Features
Java11 New FeaturesHaim Michael
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"Daniel Bryant
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Matt Raible
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle BuildAndres Almiray
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle BuildAndres Almiray
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsGR8Conf
 

Mais procurados (20)

Spring - CDI Interop
Spring - CDI InteropSpring - CDI Interop
Spring - CDI Interop
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
 
Apache Lucene for Java EE Developers
Apache Lucene for Java EE DevelopersApache Lucene for Java EE Developers
Apache Lucene for Java EE Developers
 
Play Framework workshop: full stack java web app
Play Framework workshop: full stack java web appPlay Framework workshop: full stack java web app
Play Framework workshop: full stack java web app
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play apps
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
 
Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
Java11 New Features
Java11 New FeaturesJava11 New Features
Java11 New Features
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Migrating to Java 9 Modules
Migrating to Java 9 ModulesMigrating to Java 9 Modules
Migrating to Java 9 Modules
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails Projects
 

Destaque

Cours java smi 2007 2008
Cours java smi 2007 2008Cours java smi 2007 2008
Cours java smi 2007 2008Khalil Lechheb
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web ApplicationYakov Fain
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java DevelopersYakov Fain
 
Javascript basics
Javascript basicsJavascript basics
Javascript basicsSolv AS
 
Working with Arrays in JavaScript
Working with Arrays in JavaScriptWorking with Arrays in JavaScript
Working with Arrays in JavaScriptFlorence Davis
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowYakov Fain
 
Javascript - Array - Writing
Javascript - Array - WritingJavascript - Array - Writing
Javascript - Array - WritingSamuel Santos
 
Bonnes pratiques des applications java prêtes pour la production
Bonnes pratiques des applications java prêtes pour la productionBonnes pratiques des applications java prêtes pour la production
Bonnes pratiques des applications java prêtes pour la productionCyrille Le Clerc
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScriptYakov Fain
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developersYakov Fain
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java DevelopersLoc Nguyen
 
JavaScript DOM Manipulations
JavaScript DOM ManipulationsJavaScript DOM Manipulations
JavaScript DOM ManipulationsYnon Perek
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTYakov Fain
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom ManipulationMohammed Arif
 
Reactive Thinking in Java
Reactive Thinking in JavaReactive Thinking in Java
Reactive Thinking in JavaYakov Fain
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays Reem Alattas
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework Yakov Fain
 
DOM ( Document Object Model )
DOM ( Document Object Model )DOM ( Document Object Model )
DOM ( Document Object Model )ITSTB
 

Destaque (20)

Cours java smi 2007 2008
Cours java smi 2007 2008Cours java smi 2007 2008
Cours java smi 2007 2008
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Working with Arrays in JavaScript
Working with Arrays in JavaScriptWorking with Arrays in JavaScript
Working with Arrays in JavaScript
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business Workflow
 
Javascript - Array - Writing
Javascript - Array - WritingJavascript - Array - Writing
Javascript - Array - Writing
 
Introduction àJava
Introduction àJavaIntroduction àJava
Introduction àJava
 
Arrays
ArraysArrays
Arrays
 
Bonnes pratiques des applications java prêtes pour la production
Bonnes pratiques des applications java prêtes pour la productionBonnes pratiques des applications java prêtes pour la production
Bonnes pratiques des applications java prêtes pour la production
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java Developers
 
JavaScript DOM Manipulations
JavaScript DOM ManipulationsJavaScript DOM Manipulations
JavaScript DOM Manipulations
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoT
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
Reactive Thinking in Java
Reactive Thinking in JavaReactive Thinking in Java
Reactive Thinking in Java
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
 
DOM ( Document Object Model )
DOM ( Document Object Model )DOM ( Document Object Model )
DOM ( Document Object Model )
 

Semelhante a Java(ee) mongo db applications in the cloud

Java EE 6 and NoSQL Workshop DevFest Austria
Java EE 6 and NoSQL Workshop DevFest AustriaJava EE 6 and NoSQL Workshop DevFest Austria
Java EE 6 and NoSQL Workshop DevFest AustriaShekhar Gulati
 
Mongo db bangalore
Mongo db bangaloreMongo db bangalore
Mongo db bangaloreMongoDB
 
Bringing spatial love to your python application
Bringing spatial love to your python applicationBringing spatial love to your python application
Bringing spatial love to your python applicationShekhar Gulati
 
How to Reverse Engineer Web Applications
How to Reverse Engineer Web ApplicationsHow to Reverse Engineer Web Applications
How to Reverse Engineer Web ApplicationsJarrod Overson
 
From CoreOS to Kubernetes and Concourse CI
From CoreOS to Kubernetes and Concourse CIFrom CoreOS to Kubernetes and Concourse CI
From CoreOS to Kubernetes and Concourse CIDenis Izmaylov
 
Hands-on Lab: Red Hat Container Development & OpenShift
Hands-on Lab: Red Hat Container Development & OpenShiftHands-on Lab: Red Hat Container Development & OpenShift
Hands-on Lab: Red Hat Container Development & OpenShiftAmazon Web Services
 
Plone FSR
Plone FSRPlone FSR
Plone FSRfulv
 
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18Jorge Morales
 
The Usual Suspects - Red Hat Developer Day 2012-11-01
The Usual Suspects - Red Hat Developer Day 2012-11-01The Usual Suspects - Red Hat Developer Day 2012-11-01
The Usual Suspects - Red Hat Developer Day 2012-11-01Jorge Hidalgo
 
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverageTesting NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoveragemlilley
 
20100730 phpstudy
20100730 phpstudy20100730 phpstudy
20100730 phpstudyYusuke Ando
 
Content Staging in Drupal 8
Content Staging in Drupal 8Content Staging in Drupal 8
Content Staging in Drupal 8Dick Olsson
 
Spatial mongo for PHP and Zend
Spatial mongo for PHP and ZendSpatial mongo for PHP and Zend
Spatial mongo for PHP and ZendSteven Pousty
 
RESTful OSGi middleware for NoSQL databases with Docker
RESTful OSGi middleware for NoSQL databases with DockerRESTful OSGi middleware for NoSQL databases with Docker
RESTful OSGi middleware for NoSQL databases with DockerBertrand Delacretaz
 
Extending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with KubernetesExtending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with KubernetesNicola Ferraro
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chefLeanDog
 
Producing, publishing and consuming linked data - CSHALS 2013
Producing, publishing and consuming linked data - CSHALS 2013Producing, publishing and consuming linked data - CSHALS 2013
Producing, publishing and consuming linked data - CSHALS 2013François Belleau
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsSadayuki Furuhashi
 

Semelhante a Java(ee) mongo db applications in the cloud (20)

Java EE 6 and NoSQL Workshop DevFest Austria
Java EE 6 and NoSQL Workshop DevFest AustriaJava EE 6 and NoSQL Workshop DevFest Austria
Java EE 6 and NoSQL Workshop DevFest Austria
 
Mongo db bangalore
Mongo db bangaloreMongo db bangalore
Mongo db bangalore
 
Bringing spatial love to your python application
Bringing spatial love to your python applicationBringing spatial love to your python application
Bringing spatial love to your python application
 
How to Reverse Engineer Web Applications
How to Reverse Engineer Web ApplicationsHow to Reverse Engineer Web Applications
How to Reverse Engineer Web Applications
 
From CoreOS to Kubernetes and Concourse CI
From CoreOS to Kubernetes and Concourse CIFrom CoreOS to Kubernetes and Concourse CI
From CoreOS to Kubernetes and Concourse CI
 
How to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDKHow to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDK
 
Hands-on Lab: Red Hat Container Development & OpenShift
Hands-on Lab: Red Hat Container Development & OpenShiftHands-on Lab: Red Hat Container Development & OpenShift
Hands-on Lab: Red Hat Container Development & OpenShift
 
Plone FSR
Plone FSRPlone FSR
Plone FSR
 
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
 
The Usual Suspects - Red Hat Developer Day 2012-11-01
The Usual Suspects - Red Hat Developer Day 2012-11-01The Usual Suspects - Red Hat Developer Day 2012-11-01
The Usual Suspects - Red Hat Developer Day 2012-11-01
 
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverageTesting NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
 
20100730 phpstudy
20100730 phpstudy20100730 phpstudy
20100730 phpstudy
 
Content Staging in Drupal 8
Content Staging in Drupal 8Content Staging in Drupal 8
Content Staging in Drupal 8
 
Spatial mongo for PHP and Zend
Spatial mongo for PHP and ZendSpatial mongo for PHP and Zend
Spatial mongo for PHP and Zend
 
RESTful OSGi middleware for NoSQL databases with Docker
RESTful OSGi middleware for NoSQL databases with DockerRESTful OSGi middleware for NoSQL databases with Docker
RESTful OSGi middleware for NoSQL databases with Docker
 
Extending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with KubernetesExtending DevOps to Big Data Applications with Kubernetes
Extending DevOps to Big Data Applications with Kubernetes
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
Producing, publishing and consuming linked data - CSHALS 2013
Producing, publishing and consuming linked data - CSHALS 2013Producing, publishing and consuming linked data - CSHALS 2013
Producing, publishing and consuming linked data - CSHALS 2013
 
Play framework
Play frameworkPlay framework
Play framework
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
 

Mais de Shekhar Gulati

Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7Shekhar Gulati
 
Working effectively with OpenShift
Working effectively with OpenShiftWorking effectively with OpenShift
Working effectively with OpenShiftShekhar Gulati
 
Developing Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaDeveloping Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaShekhar Gulati
 
Open shift for java(ee) developers
Open shift for java(ee) developersOpen shift for java(ee) developers
Open shift for java(ee) developersShekhar Gulati
 
Thinking beyond RDBMS - Building Polyglot Persistence Java Applications Devf...
Thinking beyond RDBMS  - Building Polyglot Persistence Java Applications Devf...Thinking beyond RDBMS  - Building Polyglot Persistence Java Applications Devf...
Thinking beyond RDBMS - Building Polyglot Persistence Java Applications Devf...Shekhar Gulati
 
Power up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftPower up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftShekhar Gulati
 
Building spatial back ends with Node.js and MongoDB
Building spatial back ends with Node.js and MongoDBBuilding spatial back ends with Node.js and MongoDB
Building spatial back ends with Node.js and MongoDBShekhar Gulati
 
A Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShiftA Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShiftShekhar Gulati
 
Indic threads java10-spring-roo-and-the-cloud
Indic threads java10-spring-roo-and-the-cloudIndic threads java10-spring-roo-and-the-cloud
Indic threads java10-spring-roo-and-the-cloudShekhar Gulati
 

Mais de Shekhar Gulati (9)

Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7
 
Working effectively with OpenShift
Working effectively with OpenShiftWorking effectively with OpenShift
Working effectively with OpenShift
 
Developing Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaDeveloping Great Apps with Apache Cordova
Developing Great Apps with Apache Cordova
 
Open shift for java(ee) developers
Open shift for java(ee) developersOpen shift for java(ee) developers
Open shift for java(ee) developers
 
Thinking beyond RDBMS - Building Polyglot Persistence Java Applications Devf...
Thinking beyond RDBMS  - Building Polyglot Persistence Java Applications Devf...Thinking beyond RDBMS  - Building Polyglot Persistence Java Applications Devf...
Thinking beyond RDBMS - Building Polyglot Persistence Java Applications Devf...
 
Power up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftPower up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShift
 
Building spatial back ends with Node.js and MongoDB
Building spatial back ends with Node.js and MongoDBBuilding spatial back ends with Node.js and MongoDB
Building spatial back ends with Node.js and MongoDB
 
A Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShiftA Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShift
 
Indic threads java10-spring-roo-and-the-cloud
Indic threads java10-spring-roo-and-the-cloudIndic threads java10-spring-roo-and-the-cloud
Indic threads java10-spring-roo-and-the-cloud
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Java(ee) mongo db applications in the cloud

  • 1. Java(EE)OPENSHIFT MongoDB Applications in the Cloud Workshop PRESENTED BY Shekhar Gulati
  • 2. WHO AM I? •    •    •    •  •  Shekhar  Gula+  -­‐-­‐  OpenShi1  Developer  Evangelist   Java  /  JavaScript  /  Python  /  NoSQL  /  Cloud  Guy   TwiEer  Handle  :  shekhargula*   Github  :  h,ps://github.com/shekhargula*   Author  of  30  technologies  in  30  days  blog  series   h,ps://www.openshi9.com/blogs/learning-­‐30-­‐ technologies-­‐in-­‐30-­‐days-­‐a-­‐developer-­‐challenge  
  • 3. AGENDA l  Get  started  with  OpenShi1   l  Develop  a  loca+on  aware  applica+on   -  Java  EE  6  –  Middleware   l  JAX-­‐RS  1.1  –  Java  API  for  REST  WS   l  CDI  –  Context  and  Dependency  Injec+on   -  Eclipse  Kepler  –  IDE   -  MongoDB  –  Database   -  OpenShi1  –  Deployment  choice   http://sharemylocation-shekhargulati.rhcloud.com/
  • 6. OpenShift is PaaS by Red Hat Multi-language, Auto-Scaling, Self-service, Elastic, Cloud Application Platform
  • 7. WHY OPENSHIFT? l  l  Supports  MongoDB  ,  PostgreSQL  ,and  MySQL   Mul+-­‐language  support.  Supports  Java,  Node.js,  Perl,  Python,   PHP  and  Ruby   l  Extensible  via  DIY  and  cartridges   l  No  need  to  learn  anything  new   l  Open  source  –  OpenShi1  Origin   l  Scalable   l  FREE!   l  Produc+on  Ready  
  • 10. OPENSHIFT – GETTING STARTED Go to https://openshift.redhat.com/app/account/new Promo code is JUDCON-IN14 Verify Email 10
  • 11. TOOLS REQUIRED 1.  Eclipse for Java EE (Kepler) 2.  Git 3.  Modern browser 11
  • 12. LAB 1 : HELLO OPENSHIFT 1.  Install OpenShift Eclipse plugin 2.  Create new application with JBoss EAP and MongoDB cartridges. 1.  Sign up for OpenShift(if not already) 2.  Create domain name or namespace 3.  Upload SSH keys to OpenShift 4.  Fill application creation wizard 5.  Finish 3.  Show OpenShift Explorer View and Server’s View 4. Make a change in index.html 1.  2.  12 Commit the change using Git Staging view Publish the change
  • 13. LAB 2 : HOT DEPLOYMENT 1.  Right click on your project and then go to OpenShift > Configure Markers 2.  Choose Hot Deploy marker 3.  Commit to git repository 4.  Go to servers view and publish your changes. 13
  • 14. LAB 3 : SET UP JAX RS 14
  • 15. LAB 3 : REST INTRODUCTION 1.  HTTP used right 2.  Defines set of RESTful constraints 1.  Everything is a resource 1.  2.  Eg. Post , Tweet , User , etc. Every resource has an identifier 1.  Eg. http://api/twitter.com/tweets/1000011111 3.  Resource can have multiple representations 1.  JSON , XML , YAML , etc. 4.  All resources expose a uniform interface 1.  GET , POST , PUT , DELETE 15
  • 16. LAB 3 JAX-RS INTRODUCTION 1.  Java API for REST Services 2.  POJO based 3.  Annotation heavy 4.  HTTP Centric 5.  Format independent 6.  Container independent 7.  Included with Java EE 6 In this workshop we will be talking about JAX-RS 1.1 16
  • 17. LAB 3 : SET UP JAX RS 1.  Update to Java 7 2.  Delete web.xml 3.  Update Maven war plugin to 2.3 4.  Create JAX-RS configuration class. 5.  Write PingResource 17
  • 18. LAB 3 : ADDING GIT REMOTE git remote add upstream -m master https://github.com/ shekhargulati/sharemylocation-demo.git git fetch –all git reset --hard upstream/lab3 18
  • 19. LAB 4 : CONFIGURE CDI AND MONGODB 19
  • 20. CDI 1.  CDI stands for Context and Dependency Injection 2.  CDI simplifies and sanitizes the API for DI and AOP like JPA did for ORM -- CDI Tutorial by Rick Hightower 3.  Type safe approach to Dependency Injection 4.  Strong typing and loose coupling 5.  To configure CDI add beans.xml to 1.  WEB-INF of WAR 2.  META-INF of JAR 6.  Beans can be injected at method , field , or constructor. 20
  • 23. WHAT IS MONGODB l  Open Source NoSQL document datastore –  l  JSON style documents Schema-less –  Each document is heterogeneous, and may have completely unique structure compared to other documents l  l  Rich query language l  Rich documents l  Easy to get running l  23 Fast and horizontally scalable Geospatial indexing
  • 24. MONGODB TERMINOLOGY   Database      →    Database   Table                    →          Collec+on   Row                        →    Document   Index                    →            Index  
  • 25. SOME QUERIES // Find all the jobs with skill as mongodb db.jobs.find({"skills":"mongodb"}) // Find all the jobs with python as skill and near to given location db.jobs.find({"lngLat":{$near : [139.69 , 35.68]}, "skills":"python"}) // Find all the python or mongodb jobs near to given location db.jobs.find({"lngLat":{$near : [139.69 , 35.68]}, "skills":{$in : ["mongodb","python"]}}) 25
  • 26. LAB 4 : ENABLE CDI AND MONGODB CONFIGURATION 1.  Create beans.xml in src/main/WEB-INF folder 2.  Create ApplicationScoped bean for configuring MongoDB 3.  PingResource writes a document to dummy collection 4.  Open Eclipse Remote System Explorer perspective and connect to gear. Right click on project 1.  26 Team > Reset > Remote Tracking > upstream/lab4
  • 27. LAB 5 : IMPLEMENT CREATE AND FIND ALL STATUS 1.  Create Status domain class 2.  Create converter for Status to DBObject and vice versa 3.  Create StatusResource with create and find all endpoints. 4.  Create ApplicationDao with create and findAll methods. 5.  Create Twitter Bootstrap and Backbonejs front end for create and find all functionalities. Right click on project -  27 Team > Reset > Remote Tracking > upstream/lab5
  • 28. LAB 6 : IMPLEMENT NEAR AND GEONEAR FEATURES 1.  Create findNear and findGeoNear methods in ApplicationDao 2.  Create near and geonear search REST endpoints in StatusResource 3.  Implement backbone views for search endpoints 4.  Create Index 1.  db.statuses.ensureIndex({“location”:”2dsphere”}) Right click on project -  28 Team > Reset > Remote Tracking > upstream/lab6
  • 30. DONE!
  • 31. STEP 1 : CHOOSE OPENSHIFT TOOLS 31
  • 32. STEP 1 : SEARCH JBOSS TOOLS 32
  • 33. GEOSPATIAL INDEXING BASICS What is it for? l  l  l  l  Find all the MongoDB jobs near me – Proximity Queries Find all the MongoDB jobs within Bangalore – Bounded Queries Find all the MongoDB job at this location – Exact Queries l  Supports only two dimensional indexes. l  You can only have one geospatial index per collection. By default, 2d geospatial indexes assume longitude and latitude have boundaries of -180 inclusive and 180 non-inclusive (i.e. [-180, 180)) l  33
  • 34. HOW TO MAKE IT WORK 1)  Put your coordinates into an array { loc : [ 50 , 30 ] } //SUGGESTED OPTION { loc : { x : 50 , y : 30 } } { loc : { foo : 50 , y : 30 } } 1)  { loc : { lon : 40.739037, lat: 73.992964 } } 2)  Make a 2d index db.places.ensureIndex( { loc : "2d" } ) 3) 34 If you use latitude and longitude as your coordinate system, always store longitude first. MongoDB’s 2d spherical index operators only recognize [ longitude, latitude] ordering.