WebLogic Integration


com.bea.wlai.common
Class ApplicationViewDescriptor

java.lang.Object
  |
  +--com.bea.wlai.common.AbstractDescriptor
        |
        +--com.bea.wlai.common.ApplicationViewDescriptor

public class ApplicationViewDescriptor
extends AbstractDescriptor
implements IApplicationViewDescriptor

Represents the metadata for an ApplicationView (e.g. its events, services, name, namespace, etc.)

Author:
Copyright © 2000, 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
Serialized Form

Constructor Summary
ApplicationViewDescriptor(java.lang.String name)
          Construct a new ApplicationViewDescriptor with the given name.
ApplicationViewDescriptor(java.lang.String name, java.lang.String description)
          Construct a new ApplicationViewDescriptor with the given name and description.
 
Method Summary
 IEventDescriptor addEvent(java.lang.String eventName)
          Add an event to this application view.
 IServiceDescriptor addService(java.lang.String serviceName)
          Add a service to this application view.
 boolean equals(java.lang.Object obj)
          Compare this object to the given object and determine if they are equal.
 boolean eventExists(java.lang.String name)
          Indicates whether the event with the given name exists in this IApplicationViewDescriptor object.
 void fromXML(IDocument doc)
          Extract the data for this descriptor from the given IDocument instance, replacing all contents of the current descriptor with the new data.
 java.security.acl.Acl getAcl()
          Returns the access control list for this application view.
 IConnectionFactoryDescriptor getConnectionFactoryDescriptor()
          Get the IConnectionFactoryDescriptor that represents the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
 java.lang.String getConnectionFactoryJNDIName()
          Get the JNDI name for the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
 java.lang.String getConnectionFactoryNameString()
          Get the name for the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
 IEventDescriptor getEvent(java.lang.String name)
          Gets the event with the given name from this IApplicationViewDescriptor object.
 java.lang.String getEventRouterURL()
          Return the URL of the event router that will receive any event subscriptions for this IApplicationViewDescriptor.
 INamespace getParentNamespace()
          Get this descriptor's parent namespace.
 java.util.Set getPrincipalsWithoutPermission(java.lang.String permissionStr)
          Gets a set of principals that have a given permission within this descriptors ACL.
 java.util.Set getPrincipalsWithPermission(java.lang.String permissionStr)
          Gets a set of principals that have a given permission within this descriptor's ACL.
 QualifiedName getQualifiedName()
          Return a QualifiedName representing this descriptor's name and parent namespace.
 IServiceDescriptor getService(java.lang.String name)
          Gets the service with the given name from this IApplicationViewDescriptor object.
 boolean grantPermission(java.lang.String principalName, java.lang.String permissionName)
          Grants a given permission to a principal (user or group) with the given name.
 boolean hasEvents()
          Indicates whether this IApplicationViewDescriptor has any events within it.
 boolean hasServices()
          Indicates whether this IApplicationViewDescriptor has any services within it.
 boolean isAsyncEnabled()
          Indicates whether the ApplicationView represented by this descriptor has been enabled for asynchronous service invocations.
 java.util.Iterator listEventNames()
          List the names of all event descriptors in this IApplicationViewDescriptor.
 java.util.Iterator listEvents()
          List all event descriptors in this IApplicationViewDescriptor.
 java.util.Iterator listServiceNames()
          List the names of all service descriptors in this IApplicationViewDescriptor.
 java.util.Iterator listServices()
          List all service descriptors in this IApplicationViewDescriptor.
static void main(java.lang.String[] args)
           
 void makeReadOnly()
          used to make this object immutable
 boolean ownsConnectionFactory()
           
 void removeAclEntryFromAcl(java.lang.String permission, java.lang.String principal, boolean negative)
          This method is used to remove an AclEntry from this object's ACL Caller should pass the boolean negative to indicate whether to remove the negative or not-negative entry for the given permission.
 IEventDescriptor removeEvent(java.lang.String name)
          Removes the event with the given name from this IApplicationViewDescriptor object.
 IServiceDescriptor removeService(java.lang.String name)
          Removes the service with the given name from this IApplicationViewDescriptor object.
 boolean revokePermission(java.lang.String principalName, java.lang.String permissionName)
          Revokes a given permission from a principal (user or group) with the given name.
 boolean serviceExists(java.lang.String name)
          Indicates whether the service with the given name exists in this IApplicationViewDescriptor object.
 void setAsyncEnabled(boolean enabled)
          Set whether the ApplicationView represented by this descriptor is enabled for asynchronous service invocations.
 void setConnectionFactoryDescriptor(IConnectionFactoryDescriptor cfDD)
          Set the IConnectionFactoryDescriptor that represents the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
 void setConnectionFactoryDescriptor(IConnectionFactoryDescriptor cfDD, boolean bOwns)
          Set the IConnectionFactoryDescriptor that represents the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
 void setConnectionFactoryJNDIName(java.lang.String jndiName)
          Set the JNDI name for the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
 void setConnectionFactoryNameString(java.lang.String name)
          Set the qualified name for the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
 void setEventRouterURL(java.lang.String url)
          Set the URL of the event router that will receive any event subscriptions for this IApplicationViewDescriptor.
 void setName(java.lang.String name)
          Set this descriptor's name.
 void setOwnsConnectionFactoryFlag(boolean bOwns)
          Sets the ownership flag for the connection factory; passing true indicates that the connection factory is solely owned by this object and it is free to do whatever it wants with the connection factory; false indicates that the connection factory is not solely owned by this application view.
 void setParentNamespace(INamespace parent)
          Set this descriptor's parent namespace.
 void toXML(IDocument doc)
          Output an XML representation of this descriptor into an IDocument instance.
 
Methods inherited from class com.bea.wlai.common.AbstractDescriptor
fromXML, fromXML, getDescription, getName, isReadOnly, setDescription, toXML, toXML
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationViewDescriptor

public ApplicationViewDescriptor(java.lang.String name)
                          throws java.lang.IllegalArgumentException
Construct a new ApplicationViewDescriptor with the given name.

ApplicationViewDescriptor

public ApplicationViewDescriptor(java.lang.String name,
                                 java.lang.String description)
                          throws java.lang.IllegalArgumentException
Construct a new ApplicationViewDescriptor with the given name and description.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Compare this object to the given object and determine if they are equal. For ApplicationView descriptors, this means that both objects match in name and parent namespace, they contain the same events and services, use the same connection factory, talk to the same event router, etc.

Returns:
True if the two objects are equal, false otherwise.
Overrides:
equals in class java.lang.Object

getQualifiedName

public QualifiedName getQualifiedName()
Return a QualifiedName representing this descriptor's name and parent namespace.

Returns:
A QualifiedName representing the descriptor's name and parent namespace. This should never be null.

setName

public void setName(java.lang.String name)
             throws java.lang.IllegalArgumentException
Set this descriptor's name. This method does not change the namespace to which the descriptor belongs, just its name.

Parameters:
name - The new name for this descriptor. Null is not allowed.
Throws:
java.lang.IllegalArgumentException - If the name param is null.
Overrides:
setName in class AbstractDescriptor

getParentNamespace

public INamespace getParentNamespace()
Get this descriptor's parent namespace.

Returns:
This descriptor's parent namespace. This can only be null when the namespace is the root namespace, or the object does not yet exist in a namespace.

setParentNamespace

public void setParentNamespace(INamespace parent)
Set this descriptor's parent namespace.

Parameters:
parent - This descriptor's parent namespace. Setting this parameter to null should be avoided, and indicates that the descriptor has no parent.

hasEvents

public boolean hasEvents()
Indicates whether this IApplicationViewDescriptor has any events within it.
Specified by:
hasEvents in interface IApplicationViewDescriptor

Returns:
True if this descriptor contains any event descriptors, false otherwise.

addEvent

public IEventDescriptor addEvent(java.lang.String eventName)
                          throws java.lang.IllegalArgumentException,
                                 DuplicateNameException
Add an event to this application view. This method checks to ensure that no event already exists in this IApplicationViewDescriptor with the same name.
Specified by:
addEvent in interface IApplicationViewDescriptor

Parameters:
eventName - The name of the event to be added. Null is not allowed, and this event's name cannot match any event already in this IApplicationViewDescriptor instance.
Returns:
An IEventDescriptor representing the new event type added.
Throws:
java.lang.IllegalArgumentException - If the event param is null.
DuplicateNameException - If the event has the same name as an event that already exists in this IApplicationViewDescriptor object.

removeEvent

public IEventDescriptor removeEvent(java.lang.String name)
Removes the event with the given name from this IApplicationViewDescriptor object.
Specified by:
removeEvent in interface IApplicationViewDescriptor

Parameters:
name - The name of the event descriptor to remove.
Returns:
The IEventDescriptor object removed, or null if none was removed.

eventExists

public boolean eventExists(java.lang.String name)
Indicates whether the event with the given name exists in this IApplicationViewDescriptor object.
Specified by:
eventExists in interface IApplicationViewDescriptor

Parameters:
name - The name of the event descriptor to look for.
Returns:
True if an event descriptor of the given name exists, false otherwise.

getEvent

public IEventDescriptor getEvent(java.lang.String name)
Gets the event with the given name from this IApplicationViewDescriptor object.
Specified by:
getEvent in interface IApplicationViewDescriptor

Parameters:
name - The name of the event descriptor to get.
Returns:
The IEventDescriptor object with the given name if it exists, null otherwise.

listEvents

public java.util.Iterator listEvents()
List all event descriptors in this IApplicationViewDescriptor.
Specified by:
listEvents in interface IApplicationViewDescriptor

Returns:
An iterator over all event descriptors (IEventDescriptor) in this IApplicationViewDescriptor.

listEventNames

public java.util.Iterator listEventNames()
List the names of all event descriptors in this IApplicationViewDescriptor.
Specified by:
listEventNames in interface IApplicationViewDescriptor

Returns:
An iterator over all event descriptors names (String) in this IApplicationViewDescriptor.

hasServices

public boolean hasServices()
Indicates whether this IApplicationViewDescriptor has any services within it.
Specified by:
hasServices in interface IApplicationViewDescriptor

Returns:
True if this descriptor contains any service descriptors, false otherwise.

addService

public IServiceDescriptor addService(java.lang.String serviceName)
                              throws java.lang.IllegalArgumentException,
                                     DuplicateNameException
Add a service to this application view. This method checks to ensure that no service already exists in this IApplicationViewDescriptor with the same name.
Specified by:
addService in interface IApplicationViewDescriptor

Parameters:
serviceName - The name of the service to add. Null is not allowed, and this service's name cannot match any service already in this IApplicationViewDescriptor instance.
Returns:
An IServiceDescriptor representing the new service just added.
Throws:
java.lang.IllegalArgumentException - If the service param is null.
DuplicateNameException - If the service has the same name as a service that already exists in this IApplicationViewDescriptor object.

removeService

public IServiceDescriptor removeService(java.lang.String name)
Removes the service with the given name from this IApplicationViewDescriptor object.
Specified by:
removeService in interface IApplicationViewDescriptor

Parameters:
name - The name of the service descriptor to remove.
Returns:
The IServiceDescriptor object removed, or null if none was removed.

serviceExists

public boolean serviceExists(java.lang.String name)
Indicates whether the service with the given name exists in this IApplicationViewDescriptor object.
Specified by:
serviceExists in interface IApplicationViewDescriptor

Parameters:
name - The name of the service descriptor to look for.
Returns:
True if a service descriptor of the given name exists, false otherwise.

getService

public IServiceDescriptor getService(java.lang.String name)
Gets the service with the given name from this IApplicationViewDescriptor object.
Specified by:
getService in interface IApplicationViewDescriptor

Parameters:
name - The name of the service descriptor to get.
Returns:
The IServiceDescriptor object with the given name if it exists, null otherwise.

listServices

public java.util.Iterator listServices()
List all service descriptors in this IApplicationViewDescriptor.
Specified by:
listServices in interface IApplicationViewDescriptor

Returns:
An iterator over all service descriptors (IServiceDescriptor) in this IApplicationViewDescriptor.

listServiceNames

public java.util.Iterator listServiceNames()
List the names of all service descriptors in this IApplicationViewDescriptor.
Specified by:
listServiceNames in interface IApplicationViewDescriptor

Returns:
An iterator over all service descriptors names (String) in this IApplicationViewDescriptor.

getEventRouterURL

public java.lang.String getEventRouterURL()
Return the URL of the event router that will receive any event subscriptions for this IApplicationViewDescriptor.
Specified by:
getEventRouterURL in interface IApplicationViewDescriptor

Returns:
The URL of the event router that will receive any event subscriptions for this IApplicationViewDescriptor, or null if no event router is known.

setEventRouterURL

public void setEventRouterURL(java.lang.String url)
Set the URL of the event router that will receive any event subscriptions for this IApplicationViewDescriptor.
Specified by:
setEventRouterURL in interface IApplicationViewDescriptor

Parameters:
url - A URL string representing the event router, or null if no event router is known.

getConnectionFactoryDescriptor

public IConnectionFactoryDescriptor getConnectionFactoryDescriptor()
Get the IConnectionFactoryDescriptor that represents the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
Specified by:
getConnectionFactoryDescriptor in interface IApplicationViewDescriptor

Returns:
The connection factory descriptor for this descriptor, or null if none has been set.

setConnectionFactoryDescriptor

public void setConnectionFactoryDescriptor(IConnectionFactoryDescriptor cfDD)
Set the IConnectionFactoryDescriptor that represents the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
Specified by:
setConnectionFactoryDescriptor in interface IApplicationViewDescriptor

Parameters:
cfDD - The connection factory descriptor for this descriptor, or null if none is known. By default, it is assumed that this application view is the sole owner of the connection factory.

setConnectionFactoryDescriptor

public void setConnectionFactoryDescriptor(IConnectionFactoryDescriptor cfDD,
                                           boolean bOwns)
Set the IConnectionFactoryDescriptor that represents the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
Specified by:
setConnectionFactoryDescriptor in interface IApplicationViewDescriptor

Parameters:
cfDD - The connection factory descriptor for this descriptor, or null if none is known.
bOwns - - a flag to indicate if the connection factory for this application view is owned by this application view; this flag is set to true by default; passing false indicates that the connection factory is used by other applications and is not solely owned by this application view

setOwnsConnectionFactoryFlag

public void setOwnsConnectionFactoryFlag(boolean bOwns)
Sets the ownership flag for the connection factory; passing true indicates that the connection factory is solely owned by this object and it is free to do whatever it wants with the connection factory; false indicates that the connection factory is not solely owned by this application view.
Specified by:
setOwnsConnectionFactoryFlag in interface IApplicationViewDescriptor


ownsConnectionFactory

public boolean ownsConnectionFactory()
Specified by:
ownsConnectionFactory in interface IApplicationViewDescriptor

Returns:
true if the connection factory referenced by this application view is owned solely by this application view, false not solely referenced by this application view.

getConnectionFactoryNameString

public java.lang.String getConnectionFactoryNameString()
Get the name for the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
Specified by:
getConnectionFactoryNameString in interface IApplicationViewDescriptor

Returns:
The qualified name (as a String) of the connection factory, or null if none has been set.

setConnectionFactoryNameString

public void setConnectionFactoryNameString(java.lang.String name)
Set the qualified name for the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
Specified by:
setConnectionFactoryNameString in interface IApplicationViewDescriptor

Parameters:
name - The qualified name (as a String) of the connection factory.

getConnectionFactoryJNDIName

public java.lang.String getConnectionFactoryJNDIName()
Get the JNDI name for the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
Specified by:
getConnectionFactoryJNDIName in interface IApplicationViewDescriptor

Returns:
The JNDI name of the connection factory, or null if none has been set.

setConnectionFactoryJNDIName

public void setConnectionFactoryJNDIName(java.lang.String jndiName)
Set the JNDI name for the connection factory that will be used at runtime to fulfill connection requests for ApplicationViews based off this IApplicationViewDescriptor.
Specified by:
setConnectionFactoryJNDIName in interface IApplicationViewDescriptor

Parameters:
jndiName - The JNDI name of the connection factory, or null if none is known.

isAsyncEnabled

public boolean isAsyncEnabled()
Indicates whether the ApplicationView represented by this descriptor has been enabled for asynchronous service invocations. If so, clients of ApplicationView objects based off this descriptor will be allowed to call the ApplicationView.invokeServiceAsync method. Otherwise, the method call will throw an exception.
Specified by:
isAsyncEnabled in interface IApplicationViewDescriptor

Returns:
True if async service invocations are enabled, false otherwise.

setAsyncEnabled

public void setAsyncEnabled(boolean enabled)
Set whether the ApplicationView represented by this descriptor is enabled for asynchronous service invocations. If so, clients of ApplicationView objects based off this descriptor will be allowed to call the ApplicationView.invokeServiceAsync method. Otherwise, the method call will throw an exception.
Specified by:
setAsyncEnabled in interface IApplicationViewDescriptor

Parameters:
enabled - Pass true if async service invocations are to be enabled, false otherwise.

getAcl

public java.security.acl.Acl getAcl()
Returns the access control list for this application view. This method is useful when retrieving access information from the application view. To add/modify permissions, use the grantPermission and revokePermission methods.
Specified by:
getAcl in interface IApplicationViewDescriptor

Returns:
The access control list for this application view. This should never be null.

grantPermission

public boolean grantPermission(java.lang.String principalName,
                               java.lang.String permissionName)
Grants a given permission to a principal (user or group) with the given name. To grant permissions do the following. IApplicationViewDescriptor avd = ; // Grant write permission for user 'Joe' avd.grantPermission("Joe", IApplicationViewDescriptor.WRITE_PERMISSION);
Specified by:
grantPermission in interface IApplicationViewDescriptor

Parameters:
principalName - The name of the principal (user or group) for which the permission is being granted.
permissionName - The name of the permission that is being granted.
Returns:
True if the permission was granted, false otherwise.

revokePermission

public boolean revokePermission(java.lang.String principalName,
                                java.lang.String permissionName)
Revokes a given permission from a principal (user or group) with the given name. To revoke permissions do the following. ApplicationViewDescriptor avd = ; // Revoke read permission for group 'PowerUsers' avd.revokePermission("PowerUsers", ApplicationViewDescriptor.READ_PERMISSION);
Specified by:
revokePermission in interface IApplicationViewDescriptor

Parameters:
principalName - The name of the principal (user or group) for which the permission is being revoked.
permissionName - The name of the permission that is being revoked.
Returns:
True if the permission was revoked, false otherwise.

getPrincipalsWithPermission

public java.util.Set getPrincipalsWithPermission(java.lang.String permissionStr)
Gets a set of principals that have a given permission within this descriptor's ACL.
Specified by:
getPrincipalsWithPermission in interface IApplicationViewDescriptor

Parameters:
permissionName - The name of the permission to search for.
Returns:
A set of prinicipals (users or groups) that have the given permission within this descriptor's ACL.

getPrincipalsWithoutPermission

public java.util.Set getPrincipalsWithoutPermission(java.lang.String permissionStr)
Gets a set of principals that have a given permission within this descriptors ACL.
Specified by:
getPrincipalsWithoutPermission in interface IApplicationViewDescriptor

Parameters:
permissionName - The name of the permission to search for.
Returns:
A set of prinicipals (users or groups) that have the given permission within this descriptor's ACL.

removeAclEntryFromAcl

public void removeAclEntryFromAcl(java.lang.String permission,
                                  java.lang.String principal,
                                  boolean negative)
This method is used to remove an AclEntry from this object's ACL Caller should pass the boolean negative to indicate whether to remove the negative or not-negative entry for the given permission. (true = negative, false = not-negative) This method is used for interface logic, so that if the user decides to revoke a previously granted permission, or vise-a-versa, the old permission can be removed from the acl entry list.
Specified by:
removeAclEntryFromAcl in interface IApplicationViewDescriptor

Parameters:
permission - is the read/write permission
principal - is the principle's name
negative - should be true = negative, false = not-negative

toXML

public void toXML(IDocument doc)
           throws DocumentException
Output an XML representation of this descriptor into an IDocument instance.

Parameters:
doc - An IDocument instance to receive the data for this descriptor.
Throws:
DocumentException - If any error occurs while processing the XML for this descriptor.
Overrides:
toXML in class AbstractDescriptor

fromXML

public void fromXML(IDocument doc)
             throws DocumentException
Extract the data for this descriptor from the given IDocument instance, replacing all contents of the current descriptor with the new data.

Parameters:
doc - An IDocument instance from which the data for this descriptor will be extracted.
Throws:
DocumentException - If any error occurs while processing the XML for this descriptor.
Overrides:
fromXML in class AbstractDescriptor

main

public static void main(java.lang.String[] args)


makeReadOnly

public void makeReadOnly()
used to make this object immutable

Overrides:
makeReadOnly in class AbstractDescriptor

WebLogic Integration

WebLogic Integration (WLI)