SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
HDF-EOS Java Application
Programming Interfaces
Genong (Eugene) Yu, Ph.D.
Research associate

Liping Di, Ph.D.
Professor & Director of CSISS
{gyu, ldi}@gmu.edu

November 28-30, 2006

HDF and HDF-EOS Workshop X,
Upper Marlboro, MD
Outline
• Why Java API interfaces?
• Java API interfaces
– Variable consideration

•
•
•
•

Java Object wrap-up
Performance consideration
Applications
Problem
– Memory management
Demand
• Distribution systems over the Web
– Java-based server
• Apache Tomcat

• Manipulation of data for the Web
application
– Re-projection service
– Classification service
– Re-format service
Bridging Java Program and C/C++ library
The Problem
HDF-EOS
HDF-EOS

HDF-EOS
HDF-EOS

HDF-EOS
HDF-EOS

HDF JNI API

• HDF-EOS library – in C/C++ library
• All functions to manipulate grid and
point are written in C
• Primer for HDF-EOS is for C
• HDF JNI libraries are available
• Possible approach

Java Reader

• Rewrite the program in Java

WEB APPLICATION

• Pros: better for Java environment
The Solution
HDF-EOS
HDF-EOS

HDF-EOS
HDF-EOS

HDF-EOS
HDF-EOS

HDF-EOS / HDF JNI API

Java Reader
WEB APPLICATION

• Cons: enormous work and need
to keep track of revision
• Call the library directly through JNI
• Pros: manageable work and
efficient re-use
• Cons: memory management,
debugging
How JNI works (1)
• Java interface
– public static native int GDopen(String filename, int
access) throws HDFEOSException;
– Load library
• System.loadLibrary("jhdfeos4");

• Compile the above code
– javac HDFEOSLibrary.java

• Create header File
– javah -jni edu
How JNI works (2)
• Create the library in C/C++
– Template
• JNIEXPORT void JNICALL Java_ClassName_MethodName
(JNIEnv *env, jobject obj) {
• //Implement Native Method Here
• }

– Example
• JNIEXPORT jint JNICALL
Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_SWdupregion
• (JNIEnv *env, jclass class, jint oldregionID)
• {
•
int32 regionID;
•
regionID=SWdupregion((int32)oldregionID);
•
return (jint)regionID;
• }
Tasks to enable the JNI
• To access a C library from a Java
program, four tasks must be completed:
– Declare appropriate “native” methods in Java
classes
– Write “interface” code for each native method
to implement the JNI C or C++ standard
– compile the JNI “interface” (C or C++) to
create a JNI library
– deploy the Java classes and the JNI library on
the system
Mapping types (1)
• Interchangeable types
Native type
(C/C++)

Java Language Description
Type

HDF/HDFEOS

bool

jboolean

Unsigned 8 bits

intn, uint8

byte

jbyte

Signed 8 bits

int8

char

jchar

Unsigned 16 bits uint16

short

jshort

Signed 16 bits

int16

long

jint

Signed 32 bits

int32

long long

jlong

Signed 64 bits

int64

Float

jfloat

Float 32 bits

float32

Double

jdouble

Float 64 bits

float64
Mapping types (2)
•

String
–

Wrong
• JNIEXPORT jint JNICALL Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_SWcreate
• (JNIEnv *env, jclass class, jint file_id, jstring swath_name)
• {
• return SWcreate( (int32)file_id, (char *) swath_name);
• }

–

Correct
• JNIEXPORT jint JNICALL Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_SWcreate
• (JNIEnv *env, jclass class, jint file_id, jstring swath_name)
• {
• char *s_filename;
• int32 swath_id;
• s_filename = (char *) (*env)->GetStringUTFChars( env, swath_name, 0);
• swath_id = SWcreate( (int32)file_id, (char *)s_filename );
• (*env)->ReleaseStringUTFChars(env, swath_name, s_filename );
• return (jint)swath_id;
• }
Mapping types (3)
•

Array
–

–

Wrong
• JNIEXPORT jboolean JNICALL
Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_GDorigininfo
• (JNIEnv *env, jclass class, jint gridID, jintArray origincode)
• {
•
int32 status;
•
status= GDorigininfo((int32)gridID,(int32 *)origincode);
•
if (status==-1) return JNI_FALSE;
•
else return JNI_TRUE;
• }
Correct
•
•
•
•
•
•
•
•
•
•
•

JNIEXPORT jboolean JNICALL Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_GDorigininfo
(JNIEnv *env, jclass class, jint gridID, jintArray origincode)
{
int32 *i_origincode;
int32 status;
i_origincode=(int32 *)(*env)->GetIntArrayElements(env,origincode,0);
status=GDorigininfo((int32)gridID,i_origincode);
(*env)->ReleaseIntArrayElements(env,origincode,(jint *)i_origincode,0);
if (status==-1) return JNI_FALSE;
else return JNI_TRUE;
}
Mapping types (4)
• Pointer
– In C
• intn SWattrinfo(int32 swathID, char *attrname, int32
* numbertype, int32 *count);

– In Java
• public static native boolean SWattrinfo(int swathID,
String attrname, int[] numbertype, int[] count) throws
HDFEOSException;
The HDF-EOS library
• Interface level
– One class to hold all “native” methods
– One C “interface” library – e.g. jhdfeos4 (dll,
so)
– One-to-one
Hierarchy of objects
dataset
GeoDataset
RasterDataset

HESwathDataset

HEGridDataset

To be implemented

HEGrid
HEGridField

HEGridFieldBand2d

VectorDataset

HEPointDataset
To be implemented
Thread safe vs. efficiency
• Model 1: Access & close
• Model 2: Open – access – close
HEGridDataset

HEGridDataset

HEGrid

HEGrid2

HEGridField

HEGridField2

HEGridFieldBand2d

HEGridFieldBand2d2

Model 1

Model 2
Applications (1)
• Web services
– Conversion
http://laits.gmu.edu:18080/DataMining/HDFEOS2ARFF?WSDL
– Conversion
http://laits.gmu.edu:18080/DataMining/ARFF2HDFEOS2?WSDL
– Training
http://laits.gmu.edu:18080/DataMining/LogisticRegressionTrainer
?WSDL
– Classification
http://laits.gmu.edu:18080/DataMining/LogisticRegressionClassif
ier?WSDL
– Regression
http://laits.gmu.edu:18080/DataMining/LogisticRegressor?WSDL

• Test pages
http://laits.gmu.edu:18080/DataMiningClientWeb/
Applications (2)
Limitations to the JNI approach
• Limitations
– JNI is not an easy API;
– Invocation: only applications and signed applets can invoke the
JNI;
– Portability: No
• compile different set of libraries and dynamically load

– Memory management: no garbage collection
• Careful to manage memory and exception in C
• Timely re-start Tomcat server (not a good solution)

– Debugging difficulty: error checking is a MUST or it has the
potential
• to crash the server
• to left dead thread
• to cause memory leak
Conclusions
• The library is available at
– http://laits.gmu.edu/~gyu/HDFEOS/
Future work
• Continue on updating the interface
• Work on HDF5-EOS
• Refine the object with considerations of
performance and usability
References
• JNI specification
http://java.sun.com/j2se/1.5.0/docs/guide/j
ni/spec/jniTOC.html
• Java Native Interface: Programmer’s
Guide and Specification
http://java.sun.com/docs/books/jni/
Acknowledgements
• The work was supported partially with grants from the
NASA Earth Science Data and Information System
Project (ESDISP) (NCC5-645, PI: Dr. Liping Di), NASA
Earth Science Technology Office (ESTO) (NAG-13409,
PI: Dr. Liping Di), NASA REASoN program
(NNG04GE61A, PI: Dr. Liping Di), and National
Geospatial-intelligence Agency (NGA) University
Research Initiative (NURI) (HM1582-04-1-2021, PI: Dr.
Liping Di).
• Thanks to Dr. Peisheng Zhao, Dr. Aijun Chen, Dr. Yuqi
Bai, Mr. Yaxing Wei, and other colleagues at Center for
Spatial Information Science and System, George Mason
University, for their inputs and contributions.

Más contenido relacionado

Similar a HDF-EOS Java Application Programming Interfaces

Arabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, IntroductionArabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, IntroductionJasonRafeMiller
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20Phil Wilkins
 
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovJava 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovSvetlin Nakov
 
Enhancing Domain Specific Language Implementations Through Ontology
Enhancing Domain Specific Language Implementations Through OntologyEnhancing Domain Specific Language Implementations Through Ontology
Enhancing Domain Specific Language Implementations Through OntologyChunhua Liao
 
Alive and Well with Java 8
Alive and Well with Java 8Alive and Well with Java 8
Alive and Well with Java 8Adam Pelsoczi
 
Geospatial web services using little-known GDAL features and modern Perl midd...
Geospatial web services using little-known GDAL features and modern Perl midd...Geospatial web services using little-known GDAL features and modern Perl midd...
Geospatial web services using little-known GDAL features and modern Perl midd...Ari Jolma
 
Building collaborative workflows for scientific data
Building collaborative workflows for scientific dataBuilding collaborative workflows for scientific data
Building collaborative workflows for scientific dataBruno Vieira
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the CloudJim Driscoll
 
Java jdk-update-nov10-sde-v3m
Java jdk-update-nov10-sde-v3mJava jdk-update-nov10-sde-v3m
Java jdk-update-nov10-sde-v3mSteve Elliott
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)JiandSon
 
State of GeoServer 2.10
State of GeoServer 2.10State of GeoServer 2.10
State of GeoServer 2.10Jody Garnett
 
Golang workshop - Mindbowser
Golang workshop - MindbowserGolang workshop - Mindbowser
Golang workshop - MindbowserMindbowser Inc
 
HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)Kevin Gill
 
Hadoop 101 for bioinformaticians
Hadoop 101 for bioinformaticiansHadoop 101 for bioinformaticians
Hadoop 101 for bioinformaticiansattilacsordas
 
1 Project 2 Introduction - the SeaPort Project seri.docx
1  Project 2 Introduction - the SeaPort Project seri.docx1  Project 2 Introduction - the SeaPort Project seri.docx
1 Project 2 Introduction - the SeaPort Project seri.docxhoney725342
 
Porting VisualWorks code to Pharo
Porting VisualWorks code to PharoPorting VisualWorks code to Pharo
Porting VisualWorks code to PharoESUG
 

Similar a HDF-EOS Java Application Programming Interfaces (20)

Arabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, IntroductionArabidopsis Information Portal, Developer Workshop 2014, Introduction
Arabidopsis Information Portal, Developer Workshop 2014, Introduction
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
 
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovJava 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
 
Enhancing Domain Specific Language Implementations Through Ontology
Enhancing Domain Specific Language Implementations Through OntologyEnhancing Domain Specific Language Implementations Through Ontology
Enhancing Domain Specific Language Implementations Through Ontology
 
Android networking-2
Android networking-2Android networking-2
Android networking-2
 
Grails 101
Grails 101Grails 101
Grails 101
 
NetCDF and HDF5
NetCDF and HDF5NetCDF and HDF5
NetCDF and HDF5
 
Alive and Well with Java 8
Alive and Well with Java 8Alive and Well with Java 8
Alive and Well with Java 8
 
Geospatial web services using little-known GDAL features and modern Perl midd...
Geospatial web services using little-known GDAL features and modern Perl midd...Geospatial web services using little-known GDAL features and modern Perl midd...
Geospatial web services using little-known GDAL features and modern Perl midd...
 
Building collaborative workflows for scientific data
Building collaborative workflows for scientific dataBuilding collaborative workflows for scientific data
Building collaborative workflows for scientific data
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
 
Java jdk-update-nov10-sde-v3m
Java jdk-update-nov10-sde-v3mJava jdk-update-nov10-sde-v3m
Java jdk-update-nov10-sde-v3m
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
State of GeoServer 2.10
State of GeoServer 2.10State of GeoServer 2.10
State of GeoServer 2.10
 
Golang workshop - Mindbowser
Golang workshop - MindbowserGolang workshop - Mindbowser
Golang workshop - Mindbowser
 
HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)
 
Hadoop 101 for bioinformaticians
Hadoop 101 for bioinformaticiansHadoop 101 for bioinformaticians
Hadoop 101 for bioinformaticians
 
1 Project 2 Introduction - the SeaPort Project seri.docx
1  Project 2 Introduction - the SeaPort Project seri.docx1  Project 2 Introduction - the SeaPort Project seri.docx
1 Project 2 Introduction - the SeaPort Project seri.docx
 
01 java intro
01 java intro01 java intro
01 java intro
 
Porting VisualWorks code to Pharo
Porting VisualWorks code to PharoPorting VisualWorks code to Pharo
Porting VisualWorks code to Pharo
 

Más de The HDF-EOS Tools and Information Center

STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...
STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...
STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...The HDF-EOS Tools and Information Center
 

Más de The HDF-EOS Tools and Information Center (20)

Cloud-Optimized HDF5 Files
Cloud-Optimized HDF5 FilesCloud-Optimized HDF5 Files
Cloud-Optimized HDF5 Files
 
Accessing HDF5 data in the cloud with HSDS
Accessing HDF5 data in the cloud with HSDSAccessing HDF5 data in the cloud with HSDS
Accessing HDF5 data in the cloud with HSDS
 
The State of HDF
The State of HDFThe State of HDF
The State of HDF
 
Highly Scalable Data Service (HSDS) Performance Features
Highly Scalable Data Service (HSDS) Performance FeaturesHighly Scalable Data Service (HSDS) Performance Features
Highly Scalable Data Service (HSDS) Performance Features
 
Creating Cloud-Optimized HDF5 Files
Creating Cloud-Optimized HDF5 FilesCreating Cloud-Optimized HDF5 Files
Creating Cloud-Optimized HDF5 Files
 
HDF5 OPeNDAP Handler Updates, and Performance Discussion
HDF5 OPeNDAP Handler Updates, and Performance DiscussionHDF5 OPeNDAP Handler Updates, and Performance Discussion
HDF5 OPeNDAP Handler Updates, and Performance Discussion
 
Hyrax: Serving Data from S3
Hyrax: Serving Data from S3Hyrax: Serving Data from S3
Hyrax: Serving Data from S3
 
Accessing Cloud Data and Services Using EDL, Pydap, MATLAB
Accessing Cloud Data and Services Using EDL, Pydap, MATLABAccessing Cloud Data and Services Using EDL, Pydap, MATLAB
Accessing Cloud Data and Services Using EDL, Pydap, MATLAB
 
HDF - Current status and Future Directions
HDF - Current status and Future DirectionsHDF - Current status and Future Directions
HDF - Current status and Future Directions
 
HDFEOS.org User Analsys, Updates, and Future
HDFEOS.org User Analsys, Updates, and FutureHDFEOS.org User Analsys, Updates, and Future
HDFEOS.org User Analsys, Updates, and Future
 
HDF - Current status and Future Directions
HDF - Current status and Future Directions HDF - Current status and Future Directions
HDF - Current status and Future Directions
 
H5Coro: The Cloud-Optimized Read-Only Library
H5Coro: The Cloud-Optimized Read-Only LibraryH5Coro: The Cloud-Optimized Read-Only Library
H5Coro: The Cloud-Optimized Read-Only Library
 
MATLAB Modernization on HDF5 1.10
MATLAB Modernization on HDF5 1.10MATLAB Modernization on HDF5 1.10
MATLAB Modernization on HDF5 1.10
 
HDF for the Cloud - Serverless HDF
HDF for the Cloud - Serverless HDFHDF for the Cloud - Serverless HDF
HDF for the Cloud - Serverless HDF
 
HDF5 <-> Zarr
HDF5 <-> ZarrHDF5 <-> Zarr
HDF5 <-> Zarr
 
HDF for the Cloud - New HDF Server Features
HDF for the Cloud - New HDF Server FeaturesHDF for the Cloud - New HDF Server Features
HDF for the Cloud - New HDF Server Features
 
Apache Drill and Unidata THREDDS Data Server for NASA HDF-EOS on S3
Apache Drill and Unidata THREDDS Data Server for NASA HDF-EOS on S3Apache Drill and Unidata THREDDS Data Server for NASA HDF-EOS on S3
Apache Drill and Unidata THREDDS Data Server for NASA HDF-EOS on S3
 
STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...
STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...
STARE-PODS: A Versatile Data Store Leveraging the HDF Virtual Object Layer fo...
 
HDF5 and Ecosystem: What Is New?
HDF5 and Ecosystem: What Is New?HDF5 and Ecosystem: What Is New?
HDF5 and Ecosystem: What Is New?
 
HDF5 Roadmap 2019-2020
HDF5 Roadmap 2019-2020HDF5 Roadmap 2019-2020
HDF5 Roadmap 2019-2020
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
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
 
🐬 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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

HDF-EOS Java Application Programming Interfaces

  • 1. HDF-EOS Java Application Programming Interfaces Genong (Eugene) Yu, Ph.D. Research associate Liping Di, Ph.D. Professor & Director of CSISS {gyu, ldi}@gmu.edu November 28-30, 2006 HDF and HDF-EOS Workshop X, Upper Marlboro, MD
  • 2. Outline • Why Java API interfaces? • Java API interfaces – Variable consideration • • • • Java Object wrap-up Performance consideration Applications Problem – Memory management
  • 3. Demand • Distribution systems over the Web – Java-based server • Apache Tomcat • Manipulation of data for the Web application – Re-projection service – Classification service – Re-format service
  • 4. Bridging Java Program and C/C++ library The Problem HDF-EOS HDF-EOS HDF-EOS HDF-EOS HDF-EOS HDF-EOS HDF JNI API • HDF-EOS library – in C/C++ library • All functions to manipulate grid and point are written in C • Primer for HDF-EOS is for C • HDF JNI libraries are available • Possible approach Java Reader • Rewrite the program in Java WEB APPLICATION • Pros: better for Java environment The Solution HDF-EOS HDF-EOS HDF-EOS HDF-EOS HDF-EOS HDF-EOS HDF-EOS / HDF JNI API Java Reader WEB APPLICATION • Cons: enormous work and need to keep track of revision • Call the library directly through JNI • Pros: manageable work and efficient re-use • Cons: memory management, debugging
  • 5. How JNI works (1) • Java interface – public static native int GDopen(String filename, int access) throws HDFEOSException; – Load library • System.loadLibrary("jhdfeos4"); • Compile the above code – javac HDFEOSLibrary.java • Create header File – javah -jni edu
  • 6. How JNI works (2) • Create the library in C/C++ – Template • JNIEXPORT void JNICALL Java_ClassName_MethodName (JNIEnv *env, jobject obj) { • //Implement Native Method Here • } – Example • JNIEXPORT jint JNICALL Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_SWdupregion • (JNIEnv *env, jclass class, jint oldregionID) • { • int32 regionID; • regionID=SWdupregion((int32)oldregionID); • return (jint)regionID; • }
  • 7. Tasks to enable the JNI • To access a C library from a Java program, four tasks must be completed: – Declare appropriate “native” methods in Java classes – Write “interface” code for each native method to implement the JNI C or C++ standard – compile the JNI “interface” (C or C++) to create a JNI library – deploy the Java classes and the JNI library on the system
  • 8. Mapping types (1) • Interchangeable types Native type (C/C++) Java Language Description Type HDF/HDFEOS bool jboolean Unsigned 8 bits intn, uint8 byte jbyte Signed 8 bits int8 char jchar Unsigned 16 bits uint16 short jshort Signed 16 bits int16 long jint Signed 32 bits int32 long long jlong Signed 64 bits int64 Float jfloat Float 32 bits float32 Double jdouble Float 64 bits float64
  • 9. Mapping types (2) • String – Wrong • JNIEXPORT jint JNICALL Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_SWcreate • (JNIEnv *env, jclass class, jint file_id, jstring swath_name) • { • return SWcreate( (int32)file_id, (char *) swath_name); • } – Correct • JNIEXPORT jint JNICALL Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_SWcreate • (JNIEnv *env, jclass class, jint file_id, jstring swath_name) • { • char *s_filename; • int32 swath_id; • s_filename = (char *) (*env)->GetStringUTFChars( env, swath_name, 0); • swath_id = SWcreate( (int32)file_id, (char *)s_filename ); • (*env)->ReleaseStringUTFChars(env, swath_name, s_filename ); • return (jint)swath_id; • }
  • 10. Mapping types (3) • Array – – Wrong • JNIEXPORT jboolean JNICALL Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_GDorigininfo • (JNIEnv *env, jclass class, jint gridID, jintArray origincode) • { • int32 status; • status= GDorigininfo((int32)gridID,(int32 *)origincode); • if (status==-1) return JNI_FALSE; • else return JNI_TRUE; • } Correct • • • • • • • • • • • JNIEXPORT jboolean JNICALL Java_edu_gmu_laits_hdfeos_HDFEOSLibrary_GDorigininfo (JNIEnv *env, jclass class, jint gridID, jintArray origincode) { int32 *i_origincode; int32 status; i_origincode=(int32 *)(*env)->GetIntArrayElements(env,origincode,0); status=GDorigininfo((int32)gridID,i_origincode); (*env)->ReleaseIntArrayElements(env,origincode,(jint *)i_origincode,0); if (status==-1) return JNI_FALSE; else return JNI_TRUE; }
  • 11. Mapping types (4) • Pointer – In C • intn SWattrinfo(int32 swathID, char *attrname, int32 * numbertype, int32 *count); – In Java • public static native boolean SWattrinfo(int swathID, String attrname, int[] numbertype, int[] count) throws HDFEOSException;
  • 12. The HDF-EOS library • Interface level – One class to hold all “native” methods – One C “interface” library – e.g. jhdfeos4 (dll, so) – One-to-one
  • 13. Hierarchy of objects dataset GeoDataset RasterDataset HESwathDataset HEGridDataset To be implemented HEGrid HEGridField HEGridFieldBand2d VectorDataset HEPointDataset To be implemented
  • 14. Thread safe vs. efficiency • Model 1: Access & close • Model 2: Open – access – close HEGridDataset HEGridDataset HEGrid HEGrid2 HEGridField HEGridField2 HEGridFieldBand2d HEGridFieldBand2d2 Model 1 Model 2
  • 15. Applications (1) • Web services – Conversion http://laits.gmu.edu:18080/DataMining/HDFEOS2ARFF?WSDL – Conversion http://laits.gmu.edu:18080/DataMining/ARFF2HDFEOS2?WSDL – Training http://laits.gmu.edu:18080/DataMining/LogisticRegressionTrainer ?WSDL – Classification http://laits.gmu.edu:18080/DataMining/LogisticRegressionClassif ier?WSDL – Regression http://laits.gmu.edu:18080/DataMining/LogisticRegressor?WSDL • Test pages http://laits.gmu.edu:18080/DataMiningClientWeb/
  • 17. Limitations to the JNI approach • Limitations – JNI is not an easy API; – Invocation: only applications and signed applets can invoke the JNI; – Portability: No • compile different set of libraries and dynamically load – Memory management: no garbage collection • Careful to manage memory and exception in C • Timely re-start Tomcat server (not a good solution) – Debugging difficulty: error checking is a MUST or it has the potential • to crash the server • to left dead thread • to cause memory leak
  • 18. Conclusions • The library is available at – http://laits.gmu.edu/~gyu/HDFEOS/
  • 19. Future work • Continue on updating the interface • Work on HDF5-EOS • Refine the object with considerations of performance and usability
  • 20. References • JNI specification http://java.sun.com/j2se/1.5.0/docs/guide/j ni/spec/jniTOC.html • Java Native Interface: Programmer’s Guide and Specification http://java.sun.com/docs/books/jni/
  • 21. Acknowledgements • The work was supported partially with grants from the NASA Earth Science Data and Information System Project (ESDISP) (NCC5-645, PI: Dr. Liping Di), NASA Earth Science Technology Office (ESTO) (NAG-13409, PI: Dr. Liping Di), NASA REASoN program (NNG04GE61A, PI: Dr. Liping Di), and National Geospatial-intelligence Agency (NGA) University Research Initiative (NURI) (HM1582-04-1-2021, PI: Dr. Liping Di). • Thanks to Dr. Peisheng Zhao, Dr. Aijun Chen, Dr. Yuqi Bai, Mr. Yaxing Wei, and other colleagues at Center for Spatial Information Science and System, George Mason University, for their inputs and contributions.