Interface IAliasPolicy
- All Superinterfaces:
IBizPolicy
,IComponent
,IInitializable
,ISystemHandler
- All Known Subinterfaces:
ITopicSpacePolicy
Policy for querying, creating and removing aliases.
Aliases are a persistent pseudonym for various things, including portal resources, uri's or arbitrary strings.
Once you have created an alias using createAlias(com.webmethods.portal.bizPolicy.IContext, java.lang.Object, java.lang.Object, java.lang.String, boolean)
, then you can lookup the target of that alias using
lookupAlias(com.webmethods.portal.bizPolicy.IContext, java.lang.Object)
.
This becomes especially useful for creating friendly names for portal resources. For example, if you want to
browse to the help topic, instead of typing in /server/nis/meta/default/topic/000000043
(assuming
you had that memorized), you could instead type: /server/nis/topic.help
and you would get automatically
redirected to the help topic.
Alias resolution like the example above works, because calls to PortalSystem.acquireURI(java.lang.String)
automatically ties into the the IAliasMechanics
which implements the IURIResolver
.
Therefore, any call to find the IURI
for 'topic.help' results in the appropriate
IThingID
for the help topic. This is done transparently to the client of
the IAliasPolicy, and is a useful by product of using this api.
Finally, aliases are persistent and clustered. This means that once you set an alias, by calling createAlias(com.webmethods.portal.bizPolicy.IContext, java.lang.Object, java.lang.Object, java.lang.String, boolean)
,
the alias will be stored in the database, and (relatively) immediately available throughout the cluster. As a result, they are optimized
for lookups, not creation calls.
Note: When setting portal resource uri's as keys, you should use ITopicSpacePolicy
instead.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createAlias
(IContext context, Object source, Object target, String params, boolean isSystem) This will create a new alias.lookupAlias
(IContext context, Object key) Retrieve the appropriateAliasValue
based on a simple key.void
removeAlias
(IContext context, Object key) Removes an alias previously created.Methods inherited from interface com.webmethods.portal.system.IComponent
getComponentData, getComponentName, getComponentProvider, getURI, isInitialized, setComponentData, setComponentProvider
Methods inherited from interface com.webmethods.portal.system.init.IInitializable
init, shutdown
-
Method Details
-
createAlias
void createAlias(IContext context, Object source, Object target, String params, boolean isSystem) throws BizException This will create a new alias. The source can be thought of as the 'key', and it is what will be passed in to subsequent calls to
lookupAlias(com.webmethods.portal.bizPolicy.IContext, java.lang.Object)
to retrieve theAliasValue
which will represent the target.Paramaters are rarely used. They are important when in the context of the web application, you want to redirect to a resource and append some extra paramaters to the url. They should be in the form of
name=value&name2=value2
IsSystem specifies extra restrictions placed upon this alias. If this is set to true, then this alias can not be removed through the alias administration portlet, and will require an administrator invoking apis directly to remove this alias.
- Parameters:
context
- Command context (user state information).source
- either a String,IURI
orIThingID
target
- either a String,IURI
orIThingID
params
- optional paramater listisSystem
- whether this is a protected system alias- Throws:
BizException
- See Also:
-
IAliasCache
AliasValue
-
lookupAlias
Retrieve the appropriateAliasValue
based on a simple key. The key is 'object' passed in from a previous call tocreateAlias(com.webmethods.portal.bizPolicy.IContext, java.lang.Object, java.lang.Object, java.lang.String, boolean)
. If an alias is found, you can get the 'target' by callingAliasValue#getValue
. Other information is also available on theAliasValue
.- Parameters:
context
- Command context (user state information).key
- an arbitary key that may be aIURI
or a String- Returns:
- the
AliasValue
if found, NULL otherwise - Throws:
BizException
-
removeAlias
Removes an alias previously created. The key is 'object' passed in from a previous call tocreateAlias(com.webmethods.portal.bizPolicy.IContext, java.lang.Object, java.lang.Object, java.lang.String, boolean)
. Note, if this alias was created as a 'system' alias, then you will not have access rights to remove it, unless you first disable theITraits
on theIContext
.- Parameters:
context
- Command context (user state information).key
- an arbitary key that may be aIURI
or a String- Throws:
BizException
-