001/******************************************************************************* 002 * Copyright (c) 2017 Red Hat Inc 003 * All rights reserved. This program and the accompanying materials 004 * are made available under the terms of the Eclipse Public License v1.0 005 * which accompanies this distribution, and is available at 006 * http://www.eclipse.org/legal/epl-v10.html 007 * 008 * Contributors: 009 * Jens Reimann - initial API and implementation 010 *******************************************************************************/ 011package org.varlink; 012 013import java.nio.file.Path; 014import java.nio.file.Paths; 015import java.util.concurrent.CompletableFuture; 016 017import de.dentrassi.varlink.spi.Interface; 018import de.dentrassi.varlink.spi.Syncer; 019 020@Interface(factory = ResolverImpl.Factory.class) 021public interface Resolver { 022 023 public static final Path ADDRESS = Paths.get("/run/org.varlink.resolver"); 024 025 public interface Async { 026 public CompletableFuture<String> resolve(String _interface); 027 } 028 029 public interface Sync { 030 public String resolve(String _interface); 031 } 032 033 public Async async(); 034 035 public default Sync sync() { 036 037 return new Sync() { 038 039 @Override 040 public String resolve(final String _interface) { 041 return Syncer.await(async().resolve(_interface)); 042 } 043 044 }; 045 } 046}