org.apache.ambari.view
Interface ViewContext


public interface ViewContext

Context object available to the view components to provide access to the view and instance attributes as well as run time information about the current execution context.


Field Summary
static String CONTEXT_ATTRIBUTE
          Key for mapping a view context as a property.
 
Method Summary
 String getAmbariProperty(String key)
          Get a property for the given key from the ambari configuration.
 ViewController getController()
          Get a view controller associated with this context.
 DataStore getDataStore()
          Get a data store for view persistence entities.
 HttpImpersonator getHttpImpersonator()
          Get the HTTP Impersonator.
 ImpersonatorSetting getImpersonatorSetting()
          Get the default settings for the Impersonator.
 Map<String,String> getInstanceData()
          Get the instance data values.
 String getInstanceData(String key)
          Get the instance data value for the given key.
 String getInstanceName()
          Get the view instance name.
 Map<String,String> getProperties()
          Get the property values specified to create the view instance.
 ResourceProvider<?> getResourceProvider(String type)
          Get the view resource provider for the given resource type.
 URLStreamProvider getURLStreamProvider()
          Get a URL stream provider.
 String getUsername()
          Get the current user name.
 ViewDefinition getViewDefinition()
          Get the view definition associated with this context.
 Collection<ViewDefinition> getViewDefinitions()
          Get all of the available view definitions.
 ViewInstanceDefinition getViewInstanceDefinition()
          Get the view instance definition associated with this context.
 Collection<ViewInstanceDefinition> getViewInstanceDefinitions()
          Get all of the available view instance definitions.
 String getViewName()
          Get the view name.
 void hasPermission(String userName, String permissionName)
          Determine whether or not the access specified by the given permission name is permitted for the given user.
 void putInstanceData(String key, String value)
          Save an instance data value for the given key.
 void removeInstanceData(String key)
          Remove the instance data value for the given key.
 

Field Detail

CONTEXT_ATTRIBUTE

static final String CONTEXT_ATTRIBUTE
Key for mapping a view context as a property.

See Also:
Constant Field Values
Method Detail

getUsername

String getUsername()
Get the current user name.

Returns:
the current user name

hasPermission

void hasPermission(String userName,
                   String permissionName)
                   throws SecurityException
Determine whether or not the access specified by the given permission name is permitted for the given user.

Parameters:
userName - the user name
permissionName - the permission name
Throws:
SecurityException - if the access specified by the given permission name is not permitted

getViewName

String getViewName()
Get the view name.

Returns:
the view name

getViewDefinition

ViewDefinition getViewDefinition()
Get the view definition associated with this context.

Returns:
the view definition

getInstanceName

String getInstanceName()
Get the view instance name.

Returns:
the view instance name; null if no instance is associated

getViewInstanceDefinition

ViewInstanceDefinition getViewInstanceDefinition()
Get the view instance definition associated with this context.

Returns:
the view instance definition; null if no instance is associated

getProperties

Map<String,String> getProperties()
Get the property values specified to create the view instance.

Returns:
the view instance property values; null if no instance is associated

putInstanceData

void putInstanceData(String key,
                     String value)
Save an instance data value for the given key.

Parameters:
key - the key
value - the value
Throws:
IllegalStateException - if no instance is associated

getInstanceData

String getInstanceData(String key)
Get the instance data value for the given key.

Parameters:
key - the key
Returns:
the instance data value; null if no instance is associated

getInstanceData

Map<String,String> getInstanceData()
Get the instance data values.

Returns:
the view instance property values; null if no instance is associated

removeInstanceData

void removeInstanceData(String key)
Remove the instance data value for the given key.

Parameters:
key - the key
Throws:
IllegalStateException - if no instance is associated

getAmbariProperty

String getAmbariProperty(String key)
Get a property for the given key from the ambari configuration.

Parameters:
key - the property key
Returns:
the property value; null indicates that the configuration contains no mapping for the key

getResourceProvider

ResourceProvider<?> getResourceProvider(String type)
Get the view resource provider for the given resource type.

Parameters:
type - the resource type
Returns:
the resource provider; null if no instance is associated

getURLStreamProvider

URLStreamProvider getURLStreamProvider()
Get a URL stream provider.

Returns:
a stream provider

getDataStore

DataStore getDataStore()
Get a data store for view persistence entities.

Returns:
a data store; null if no instance is associated

getViewDefinitions

Collection<ViewDefinition> getViewDefinitions()
Get all of the available view definitions.

Returns:
the view definitions

getViewInstanceDefinitions

Collection<ViewInstanceDefinition> getViewInstanceDefinitions()
Get all of the available view instance definitions.

Returns:
the view instance definitions

getController

ViewController getController()
Get a view controller associated with this context.

Returns:
the view controller

getHttpImpersonator

HttpImpersonator getHttpImpersonator()
Get the HTTP Impersonator.

Returns:
the HTTP Impersonator, which internally uses the App Cookie Manager

getImpersonatorSetting

ImpersonatorSetting getImpersonatorSetting()
Get the default settings for the Impersonator.

Returns:
the Impersonator settings.


Copyright © 2015 Apache Software Foundation. All rights reserved.