SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
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.

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Plus 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
 

Plus 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
 

Dernier

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
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
 
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
 
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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
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
 

Dernier (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
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
 
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
 
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...
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
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
 
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
 

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.