Skip to content

Commit

Permalink
Begin work on new RestClient.
Browse files Browse the repository at this point in the history
Delay Specification of the interfaces until more
experience is achieved.
  • Loading branch information
sasinda committed Aug 19, 2012
1 parent 6de53c7 commit b8ee6c0
Show file tree
Hide file tree
Showing 38 changed files with 5,333 additions and 0 deletions.
107 changes: 107 additions & 0 deletions xwiki-android-core/src/org/xwiki/android/rest/ral/FetchConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package org.xwiki.android.rest.ral;


/**
* Configure how much things you need to fetch.
* Note: Some fetchX() methods like fetchObjectSummaries(ClassName, offset, len) act as hints to fetch only the specified summaries.
* But the DocumentRao may fetch all object summaries.
* @author xwiki gsoc 2012
*
*/
public class FetchConfig
{
//parts of a doc.
public static int PAGE = 1;
public static int PAGE_SUMMARY=512;
/**
* all Objects except comment and tag objects.
*/
public static int OBJECTS = 2;
public static int OBJECT_SUMMARIES=1024;
public static int COMMENTS = 4;
public static int TAGS = 8;
public static int ATTACHMENT_SUMMARIES = 16;
public static int COMMENT_OBJECTS=32;
public static int TAG_OBJECT=64;
public static int HISTORY=128;
public static int TRANSLATIONS=256;
public static int ALL = 2147483647;


int parts;

public FetchConfig(){
}

/**
* quick constructor to add parts. parts=PAGE || OBJECTS mean the retreived document will be filled with the objects + the page data.
* @param parts
*/
public FetchConfig(int parts)
{
this.parts=parts;
}


public FetchConfig fetchObjects(){
return this;
}
public FetchConfig fetchObjects(String className)
{
return null;
}

public FetchConfig fetchObjects(String className, String... properties)
{
return null;
}
public FetchConfig fetchObjects(String className, int offset, int len)
{
return this;
}

public FetchConfig fetchObjects(String className, int offset, int len,String... properties)
{
return this;
}

public FetchConfig fetchObjectSummaries()
{
return this;
}

public FetchConfig fetchObjectSummaries(String className)
{
return this;
}

public FetchConfig fetchObjectSummaries(String className, int offset, int len)
{
return this;
}

public FetchConfig fetchComments()
{
return null;
}
public FetchConfig fetchComments(int offset, int len)
{
return null;
}
public FetchConfig fetchAttachmentSummaries()
{
return null;
}
public FetchConfig fetchAttachmentSummaries(int offset, int len)
{
return null;
}

public FetchConfig fetchAttachments(){
return this;
}
public FetchConfig fetchAttachment(String name){
return this;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.xwiki.android.rest.ral.algo;

/**
* For fetching with a fetch config.
* @author xwiki gsoc 2012
*
*/
public class ConfigurableDocRetStraegy
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.xwiki.android.rest.ral.algo;
/**
*
*
* Proof of Concept example.
*
*/
public class ParallelDocRetreiveStrategy
{

}


class Worker extends Thread{

}

class Job{

}

class RetreiveJob extends Job{

}
/**
class createJob extends Job{
}
class UpdateJob extends Job{
}
**/
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
How to parallel
Make Worker thread which can do Jobs.
CreateJob
{ pages, comments, tags, attachmnts, ...}
UpdateJob
{ comments , ...}
RetreiveJob
{
pages, ...

}
Worker knows what to do for each job. The worker is allowed to parallelize at any extent.
i.e upload each item in comments, page, etc parallel.
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package org.xwiki.android.rest.ral.wrappers;

import org.xwiki.android.xmodel.entity.Document;

public class TranspDocumentWrapper extends DocumentWrapper
{

boolean pageSummary;
boolean page;
boolean historySummaries;
boolean comments;
boolean attachmentSummaries;


public TranspDocumentWrapper(Document doc)
{
super(doc);
}

}

/**
page summary
<link></link>
<id>xwiki:Blog.BlogIntroduction</id>
<fullName>Blog.BlogIntroduction</fullName>
<wiki>xwiki</wiki>
<space>Blog</space>
<name>BlogIntroduction</name>
<title>First blog post</title>
<parent>Blog.WebHome</parent>
<parentId>xwiki:Blog.WebHome</parentId>
<xwikiRelativeUrl>
http://localhost:8080/xwiki/bin/view/Blog/BlogIntroduction
</xwikiRelativeUrl>
<xwikiAbsoluteUrl>
http://localhost:8080/xwiki/bin/view/Blog/BlogIntroduction
</xwikiAbsoluteUrl>
<translations/>
<syntax>xwiki/2.0</syntax>
page
<link rel="http://www.xwiki.org/rel/class" href="http://localhost:8080/xwiki/rest/wikis/xwiki/classes/Blog.BlogIntroduction"/>
<id>xwiki:Blog.BlogIntroduction</id>
<fullName>Blog.BlogIntroduction</fullName>
<wiki>xwiki</wiki>
<space>Blog</space>
<name>BlogIntroduction</name>
<title>First blog post</title>
<parent>Blog.WebHome</parent>
<parentId>xwiki:Blog.WebHome</parentId>
<xwikiRelativeUrl>
http://localhost:8080/xwiki/bin/view/Blog/BlogIntroduction
</xwikiRelativeUrl>
<xwikiAbsoluteUrl>
http://localhost:8080/xwiki/bin/view/Blog/BlogIntroduction
</xwikiAbsoluteUrl>
<translations/>
<syntax>xwiki/2.0</syntax>
<language/>
<version>14.1</version>
<majorVersion>14</majorVersion>
<minorVersion>1</minorVersion>
<created>2009-03-11T14:58:10+05:30</created>
<creator>XWiki.Admin</creator>
<modified>2012-07-11T16:58:21+05:30</modified>
<modifier>XWiki.superadmin</modifier>
<content/>
<objectSummary>
<link rel="http://www.xwiki.org/rel/object" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction/objects/Blog.BlogPostClass/0"/>
<link rel="http://www.xwiki.org/rel/properties" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction/objects/Blog.BlogPostClass/0/properties"/>
<id>
xwiki:Blog.BlogIntroduction:49ea4e6b-9a83-4f63-9ab9-7b596176bce8
</id>
<guid>49ea4e6b-9a83-4f63-9ab9-7b596176bce8</guid>
<pageId>xwiki:Blog.BlogIntroduction</pageId>
<wiki>xwiki</wiki>
<space>Blog</space>
<pageName>BlogIntroduction</pageName>
<className>Blog.BlogPostClass</className>
<number>0</number>
<headline>Blog.News</headline>
</objectSummary>
<historySummary>
<link rel="http://www.xwiki.org/rel/page" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogIntroduction/history/14.1"/>
<pageId>xwiki:Blog.BlogIntroduction</pageId>
<wiki>xwiki</wiki>
<space>Blog</space>
<name>BlogIntroduction</name>
<version>14.1</version>
<majorVersion>14</majorVersion>
<minorVersion>1</minorVersion>
<modified>2012-07-11T16:58:21+05:30</modified>
<modifier>XWiki.superadmin</modifier>
</historySummary>
then comes hisotry page.
**/

Loading

0 comments on commit b8ee6c0

Please sign in to comment.