XArchADTProxy Overview
The IXArchADT
is a
distributable interface that provides additional low-level
functionality that is not available when using the xArch/xADL Data Binding Library directly. However, it uses
strings to specify (indirectly) method calls. Thus, errors that are
normally detected by the compiler when type- checking (when using the
native Data Binding Libray interface) will show up only at run-time as
exceptions (when using the IXArchADT).
This can make it difficult to manage source code that takes advantage
of the
IXArchADT
. It can be especially difficult to maintain source code so that it
adheres to changes in one of the Data Binding Library's underlying XML
schemas. Recompiling will not indicate that a removed method no longer
exists, or that method signatures have changed. In addition, using the
IXArchADT
prevents one from using the code assist features (e.g., AutoComplete)
that are available in many modern integrated development environments.
XArchADTProxy
addresses these problems by providing a layer on top of the IXArchADT
that exposes interfaces nearly identical to those exposed by the
xArch/xADL Data Binding Library (e.g.,
Component
). Thus, calls using the XArchADTProxy mechanism will appear (and
compile) like calls made to the data binding library directly. In
reality, however, these calls will be dynamically translated to
IXArchADT calls "under the covers." As such, this allows you to combine
the ease of use of the data binding library's interface with the
distributability and loose coupling provided by the IXArchADT.
Please read throught the IXArchADT
and the Data
Binding Library Example that shows how to write a program that
manipulates an architecture description directly using the Data Binding
Library. It also shows how to write the same example using the
XArchADTProxy.
Limitations
XArchADTProxy
is somewhat more limited than using the data binding library or the
IXArchADT
directly, namely:
XArchADTProxy
users cannot directly add themselves asXArchADTModelListener
s and receiveXArchADTModelEvent
s.
Let's look at how to use
XArchADTProxy
. Using this mechanism imposes certain minor constraints on your code:
- You must access documents using data binding interfaces
(e.g.,
Component
), not implementation types (e.g.,ComponentImpl
). (NB: You shouldn't be usingImpl
classes in any case )
Working with XArchADTProxy
A program that was previously written to use the DOM-based Data Binding Library should be modified to:
- Use interfaces (if it did not already do so);
- Use proxied versions of
EFactory
s; and - Use proxied versions of
EObject
s
To interact with ArchStudio (e.g., XArchModelEvents) it is occassionally necessary to convert between ObjRefs and EObjects. The following code converts an ObjRef to its corresponding EObject:
IXArchADT xarch = ...; ObjRef componentRef = ...; // convert an ObjRef to an EObject Component component = XArchADTProxy.proxy(xarch, componentRef);
The following code converts an EObject back to an ObjRef:
Component component = ... // convert an EObject to an ObjRef ObjRef componentRef = XArchADTProxy.unproxy(component);
The following code proxies an EFactory:
// create a proxied EFactory String structureNsUri = Structure_3_0Package.eINSTANCE.getNsURI(); Structure_3_0Factory structureFactory = XArchADTProxy.proxy(xarch, structureNsUri);
For a complete example, look at the Data Binding Library Example
Contact Us
If you have questions not answered by this website, please feel free to
contact the software architectures group at UC Irvine through the
ArchStudio developer's (mailman protected) email list at:
archstudio-dev [@] uci
[.] edu. (Note: You must
subscribe to the mail list
before you can post to it.)