import java.util.List;
import be.nikiroo.jvcard.Card;
+import be.nikiroo.jvcard.launcher.CardResult.MergeCallback;
/**
* This class let you call "optional" methods, that is, methods and classes that
InvocationTargetException {
@SuppressWarnings("rawtypes")
Class serverClass = Class.forName("be.nikiroo.jvcard.remote.Server");
- Method run = serverClass.getDeclaredMethod("run", new Class[] {});
+ Method run = serverClass.getDeclaredMethod("run", new Class<?>[] {});
run.invoke(serverClass.getConstructor(int.class).newInstance(port));
}
@SuppressWarnings("rawtypes")
Class launcherClass = Class
.forName("be.nikiroo.jvcard.tui.TuiLauncher");
- Method start = launcherClass.getDeclaredMethod("start", new Class[] {
+ Method start = launcherClass.getDeclaredMethod("start", new Class<?>[] {
Boolean.class, List.class });
start.invoke(launcherClass.newInstance(), textMode, files);
}
* @param input
* the jvcard:// with resource name URL (e.g.:
* <tt>jvcard://localhost:4444/coworkers</tt>)
+ * @param callback
+ * the {@link MergeCallback} to call in case of conflict, or NULL
+ * to disallow conflict management (the {@link Card} will not be
+ * allowed to synchronise in case of conflicts)
*
* @throws SecurityException
* in case of internal error
* in case of IO error
*/
@SuppressWarnings("unchecked")
- static public Card syncCard(String input) throws ClassNotFoundException,
- NoSuchMethodException, SecurityException, InstantiationException,
- IllegalAccessException, IllegalArgumentException,
- InvocationTargetException, IOException {
+ static public CardResult syncCard(String input, MergeCallback callback)
+ throws ClassNotFoundException, NoSuchMethodException,
+ SecurityException, InstantiationException, IllegalAccessException,
+ IllegalArgumentException, InvocationTargetException, IOException {
@SuppressWarnings("rawtypes")
Class syncClass = Class.forName("be.nikiroo.jvcard.remote.Sync");
- Method sync = syncClass.getDeclaredMethod("sync",
- new Class[] { boolean.class });
+ Method sync = syncClass.getDeclaredMethod("sync", new Class<?>[] {
+ boolean.class, MergeCallback.class });
Object o = syncClass.getConstructor(String.class).newInstance(input);
- Card card = (Card) sync.invoke(o, false);
+ CardResult card = (CardResult) sync.invoke(o, false, callback);
return card;
}