Mais conteúdo relacionado Semelhante a Java 5 PSM for DDS: Revised Submission (out of date) (20) Java 5 PSM for DDS: Revised Submission (out of date)1. Java 5 PSM for DDS:
Revised Submission
MARS – Cambridge, MA – September 2010
Presenter: Rick Warren, RTI
Submitting POCs:
Rick Warren, RTI:
rick.warren@rti.com
Angelo Corsaro, PrismTech:
angelo.corsaro@prismtech.com
document number: mars/2010-09-05
2. Agenda
Specification Overview
Mostly review from last time
Specification changes since Minneapolis
Full DDS-XTypes support
Java Type Representation
Other minor changes
In depth: Java Type Representation
TODO for the next meeting
Review: This will impact many of us; needs to be right
Copyright © 2010 RTI - All rights Reserved 2
3. Goals & Design Principles
Improve user experience
standardNamingConvention
Standard containers (e.g. java.util.List)
Standard enumerations
Error conditions reported with exceptions
Serializable, Cloneable value types
Simplified method overloads
Improve type safety
Generics
Improve performance
Loanable memory
No critical-path memory allocation (unlike IDL PSM)
Improve portability
Build apps against standard interfaces; decide at run time
which impl to use
Host multiple implementations (or versions) within same JVM
Dynamic loading and unloading
Play nicely with containers, e.g. Java EE and OSGi
Don’t require non-constant static state
Copyright © 2010 RTI - All rights Reserved 3
4. State of the Proposal
First revised submission
Process moving quickly and efficiently
Submitters have joined
All mandatory requirements satisfied
User vetting process begun
Private conversations with Java power users
Publicly available code repository at
http://code.google.com/p/datadistrib4j/
So far, reviewers enthusiastic
Still to go:
Review within submission team and with our customers
Review with your own stakeholders!
Next submission will be ready for a vote
Copyright © 2010 RTI - All rights Reserved 4
5. Hello, World
import org.omg.dds.*;
Topic<Foo> t = …;
DataWriter<Foo> dw =
myPub.createDataWriter(t);
Foo data = …;
dw.write(data);
dw.close();
DataReader<Foo> dr =
mySub.createDataReader(t);
Sample.Iterator<Foo> it =
dr.take();
Foo data2 = it.next().
getData();
it.returnLoan();
dr.close();
OMG package
Typical naming
convention
Overloaded
methods
Generics for type
safety
Close like JMS,
I/O stream
Standard
collections
Copyright © 2010 RTI - All rights Reserved 5
6. Since Initial Submission: DDS-XTypes
Dynamic Language Binding
TypeObject for type propagation
Built-in data types:
Types: String, KeyedString, Bytes, KeyedBytes
Added overloads to Publisher, Subscriber to create
statically type-safe readers and writers of these types
New QoS policies
Standard annotations
Copyright © 2010 RTI - All rights Reserved 6
7. Since Initial Submission: Java Type Rep’n
Publish and subscribe to POJOs without
code generation
Based on Java reflection
More on this later
Copyright © 2010 RTI - All rights Reserved 7
8. Since Initial Submission: Misc. Details
Improved static type safety of topic creation
Improved static type safety of topic, reader,
and writer listeners
Improved portability of TypeSupport creation
Improved Context loading
Miscellaneous alignments with C++ PSM
“Hello World” code example
Automated generation of binary jar and
source zip files
Copyright © 2010 RTI - All rights Reserved 8
9. Java Type Representation: Intro
Goal: Write the following code:
public class MyPojo /*extends/implements…*/ {
private int foo;
private Bar[] baz;
public void doStuff() { … }
}
…
Topic<MyPojo> t = dp.createTopic(
"My Topic", MyPojo.class);
Copyright © 2010 RTI - All rights Reserved 9
10. Java Type Representation: Intro
Does not replace, modify existing
standard Language Bindings
Interoperable at wire level
…with generated or dynamic types
…in Java or any other language
Convenience feature for non-real-time
Java systems
“Representation” is run-time, reflection-based:
no Java source code parsing or code generation
Implication: Reflection slower than compiled
generated code
Implication: If other languages are used, type
definitions must be “duplicated”
Copyright © 2010 RTI - All rights Reserved 10
11. Java Type Representation: Approach
Leverage the knowledge of Java developers
Leverage the code they already have
Observations:
JRE already provides type definition constructs
Primitive types, strings, lists (sequences), classes
(structures), enumerations, annotations
Types to be sent over network already indicate that
…by implementing java.io.Serializable
…including which fields should not be sent
…with the transient keyword
Copyright © 2010 RTI - All rights Reserved 11
12. Java Type Representation: Approach
What this Representation has to do:
1. Define mappings between JRE concepts and DDS
concepts
int Int32 (IDL long)
double Float64 (IDL double)
java.util.List Sequence
Serializable class Structure
2. Allow customizability to support non-Java DDS concepts
e.g. unsigned primitives, narrow vs. wide strings, unions
Mechanism: @SerializeAs annotation
Copyright © 2010 RTI - All rights Reserved 12
13. Java Type Representation: Example
Java
package com.acme;
class Foo
implements Serializable {
@Key int theInt;
transient float theFlt;
String theStr;
@SerializeAs(UINT_64)
BigInteger theUInt;
String[] theArr;
}
IDL
module com { module acme {
@Extensibility(MUTABLE)str
uct Foo {
@Key long theInt;
string theStr;
unsigned long theUInt;
sequence<string> theArr;
};
}}
Copyright © 2010 RTI - All rights Reserved 13
14. Still TO DO
We will ask for a vote at the December meeting
Review the PSM with your stakeholders
API
Implementation: Context.createInstance
(only non-trivial implementation in the PSM)
Specification document
Review the code license, copyrights
(Will want AB, SMC guidance too)
OMG and submitters (RTI, PrismTech) have joint copyright
OMG-standard Java source files have BSD-style license
Does not constrain licenses or biz models of impl’s
Vendors redistributing these files must:
Document license terms
Acknowledge copyright holders
Will be further alignment within submission team,
including consideration of C++ PSM
Copyright © 2010 RTI - All rights Reserved 14
15. Still TO DO
Copy specification into JavaDoc?
Friendly for IDE users
myWriter.setQos|
More examples? (non-normative)
e.g. Application code examples
e.g. No-op reference implementation
You tell us!
Copyright © 2010 RTI - All rights Reserved 15
void setQos(DataWriterQos q)
Set the QoS of this DataWriter. The result
of subsequent calls to getQos will be
equal to the value set by this method.
16. Summary
DDS will have a first-class
Java API.
That looks and behaves like a
typical Java API.
That performs well.
Soon.
Copyright © 2010 RTI - All rights Reserved 16
Notas do Editor Benefits of “close” instead of factory method:
Familiar from java.io, javax.jms
Can’t get it wrong by using wrong factory Write a normal-looking Java class with no DDS dependencies, then use it to pub and sub Decision matrix:
* Need maximum performance? Want to share type definitions across languages? Generate code.
* Want maximum convenience? Working mostly in Java? Use this new Representation.