mobi.voiceassistant.base
Class AgentUris

java.lang.Object
  extended by mobi.voiceassistant.base.AgentUris

public final class AgentUris
extends Object

Utility class for building and parsing different assist Uris.


Method Summary
static Uri buildBaseUri(String authority, Locale locale)
          Base uri for Dispatcher.
static Uri buildRequestUri(String authority, Locale locale, ComponentName component, String tag)
          Uri for Request.
static boolean isBaseUri(Uri uri)
          Checks if provided uri has no request parts specified.
static ComponentName parseComponent(Uri uri)
          Extracts component name of agent or null if Uri does not contain agent specification (i.e.
static Locale parseLocale(Uri uri)
          Returns locale specified in provided Uri or null.
static String parsePackageName(Uri uri)
          Extracts package name of agent or null if Uri does not contain agent specification (i.e.
static String parseRequestTag(Uri uri)
          Returns request tag or null if provided Uri does not denote request.
static String parseResponseTag(Uri uri)
          Returns response tag or null if provided Uri does not denote response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buildBaseUri

public static Uri buildBaseUri(String authority,
                               Locale locale)
Base uri for Dispatcher. assist://authority/xx/XX/ when locale's language nad country are not empty. assist://authority/ when locale is null

Parameters:
authority - Denotes dispatcher
locale - Locale of assistant

buildRequestUri

public static Uri buildRequestUri(String authority,
                                  Locale locale,
                                  ComponentName component,
                                  String tag)
Uri for Request. assist://authority/xx/XX/packageName/className/tag

Parameters:
authority - Denotes dispatcher
locale - Locale of assistant
component - Agent's component
tag - Request tag
See Also:
buildBaseUri(String, Locale)

isBaseUri

public static boolean isBaseUri(Uri uri)
Checks if provided uri has no request parts specified.

See Also:
buildBaseUri(String, Locale)

parseLocale

public static Locale parseLocale(Uri uri)
Returns locale specified in provided Uri or null.

Parameters:
uri - Uri to check

parsePackageName

public static String parsePackageName(Uri uri)
Extracts package name of agent or null if Uri does not contain agent specification (i.e. isBaseUri(Uri).

Parameters:
uri - Uri to parse
Returns:
Agent's package name
See Also:
buildRequestUri(String, java.util.Locale, ComponentName, String), ComponentName.getPackageName()

parseComponent

public static ComponentName parseComponent(Uri uri)
Extracts component name of agent or null if Uri does not contain agent specification (i.e. isBaseUri(Uri).

Parameters:
uri - Uri to parse
Returns:
Agent's component name
See Also:
buildRequestUri(String, java.util.Locale, ComponentName, String), parsePackageName(Uri)

parseRequestTag

public static String parseRequestTag(Uri uri)
Returns request tag or null if provided Uri does not denote request.

Parameters:
uri - Uri to parse
Returns:
Request tag
See Also:
parseResponseTag(Uri), Request.getUri(), Request.getOrigin(), Response.getUri()

parseResponseTag

public static String parseResponseTag(Uri uri)
Returns response tag or null if provided Uri does not denote response.

Parameters:
uri - Uri to parse
Returns:
Response tag
See Also:
parseRequestTag(Uri), Request.getOrigin(), Response.getUri()