[Aerogear Pipeline] Support for nested endpoints
by Sebastien Blanc
Hi,
While I was playing with scaffolding and tried to build a simple Blog
Application with Aerogear I faced the current situation :
I have a *Post* object which contains many *Comment* objects. Now I want to
call my Post pipe to retrieve the related comments, I have currently 2
options :
*
*
*/posts/1* -> assuming comments will be implicitly retrieved (eager loading)
*/comments/?postid=1*
But regarding our model the correct form should be :
*/posts/1/comments*
*
*
But, AFAIK, with the current API, it is not possible to define this last
pattern (at least for JS and iOs, confirmed by Matzew). When doing a *read
*we can pass an *id *option but as mentioned in the doc, this id will
always be append to the endpoint.
IMO, we should be able to support this pattern but for now I'm not really
sure how to specify this in our API, so if you have any ideas feedback this
thread has been made for you !
Seb
11 years, 7 months
Offline and Sync Brainstorm
by Summers Pittman
*
So for offline and sync for 2.0 I've been doing some thinking/research
and come up with some broad topics to discuss so we can start honing in
on what we want it to do/look like.
This isn't a spec, this isn't a proposal, this is just trying to narrow
down what we want at a high level so we can pick things to focus on.
1. Documents vs Transactions
There are two "big picture" methods of doing sync. One is a Document
sync (Think like a gallery with videos and pictures). Documents are
saved, the whole document is sent to the server, then the whole document
is pushed out to other clients who are syncing against the same source.
The other is a Transactional sync where many small atomic operations
are sent to the server. The best analog I have is Google
Drive/operation transforms.
Obviously the server side implementations of these are hilariously
divergent and I will leave the relative complexity of each as an
exercise for the list.
2. Background vs Foreground sync
Does the application have to be opened (foreground) for syncing to
happen? As far as I know, native Web requires this (barring extensions
to the browser, plugins etc). I think Cordova can in Android, but I
haven't researched it. iOS seems like a mixed bag, but generally you
can only sync if your application is in the foreground (but you can use
notifications and badges to communicate that there is a pending sync or
new data). I understand there is CoreData + iCloud that is supposed to
do something, but that seems like it is still foreground only. On
Android background sync is easy.
Is it OK to only have background syncing on some platforms but not others?
3. Push vs Poll?
Obviously pushing updates is better for devices and users, but polling
will let things work better for legacy services which may not have push
support or which may be difficult to integrate into AG-Controller.
Should we support both on the clients?
4. Multiple clients,multiple users, and conflicts
How do we want to support multiple users and multiple clients? How
should we try to do conflict resolution? What does authorization and
authentication look like here?
At a high level here are some options I have seen for conflict resolution:
A. Last in always wins. The server explicitly trusts things in the
order it gets and pushes that data out to users.
B. Clients are allowed one submit at a time and must wait for the
server to acknowledge the receipt. If there is a conflict the app can
either a) merge the data, b)reload the latest from the server and make
the user do his operation again, or c) create a new document and inform
the user.
C. Operation Transforms. This was meant to solve the conflict and
sync problem. However it is a LOT of work
5. Offline Support
Really this is more what do we want to do for coming from an "offline"
mode to an "online" mode? Abstractly, operations which happen offline
are the same as operations which happen online just with a REALLY REALLY
laggy connection. :) We could just only viewing data when offline and
requiring a connection for editing, queueing an upload, etc.
6. How much of this is the responsibility of AG-controller vs
underlying services?
How should the controller expose resources to clients, how should the
controller send data to its underlying services, how much data should
the controller be responsible itself for?
Should it be easy for an Operation Transform system to integrate with
AeroGear-controller?
Should it be easy to write a Controller based project which polls a
third party source?
How would the server handle passing credentials to the third party source?
Appendix Use Cases:
Here are a few contrived use cases that we may want to keep in mind.
1. Legacy Bug Trackers From Hell
a. It is a webapp written in COBOL, no one will ever EVER update or
change the code
b. It has TONS of legacy but important data
c. It has TONS of users
d. It only has a few transactions per day, all creating and updating
bug reports
e. Multiple users can edit the same report
2. Slacker Gallery
a. Each User has a multiple galleries, each gallery has multiple photos
b. A Gallery has only one user, but the user may be on multiple devices
c. Galleries may be renamed, created, and deleted
d. Photos may only be created or deleted. Photos also have meta data
which may be updated, but its creation and deletion is tied to the Photo
object.
3. Dropbox clone
a. A folder of files may be shared among users
b. There is a size limit to files and how much storage may be used
per folder
c. Files are not updated. If there is a new file, there is an atomic
delete and create operation
4. Email client
a. This is an AG-controller which accesses a mail account.
b. There are mobile offline and sync enabled clients which connect
to this controller.
5. Google Docs clone
a. Operational Transform out the wazzoo
b. What would the server need?
c. What would the client need?
Appendix Reference (Open Source) Products:
Wave-in-a-box
CouchDB
Google Drive RealtimeAPI
Can you guys think of more projects/examples to look at for inspiration?
*
11 years, 8 months
Replacing JQuery Ajax with Aerogear pipes
by soumik.basu
Hi,
I am trying to access my REST easy service from my html5 page. I tried to
access the REST url from JQuery AJAX and I can successfully do that and
get the data back in my html as given below:
$(document).ready(function(){
$.ajax({
type: "POST",
url: "../JAX_RS_HelloWorld/helloworld",
success: function(result){
alert(result);
}
});
*Rest Service code :*
@Path("/helloworld")
@RequestScoped
@Stateful
public class RSHelloWorld {
@GET
@Produces(MediaType.APPLICATION_JSON)
public String sayHello() {
System.out.println("i got hit");
return "Hello";
}
}
but I want to replace and use Aerogear pipes for this purpose.
I tried by following the example code and the document, as below:
*JS code:*
var memberPipe = AeroGear.Pipeline([{
name: "helloworld",
settings: {
baseURL: "/JAX_RS_HelloWorld/"
}
} ]).pipes.helloworld;
alert(memberPipe);*// this alert is coming as [object object]*
function getRestData(){
subs = memberPipe.read({
success: function(data) {
MemberStore.save( data );
alert("in function" + data);
},
error: function(jqXHR,textStatus,errorThrown){
alert("jq" + jqXHR);
alert("err" + errorThrown); *//I
am getting a parsing error here*
alert("status" + textStatus);
}
});
var testData = MemberStore.read();
alert("testData" + testData);
}
Would appreciate your help, in replacing the Jquery ajax call with the
aerogear .
Regards
Soumik Basu
--
View this message in context: http://aerogear-dev.1069024.n5.nabble.com/Replacing-JQuery-Ajax-with-Aero...
Sent from the aerogear-dev mailing list archive at Nabble.com.
11 years, 8 months
aeroGear.pipeline not working
by soumik.basu
Hi team,
I am using the jquery as javascript library for my app. I just thought of
including aerogear Rest service call instead of Jquery ajax call, so was
trying out with a small sample code. But the request was not getting fired.
I have deployed my sample Rest app as a separate project under a different
context. I can acces it from my browser as :
http://localhost:8080/JAX_RS_HelloWorld/helloworld.
I am trying to access this from :
http://localhost:8080/html5Start/test1.html page.
I have written the code as:
var memberPipe = AeroGear.Pipeline([{
name: "helloworld",
settings: {
baseURL: "JAX_RS_HelloWorld/"
}
} ]).pipes.members;
alert(memberPipe);
/I am getting undefined from this alert/
subs = memberPipe.read();
alert(subs);
so the script is failing here. Is it compulsory that I need to access this
Rest service from same context path as mentioned in the guide
"By default, the RESTful endpoint used by this pipe is the app's current
context, followed by the pipe name. For example, if the app is running on
http://mysite.com/myApp, then a pipe named `tasks` would use
http://mysite.com/myApp/tasks as its REST endpoint."...In that case what is
the way to change the base url to access the service from a different
context?
Please let me know if I am doing anything wrong here.
Thanks in advance.
Regards
Soumik
--
View this message in context: http://aerogear-dev.1069024.n5.nabble.com/aeroGear-pipeline-not-working-t...
Sent from the aerogear-dev mailing list archive at Nabble.com.
11 years, 8 months
iOS landing page
by Christos Vasilakis
Hi team,
have updated the iOS landing page here [1]. Further, on the same page, I have also put a download link to the aerogear-otp-ios together with links to the "OTP demo" and "Learn More" link. For the "Learn more" I have converted my blog post describing OTP to asciidoc[2] and added it in the user guide section in the documentation page so it can be easily link to by other landing pages (e.g. Android).
Not sure if there will be separate page for AeroGear-OTP download links for iOS or Android or each library have a link to the OTP page(as I did here). if it does I can safely remove the OTP link from the landing page.
Let me know what you think.
Thanks
Christos
[1] http://tinyurl.com/d7cuz34
[2] http://tinyurl.com/cspkqog
11 years, 8 months