程序包 org.elastos.hive
类 AppContext
- java.lang.Object
-
- org.elastos.hive.AppContext
-
public class AppContext extends java.lang.ObjectThe application context would contain the resources list below:- The reference of application context provider;
- The user did which uses this application.
Normally, there are only one application context for one application.
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static AppContextbuild(AppContextProvider provider, java.lang.String userDid)Create the application context.AppContextProvidergetAppContextProvider()Get the provider of the application context.java.util.concurrent.CompletableFuture<java.lang.String>getProviderAddress()Get the provider address from user DID document.java.util.concurrent.CompletableFuture<java.lang.String>getProviderAddress(java.lang.String targetDid)Get the URL address of the provider throw the document of the user DID.static java.util.concurrent.CompletableFuture<java.lang.String>getProviderAddress(java.lang.String targetDid, java.lang.String preferredProviderAddress, boolean isForce)Get the URL address of the provider by the user DID.java.lang.StringgetUserDid()Get the user DID.static voidsetupResolver(java.lang.String resolver, java.lang.String cacheDir)Setup the resolver for the DID verification.AppContextsetUserDidForceResolveFlag(boolean force)Set the force resolve flag for app context which will cause always resolve did from chain.
-
-
-
方法详细资料
-
getAppContextProvider
public AppContextProvider getAppContextProvider()
Get the provider of the application context.- 返回:
- The provider of the application context.
-
getUserDid
public java.lang.String getUserDid()
Get the user DID.- 返回:
- The user DID.
-
getProviderAddress
public java.util.concurrent.CompletableFuture<java.lang.String> getProviderAddress()
Get the provider address from user DID document.- 返回:
- The provider address.
-
setupResolver
public static void setupResolver(java.lang.String resolver, java.lang.String cacheDir) throws HiveExceptionSetup the resolver for the DID verification.- 参数:
resolver- The URL of the resolver.cacheDir- The local directory for DID cache.- 抛出:
HiveException- SeeHiveException
-
build
public static AppContext build(AppContextProvider provider, java.lang.String userDid)
Create the application context.- 参数:
provider- The provider of the application context.userDid- The user DID.- 返回:
- The application context.
-
setUserDidForceResolveFlag
public AppContext setUserDidForceResolveFlag(boolean force)
Set the force resolve flag for app context which will cause always resolve did from chain.- 参数:
force- force or not.- 返回:
- app context
-
getProviderAddress
public java.util.concurrent.CompletableFuture<java.lang.String> getProviderAddress(java.lang.String targetDid)
Get the URL address of the provider throw the document of the user DID. The will access the property of the document of the user DID.- 参数:
targetDid- The user DID.- 返回:
- The URL address of the provider.
-
getProviderAddress
public static java.util.concurrent.CompletableFuture<java.lang.String> getProviderAddress(java.lang.String targetDid, java.lang.String preferredProviderAddress, boolean isForce)Get the URL address of the provider by the user DID. The will access the property of the user DID.- 参数:
targetDid- The user DID.preferredProviderAddress- The preferred URL address of the provider.isForce- Whether forcing resolve provider url from chain.- 返回:
- The URL address of the provider
-
-