-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make "model Transformation" components: Document Builder ,
XmodelTranslator pom changed.Upgraded jayway android maven plugin.
- Loading branch information
Showing
99 changed files
with
4,715 additions
and
1,147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
# Project target. | ||
target=android-7 | ||
android.library=true | ||
android.library.reference.1=../xwiki-android-rest |
This file was deleted.
Oops, something went wrong.
134 changes: 134 additions & 0 deletions
134
xwiki-android-core/src/org/xwiki/android/bgsvcs/SyncBackgroundService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
package org.xwiki.android.bgsvcs; | ||
|
||
import java.io.IOException; | ||
import java.sql.SQLException; | ||
import java.util.List; | ||
import java.util.Timer; | ||
import java.util.TimerTask; | ||
|
||
import org.xwiki.android.context.XWikiApplicationContext; | ||
import org.xwiki.android.dal.EntityManager; | ||
import org.xwiki.android.entity.SyncOutEntity; | ||
import org.xwiki.android.entity.SyncOutEntity.StatusType; | ||
import org.xwiki.android.fileStore.DocumentFao; | ||
import org.xwiki.android.fileStore.FSDocumentReference; | ||
import org.xwiki.android.fileStore.FileStoreManager; | ||
import org.xwiki.android.ral.DocumentRao; | ||
import org.xwiki.android.ral.RESTfulManager; | ||
import org.xwiki.android.ral.RaoException; | ||
import org.xwiki.android.rest.RestConnectorException; | ||
import org.xwiki.android.xmodel.entity.Document; | ||
import org.xwiki.android.xmodel.svc.DocumentRemoteSvcCallbacks; | ||
|
||
import android.app.Service; | ||
import android.content.Intent; | ||
import android.os.IBinder; | ||
import android.util.Log; | ||
import android.widget.Toast; | ||
|
||
import com.j256.ormlite.dao.Dao; | ||
|
||
/** | ||
* | ||
* @author xwiki gsoc 2012 | ||
* @version 1.0 Handles syncing of Documents with the server. | ||
*/ | ||
|
||
// dev note:Other remote syncing functionalities should also be put here. | ||
public class SyncBackgroundService extends Service | ||
{ | ||
private static final String tag="SyncBackgroundService"; | ||
private static final int SYNC_PERIOD = 60000;// sync every min. | ||
private Timer timer; | ||
private TimerTask task; | ||
|
||
|
||
|
||
@Override | ||
public void onCreate() | ||
{ | ||
Log.d(tag,"bg service created"); | ||
// HandlerThread thread = new HandlerThread("ServiceStartArguments", | ||
// Process.THREAD_PRIORITY_BACKGROUND); | ||
// thread.start(); | ||
timer = new Timer(); | ||
task = new TimerTask() | ||
{ | ||
@Override | ||
public void run() | ||
{ | ||
XWikiApplicationContext ctx=XWikiApplicationContext.getInstance(); | ||
EntityManager em=ctx.newEntityManager(); | ||
try { | ||
Dao<SyncOutEntity, Integer> dao = em.getDao(SyncOutEntity.class); | ||
List<SyncOutEntity> list=dao.queryForAll(); | ||
if(!list.isEmpty()){ | ||
RESTfulManager rm=ctx.newRESTfulManager(); | ||
FileStoreManager fm=ctx.getFileStoreManager(); | ||
DocumentRemoteSvcCallbacks clbks=new DocumentRemoteSvcCallbacks() | ||
{ | ||
public void onCreated(Document res, boolean success,RaoException ex) { | ||
|
||
}; | ||
}; | ||
|
||
DocumentRao rao=rm.newDocumentRao(); | ||
DocumentFao fao=fm.getDocumentFao(); | ||
for(SyncOutEntity s:list){ | ||
FSDocumentReference ref=s.getDocref(); | ||
Document doc=fao.load(ref); | ||
try { | ||
rao.create(doc); | ||
} catch (RestConnectorException e) { | ||
e.printStackTrace(); | ||
break;//abort sync. retry after SYNC_PERIOD | ||
} catch (RaoException e) { | ||
//doc may be already created. | ||
try { | ||
rao.update(doc); | ||
} catch (RestConnectorException e1) { | ||
e1.printStackTrace(); | ||
break; | ||
} catch (RaoException e1) { | ||
// we cannot do an update also. | ||
//donot delete and recreate. Just mark failed. | ||
s.setStatus(StatusType.FAILED); | ||
dao.update(s); | ||
e1.printStackTrace(); | ||
} | ||
e.printStackTrace(); | ||
} | ||
} | ||
}else{ | ||
Log.d(tag, "terminating SyncBackgroundService. No docs to sync out"); | ||
} | ||
} catch (SQLException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
stopSelf();//stop native service after all sync entries are synced. | ||
} | ||
}; | ||
|
||
} | ||
|
||
@Override | ||
public int onStartCommand(Intent intent, int flags, int startId) | ||
{ | ||
Toast.makeText(this, "Sync Service Starting", Toast.LENGTH_SHORT).show(); | ||
timer.schedule(task, 3000, SYNC_PERIOD); | ||
return START_NOT_STICKY; | ||
} | ||
|
||
@Override | ||
public IBinder onBind(Intent intent) | ||
{ | ||
return null;// not supported | ||
} | ||
|
||
@Override | ||
public void onDestroy() | ||
{ | ||
Toast.makeText(this, "service done", Toast.LENGTH_SHORT).show(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
xwiki-android-core/src/org/xwiki/android/blog/xobj/XCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
package org.xwiki.android.blog.xobj; | ||
|
||
public class XCategory | ||
import org.xwiki.android.xmodel.xobjects.XSimpleObject; | ||
|
||
public class XCategory extends XSimpleObject | ||
{ | ||
// todo: text area class desc | ||
// stringclass name | ||
public XCategory() | ||
{ | ||
super(""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.