|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rioproject.system.capability.PlatformCapability
public class PlatformCapability
A PlatformCapability defines a specific type of mechanism or quality
associated with a compute resource, and is used to define base platform
capabilities and resources. These capabilities allow better control
over resources and better provisioning behaviour. In turn, this
leads to optimal ServiceBean compute ability.
PlatformCapability attributes will be stored as (key, value) pairs
in a HashMap and tested for supportability against SystemRequirements.SystemComponent attributes.
Attributes obtained from the SystemRequirement
class will be tested for supportability using regular expression
matching.
If the SystemRequirement class contains a
VERSION requirement, the required version
value is processed as follows:
The VERSION determines which version of the
PlatformCapability is required. Without this key set, your service may
not launch with the desired version of the PlatformCapability. The
"Version" value can use the asterisk (*) or plus (+) symbols to
determine version requirements.
| Requirement |
Support Criteria |
|---|---|
| 1.2.7 |
Specifies an exact version |
| 2* |
Supported for all minor versions
of 2 |
| 3.4* |
Supported for all minor versions
of 3.4, including 3.4 |
| 1.2+ |
Supported for version 1.2 or above |
| Field Summary | |
|---|---|
protected Hashtable<String,Object> |
capabilities
Map of platform capability key and values |
protected String |
description
A description of the PlatformCapability |
static String |
DESCRIPTION
Description information for the capability |
protected static Logger |
logger
A suitable Logger |
static String |
MANUFACTURER
Manufacturer information for the capability |
static String |
MODEL
Model information for the capability |
static String |
NAME
Name information for the capability |
static String |
NATIVE_LIBS
Native Libraries Key. |
static int |
PROVISIONABLE
Indicates that the PlatformCapability may be provisioned |
static int |
STATIC
Indicates that the PlatformCapability must be installed |
static String |
VENDOR
Vender information for the capability |
static String |
VERSION
Version information for the capability |
| Constructor Summary | |
|---|---|
PlatformCapability()
|
|
| Method Summary | |
|---|---|
void |
addDownloadRecord(DownloadRecord record)
Add a DownloadRecord instance for the PlatformCapability |
void |
addStagedSoftware(StagedSoftware... software)
Add StagedSoftware for the PlatformCapability. |
ResourceCost |
calculateResourceCost(double units,
long duration)
Calculate the cost based on the units provided. |
void |
clearAll()
Clear all platform capability mappings |
void |
decrementUsage()
|
void |
define(String key,
Object value)
Define a platform capability mapping |
void |
defineAll(Map<String,Object> map)
Define all platform capability mappings to the platform capability Map |
boolean |
equals(Object obj)
A PlatformCapability is equal to another PlatformCapability if they are the same class and their capabilities maps are equal |
Map<String,Object> |
getCapabilities()
The collection of key,value pairs this PlatformCapability has been created with |
String[] |
getClassPath()
Get the classpath for the PlatformCapability |
String |
getConfigurationFile()
|
String |
getDescription()
Get the description associated with the PlatformCapability |
DownloadRecord[] |
getDownloadRecords()
Get the DownloadRecord instances for the PlatformCapability |
URL[] |
getLoadableClassPath()
Get the loadable classpath for the PlatformCapability. |
String |
getName()
Get the name of this PlatformCapability |
String |
getPath()
Get the path of the PlatformCapability, where it is located on the filesystem |
String[] |
getPlatformKeys()
Get the keys for the platform capability |
ResourceCostModel |
getResourceCostModel()
Get the ResourceCostModel
for the PlatformCapability |
StagedSoftware[] |
getStagedSoftware()
Get the StagedSoftware for the PlatformCapability |
int |
getType()
Get the type of PlatformCapability |
int |
getUsageCount()
|
Object |
getValue(String key)
Get the value associated with the key in the platform capability mapping. |
protected boolean |
hasBasicSupport(String name,
String className)
Determine basic supportability |
int |
hashCode()
Override hashCode to return the hashCode of the capabilities Map |
void |
incrementUsage()
|
void |
loadResources()
Allows the PlatformCapability to load any required native libraries as determined by values in the NativeLibsKey using the
System.loadLibrary method. |
protected boolean |
matches(String input,
String value)
Matching semantics are accomplished using pattern matching with regular expressions |
boolean |
remove(String key)
Remove a defined platform capability mapping |
void |
setClassPath(String[] classpath)
Set the classpath of the PlatformCapability |
void |
setConfigurationFile(String configurationFile)
|
void |
setDescription(String description)
Set the description associated with the PlatformCapability |
void |
setPath(String path)
Set the path of the PlatformCapability |
void |
setResourceCostModel(ResourceCostModel costModel)
Set the ResourceCostModel
for the PlatformCapability |
protected void |
setType(int type)
Set the type of this record to be either STATIC or PROVISIONABLE |
boolean |
supports(PlatformCapability requirement)
Deprecated. |
boolean |
supports(SystemRequirements.SystemComponent requirement)
Determine if the provided SystemRequirements.SystemComponent can
be supported. |
String |
toString()
String representation of a PlatformCapability |
protected boolean |
versionSupported(String requiredVersion,
String configuredVersion)
Determine if versions are supported |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String MANUFACTURER
public static final String MODEL
public static final String NAME
public static final String VENDOR
public static final String VERSION
public static final String DESCRIPTION
public static final String NATIVE_LIBS
lib1:lib2:lib3
public static final int STATIC
public static final int PROVISIONABLE
protected final Hashtable<String,Object> capabilities
protected String description
protected static final Logger logger
| Constructor Detail |
|---|
public PlatformCapability()
| Method Detail |
|---|
public void setPath(String path)
path - The path on an accessible filesystem where the
PlatformCapability is installedpublic String getPath()
getPath in interface PlatformCapabilityMBeanpublic void setClassPath(String[] classpath)
classpath - The classpath for the PlatformCapabilitypublic String[] getClassPath()
public URL[] getLoadableClassPath()
throws MalformedURLException
MalformedURLException - if the classpath cannot be constructedpublic void loadResources()
NativeLibsKey using the
System.loadLibrary method.
Libraries are loaded from the location pointed to by the
java.library.path
public void define(String key,
Object value)
key - The key associated with the platform capability. Can be a name
or another descriptive attribute used to uniquely identify the platform
capabilityvalue - The value associated with the platform capability keypublic void defineAll(Map<String,Object> map)
map - The Map containing platform capability mappingspublic Object getValue(String key)
key - The platform capability key
public boolean remove(String key)
key - The platform capability key to remove
public void clearAll()
public boolean supports(PlatformCapability requirement)
requirement - The PlatformCapability to requirement
public boolean supports(SystemRequirements.SystemComponent requirement)
SystemRequirements.SystemComponent can
be supported. A SystemRequirement can be supported if this
PlatformCapability is the same class name (sans the package name) as
the input SystemRequirement.getClassName() or the same
fully qualified classname as provided by the
SystemRequirement.getClassName() property and all
key,value parameters provided in the input SystemRequirement
are found and equal to mappings in this PlatformCapability
requirement - The SystemRequirement to test for supportability.
protected boolean hasBasicSupport(String name,
String className)
name - The name of the class, sans the package name. If this
parameter is not null, this will be checkedclassName - The fully qualified className to match if the name
is null
protected boolean matches(String input,
String value)
input - The regular expression, specified as a string. Must
not be nullvalue - Match the given input against this pattern.
true if, and only if, a subsequence of the
regex matches this matcher's pattern
protected boolean versionSupported(String requiredVersion,
String configuredVersion)
requiredVersion - The required version, specified as a string. Must
not be nullconfiguredVersion - The configured version value
true if, and only if, the request version can be
supportedpublic String[] getPlatformKeys()
public void setDescription(String description)
description - Description of the PlatformCapabilitypublic String getDescription()
getDescription in interface PlatformCapabilityMBeanpublic String getName()
public Map<String,Object> getCapabilities()
PlatformCapabilityMBean
getCapabilities in interface PlatformCapabilityMBeanPlatformCapabilityMBean.getCapabilities()public void setResourceCostModel(ResourceCostModel costModel)
ResourceCostModel
for the PlatformCapability
costModel - The ResourceCostModel that will determine the cost
of using this PlatformCapabilitypublic ResourceCostModel getResourceCostModel()
ResourceCostModel
for the PlatformCapability
ResourceCostModel
for the PlatformCapability
public ResourceCost calculateResourceCost(double units,
long duration)
ResourceCostProducer
calculateResourceCost in interface ResourceCostProducerunits - The units to be costedduration - The amount of time in milliseconds the resource has
been used for
ResourceCostProducer.calculateResourceCost(double, long)public void addStagedSoftware(StagedSoftware... software)
software - The StagedSoftware defining where the software for
the PlatformCapability can be downloaded frompublic StagedSoftware[] getStagedSoftware()
public void addDownloadRecord(DownloadRecord record)
record - A DownloadRecord instance defining where
software has been installedpublic DownloadRecord[] getDownloadRecords()
public int getType()
protected void setType(int type)
type - The type of the PlatformCapability
IllegalArgumentException - if the supplied type is neither
STATIC or PROVISIONABLEpublic void incrementUsage()
public void decrementUsage()
public int getUsageCount()
public String getConfigurationFile()
public void setConfigurationFile(String configurationFile)
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Object
|
Copyright © Rio Project. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||