pnever 2002/06/16 09:29:58
Modified: src/share/org/apache/slide/common Namespace.java
Log:
Added the option to notify a listener when a new store was created.
Revision Changes Path
1.48 +39 -4 jakarta-slide/src/share/org/apache/slide/common/Namespace.java
Index: Namespace.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Namespace.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- Namespace.java 25 Apr 2002 21:30:12 -0000 1.47
+++ Namespace.java 16 Jun 2002 16:29:58 -0000 1.48
@@ -72,6 +72,7 @@
import java.io.Writer;
import java.io.FileReader;
import java.io.IOException;
+import java.lang.reflect.Method;
import javax.transaction.TransactionManager;
import javax.transaction.Transaction;
import javax.transaction.Status;
@@ -149,6 +150,19 @@
*/
private static final String LOG_CHANNEL = Namespace.class.getName();
+ protected static final String I_CREATESTORELISTENERCLASS =
"createStoreListenerClass";
+ protected static final String I_CREATESTORELISTENERCLASS_DEFAULT =
"org.apache.slide.webdav.util.UriHandler";
+
+ protected static Class createStoreListenerClass;
+ static {
+ try {
+ String createStoreListenerClassName =
Domain.getParameter(I_CREATESTORELISTENERCLASS, I_CREATESTORELISTENERCLASS_DEFAULT);
+ createStoreListenerClass = Class.forName( createStoreListenerClassName
);
+ }
+ catch( Exception x ) {
+ Domain.warn( "Loading of create_store_listener class failed:
"+x.getMessage() );
+ }
+ }
// ----------------------------------------------------- Instance Variables
@@ -436,6 +450,9 @@
// set the scope in the father and child stores
store.setScope(scope);
+ // call the create_store_listener
+ notifyStoreCreated( this.name, scope.toString(), storeName );
+
} catch(InstantiationException e) {
throw new ServiceRegistrationFailedException
(storeClass);
@@ -1195,6 +1212,24 @@
+ " on scope " + match,LOG_CHANNEL,Logger.INFO);
}
+ }
+
+ /**
+ *
+ */
+ private void notifyStoreCreated( String namespaceName, String scope, String
storeName ) {
+
+ if( createStoreListenerClass != null ) {
+ try {
+ Method nsc = createStoreListenerClass.getMethod(
+ "notifyStoreCreated", new Class[]{String.class, String.class,
String.class} );
+ nsc.invoke( null, new Object[]{namespaceName, scope, storeName} );
// obj=null since method is static
+ }
+ catch( Exception x ) {
+ Domain.warn( "Notification of store creation "+
+ "(namespace="+namespaceName+", scope="+scope+",
store="+storeName+") failed: "+x.getMessage() );
+ }
+ }
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>