|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nitido.nim.NiM
public final class NiM
The NiM class provides application developers with a centralized access to all of NiM services such as entity management, profile management, logging, event monitoring, nugget management, and configuration management. NiM is a singleton class such that a running JVM can instantiate at most one instance of NiM.
Field Summary |
---|
Method Summary | |
---|---|
void |
deprovisionEntity(Credential targetCred,
Entity adminEntity)
This method will de-provision the entity associated to the given target credential. |
java.lang.String |
generateUniqueId()
This method is used to generate a unique string identifier for each method invocation. |
java.lang.String |
getApplicationId()
This method returns the identifier associated to the running NiM applicaiton. |
Brand |
getBrand(NimletInput input,
Entity user)
Get a brand object. |
Brand |
getDomainBrand(java.lang.String domain)
Get a brand object for a given domain without relying on input or an authenticated entity. |
Entity |
getEntity(Credential credential)
This method returns an instance of an Entity for the given credential. |
java.lang.String |
getEnvironmentId()
This method returns the identifier of the environment (production, lab, development, etc.) where the NiM application is running. |
static NiM |
getInstance()
This method is used to get the referece to the NiM object. |
Logger |
getLogger(java.lang.Class clazz)
This method returns a reference to the NiM Logger object for the given class. |
Logger |
getLogger(java.lang.String name)
This method returns a reference to the NiM Logger object for the given class name. |
java.lang.String |
getMessage(java.lang.String domainID,
java.lang.String brandID,
java.lang.String msgID,
java.lang.String locale,
java.lang.Object... msgParams)
Get a translated message for this brand. |
java.lang.String |
getNodeId()
This method returns the node identifier where the instance of NiM is running. |
NotificationStatus |
getNotificationStatus(java.lang.String ticket)
This method is used to retrieve the status of a message that was given to the notification service to be sent out. |
java.util.Properties |
getPropertiesByFilter(java.lang.String searchFilter)
This method returns all the properties whose keys satisfy the given search filter. |
java.util.Properties |
getPropertiesByPrefix(java.lang.String prefix)
This method returns all the properties whose keys start with the given prefix. |
java.lang.String |
getProperty(java.lang.String name)
This method returns the configuration property associated to the given name. |
java.lang.String |
getPropertyWithDefault(java.lang.String name,
java.lang.String defaultValue)
This method returns the configuration property associated to the given name. |
java.lang.String |
getRevisionId()
This method returns the current revision identifier of the NiM applicaiton. |
Brand |
getSystemDefaultBrand()
Get the system default brand for this installation. |
User |
getUser(Credential credential)
This method returns a reference to an authenticated User. |
void |
logEvent(java.lang.String eventName,
java.lang.String msg,
Credential credential)
This method is used to log application level events. |
boolean |
needToLogEvent(java.lang.String eventName,
Credential credential)
This method indicates whether the given event needs to be logged. |
void |
provisionEntity(EntityProvisionDescriptor descriptor,
Entity adminEntity)
This method is used to provision a new entity. |
void |
releaseEntity(Entity entity)
This method is used to signal to the NiM that the Entity is dying. |
java.lang.String |
sendNotification(NotificationMessage msg)
This method allows the application to send out messages to users both internal and external to the system. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final NiM getInstance()
NOTE: This method is thread safe even though it is not a "synchronized method". It is because the underlying NiM object was instantiated by the static initializer and cannot be modified after the class has been loaded. The NiM instance can be "read" only, and therefore, this method doesn't need to be "synchronized".
public final java.lang.String sendNotification(NotificationMessage msg) throws NotificationServiceException
msg
- the message to be sent out
NotificationServiceException
- thrown if the message was not valid or
if the notification service could not accept the message for deliverypublic final NotificationStatus getNotificationStatus(java.lang.String ticket) throws StatusNotFoundException
ticket
- the ticket returned by sendNotification()
StatusNotFoundException
- thrown if the ticket did not match any
of the status objects being stored in the service's cache. The ticket
may be invalid or enough time has passed and the status object has been
cleaned up by the service.public final Brand getBrand(NimletInput input, Entity user)
input
- the nimlet input from the current requestuser
- the currently logged in entity. If this brand object is
required for an unauthenticated entity it may be left null.
NiMRuntimException
- if the BrandService is not specified or
failed to be initialized.public final Brand getDomainBrand(java.lang.String domain)
domain
- domain whose default brand is to be retrieved
NiMRuntimException
- if the BrandService is not specified or
failed to be initialized.public final Brand getSystemDefaultBrand()
NiMRuntimException
- if the BrandService is not specified or
failed to be initialized.public final java.lang.String getMessage(java.lang.String domainID, java.lang.String brandID, java.lang.String msgID, java.lang.String locale, java.lang.Object... msgParams)
domainID
- the domain IDbrandID
- the brand IDmsgID
- the message IDlocale
- the locale to translate tomsgParams
- the parameters (this arguments is optional, it may be
an array of Objects or any number of arguments) to format
the variables within the message
NiMRuntimException
- if the BrandService is not specified or
failed to be initialized.public final java.lang.String generateUniqueId()
public final Logger getLogger(java.lang.String name)
name
- The name of the class of the object requesting the logger.
public final Logger getLogger(java.lang.Class clazz)
clazz
- The class reference of the object that is requesting the logger.
public final java.util.Properties getPropertiesByPrefix(java.lang.String prefix)
prefix
- The prefix used to search the configuration properties.
Properties
public final java.util.Properties getPropertiesByFilter(java.lang.String searchFilter)
searchFilter
- The search filter used to retrieve a set of configuration
properties. The filter can be the full key name or a
substring with the wildcard character "*". However, this
substring CAN NOT contain other special characters such as
"(", ")" or "/".
public final java.lang.String getProperty(java.lang.String name)
name
- The name of the configuration property.
public final java.lang.String getPropertyWithDefault(java.lang.String name, java.lang.String defaultValue)
name
- The name of the configuration property.defaultValue
- The return value if the given property name does not exist.
public final Entity getEntity(Credential credential) throws IllegalCredentialException, AuthenticationFailedException, NiMException
credential
- The credential that uniquely identifies the requested Entity.
IllegalCredentialException
- If the given credential is null or invalid.
AuthenticationFailedException
- If unable to authenticate the given entity credentials.
NiMException
- If unable to establish a connection to the authentication
service on the back-end.Entity
,
User
,
getUser( Credential )
public final void releaseEntity(Entity entity)
NOTE: An Entity object is regarded as "destroyed" after this method is invoked, even if an exception is thrown by this method. No operation should be performed on the object afterward.
entity
- The Entity object that is "dying".public final User getUser(Credential credential) throws java.lang.IllegalArgumentException, AuthenticationFailedException, NiMException
credential
- The credential that uniquely identifies the requested User
java.lang.IllegalArgumentException
- If the given credential is null or the entity type
parameter of the is invalid.
AuthenticationFailedException
- If unable to authenticate the user with the given credential.
NiMException
- If unable to establish a connection with the back-end
authentication service.getEntity( Credential )
public final void provisionEntity(EntityProvisionDescriptor descriptor, Entity adminEntity) throws java.lang.IllegalArgumentException, EntityProvisionException, PermissionDeniedException, NiMException
descriptor
- The entity descriptor is data container that holds all the
information necessary to provision the required EntityadminEntity
- The entity object of the administrator. The identifying
credential of this administrator entity object should
have enough privilege for provisioning a new entity
java.lang.IllegalArgumentException
- If any of the given arguments are null.
EntityProvisionException
- If unable to cprovision the entity due to inconsistencies
on the data in the EntityProvisionDescriptor and the
back-end requirements.
PermissionDeniedException
- If given Credential does not have permission to perform the
required action.
NiMException
- If unable to establish a connection with the back-end
provisioning service.public final void deprovisionEntity(Credential targetCred, Entity adminEntity) throws java.lang.IllegalArgumentException, PermissionDeniedException, NiMException
targetCred
- The identifying credential of the entity being de-provisioned.adminEntity
- The entity object of the administrator. The identifying
credential of this administrator entity object should
have enough privilege for deprovisioning an entity
PermissionDeniedException
- If the given credential does not have permission for the action.
NiMException
- If unable to establish a connection with the back-end
de-provisioning service.
java.lang.IllegalArgumentException
public final void logEvent(java.lang.String eventName, java.lang.String msg, Credential credential)
eventName
- The name that uniquely identifies the event being logged.msg
- The log message associated to the event.credential
- The credential of the user logging the event.public final boolean needToLogEvent(java.lang.String eventName, Credential credential)
The creation of the log message can consume a significant amount of time, a developer can first call this method to determine whether the corresponding log message is to be logged.
eventName
- The name that uniquely identifies the event to be logged.credential
- The credential of the user logging the event
public final java.lang.String getApplicationId()
public final java.lang.String getEnvironmentId()
public final java.lang.String getNodeId()
public final java.lang.String getRevisionId()
|
Nitido NiM 2.5 Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2009 Nitido Inc. Proprietary and Confidential. All Rights Reserved.