- /**
- * Return the {@link Card} corresponding to the given URL, synchronised if
- * necessary.
- *
- * @param input
- * the jvcard:// with resource name URL (e.g.:
- * <tt>jvcard://localhost:4444/coworkers</tt>)
- *
- * @throws SecurityException
- * in case of internal error
- * @throws NoSuchMethodException
- * in case of internal error
- * @throws ClassNotFoundException
- * in case of internal error
- * @throws IllegalAccessException
- * in case of internal error
- * @throws InstantiationException
- * in case of internal error
- * @throws InvocationTargetException
- * in case of internal error
- * @throws IllegalArgumentException
- * in case of internal error
- * @throws IOException
- * in case of IO error
- */
- @SuppressWarnings("unchecked")
- static private Card syncCard(String input) throws ClassNotFoundException,
- NoSuchMethodException, SecurityException, InstantiationException,
- IllegalAccessException, IllegalArgumentException,
- InvocationTargetException, IOException {
- @SuppressWarnings("rawtypes")
- Class syncClass = Class.forName("be.nikiroo.jvcard.remote.Sync");
- Method getCache = syncClass.getDeclaredMethod("getCache",
- new Class[] {});
- Method sync = syncClass.getDeclaredMethod("sync", new Class[] {
- Card.class, boolean.class });
-
- Object o = syncClass.getConstructor(String.class).newInstance(input);
-
- File file = (File) getCache.invoke(o);
- Card card = new Card(file, Format.VCard21);
- card.setRemote(true);
- sync.invoke(o, card, false);