public class RemoteProfiles extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RemoteProfiles.UncommittedProfile<T>
Contains references and exposes utility methods needed to update and commit a newly-created profile.
|
Modifier and Type | Method and Description |
---|---|
static void |
createCommittedProfile(MBeanServerConnection server,
String profileTableName,
String profileName,
AttributeList attributes)
Creates a profile, sets the attributes, then commits it.
|
static RemoteProfiles.UncommittedProfile<?> |
createUncommittedProfile(MBeanServerConnection server,
String profileTableName,
String profileName)
Creates a profile but does not commit it, allowing the caller to set the attributes before committing.
|
static <T> RemoteProfiles.UncommittedProfile<T> |
createUncommittedProfile(MBeanServerConnection server,
String profileTableName,
String profileName,
Class<T> profileInterface)
Creates a profile but does not commit it, allowing the caller to set the attributes before committing.
|
static Map<String,Object> |
getAttributeMap(MBeanServerConnection server,
String profileTableName,
String profileName)
Get the attributes of a profile.
|
static Map<String,Object> |
getAttributeMap(MBeanServerConnection server,
String profileTableName,
String profileName,
String[] attributeNames)
Get the attributes of a profile.
|
static String[] |
getAttributeNames(MBeanServerConnection server,
String profileTableName)
Get the attribute names for a profile table.
|
static AttributeList |
getAttributes(MBeanServerConnection server,
String profileTableName,
String profileName)
Get the attributes of a profile.
|
static String |
getAttributeType(MBeanServerConnection server,
ObjectName objectName,
String attributeName)
Get the attribute type for an attribute of any MBean.
|
static String |
getAttributeType(MBeanServerConnection server,
String profileTableName,
String attributeName)
Get the attribute type for an attribute on a profile table.
|
static <T> T |
getProfile(MBeanServerConnection server,
String tableName,
String profileName,
Class<T> profileClass)
Get a proxy for a profile.
|
static ProfileMBean |
getProfileMBean(MBeanServerConnection server,
ObjectName objectName)
Creates a
Profile proxy object for a given ObjectName . |
static ProfileMBean |
getProfileMBean(MBeanServerConnection server,
ProfileID profileId)
Creates a
Profile proxy object for a given profile Id. |
static ProfileMBean |
getProfileMBean(MBeanServerConnection server,
String tableName,
String profileName)
Creates a
Profile proxy object for a given profile table and profile name |
static ProfileTableUsageMBean |
getProfileTableUsage(MBeanServerConnection server,
String tableName)
Provides a
ProfileTableUsageMBean proxy object for the given profile table. |
static boolean |
profileTableExists(MBeanServerConnection server,
String tableName)
Check if a profile table exists.
|
static void |
setAttributes(MBeanServerConnection server,
ObjectName objectName,
AttributeList attrs)
Set the attributes of a profile using an
AttributeList . |
static void |
setAttributes(MBeanServerConnection server,
String profileTableName,
String profileName,
AttributeList attrs)
Set the attributes of a profile using an
AttributeList . |
public static void createCommittedProfile(MBeanServerConnection server, String profileTableName, String profileName, AttributeList attributes) throws InvalidArgumentException, UnrecognizedProfileTableNameException, ProfileAlreadyExistsException, ManagementException, ProfileVerificationException
If an error occurs, the profile creation attempt is rolled back and an exception is thrown.
server
- a server connectionprofileTableName
- the name of the profile tableprofileName
- the name of the profileattributes
- list of attributes to create the profile with, must contain attribute values of the
correct type.NullPointerException
- if profileTableName or profileName is null
UnrecognizedProfileTableNameException
- if a profile table with the specified
name does not exist.InvalidArgumentException
- if profileName
is zero-length or
contains illegal characters.ProfileAlreadyExistsException
- if a profile with the same name already
exists in the profile table.ProfileVerificationException
- if thrown by the Profile.profileVerify()
callback method in the profile's Management Profile Abstract Class. This exception
can also be thrown by the profile MBean if the deployment descriptor for the profile
specification documents an indexed attribute as requiring unique values and a
non-unique value has been supplied in the profile.ManagementException
- if the profile could not be created due to a
system-level failure.public static <T> RemoteProfiles.UncommittedProfile<T> createUncommittedProfile(MBeanServerConnection server, String profileTableName, String profileName, Class<T> profileInterface) throws InvalidArgumentException, UnrecognizedProfileTableNameException, ProfileAlreadyExistsException, ManagementException, InvalidStateException, ProfileVerificationException
RemoteProfiles.UncommittedProfile
object contains the necessary references to
set attributes and commit the profile.T
- expected type of the profile interfaceserver
- a server connectionprofileTableName
- the name of the profile tableprofileName
- the name of the profileprofileInterface
- the interface that the proxy for the Profile will supportRemoteProfiles.UncommittedProfile
containing references to a ProfileMBean proxy, the new profile's
ObjectName and a proxy for the Profile itselfNullPointerException
- if profileTableName or profileName is null
UnrecognizedProfileTableNameException
- if a profile table with the specified
name does not exist.InvalidArgumentException
- if profileName
is zero-length or
contains illegal characters.ProfileAlreadyExistsException
- if a profile with the same name already
exists in the profile table.ManagementException
- if the profile could not be created due to a
system-level failure.InvalidStateException
ProfileVerificationException
public static RemoteProfiles.UncommittedProfile<?> createUncommittedProfile(MBeanServerConnection server, String profileTableName, String profileName) throws InvalidArgumentException, UnrecognizedProfileTableNameException, ProfileAlreadyExistsException, ManagementException, InvalidStateException, ProfileVerificationException
server
- a server connectionprofileTableName
- the name of the profile tableprofileName
- the name of the profileRemoteProfiles.UncommittedProfile
containing references to a ProfileMBean proxy and the new profile's ObjectNameNullPointerException
- if profileTableName or profileName is null
UnrecognizedProfileTableNameException
- if a profile table with the specified
name does not exist.InvalidArgumentException
- if profileName
is zero-length or
contains illegal characters.ProfileAlreadyExistsException
- if a profile with the same name already
exists in the profile table.ManagementException
- if the profile could not be created due to a
system-level failure.InvalidStateException
ProfileVerificationException
public static ProfileMBean getProfileMBean(MBeanServerConnection server, ObjectName objectName)
Profile
proxy object for a given ObjectName
.server
- a server connectionobjectName
- the objectName of the profile.ProfileMBean
proxypublic static ProfileMBean getProfileMBean(MBeanServerConnection server, ProfileID profileId) throws UnrecognizedProfileTableNameException, UnrecognizedProfileNameException, ManagementException
Profile
proxy object for a given profile Id.server
- a server connectionprofileId
- the ProfileID
UnrecognizedProfileTableNameException
- if the profile table name is not recognized.UnrecognizedProfileNameException
- if the profile name is not recognized.ManagementException
- if a management exception occurs.public static ProfileMBean getProfileMBean(MBeanServerConnection server, String tableName, String profileName) throws UnrecognizedProfileTableNameException, UnrecognizedProfileNameException, ManagementException
Profile
proxy object for a given profile table and profile nameserver
- a server connectiontableName
- the name of the table.profileName
- the name of the profile.UnrecognizedProfileTableNameException
- if the profile table name is not recognized.UnrecognizedProfileNameException
- if the profile name is not recognized.ManagementException
- if a management exception occurs.public static ProfileTableUsageMBean getProfileTableUsage(MBeanServerConnection server, String tableName) throws InvalidArgumentException, UnrecognizedProfileTableNameException, ManagementException
ProfileTableUsageMBean
proxy object for the given profile table.server
- a server connectiontableName
- the name of the profile tableProfileTableUsageMBean
proxyUnrecognizedProfileTableNameException
- if the profile table name is unrecognized.InvalidArgumentException
- if the profile specification component that the
specified profile table was created from does not define a usage parameters
interface.ManagementException
- if a management exception occurs.public static boolean profileTableExists(MBeanServerConnection server, String tableName) throws ManagementException
server
- a server connectiontableName
- the profile table nameManagementException
- if the profile table names could not be obtained due to a system-level failure.public static <T> T getProfile(MBeanServerConnection server, String tableName, String profileName, Class<T> profileClass) throws UnrecognizedProfileNameException, UnrecognizedProfileTableNameException, ManagementException
T
- expected type of the profile interfaceserver
- a server connectiontableName
- the profile table nameprofileName
- the profile nameprofileClass
- the profile classUnrecognizedProfileTableNameException
- if the profile table name is not recognized.UnrecognizedProfileNameException
- if the profile name is not recognized.ManagementException
- if the profile could not be retrieved due to a system-level failure.public static String[] getAttributeNames(MBeanServerConnection server, String profileTableName) throws ManagementException, UnrecognizedProfileTableNameException
The attributes used by the SLEE, ProfileWriteable
and ProfileDirty
, are excluded
automatically.
server
- a server connectionprofileTableName
- the name of the profile tableManagementException
- if the profile attributes could not be retrieved due to a system-level failure.UnrecognizedProfileTableNameException
- if the profile table name is not recognized.public static String getAttributeType(MBeanServerConnection server, String profileTableName, String attributeName) throws AttributeNotFoundException, ManagementException, UnrecognizedProfileTableNameException
The string will be the value returned from MBeanAttributeInfo.getType(), which is the class name of the attribute.
server
- a server connectionprofileTableName
- the profile table nameattributeName
- the attribute nameAttributeNotFoundException
- if the given attribute name is not an attribute of the given profile tableManagementException
- if the profile attributes could not be retrieved due to a system-level failure.UnrecognizedProfileTableNameException
- if the profile table name is not recognized.public static String getAttributeType(MBeanServerConnection server, ObjectName objectName, String attributeName) throws AttributeNotFoundException, ManagementException
The string will be the value returned from MBeanAttributeInfo.getType(), which is the class name of the attribute.
server
- a server connectionobjectName
- the object name of the MBeanattributeName
- the attribute nameAttributeNotFoundException
- if the given attribute name is not an attribute of the given profile tableManagementException
- if the profile attributes could not be retrieved due to a system-level failure.public static AttributeList getAttributes(MBeanServerConnection server, String profileTableName, String profileName) throws ManagementException, UnrecognizedProfileTableNameException, UnrecognizedProfileNameException
server
- a server connectionprofileTableName
- the name of the profile tableprofileName
- the name of the profileManagementException
- if the profile attributes could not be retrieved due to a system-level failure.UnrecognizedProfileTableNameException
- if the profile table name is not recognized.UnrecognizedProfileNameException
- if the profile name is not recognized.public static Map<String,Object> getAttributeMap(MBeanServerConnection server, String profileTableName, String profileName) throws ManagementException, UnrecognizedProfileTableNameException, UnrecognizedProfileNameException
server
- a server connectionprofileTableName
- the name of the profile tableprofileName
- the name of the profileManagementException
- if the profile attributes could not be retrieved due to a system-level failure.UnrecognizedProfileTableNameException
- if the profile table name is not recognized.UnrecognizedProfileNameException
- if the profile name is not recognized.public static Map<String,Object> getAttributeMap(MBeanServerConnection server, String profileTableName, String profileName, String[] attributeNames) throws ManagementException, UnrecognizedProfileTableNameException, UnrecognizedProfileNameException
attributeNames
is null, the list of attributes for the given
profile will be retrieved first, and the map returned will contain values for all attributes. If attributeNames
is not null, the MBean will be queried for given attributes without checking the attributes are valid.server
- a server connectionprofileTableName
- the name of the profile tableprofileName
- the name of the profileattributeNames
- the names of the attributes to return, if null all attributes are returnedManagementException
- if the profile attributes could not be retrieved due to a system-level failure.UnrecognizedProfileTableNameException
- if the profile table name is not recognized.UnrecognizedProfileNameException
- if the profile name is not recognized.public static void setAttributes(MBeanServerConnection server, String profileTableName, String profileName, AttributeList attrs) throws UnrecognizedProfileTableNameException, ManagementException, UnrecognizedProfileNameException
AttributeList
.server
- a server connectionprofileTableName
- the name of the profile tableprofileName
- the name of the profileattrs
- a JMX AttributeList object containing the attributes to be setManagementException
- if the profile attributes could not be set due to a system-level failure.UnrecognizedProfileTableNameException
- if the profile table name is not recognized.UnrecognizedProfileNameException
- if the profile name is not recognized.public static void setAttributes(MBeanServerConnection server, ObjectName objectName, AttributeList attrs) throws UnrecognizedProfileTableNameException, ManagementException, UnrecognizedProfileNameException
AttributeList
.server
- a server connectionobjectName
- a managed objectattrs
- a JMX AttributeList object containing the attributes to be setManagementException
- if the profile attributes could not be set due to a system-level failure.UnrecognizedProfileTableNameException
- if the profile table name is not recognized.UnrecognizedProfileNameException
- if the profile name is not recognized.