Jim, this is really great that you're sounding like you may help with this, and you're ideas and suggestions sound very interesting. I'm going to chase you up after JavaOne...
...ant On 3/23/06, Jim Marino <[EMAIL PROTECTED]> wrote: > > > On Mar 23, 2006, at 12:51 AM, ant elder wrote: > > > On 3/22/06, Jim Marino <[EMAIL PROTECTED]> wrote: > > > >> > >> > >> On Mar 22, 2006, at 9:53 AM, ant elder wrote: > >> > >> > >>> Thought about it a little bit, and in some offline discussion a > >>> while ago > >>> Jeremy was also interested in that. I think there does need to be a > >>> balance > >>> so as to not lose the simplicity of the client environment and to > >>> utilize > >>> its dynamic nature. I'm definately interested in any feedback or > >>> suggestions. The SCA PHP guys have had similar issues so it would > >>> be useful > >>> to talk to them or align this with what they do rather than what > >>> Java SCA > >>> does. > >>> > >>> > >> Maybe - I haven't looked at the PHP stuff. I think doing some of the > >> Java stuff in JavaScript would be pretty strightforward. I'm not > >> completely sure, though, since most of my experience is with > >> Actionscript. > >> > > > > > > It would be straight forward to do the > > ModuleContext/getContext/locateService stuff but I wondered if that > > just > > made things more complicated. Having the SCA script in the HTML > > script tag > > initialises the SCA environment so the entryPoints and > > externalServices can > > be automatically 'injected' into the browser client environment in > > a similar > > way as references are injected into Java SCA components. > > > Yes I was assuming there would be injection. It would be cool to > inject on JavaScript objects too. ModuleContext would be useful for > the eventual metadata API that we intend to have in the spec. > > > >> I'm really interested in looking at utilizing Flash. > >> > >>> > >>> One technique is to have in the HTML page a hidden Flash movie > >>> with no > >>> visual content and expose its XMLSocket to the JavaScript > >>> environment. This > >>> would work really well when Tuscany has the HTTP system service > >>> that Jeremy > >>> has mentioned for the XMLSocket to talk to. > >>> > >>> Not all browsers will have the Flash plugin so you still need to > >>> support the > >>> other ways like HTML streaming, and older browsers don't support > >>> streaming > >>> so sometimes you'd fall back to using periodic refresh. But all > >>> thats hidden > >>> from the client as the Tuscany server and client code can > >>> interrogate the > >>> environment and use what is most appropriate for the environment > >>> and the > >>> parameters on the SCA binding. The client HTML and scripts remain > >>> really > >>> simple and it runs on any browser. > >>> > >>> > >> I would probably build some type of message pump in Flash and tunnel > >> it through Javascript. The Flash<-->Javascript integration was > >> pretty bad, though, prior to Flash Player 7. > >> > > > > > > This is where I hoped using JSON would help. JSON messages are just > > simple > > strings, so all thats really required is functions to send and > > receive a > > string. There's a couple of projects doing this (though not with > > JSON) so > > it is possible. I've never used Flash so any help you could give > > here would > > be great. > > > Probably after the JavaOne release. I've found Actionscript and the > Flash environment to be much more sophisticated than what browsers > offer. Macromedia has an interesting new thing called Flex Data > Services along these lines. Also, there are some open source projects > such as Red5 (it's LGPL though) that also support the flv transport > which would be really cool since it supports things for handling out- > of-order packet transmission. > > > >> There are other projects working on these types of things but this > >> > >>> seems to > >>> have a some benefits over them. One of the problems with other web > >>> remoting > >>> technologies is they use custom protocols which are often platform > >>> specific, > >>> but this using JSON makes it platform independent. That and using > >>> the SCA > >>> config model means these SCA AJAX clients could theoretically be > >>> hosted on > >>> any SCA platform, and when using the Tuscany HTTP service the > >>> performance > >>> would be very competitive. > >>> > >> > >> How about an ECMAScript SDO impl :-) ? I implemented a primitive > >> change tracking mechanism in Actionscript a while back that could do > >> both "dynamic" method and field-level interception so I imagine this > >> would be theoretically possible in Java/ECMAScript. > >> > > > > > > I agree a JavaScript SDO impl seems like its required if the > > JavaScript > > componentType is going to be a really 1st class supported > > componentType. > > While thats being hosted within the Tuscany Java runtime its not > > actually so > > hard as JavaScript can just delegates to the Java SDO impl. Eg, the > > BigBank > > account stuff uses SDO and already works with the JavaScript > > componentType: > > > > http://svn.apache.org/repos/asf/incubator/tuscany/java/samples/ > > bigbankJS/accountJS/src/main/resources/org/apache/tuscany/samples/ > > bigbankjs/account/services/account/AccountServiceImpl.js > > > > I'm not sure if SDO within a browser client is so important. > > Browser clients > > are not going to be using any DAS or requiring data binding support as > > everything can be JSON messages to/from host SCA components which > > do all the > > work. > > > Actually I think this might be the more common case. The problem in > my opinion with AJAX stuff in browsers as opposed to Flash is that > they don't have a really good detachment approach. For example, many > apps go back to the server to fill combo boxes as the user enters > information. What I think is a better approach is to make the > interaction much more corse grained, pull messages down from the > server, deserialize them as an object graph and inject change > tracking capabilities (AOP-ish things are easier in prototype-based > languages anyway), manipulate them over a period of pages without > hitting the server, then boxcar the diffgrams and send them to the > server. The server decomposes the boxcared messages and sends them > to appropriate services for handling. This way, the structure of UI > flow and pages are decoupled from he server environment. > > I wrote a framework about a year ago that did this, including the > ability to bind complex types in Actionscript (with E4X this binding > step probably isn't necessary now). I looked at SDO and it was just a > bit more complicated than I needed so I didin't bother since it was > just a personal project for my wife. The Flex product I mentioned has > detach/reattach and change tracking. > I'd eventually be interested in revisiting this in a few months after > the work on other more pressing things like the core and Java > container are done. > > Jim > > > ...ant > > > > > >> > >> > >>> ...ant > >>> > >>> On 3/22/06, Jim Marino <[EMAIL PROTECTED]> wrote: > >>> > >>> > >>>> > >>>> This seems interesting but I have a few questions, which are not > >>>> really important but arise from curiosity: > >>>> > >>>> I'm curious if you thought about making this look more like SCA > >>>> Client & Implementation specs? For example, it may be convenient to > >>>> have the APIs look more like the Java C&I spec such as instead of > >>>> SCA.xxx doing: > >>>> > >>>> ModuleContext moduleContext = > >>>> CurrentModuleContext.getContext(); > >>>> HelloWorldService helloworldService = HelloWorldService > >>>> (moduleContext.locateService("HelloWorldServiceComponent")); > >>>> > >>>> I also think dependency injection, metadata, and dynamic generation > >>>> of proxies for external services could be supported (with > >>>> invocation > >>>> handlers for policies). I've seen people attach "markers" to the > >>>> function object's prototype and/or prototype of a class in > >>>> JavaScript. It would also be nice to be able to support the > >>>> asynchronous C&I spec model more closely, e.g. callbacks and ending > >>>> sessions by calling a business method. What would be really cool > >>>> IMO > >>>> is an SDO implementation in JavaScript. These things would > >>>> provide an > >>>> interesting client-side model, which could actually be done as a > >>>> Javascript-based implementation of an SCA container. > >>>> > >>>> As a side note, I've found Actionscript and Flash have a lot of > >>>> capabilities for doing these types of things - e.g. the ability > >>>> to do > >>>> "real" client side async with sockets, including binary sockets in > >>>> Flash Player 8.5. It may even be worth looking at using a > >>>> lightweight flash client that just keeps a socket open to the > >>>> server > >>>> and communicates with Javascript to provide real async and local > >>>> persistent storage. > >>>> > >>>> Unfortunately, I'm drowning in a bunch of other work right now so I > >>>> can't really volunteer for any of this. > >>>> > >>>> Jim > >>>> > >>>> On Mar 22, 2006, at 2:29 AM, ant elder wrote: > >>>> > >>>> > >>>> > >>>>> Below is the note I posted a few weeks ago about what the JSON-RPC > >>>>> binding > >>>>> does, which is to support entryPoints which enabled web pages in a > >>>>> browser > >>>>> to make RPC style calls into SCA components on the server. (The > >>>>> code has > >>>>> moved from the sandbox now so those links below are wrong) > >>>>> > >>>>> I'd like to also add support for externalServices which would > >>>>> enable the > >>>>> server to push events asynchronously out to the browser client. It > >>>>> would > >>>>> work something like the following: > >>>>> > >>>>> As before the HTML page includes the SCA system script "scripts/ > >>>>> sca.js" > >>>>> which gets initialised when the page is loaded. That makes the > >>>>> SCA. > >>>>> object > >>>>> available in the script environment which is used to make RPC > >>>>> calls > >>>>> to the > >>>>> SCA entryPoints as before, but now it also supports registering > >>>>> handlers for > >>>>> the methods on any SCA externalServices. For example: > >>>>> > >>>>> SCA.myExternalService.foo(fooHandler); > >>>>> > >>>>> The fooHandler here is a JavaScipt function, such as: > >>>>> > >>>>> function fooHandler(s) { > >>>>> alert(s); > >>>>> } > >>>>> > >>>>> So that would pop up an alert box on the browser every time the > >>>>> server side > >>>>> externalService received a foo message. > >>>>> > >>>>> The act of registering the handler establishes the channel back > >>>>> to the > >>>>> server. It could be closed by the client making the call with null > >>>>> to remove > >>>>> the handler: > >>>>> > >>>>> SCA.myExternalService.foo(null); > >>>>> > >>>>> There are various techniques for doing these asynchronous > >>>>> communications, > >>>>> HTTP streaming, periodic refresh, etc, there's a lot of info > >>>>> about the > >>>>> techniques at: http://ajaxpatterns.org/HTTP_Streaming. > >>>>> > >>>>> Exactly how its done is completely transparent to the web client. > >>>>> There > >>>>> would be configuration parameters on the SCA binding to configure > >>>>> which ever > >>>>> technique is most appropriate for that application and the options > >>>>> that may > >>>>> require such as timeout or heartbeat intervals. > >>>>> > >>>>> This seems way cool to me, but there wasn't any comments on the > >>>>> original > >>>>> post so maybe I'm missing something, what do others think about > >>>>> this? > >>>>> > >>>>> ...ant > >>>>> > >>>>> > >>>>> ---------- Forwarded message ---------- > >>>>> From: ant elder <[EMAIL PROTECTED]> > >>>>> Date: Mar 8, 2006 8:59 PM > >>>>> Subject: Re: How do you register SCDL for a new binding? > >>>>> To: [email protected] > >>>>> > >>>>> Thanks to Jeremy and Sebastien for helping with this, I have it > >>>>> going now > >>>>> and I've updated the sandbox with code that works: > >>>>> http://svn.apache.org/repos/asf/incubator/tuscany/sandbox/ant/ > >>>>> jsonrpc/ > >>>>> > >>>>> It enables JavaScript running in a browser to access SCA > >>>>> components > >>>>> defined > >>>>> in the web app with an entryPoint using the new binding. All you > >>>>> have to do > >>>>> is add one extra script definition line to the HTML: > >>>>> > >>>>> <script type="text/javascript" src="scripts/sca.js"></script> > >>>>> > >>>>> and then user scripts can access all the entryPoints from an SCA > >>>>> variable > >>>>> that gets automatically defined: > >>>>> > >>>>> var result = SCA.HelloWorldService.getGreetings(name); > >>>>> > >>>>> There's a sample helloworld app that demonstrates it: > >>>>> http://svn.apache.org/repos/asf/incubator/tuscany/sandbox/ant/ > >>>>> jsonrpc/helloworldajax/ > >>>>> > >>>>> > >>>>> ...ant > >>>>> > >>>>> On 3/6/06, ant elder <[EMAIL PROTECTED]> wrote: > >>>>> > >>>>> > >>>>> > >>>>> > >>>>>> You're a star, thanks! > >>>>>> > >>>>>> > >>>>>> On 3/6/06, Jean-Sebastien Delfino <[EMAIL PROTECTED]> wrote: > >>>>>> > >>>>>> > >>>>>> > >>>>>>> > >>>>>>> ant elder wrote: > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> I'm messing about trying to add a new binding to Tuscany but > >>>>>>>> can't get > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> it to > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> work. There must be something I'm missing to register the new > >>>>>>>> binding > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> SCDL > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> as all I get is the exception below saying "Feature ' > >>>>>>>> binding.ajax' > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> not > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> found". Could someone have a quick look if its something > >>>>>>>> obvious? The > >>>>>>>> code's up at http://svn.apache.org/repos/asf/incubator/tuscany/ > >>>>>>>> sandbox/ant/ > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> , > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> the AJAXAssemblyLoaderTestCase shows the problem. > >>>>>>>> > >>>>>>>> Thanks, > >>>>>>>> > >>>>>>>> ...ant > >>>>>>>> > >>>>>>>> java.lang.RuntimeException: > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> file:/C:/SCA/SVN/WORK/sca/binding.ajax/bin/org/apache/tuscany/ > >>>>>>> binding/ajax/assembly/tests/sca.module > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> at > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> org.apache.tuscany.model.scdl.loader.impl.SCDLXMLReader.getRootO > >>>>>>> bj > >>>>>>> ec > >>>>>>> t > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> (SCDLXMLReader.java:103) > >>>>>>>> at > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> org.apache.tuscany.model.scdl.loader.impl.SCDLXMLReader.getModul > >>>>>>> e( > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> SCDLXMLReader.java :61) > >>>>>>>> at > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoade > >>>>>>> rI > >>>>>>> mp > >>>>>>> l.loadModule > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> (SCDLAssemblyModelLoaderImpl.java:101) > >>>>>>>> at > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> org.apache.tuscany.binding.ajax.assembly.tests.AJAXAssemblyLoade > >>>>>>> rT > >>>>>>> es > >>>>>>> tCase.testLoader > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> (AJAXAssemblyLoaderTestCase.java:63) > >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native > >>>>>>>> Method) > >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown > >>>>>>>> Source) > >>>>>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> Source) > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> at java.lang.reflect.Method.invoke(Unknown Source) > >>>>>>>> at junit.framework.TestCase.runTest(TestCase.java:154) > >>>>>>>> at junit.framework.TestCase.runBare(TestCase.java:127) > >>>>>>>> at junit.framework.TestResult$1.protect(TestResult.java: > >>>>>>>> 106) > >>>>>>>> at junit.framework.TestResult.runProtected(TestResult.java: > >>>>>>>> 124) > >>>>>>>> at junit.framework.TestResult.run(TestResult.java:109) > >>>>>>>> at junit.framework.TestCase.run (TestCase.java:118) > >>>>>>>> at junit.framework.TestSuite.runTest(TestSuite.java:208) > >>>>>>>> at junit.framework.TestSuite.run(TestSuite.java:203) > >>>>>>>> at > >>>>>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > >>>>>>>> ( > >>>>>>>> RemoteTestRunner.java:478) > >>>>>>>> at > >>>>>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run( > >>>>>>>> RemoteTestRunner.java:344) > >>>>>>>> at > >>>>>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main ( > >>>>>>>> RemoteTestRunner.java:196) > >>>>>>>> Caused by: > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> org.eclipse.emf.ecore.resource.Resource > >>>>>>> $IOWrappedException:Feature ' > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> binding.ajax' not found. ( http:///temp.xml, 23, 24) > >>>>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load( > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> XMLLoadImpl.java:283) > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad( > >>>>>>>> XMLResourceImpl.java:646) > >>>>>>>> at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load ( > >>>>>>>> XMLResourceImpl.java:614) > >>>>>>>> at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load( > >>>>>>>> XMLDocumentImpl.java:246) > >>>>>>>> at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load( > >>>>>>>> XMLDocumentImpl.java :225) > >>>>>>>> at org.apache.tuscany.sdo.helper.XMLHelperImpl.load( > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> XMLHelperImpl.java > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> :72) > >>>>>>>> at org.apache.tuscany.sdo.helper.XMLHelperImpl.load( > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> XMLHelperImpl.java > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> :66) > >>>>>>>> at > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> org.apache.tuscany.model.scdl.loader.impl.SCDLXMLReader.getRootO > >>>>>>> bj > >>>>>>> ec > >>>>>>> t > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>>> (SCDLXMLReader.java:100) > >>>>>>>> ... 18 more > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> Ant, > >>>>>>> > >>>>>>> Good news, I took a look at your AJAX binding in your sandbox > >>>>>>> and > >>>>>>> was > >>>>>>> able to get your test case working... You just had a few minor > >>>>>>> problems > >>>>>>> in your XSD, missing a namespace prefix declaration, and some > >>>>>>> left-over > >>>>>>> references to axis2. > >>>>>>> > >>>>>>> I am committing the fixes for you. Here are the details: > >>>>>>> - In sca-binding-ajax.xsd, removed the <include > >>>>>>> location="sca-core.xsd"/> which actually included a copy of the > >>>>>>> whole > >>>>>>> SCDL schema in your Ajax binding namespace. This is not > >>>>>>> necessary, > >>>>>>> instead the base SCDL XSD needs to be correctly imported so that > >>>>>>> your > >>>>>>> AJAXBinding can extend the correct base SCDL Binding type. > >>>>>>> - Fixed the location attribute in the <import location=".... > >>>>>>> sca-core.xsd"> to a correct relative location pointing to sca- > >>>>>>> core.xsd > >>>>>>> in the java/sca/model project from your sandbox/ant/ > >>>>>>> binding.ajax. > >>>>>>> - In sca.module, added an ajax namespace prefix declaration for > >>>>>>> your > >>>>>>> Ajax binding namespace and changed <binding.ajax/> to > >>>>>>> <ajax:binding.ajax > >>>>>>> />. > >>>>>>> - Changed the left over references to axis2 to ajax in > >>>>>>> sca.module > >>>>>>> and > >>>>>>> the test case itself. > >>>>>>> > >>>>>>> Hope this helps... > >>>>>>> > >>>>>>> -- > >>>>>>> Jean-Sebastien > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>> > >>>>> > >>>>> > >>>> > >>>> > >>>> > >>> > >>> > >> > >> > > > >
