This a Java serverside for the persistencejs.sync, for demo puropose just running the sync testsuite. I it is based on the slim3 appengine framework.
- eclipse with appengine plugin
Eclipse projects (must be in same folder as this project):
- Annotation-processing-extension and ant-task code generator: http://github.com/rsaccon/persistencejs-gen
- Runtime-lib: http://github.com/rsaccon/persistencejs-sync
Import this project (and required dependencies) into eclipse, start the server and point your browser to the server address.
If started from a slim3-blank project, the following additional setup steps are necessary
- Set annotation factory path (at the project java compiler settings) to persistencejs-gen jar (built by persistencejs-gen).
- Use the build.xml provided by this project.
- Use the gen-persistencejs-sync task to create synced model and associated controller.
- Add fields to models as usual, use Sync annotation to mark fields for sync
- After generating setter/getter for new fields, insert at the setter body a meta function (which checks/sets a dirty field), see example below:
public class MyModel implements Serializable {
// ... [cutted out]
@Sync
private String foo;
// ... [cutted out]
public void setFoo(String foo) {
MyModelMeta.get().syncFoo(this, foo); // <<< ADD THIS !!!
this.foo = foo;
}
}
If started from a slim3-persistencejs-blank project, project dependencies are not required.