You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/04/26 20:50:06 UTC
svn commit: rev 10287 - in incubator/directory/rms/trunk/je/src/java/org/apache/rms/je: . permissions
Author: akarasulu
Date: Mon Apr 26 11:50:05 2004
New Revision: 10287
Added:
incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/JeRmsException.java (contents, props changed)
incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitor.java (contents, props changed)
incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitorAdapter.java (contents, props changed)
incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionDAOMonitor.java (contents, props changed)
Modified:
incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/JeBitPermissionDAO.java
Log:
Commit changes ...
o added monitor interface for BitPermissionDAO
o added monitor adapter for BitPermissionDAO
o added callbacks within BitPermissionDAO for the monitor
o added logging monitor impl based on commons-logging for BitPermissionDAO
To do items ...
o finish off logging monitor
Added: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/JeRmsException.java
==============================================================================
--- (empty file)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/JeRmsException.java Mon Apr 26 11:50:05 2004
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.rms.je ;
+
+
+import org.apache.rms.RmsException ;
+import com.sleepycat.je.OperationStatus ;
+
+
+/**
+ * A JE specific Rms exception.
+ *
+ * @todo need to make message and trace show the status
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class JeRmsException extends RmsException
+{
+ /** the operation status if available - may be null */
+ private final OperationStatus status ;
+
+
+ // -----------------------------------------------------------------------
+ // C O N S T R U C T O R S
+ // -----------------------------------------------------------------------
+
+
+ /**
+ * Creates an exception with an associated operation status.
+ *
+ * @param status the operation status
+ */
+ public JeRmsException( OperationStatus status )
+ {
+ this.status = status ;
+ }
+
+
+ /**
+ * Creates a an exception with a message.
+ *
+ * @param status the operation status
+ * @param message a message String indicating the problem
+ */
+ public JeRmsException( OperationStatus status, String message )
+ {
+ super( message ) ;
+ this.status = status ;
+ }
+
+
+ /**
+ * Creates a nested exception wrapping another throwable.
+ *
+ * @param status the operation status
+ * @param nested the throwable wrapped by this RmsException.
+ */
+ public JeRmsException( OperationStatus status, Throwable nested )
+ {
+ super( nested ) ;
+ this.status = status ;
+ }
+
+
+ /**
+ * Creates a nested exception wrapping another throwable with a message.
+ *
+ * @param status the operation status
+ * @param message a message String indicating the problem
+ * @param nested the throwable wrapped by this RmsException.
+ */
+ public JeRmsException( OperationStatus status, String message, Throwable nested )
+ {
+ super( message, nested ) ;
+ this.status = status ;
+ }
+
+
+ /**
+ * Creates a simple exception with no message.
+ */
+ public JeRmsException()
+ {
+ super() ;
+ this.status = null ;
+ }
+
+ /**
+ * Creates a an exception with a message.
+ *
+ * @param message a message String indicating the problem
+ */
+ public JeRmsException( String message )
+ {
+ super( message ) ;
+ this.status = null ;
+ }
+
+
+ /**
+ * Creates a nested exception wrapping another throwable.
+ *
+ * @param nested the throwable wrapped by this RmsException.
+ */
+ public JeRmsException( Throwable nested )
+ {
+ super( nested ) ;
+ this.status = null ;
+ }
+
+ /**
+ * Creates a nested exception wrapping another throwable with a message.
+ *
+ * @param message a message String indicating the problem
+ * @param nested the throwable wrapped by this RmsException.
+ */
+ public JeRmsException( String message, Throwable nested )
+ {
+ super( message, nested ) ;
+ this.status = null ;
+ }
+
+
+ // -----------------------------------------------------------------------
+ // Status Accessor
+ // -----------------------------------------------------------------------
+
+
+ /**
+ * Gets the status of the operation that resulted in this exception.
+ *
+ * @return the status if relavent or null
+ */
+ public OperationStatus getStatus()
+ {
+ return status ;
+ }
+}
Added: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitor.java Mon Apr 26 11:50:05 2004
@@ -0,0 +1,325 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.rms.je.permissions ;
+
+
+import java.util.Iterator ;
+
+import org.apache.rms.BitPermission ;
+
+
+/**
+ * A monitor interface for BitPermission data access object operations.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface BitPermissionDAOMonitor
+{
+ /**
+ * Monitors events where the DAO fails to create a new BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ void failedOnCreate( BitPermissionDAO dao, String appName, String name,
+ Throwable fault ) ;
+
+ /**
+ * Monitors events where the DAO fails to create a new BitPermission
+ * because the permission for the application by the name specified
+ * already exists.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ void permissionExists( BitPermissionDAO dao, String appName,
+ String name ) ;
+
+ /**
+ * Monitors event where the DAO creates a new BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ void permissionCreated( BitPermissionDAO dao, String appName,
+ String name ) ;
+
+ /**
+ * Monitors the successful deletion of an application's BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ void permissionDeleted( BitPermissionDAO dao, String appName,
+ String name ) ;
+
+ /**
+ * Monitors failures to delete a BitPermission due to DAO failures.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ void deleteFailed( BitPermissionDAO dao, String appName, String name,
+ Throwable fault ) ;
+
+ /**
+ * Monitors events where an operation on an non-existant BitPermission
+ * was attempted.
+ *
+ * @param dao the data access object that failed
+ * @param op the operation that was attempted
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ void permissionDoesNotExist( BitPermissionDAO dao, String op,
+ String appName, String name ) ;
+
+
+ /**
+ * Monitors events where an operation on an non-existant BitPermission
+ * was attempted.
+ *
+ * @param dao the data access object that failed
+ * @param op the operation that was attempted
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ */
+ void permissionDoesNotExist( JeBitPermissionDAO dao, String op,
+ String appName, int index ) ;
+
+ /**
+ * Monitors events where the rename of a BitPermission failed.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param newName the new name for the permission
+ * @param fault the fault that caused the failure
+ */
+ void failedOnRename( JeBitPermissionDAO dao, String appName, String name,
+ String newName, Throwable fault ) ;
+
+ /**
+ * Monitors events where the a BitPermission was successfully renamed.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param newName the new name for the permission
+ */
+ void permissionRenamed( JeBitPermissionDAO dao, String appName,
+ String name, String newName ) ;
+
+ /**
+ * Monitors the successful lookup event of a permission's index.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param index the bit index of the permission
+ */
+ void indexLookedUp( JeBitPermissionDAO dao, String appName, String name,
+ int index ) ;
+
+ /**
+ * Monitors events where a permission fails on lookup.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ void failedPermissionLookup( JeBitPermissionDAO dao, String appName,
+ String name, Throwable fault ) ;
+
+ /**
+ * Monitors the successful lookup of a permission by name or by index.
+ *
+ * @param dao the data access object that failed
+ * @param perm the permission object looked up
+ */
+ void permissionLookedUp( JeBitPermissionDAO dao, BitPermission perm ) ;
+
+ /**
+ * Monitors events where the lookup of a permissions name by index fails.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ * @param fault the fault that caused the failure
+ */
+ void failedNameLookup( JeBitPermissionDAO dao, String appName,
+ int index, Throwable fault ) ;
+
+ /**
+ * Monitors successful events for looking up the name of a permission by
+ * index.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param index the bit index of the permission
+ */
+ void nameLookedUP( JeBitPermissionDAO dao, String appName,
+ String name, int index ) ;
+
+ /**
+ * Monitors events where the lookup of a permission object by index fails.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ * @param fault the fault that caused the failure
+ */
+ void failedPermissionLookup( JeBitPermissionDAO dao, String appName,
+ int index, Throwable fault ) ;
+
+ /**
+ * Monitors events where a cleanup operation on a resource fails.
+ *
+ * @param dao the data access object that failed
+ * @param op the cleanup operation that failed
+ * @param resource the resource being cleanup
+ * @param fault the fault that caused the failure
+ */
+ void failedOnCleanupOperation( JeBitPermissionDAO dao, String op,
+ Object resource, Throwable fault ) ;
+
+ /**
+ * Monitors events where a cleanup operation occured.
+ *
+ * @param dao the data access object that failed
+ * @param op the cleanup operation that failed
+ * @param resource the resource being cleanup
+ */
+ void cleanedUp( JeBitPermissionDAO dao, String op, Object resource ) ;
+
+ /**
+ * Monitors events where an empty list is returned on a permission [name]
+ * listing.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if
+ * the Iterator perms
+ */
+ void listingEmpty( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames ) ;
+
+ /**
+ * Monitors events when an Iterator over the list of permission names is
+ * sucessful.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ */
+ void listingNamesOnly( JeBitPermissionDAO dao, Iterator listing,
+ String appName ) ;
+
+ /**
+ * Monitors events when an Iterator over the list of permission objects is
+ * sucessful.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ */
+ void listingPermissions( JeBitPermissionDAO dao, Iterator listing,
+ String appName ) ;
+
+ /**
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if
+ * the Iterator perms
+ * @param fault the fault that caused the failure
+ */
+ void failedListing( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames, Throwable fault ) ;
+
+ /**
+ * Monitors the successful prefetch of the next permission name.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param retVal the next value to be returned
+ * @param prefetched the prefetched value if this Iterator prefetches the
+ * next value
+ */
+ void successOnNextName( JeBitPermissionDAO dao, Iterator listing,
+ String appName, Object retVal,
+ Object prefetched ) ;
+
+
+ /**
+ * Monitors the successful prefetch of the next permission.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param retVal the next value to be returned
+ * @param prefetched the prefetched value if this Iterator prefetches the
+ * next value
+ */
+ void successOnNextPerm( JeBitPermissionDAO dao, Iterator listing,
+ String appName, Object retVal,
+ Object prefetched ) ;
+
+ /**
+ * Monitors events where the iterator fails to return the next element, or
+ * fails to prefetch an element to return on a subsequent next method call.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if
+ * the Iterator perms
+ * @param retVal the next value to be returned
+ * @param fault the fault that caused the failure
+ */
+ void iteratorFailure( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames, Object retVal,
+ Throwable fault ) ;
+
+ /**
+ * Monitors events where the iterator runs out of elements to prefetch.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if
+ * the Iterator perms
+ * @param lastVal the last value to be returned on the subsequent (final)
+ * next() call
+ */
+ void iteratorExhausted( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames,
+ Object lastVal ) ;
+}
Added: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitorAdapter.java
==============================================================================
--- (empty file)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/BitPermissionDAOMonitorAdapter.java Mon Apr 26 11:50:05 2004
@@ -0,0 +1,409 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.rms.je.permissions ;
+
+
+import java.util.Iterator ;
+import org.apache.rms.BitPermission ;
+
+
+/**
+ * A do nothing monitor for BitPermission data access objects. This monitor
+ * will be cautious with exceptions and dump them to stderr as a bare minimum.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class BitPermissionDAOMonitorAdapter implements BitPermissionDAOMonitor
+{
+ /**
+ * Monitors events where the DAO fails to create a new BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedOnCreate( BitPermissionDAO dao, String appName,
+ String name, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where the DAO fails to create a new BitPermission
+ * because the permission for the application by
+ * the name specified already exists.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ public void permissionExists( BitPermissionDAO dao, String appName,
+ String name )
+ {
+ }
+
+
+ /**
+ * Monitors event where the DAO creates a new BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ public void permissionCreated( BitPermissionDAO dao, String appName,
+ String name )
+ {
+ }
+
+
+ /**
+ * Monitors the successful deletion of an application's BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ public void permissionDeleted( BitPermissionDAO dao, String appName,
+ String name )
+ {
+ }
+
+
+ /**
+ * Monitors failures to delete a BitPermission due to DAO failures.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void deleteFailed( BitPermissionDAO dao, String appName,
+ String name, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where an operation on an non-existant BitPermission
+ * was attempted.
+ *
+ * @param dao the data access object that failed
+ * @param op the operation that was attempted
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ public void permissionDoesNotExist( BitPermissionDAO dao, String op,
+ String appName, String name )
+ {
+ }
+
+
+ /**
+ * Monitors events where an operation on an non-existant BitPermission
+ * was attempted.
+ *
+ * @param dao the data access object that failed
+ * @param op the operation that was attempted
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ */
+ public void permissionDoesNotExist( JeBitPermissionDAO dao, String op,
+ String appName, int index )
+ {
+ }
+
+
+ /**
+ * Monitors events where the rename of a BitPermission failed.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param newName the new name for the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedOnRename( JeBitPermissionDAO dao, String appName,
+ String name, String newName, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where the a BitPermission was successfully renamed.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param newName the new name for the permission
+ */
+ public void permissionRenamed( JeBitPermissionDAO dao, String appName,
+ String name, String newName )
+ {
+ }
+
+
+ /**
+ * Monitors the successful lookup event of a permission's index.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param index the bit index of the permission
+ */
+ public void indexLookedUp( JeBitPermissionDAO dao, String appName,
+ String name, int index )
+ {
+ }
+
+
+ /**
+ * Monitors events where a permission fails on lookup.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedPermissionLookup( JeBitPermissionDAO dao, String appName,
+ String name, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors the successful lookup of a permission by name or by index.
+ *
+ * @param dao the data access object that failed
+ * @param perm the permission object looked up
+ */
+ public void permissionLookedUp( JeBitPermissionDAO dao,
+ BitPermission perm )
+ {
+ }
+
+
+ /**
+ * Monitors events where the lookup of a permissions name by index fails.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedNameLookup( JeBitPermissionDAO dao, String appName,
+ int index, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors successful events for looking up the name of a permission by
+ * index.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param index the bit index of the permission
+ */
+ public void nameLookedUP( JeBitPermissionDAO dao, String appName,
+ String name, int index )
+ {
+ }
+
+
+ /**
+ * Monitors events where the lookup of a permission object by index fails.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedPermissionLookup( JeBitPermissionDAO dao,
+ String appName, int index,
+ Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where a cleanup operation on a resource fails.
+ *
+ * @param dao the data access object that failed
+ * @param op the cleanup operation that failed
+ * @param resource the resource being cleanup
+ * @param fault the fault that caused the failure
+ */
+ public void failedOnCleanupOperation( JeBitPermissionDAO dao, String op,
+ Object resource, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where a cleanup operation occured.
+ *
+ * @param dao the data access object that failed
+ * @param op the cleanup operation that failed
+ * @param resource the resource being cleanup
+ */
+ public void cleanedUp( JeBitPermissionDAO dao, String op, Object resource )
+ {
+ }
+
+
+ /**
+ * Monitors events where an empty list is returned on a permission [name]
+ * listing.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if the
+ * Iterator perms
+ */
+ public void listingEmpty( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames )
+ {
+ }
+
+
+ /**
+ * Monitors events when an Iterator over the list of permission names
+ * is sucessful.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ */
+ public void listingNamesOnly( JeBitPermissionDAO dao, Iterator listing,
+ String appName )
+ {
+ }
+
+
+ /**
+ * Monitors events when an Iterator over the list of permission objects
+ * is sucessful.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ */
+ public void listingPermissions( JeBitPermissionDAO dao, Iterator listing,
+ String appName )
+ {
+ }
+
+
+ /**
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if
+ * the Iterator perms
+ * @param fault the fault that caused the failure
+ */
+ public void failedListing( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames,
+ Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors the successful prefetch of the next permission name.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param retVal the next value to be returned
+ * @param prefetched the prefetched value if this Iterator prefetches
+ * the next value
+ */
+ public void successOnNextName( JeBitPermissionDAO dao, Iterator listing,
+ String appName, Object retVal,
+ Object prefetched )
+ {
+ }
+
+
+ /**
+ * Monitors the successful prefetch of the next permission.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param retVal the next value to be returned
+ * @param prefetched the prefetched value if this Iterator prefetches
+ * the next value
+ */
+ public void successOnNextPerm( JeBitPermissionDAO dao, Iterator listing,
+ String appName, Object retVal,
+ Object prefetched )
+ {
+ }
+
+
+ /**
+ * Monitors events where the iterator fails to return the next element,
+ * or fails to prefetch an element to return on a subsequent next method
+ * call.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if the
+ * Iterator perms
+ * @param retVal the next value to be returned
+ * @param fault the fault that caused the failure
+ */
+ public void iteratorFailure( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames,
+ Object retVal, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where the iterator runs out of elements to prefetch.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if
+ * the Iterator perms
+ * @param lastVal the last value to be returned on the subsequent
+ * (final) next() call
+ */
+ public void iteratorExhausted( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames,
+ Object lastVal )
+ {
+ }
+}
Modified: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/JeBitPermissionDAO.java
==============================================================================
--- incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/JeBitPermissionDAO.java (original)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/JeBitPermissionDAO.java Mon Apr 26 11:50:05 2004
@@ -19,7 +19,6 @@
import com.sleepycat.je.* ;
-
import java.util.List ;
import java.util.Iterator ;
@@ -31,6 +30,7 @@
import org.apache.rms.je.JeUtils ;
import org.apache.rms.RmsException ;
import org.apache.rms.BitPermission ;
+import org.apache.rms.je.JeRmsException ;
import org.apache.rms.je.sequence.Sequence ;
@@ -65,6 +65,8 @@
private SecondaryDatabase byAppName ;
/** the secondary database keyed by permission name*/
private SecondaryDatabase byPermName ;
+ /** the monitor notified on important DAO operations */
+ private BitPermissionDAOMonitor monitor ;
// ----------------------------------------------------------------------
@@ -151,19 +153,24 @@
}
catch ( IOException e )
{
+ monitor.failedOnCreate( this, appName, name, e ) ;
throw new RmsException( e ) ;
}
catch ( DatabaseException e )
{
+ monitor.failedOnCreate( this, appName, name, e ) ;
throw new RmsException( e ) ;
}
if ( status == OperationStatus.SUCCESS )
{
+ monitor.permissionCreated( this, appName, name ); ;
return index ;
}
- throw new RmsException( "Create operation failed with status: " +
+ monitor.permissionExists( this, appName, name ) ;
+ throw new JeRmsException( status,
+ "Create operation failed with status: " +
status.toString() ) ;
}
@@ -180,15 +187,33 @@
public void delete( String appName, String name ) throws RmsException
{
OperationStatus status = null ;
- DatabaseEntry key = getRow( appName, name, true ) ;
+ DatabaseEntry key = null ;
DatabaseEntry value = new DatabaseEntry() ;
try
{
+ key = getRow( appName, name, true ) ;
+ }
+ catch ( JeRmsException e )
+ {
+ if ( e.getStatus() == OperationStatus.NOTFOUND )
+ {
+ monitor.permissionDoesNotExist( this, "delete", appName, name ) ;
+ }
+
+ throw e ;
+ }
+
+ try
+ {
status = db.get( null, key, value, LockMode.DEFAULT ) ;
+
if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to get record for permission "
+ monitor.permissionDoesNotExist( this, "delete", appName,
+ name ) ;
+ throw new JeRmsException( status,
+ "failed to get record for permission "
+ name + " for application " + appName
+ " with status of " + status.toString() ) ;
}
@@ -196,7 +221,10 @@
status = db.delete( null, key ) ;
if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to delete permission "
+ monitor.permissionDoesNotExist( this, "delete", appName,
+ name ) ;
+ throw new JeRmsException( status,
+ "failed to delete permission "
+ name + " for application " + appName
+ " with status of " + status.toString() ) ;
}
@@ -206,8 +234,11 @@
}
catch ( DatabaseException e )
{
+ monitor.deleteFailed( this, appName, name, e ) ;
throw new RmsException( e ) ;
}
+
+ monitor.permissionDeleted( this, appName, name ) ;
}
@@ -225,76 +256,138 @@
public void rename( String appName, String name, String newName ) throws RmsException
{
OperationStatus status = null ;
- DatabaseEntry key = getRow( appName, name, true ) ;
+ DatabaseEntry key = null ;
DatabaseEntry value = new DatabaseEntry() ;
try
{
- db.get( null, key, value, LockMode.DEFAULT ) ;
+ key = getRow( appName, name, true ) ;
+ }
+ catch ( JeRmsException e )
+ {
+ if ( e.getStatus() == OperationStatus.NOTFOUND )
+ {
+ monitor.permissionDoesNotExist( this, "rename", appName, name ) ;
+ }
+
+ throw e ;
+ }
+
+ try
+ {
+ // Get the full data record from primary
+ status = db.get( null, key, value, LockMode.DEFAULT ) ;
+
+ // extract the index from the record
int index = BINDING.getPermissionIndex( value ) ;
+
+ // use index and new permission name to construct new data record
BINDING.objectToEntry( value, appName, newName, index ) ;
+
+ // put data record into primary overwriting the old data record
status = db.put( null, key, value ) ;
if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to rename permission "
+ RmsException e = new JeRmsException( status,
+ "failed to rename permission "
+ name + " to " + newName + " for application "
+ appName + " with status of " + status.toString() ) ;
+ monitor.failedOnRename( this, appName, name, newName, e ) ;
+ throw e ;
}
}
catch ( IOException e )
{
+ monitor.failedOnRename( this, appName, name, newName, e ) ;
throw new RmsException( e ) ;
}
catch ( DatabaseException e )
{
+ monitor.failedOnRename( this, appName, name, newName, e ) ;
throw new RmsException( e ) ;
}
+
+ monitor.permissionRenamed( this, appName, name, newName ) ;
}
/**
- * Gets the index of an application's permission.
+ * Gets an application's permission by name.
*
* @param appName the name of the application
- * @param name the name of the permission to get the index for
- * @return the bit index the permission occupies
+ * @param name the name of the permission to get
+ * @return the application's BitPermission
* @throws org.apache.rms.RmsException if there are failures accessing
* the backing store or the permission does not exist, or the application
* itself does not exist
*/
- public int getIndex( String appName, String name ) throws RmsException
+ public BitPermission getPermission( String appName, String name ) throws RmsException
{
- DatabaseEntry value = getRow( appName, name, false ) ;
- return BINDING.getPermissionIndex( value ) ;
+ BitPermission perm = null ;
+ DatabaseEntry entry = null ;
+
+ try
+ {
+ entry = getRow( appName, name, false ) ;
+ }
+ catch ( JeRmsException e )
+ {
+ if ( e.getStatus() == OperationStatus.NOTFOUND )
+ {
+ monitor.permissionDoesNotExist( this, "getPermission", appName,
+ name ) ;
+ }
+
+ throw e ;
+ }
+
+ try
+ {
+ perm = ( BitPermission ) BINDING.entryToObject( entry ) ;
+ }
+ catch ( IOException e )
+ {
+ monitor.failedPermissionLookup( this, appName, name, e ) ;
+ throw new RmsException( e ) ;
+ }
+
+ monitor.permissionLookedUp( this, perm ) ;
+ return perm ;
}
/**
- * Gets an application's permission by name.
+ * Gets the index of an application's permission.
*
* @param appName the name of the application
- * @param name the name of the permission to get
- * @return the application's BitPermission
+ * @param name the name of the permission to get the index for
+ * @return the bit index the permission occupies
* @throws org.apache.rms.RmsException if there are failures accessing
* the backing store or the permission does not exist, or the application
* itself does not exist
*/
- public BitPermission getPermission( String appName, String name ) throws RmsException
+ public int getIndex( String appName, String name ) throws RmsException
{
- BitPermission perm = null ;
- DatabaseEntry entry = getRow( appName, name, false ) ;
+ DatabaseEntry value = null ;
try
{
- perm = ( BitPermission ) BINDING.entryToObject( entry ) ;
+ value = getRow( appName, name, false ) ;
}
- catch ( IOException e )
+ catch ( JeRmsException e )
{
- throw new RmsException( e ) ;
+ if ( e.getStatus() == OperationStatus.NOTFOUND )
+ {
+ monitor.permissionDoesNotExist( this, "getIndex", appName, name ) ;
+ }
+
+ throw e ;
}
- return perm ;
+ int index = BINDING.getPermissionIndex( value ) ;
+ monitor.indexLookedUp( this, appName, name, index ) ;
+ return index ;
}
@@ -310,16 +403,35 @@
*/
public String getName( String appName, int index ) throws RmsException
{
- DatabaseEntry value = getRow( appName, index, false ) ;
+ String name = null ;
+ DatabaseEntry value = null ;
try
{
- return BINDING.getPermissionName( value ) ;
+ value = getRow( appName, name, false ) ;
+ }
+ catch ( JeRmsException e )
+ {
+ if ( e.getStatus() == OperationStatus.NOTFOUND )
+ {
+ monitor.permissionDoesNotExist( this, "getName", appName, name ) ;
+ }
+
+ throw e ;
+ }
+
+ try
+ {
+ name = BINDING.getPermissionName( value ) ;
}
catch ( IOException e )
{
+ monitor.failedNameLookup( this, appName, index, e ) ;
throw new RmsException( e ) ;
}
+
+ monitor.nameLookedUP( this, appName, name, index ) ;
+ return name ;
}
@@ -335,16 +447,35 @@
*/
public BitPermission getPermission( String appName, int index ) throws RmsException
{
- DatabaseEntry value = getRow( appName, index, false ) ;
+ BitPermission perm = null ;
+ DatabaseEntry value = null ;
+
+ try
+ {
+ value = getRow( appName, index, false ) ;
+ }
+ catch ( JeRmsException e )
+ {
+ if ( e.getStatus() == OperationStatus.NOTFOUND )
+ {
+ monitor.permissionDoesNotExist( this, "getIndex", appName, index ) ;
+ }
+
+ throw e ;
+ }
try
{
- return ( BitPermission ) BINDING.entryToObject( value ) ;
+ perm = ( BitPermission ) BINDING.entryToObject( value ) ;
}
catch ( IOException e )
{
+ monitor.failedPermissionLookup( this, appName, index, e ) ;
throw new RmsException( e ) ;
}
+
+ monitor.permissionLookedUp( this, perm ) ;
+ return perm ;
}
@@ -448,12 +579,14 @@
.getSearchKey( nameEntry, value, LockMode.DEFAULT ) ;
if ( status == OperationStatus.NOTFOUND )
{
- throw new RmsException( "A permission by the name of "
+ throw new JeRmsException( status,
+ "A permission by the name of "
+ name + " does not exist" ) ;
}
else if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to position name cursor "
+ throw new JeRmsException( status,
+ "failed to position name cursor "
+ "with status of " + status.toString() ) ;
}
@@ -461,13 +594,15 @@
.getSearchKey( appNameEntry, value, LockMode.DEFAULT ) ;
if ( status == OperationStatus.NOTFOUND )
{
- throw new RmsException( "An application by the name of "
+ throw new JeRmsException( status,
+ "An application by the name of "
+ appName + " does not exist" ) ;
}
else if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to position app cursor "
- + "with status of " + status.toString() ) ;
+ throw new JeRmsException( status,
+ "failed to position app cursor with status of "
+ + status.toString() ) ;
}
SecondaryCursor [] secCursors = { nameCursor, appNameCursor } ;
@@ -476,7 +611,8 @@
if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to get permission rowId "
+ throw new JeRmsException( status,
+ "failed to get permission rowId "
+ name + " for application " + appName
+ " with status of " + status.toString() ) ;
}
@@ -546,26 +682,30 @@
.getSearchKey( intEntry, value, LockMode.DEFAULT ) ;
if ( status == OperationStatus.NOTFOUND )
{
- throw new RmsException( "A permission with an index of "
+ throw new JeRmsException( status,
+ "A permission with an index of "
+ index + " does not exist" ) ;
}
else if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to position index cursor "
- + "with status of " + status.toString() ) ;
+ throw new JeRmsException( status,
+ "failed to position index cursor with status of "
+ + status.toString() ) ;
}
status = appNameCursor
.getSearchKey( appNameEntry, value, LockMode.DEFAULT ) ;
if ( status == OperationStatus.NOTFOUND )
{
- throw new RmsException( "An application by the name of "
+ throw new JeRmsException( status,
+ "An application by the name of "
+ appName + " does not exist" ) ;
}
else if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to position app cursor "
- + "with status of " + status.toString() ) ;
+ throw new JeRmsException( status,
+ "failed to position app cursor with status of "
+ + status.toString() ) ;
}
SecondaryCursor [] secCursors = { intCursor, appNameCursor } ;
@@ -574,7 +714,8 @@
if ( status != OperationStatus.SUCCESS )
{
- throw new RmsException( "failed to get permission with index "
+ throw new JeRmsException( status,
+ "failed to get permission with index "
+ index + " for application " + appName
+ " with status of " + status.toString() ) ;
}
@@ -601,6 +742,11 @@
}
+ // -----------------------------------------------------------------------
+ // Utility Methods
+ // -----------------------------------------------------------------------
+
+
/**
* Closes a cursor without throwing an error.
*
@@ -610,6 +756,7 @@
{
if ( cursor == null )
{
+ monitor.cleanedUp( this, "close()", cursor ) ;
return ;
}
@@ -619,8 +766,7 @@
}
catch ( DatabaseException e )
{
- // @todo need to log this
- e.printStackTrace() ;
+ monitor.failedOnCleanupOperation( this, "close()", cursor, e ) ;
}
}
@@ -634,6 +780,7 @@
{
if ( cursor == null )
{
+ monitor.cleanedUp( this, "close()", cursor ) ;
return ;
}
@@ -643,15 +790,47 @@
}
catch ( DatabaseException e )
{
- // @todo need to log this
- e.printStackTrace() ;
+ monitor.failedOnCleanupOperation( this, "close()", cursor, e ) ;
}
}
+ // -----------------------------------------------------------------------
+ // Monitor Getter/Setter Pair
+ // -----------------------------------------------------------------------
+
+
+ /**
+ * Gets the monitor notified by this DAO.
+ *
+ * @return the monitor notified by this DAO
+ */
+ public BitPermissionDAOMonitor getMonitor()
+ {
+ return monitor ;
+ }
+
+
+ /**
+ * Sets the monitor notified by this DAO.
+ *
+ * @param monitor the new monitor to be notified by this DAO
+ */
+ public void setMonitor( BitPermissionDAOMonitor monitor )
+ {
+ this.monitor = monitor ;
+ }
+
+
+ // -----------------------------------------------------------------------
+ // Cursor Iterator
+ // -----------------------------------------------------------------------
+
+
/**
* Special iterator to list the String names or BitPermission of an
- * application or the entire database.
+ * application or the entire database. This Iterator is primarily
+ * returned by DAO list methods.
*/
class JeAppPermIterator implements Iterator
{
@@ -684,31 +863,43 @@
{
hasNext = false ;
closeNoError( cursor ) ;
+ monitor.listingEmpty( JeBitPermissionDAO.this, this,
+ appName, onlyNames ) ;
return ;
}
if ( onlyNames )
{
prefetched = BINDING.getPermissionName( value ) ;
+ monitor.listingNamesOnly( JeBitPermissionDAO.this, this,
+ appName ) ;
}
else
{
prefetched = BINDING.entryToObject( value ) ;
+ monitor.listingPermissions( JeBitPermissionDAO.this, this,
+ appName ) ;
}
}
catch ( DatabaseException e )
{
closeNoError( cursor ) ;
+ monitor.failedListing( JeBitPermissionDAO.this, this, appName,
+ onlyNames, e ) ;
throw new RmsException( e ) ;
}
catch ( UnsupportedEncodingException e )
{
closeNoError( cursor ) ;
+ monitor.failedListing( JeBitPermissionDAO.this, this, appName,
+ onlyNames, e ) ;
throw new RmsException( e ) ;
}
catch ( IOException e )
{
closeNoError( cursor ) ;
+ monitor.failedListing( JeBitPermissionDAO.this, this, appName,
+ onlyNames, e ) ;
throw new RmsException( e ) ;
}
}
@@ -729,31 +920,43 @@
{
hasNext = false ;
closeNoError( cursor ) ;
+ monitor.listingEmpty( JeBitPermissionDAO.this, this,
+ appName, onlyNames ) ;
return ;
}
if ( onlyNames )
{
prefetched = BINDING.getPermissionName( value ) ;
+ monitor.listingNamesOnly( JeBitPermissionDAO.this, this,
+ appName ) ;
}
else
{
prefetched = BINDING.entryToObject( value ) ;
+ monitor.listingPermissions( JeBitPermissionDAO.this, this,
+ appName ) ;
}
}
catch ( DatabaseException e )
{
closeNoError( cursor ) ;
+ monitor.failedListing( JeBitPermissionDAO.this, this, appName,
+ onlyNames, e ) ;
throw new RmsException( e ) ;
}
catch ( UnsupportedEncodingException e )
{
closeNoError( cursor ) ;
+ monitor.failedListing( JeBitPermissionDAO.this, this, appName,
+ onlyNames, e ) ;
throw new RmsException( e ) ;
}
catch ( IOException e )
{
closeNoError( cursor ) ;
+ monitor.failedListing( JeBitPermissionDAO.this, this, appName,
+ onlyNames, e ) ;
throw new RmsException( e ) ;
}
}
@@ -791,16 +994,22 @@
{
hasNext = false ;
closeNoError( cursor ) ;
+ monitor.iteratorExhausted( JeBitPermissionDAO.this, this,
+ appName, onlyNames, retVal ) ;
}
else
{
if ( onlyNames )
{
prefetched = BINDING.getPermissionName( value ) ;
+ monitor.successOnNextName( JeBitPermissionDAO.this,
+ this, appName, retVal, prefetched ) ;
}
else
{
prefetched = BINDING.entryToObject( value ) ;
+ monitor.successOnNextPerm( JeBitPermissionDAO.this,
+ this, appName, retVal, prefetched ) ;
}
}
}
@@ -813,8 +1022,8 @@
closeNoError( cursor ) ;
}
- // @todo need to log this
- e.printStackTrace() ;
+ monitor.iteratorFailure( JeBitPermissionDAO.this, this,
+ appName, onlyNames, retVal, e ) ;
}
catch ( DatabaseException e )
{
@@ -824,8 +1033,8 @@
closeNoError( cursor ) ;
}
- // @todo need to log this
- e.printStackTrace() ;
+ monitor.iteratorFailure( JeBitPermissionDAO.this, this,
+ appName, onlyNames, retVal, e ) ;
}
return retVal ;
Added: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionDAOMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/permissions/LoggingBitPermissionDAOMonitor.java Mon Apr 26 11:50:05 2004
@@ -0,0 +1,408 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.rms.je.permissions ;
+
+
+import java.util.Iterator ;
+import org.apache.rms.BitPermission ;
+
+
+/**
+ * A logging monitor for BitPermission data access objects.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class LoggingBitPermissionDAOMonitor implements BitPermissionDAOMonitor
+{
+ /**
+ * Monitors events where the DAO fails to create a new BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedOnCreate( BitPermissionDAO dao, String appName,
+ String name, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where the DAO fails to create a new BitPermission
+ * because the permission for the application by
+ * the name specified already exists.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ public void permissionExists( BitPermissionDAO dao, String appName,
+ String name )
+ {
+ }
+
+
+ /**
+ * Monitors event where the DAO creates a new BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ public void permissionCreated( BitPermissionDAO dao, String appName,
+ String name )
+ {
+ }
+
+
+ /**
+ * Monitors the successful deletion of an application's BitPermission.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ public void permissionDeleted( BitPermissionDAO dao, String appName,
+ String name )
+ {
+ }
+
+
+ /**
+ * Monitors failures to delete a BitPermission due to DAO failures.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void deleteFailed( BitPermissionDAO dao, String appName,
+ String name, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where an operation on an non-existant BitPermission
+ * was attempted.
+ *
+ * @param dao the data access object that failed
+ * @param op the operation that was attempted
+ * @param appName the name of the application
+ * @param name the name of the permission
+ */
+ public void permissionDoesNotExist( BitPermissionDAO dao, String op,
+ String appName, String name )
+ {
+ }
+
+
+ /**
+ * Monitors events where an operation on an non-existant BitPermission
+ * was attempted.
+ *
+ * @param dao the data access object that failed
+ * @param op the operation that was attempted
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ */
+ public void permissionDoesNotExist( JeBitPermissionDAO dao, String op,
+ String appName, int index )
+ {
+ }
+
+
+ /**
+ * Monitors events where the rename of a BitPermission failed.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param newName the new name for the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedOnRename( JeBitPermissionDAO dao, String appName,
+ String name, String newName, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where the a BitPermission was successfully renamed.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param newName the new name for the permission
+ */
+ public void permissionRenamed( JeBitPermissionDAO dao, String appName,
+ String name, String newName )
+ {
+ }
+
+
+ /**
+ * Monitors the successful lookup event of a permission's index.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param index the bit index of the permission
+ */
+ public void indexLookedUp( JeBitPermissionDAO dao, String appName,
+ String name, int index )
+ {
+ }
+
+
+ /**
+ * Monitors events where a permission fails on lookup.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedPermissionLookup( JeBitPermissionDAO dao, String appName,
+ String name, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors the successful lookup of a permission by name or by index.
+ *
+ * @param dao the data access object that failed
+ * @param perm the permission object looked up
+ */
+ public void permissionLookedUp( JeBitPermissionDAO dao,
+ BitPermission perm )
+ {
+ }
+
+
+ /**
+ * Monitors events where the lookup of a permissions name by index fails.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedNameLookup( JeBitPermissionDAO dao, String appName,
+ int index, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors successful events for looking up the name of a permission by
+ * index.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param name the name of the permission
+ * @param index the bit index of the permission
+ */
+ public void nameLookedUP( JeBitPermissionDAO dao, String appName,
+ String name, int index )
+ {
+ }
+
+
+ /**
+ * Monitors events where the lookup of a permission object by index fails.
+ *
+ * @param dao the data access object that failed
+ * @param appName the name of the application
+ * @param index the bit index of the permission
+ * @param fault the fault that caused the failure
+ */
+ public void failedPermissionLookup( JeBitPermissionDAO dao,
+ String appName, int index,
+ Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where a cleanup operation on a resource fails.
+ *
+ * @param dao the data access object that failed
+ * @param op the cleanup operation that failed
+ * @param resource the resource being cleanup
+ * @param fault the fault that caused the failure
+ */
+ public void failedOnCleanupOperation( JeBitPermissionDAO dao, String op,
+ Object resource, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where a cleanup operation occured.
+ *
+ * @param dao the data access object that failed
+ * @param op the cleanup operation that failed
+ * @param resource the resource being cleanup
+ */
+ public void cleanedUp( JeBitPermissionDAO dao, String op, Object resource )
+ {
+ }
+
+
+ /**
+ * Monitors events where an empty list is returned on a permission [name]
+ * listing.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if the
+ * Iterator perms
+ */
+ public void listingEmpty( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames )
+ {
+ }
+
+
+ /**
+ * Monitors events when an Iterator over the list of permission names
+ * is sucessful.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ */
+ public void listingNamesOnly( JeBitPermissionDAO dao, Iterator listing,
+ String appName )
+ {
+ }
+
+
+ /**
+ * Monitors events when an Iterator over the list of permission objects
+ * is sucessful.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ */
+ public void listingPermissions( JeBitPermissionDAO dao, Iterator listing,
+ String appName )
+ {
+ }
+
+
+ /**
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if
+ * the Iterator perms
+ * @param fault the fault that caused the failure
+ */
+ public void failedListing( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames,
+ Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors the successful prefetch of the next permission name.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param retVal the next value to be returned
+ * @param prefetched the prefetched value if this Iterator prefetches
+ * the next value
+ */
+ public void successOnNextName( JeBitPermissionDAO dao, Iterator listing,
+ String appName, Object retVal,
+ Object prefetched )
+ {
+ }
+
+
+ /**
+ * Monitors the successful prefetch of the next permission.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param retVal the next value to be returned
+ * @param prefetched the prefetched value if this Iterator prefetches
+ * the next value
+ */
+ public void successOnNextPerm( JeBitPermissionDAO dao, Iterator listing,
+ String appName, Object retVal,
+ Object prefetched )
+ {
+ }
+
+
+ /**
+ * Monitors events where the iterator fails to return the next element,
+ * or fails to prefetch an element to return on a subsequent next method
+ * call.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if the
+ * Iterator perms
+ * @param retVal the next value to be returned
+ * @param fault the fault that caused the failure
+ */
+ public void iteratorFailure( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames,
+ Object retVal, Throwable fault )
+ {
+ fault.printStackTrace() ;
+ }
+
+
+ /**
+ * Monitors events where the iterator runs out of elements to prefetch.
+ *
+ * @param dao the data access object that failed
+ * @param listing the Iterator created
+ * @param appName the name of the application
+ * @param onlyNames true if the Iterator was to return names false if
+ * the Iterator perms
+ * @param lastVal the last value to be returned on the subsequent
+ * (final) next() call
+ */
+ public void iteratorExhausted( JeBitPermissionDAO dao, Iterator listing,
+ String appName, boolean onlyNames,
+ Object lastVal )
+ {
+ }
+}