X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Flauncher%2FMain.java;h=06c55c655819b8517c13fa55dd44141556e90e46;hp=997cdecc4842b0759b183bbdc243c32137c3a0fa;hb=5ad0e17e7fea1c602cb2638a006424af9c7e33e8;hpb=e4444b0bc462544629d9e7e7ab62b96a4d9cab10 diff --git a/src/be/nikiroo/jvcard/launcher/Main.java b/src/be/nikiroo/jvcard/launcher/Main.java index 997cdec..06c55c6 100644 --- a/src/be/nikiroo/jvcard/launcher/Main.java +++ b/src/be/nikiroo/jvcard/launcher/Main.java @@ -9,6 +9,7 @@ import java.util.LinkedList; import java.util.List; import be.nikiroo.jvcard.Card; +import be.nikiroo.jvcard.launcher.CardResult.MergeCallback; import be.nikiroo.jvcard.parsers.Format; import be.nikiroo.jvcard.remote.Command; import be.nikiroo.jvcard.remote.SimpleSocket; @@ -243,13 +244,18 @@ public class Main { * @param input * a filename or a remote jvcard url with named resource (e.g.: * jvcard://localhost:4444/coworkers.vcf) + * @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) * * @return the {@link Card} * * @throws IOException * in case of IO error or remoting not available */ - static public Card getCard(String input) throws IOException { + static public CardResult getCard(String input, MergeCallback callback) + throws IOException { boolean remote = false; Format format = Format.Abook; String ext = input; @@ -265,12 +271,13 @@ public class Main { remote = true; } - Card card = null; + CardResult card = null; try { if (remote) { - card = Optional.syncCard(input); + card = Optional.syncCard(input, callback); } else { - card = new Card(new File(input), format); + card = new CardResult(new Card(new File(input), format), false, + false, false); } } catch (IOException ioe) { throw ioe;