jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r633899 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/ jackrabbit-site...
Date Wed, 05 Mar 2008 16:12:00 GMT
Author: dpfister
Date: Wed Mar  5 08:11:58 2008
New Revision: 633899

URL: http://svn.apache.org/viewvc?rev=633899&view=rev
Log:
JCR-1441 - Support workspace event listeners that will be created/registered on initialization
time
- reverting commit

Removed:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceAuditLogger.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/EventListenerConfig.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-1.4.dtd
    jackrabbit/trunk/jackrabbit-site/src/site/resources/dtd/repository-1.4.dtd

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=633899&r1=633898&r2=633899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Wed Mar  5 08:11:58 2008
@@ -32,7 +32,6 @@
 import org.apache.jackrabbit.core.cluster.UpdateEventListener;
 import org.apache.jackrabbit.core.config.ClusterConfig;
 import org.apache.jackrabbit.core.config.DataStoreConfig;
-import org.apache.jackrabbit.core.config.EventListenerConfig;
 import org.apache.jackrabbit.core.config.FileSystemConfig;
 import org.apache.jackrabbit.core.config.LoginModuleConfig;
 import org.apache.jackrabbit.core.config.PersistenceManagerConfig;
@@ -604,24 +603,6 @@
                     | Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED
                     | Event.PROPERTY_CHANGED,
                     "/", true, null, null, false);
-        }
-        
-        // create and register user-defined event listeners
-        EventListenerConfig[] elcs = wspInfo.config.getEventListenersConfig();
-        if (elcs != null) {
-            for (int i = 0; i < elcs.length; i++) {
-                EventListenerConfig elc = elcs[i];
-                
-                try {
-                    EventListener el = elcs[i].createEventListener();
-                    wsp.getObservationManager().addEventListener(el, 
-                            elc.getEventTypes(), elc.getAbsPath(), elc.isDeep(),
-                            elc.getUUID(), elc.getNodeTypeName(), elc.isNoLocal());
-                } catch (RepositoryException e) {
-                    log.error("Unable to create and register event listener: " +
-                            elc.getClassName() + ": " + e.getMessage(), e);
-                }
-            }
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java?rev=633899&r1=633898&r2=633899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
Wed Mar  5 08:11:58 2008
@@ -286,49 +286,4 @@
         }
     }
 
-    /**
-     * Returns the value of the named attribute of the given element.
-     * If the attribute is not found, then the given default value is returned.
-     *
-     * @param element element
-     * @param name attribute name
-     * @param def default value
-     * @return attribute value, or the default value
-     */
-    protected boolean getAttribute(Element element, String name, boolean def) {
-        Attr attribute = element.getAttributeNode(name);
-        if (attribute != null) {
-            return Boolean.valueOf(attribute.getValue()).booleanValue();
-        } else {
-            return def;
-        }
-    }
-
-    /**
-     * Returns the value of the named attribute of the given element.
-     * If the attribute is not found, then the given default value is returned.
-     *
-     * @param element element
-     * @param name attribute name
-     * @param def default value
-     * @return attribute value, or the default value
-     */
-    protected int getAttribute(Element element, String name, int def) 
-            throws ConfigurationException {
-        
-        Attr attribute = element.getAttributeNode(name);
-        if (attribute != null) {
-            String s = attribute.getValue();
-            
-            try {
-                return Integer.parseInt(s);
-            } catch (NumberFormatException e) {
-                throw new ConfigurationException(
-                        "Value of attribute " + name + 
-                        " is not an integer: " + s, e);
-            }
-        } else {
-            return def;
-        }
-    }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java?rev=633899&r1=633898&r2=633899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
Wed Mar  5 08:11:58 2008
@@ -17,11 +17,8 @@
 package org.apache.jackrabbit.core.config;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.Properties;
 
-import javax.jcr.observation.Event;
-
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -95,9 +92,6 @@
     /** Name of the ism locking configuration element. */
     public static final String ISM_LOCKING_ELEMENT = "ISMLocking";
 
-    /** Name of the event listener configuration element. */
-    public static final String EVENT_LISTENER_ELEMENT = "EventListener";
-    
     /** Name of the application name configuration attribute. */
     public static final String APP_NAME_ATTRIBUTE = "appName";
 
@@ -130,32 +124,6 @@
     /** Default synchronization delay, in milliseconds. */
     public static final String DEFAULT_SYNC_DELAY = "5000";
 
-    /** Name of the eventTypes attribute */
-    public static final String EVENT_TYPES_ATTRIBUTE = "eventTypes";
-    
-    /** Default value of the eventTypes attribute */
-    public static final int EVENT_TYPES_VALUE = 
-        Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED |
-        Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED;
-
-    /** Name of the absPath attribute */
-    public static final String ABS_PATH_ATTRIBUTE = "absPath";
-
-    /** Name of the isDeep attribute */
-    public static final String IS_DEEP_ATTRIBUTE = "isDeep";
-
-    /** Name of the uuid attribute */
-    public static final String UUID_ATTRIBUTE = "uuid";
-
-    /** Name of the nodeTypeName attribute */
-    public static final String NODE_TYPE_NAME_ATTRIBUTE = "nodeTypeName";
-    
-    /** Name of the noLocal attribute */
-    public static final String NO_LOCAL_ATTRIBUTE = "noLocal";
-    
-    /** Name of the workspace property */
-    public static final String WORKSPACE_PROP_NAME = "workspace";
-    
     /**
      * Creates a new configuration parser with the given parser variables.
      *
@@ -403,10 +371,7 @@
         // Item state manager locking configuration (optional)
         ISMLockingConfig ismLockingConfig = tmpParser.parseISMLockingConfig(root);
 
-        // Event listeners configuration (optional)
-        EventListenerConfig[] elcs = tmpParser.parseEventListenersConfig(root);
-        
-        return new WorkspaceConfig(home, name, clustered, fsc, pmc, sc, ismLockingConfig,
elcs);
+        return new WorkspaceConfig(home, name, clustered, fsc, pmc, sc, ismLockingConfig);
     }
 
     /**
@@ -507,70 +472,6 @@
         return null;
     }
 
-    
-    /**
-     * Parse event listeners config.
-     * 
-     * @param parent parent of the <code>EventListener</code> elements.
-     * @return event listener configuration array
-     * @throws ConfigurationException if the configuration is broken
-     */
-    protected EventListenerConfig[] parseEventListenersConfig(Element parent)
-            throws ConfigurationException {
-        
-        ArrayList configs = new ArrayList();
-        
-        NodeList children = parent.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node child = children.item(i);
-            if (child.getNodeType() == Node.ELEMENT_NODE
-                    && EVENT_LISTENER_ELEMENT.equals(child.getNodeName())) {
-                Element element = (Element) child;
-                configs.add(parseEventListenerConfig(element));
-            }
-        }
-        EventListenerConfig[] rv = new EventListenerConfig[configs.size()];
-        configs.toArray(rv);
-        return rv;
-    }
-
-    /**
-     * Parse event listener config.
-     * 
-     * @param element an  <code>EventListener</code> element.
-     * @return event listener configuration
-     * @throws ConfigurationException if the configuration is broken
-     */
-    protected EventListenerConfig parseEventListenerConfig(Element element)
-            throws ConfigurationException {
-        
-        String className = getAttribute(element, CLASS_ATTRIBUTE);
-        Properties parameters = parseParameters(element);
-        
-        // Provide a meaningful default for the workspace property
-        if (!parameters.containsKey(WORKSPACE_PROP_NAME)) {
-            parameters.put(WORKSPACE_PROP_NAME, 
-                    replaceVariables("${" + WORKSPACE_NAME_VARIABLE + "}"));
-        }
-
-        EventListenerConfig config = new EventListenerConfig(className, parameters);
-        config.setEventTypes(getAttribute(element, 
-                EVENT_TYPES_ATTRIBUTE, EVENT_TYPES_VALUE));
-        config.setAbsPath(getAttribute(element, ABS_PATH_ATTRIBUTE, "/"));
-        config.setDeep(getAttribute(element, IS_DEEP_ATTRIBUTE, true));
-        
-        String s = getAttribute(element, UUID_ATTRIBUTE, null);
-        if (s != null) {
-            config.setUUID(s.split(","));
-        }
-        s = getAttribute(element, NODE_TYPE_NAME_ATTRIBUTE, null);
-        if (s != null) {
-            config.setNodeTypeName(s.split(","));
-        }
-        config.setNoLocal(getAttribute(element, NO_LOCAL_ATTRIBUTE, false));
-        return config;
-    }
-    
     /**
      * Parses versioning configuration. Versioning configuration uses the
      * following format:

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java?rev=633899&r1=633898&r2=633899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java
Wed Mar  5 08:11:58 2008
@@ -63,11 +63,6 @@
     private ISMLockingConfig ismLockingConfig;
 
     /**
-     * Event listeners configuration.
-     */
-    private EventListenerConfig[] elcs;
-    
-    /**
      * Creates a workspace configuration object.
      *
      * @param home home directory
@@ -80,8 +75,7 @@
      */
     public WorkspaceConfig(String home, String name, boolean clustered,
                            FileSystemConfig fsc, PersistenceManagerConfig pmc,
-                           SearchConfig sc, ISMLockingConfig ismLockingConfig,
-                           EventListenerConfig[] elcs) {
+                           SearchConfig sc, ISMLockingConfig ismLockingConfig) {
         this.home = home;
         this.name = name;
         this.clustered = clustered;
@@ -93,7 +87,6 @@
         } else {
             this.ismLockingConfig = ISMLockingConfig.createDefaultConfig();
         }
-        this.elcs = elcs;
     }
 
     /**
@@ -131,13 +124,6 @@
         return ismLockingConfig;
     }
 
-    /**
-     * @return the configuration for the event listeners.
-     */
-    public EventListenerConfig[] getEventListenersConfig() {
-        return elcs;
-    }
-    
     /**
      * Returns the file system configuration.
      *

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-1.4.dtd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-1.4.dtd?rev=633899&r1=633898&r2=633899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-1.4.dtd
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-1.4.dtd
Wed Mar  5 08:11:58 2008
@@ -119,7 +119,7 @@
     it is used to create the initial workspace if there's no workspace yet
     and for creating additional workspaces through the api
 -->
-<!ELEMENT Workspace (FileSystem,PersistenceManager,SearchIndex?,ISMLocking?,EventListener*)>
+<!ELEMENT Workspace (FileSystem,PersistenceManager,SearchIndex?,ISMLocking?)>
 <!ATTLIST Workspace name CDATA #REQUIRED>
 
 <!--
@@ -172,16 +172,3 @@
 -->
 <!ELEMENT ISMLocking (param*)>
 <!ATTLIST ISMLocking class CDATA #REQUIRED>
-
-<!--
-    The EventListener element configures a user-defined event listener that
-    will be created and registered on workspace initialization.
--->
-<!ELEMENT EventListener (param*)>
-<!ATTLIST EventListener class        CDATA #REQUIRED
-                        eventTypes   CDATA #IMPLIED
-                        absPath      CDATA #IMPLIED
-                        isDeep       CDATA #IMPLIED
-                        uuid         CDATA #IMPLIED
-                        nodeTypeName CDATA #IMPLIED
-                        noLocal      CDATA #IMPLIED>

Modified: jackrabbit/trunk/jackrabbit-site/src/site/resources/dtd/repository-1.4.dtd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/resources/dtd/repository-1.4.dtd?rev=633899&r1=633898&r2=633899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/resources/dtd/repository-1.4.dtd (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/resources/dtd/repository-1.4.dtd Wed Mar  5
08:11:58 2008
@@ -119,7 +119,7 @@
     it is used to create the initial workspace if there's no workspace yet
     and for creating additional workspaces through the api
 -->
-<!ELEMENT Workspace (FileSystem,PersistenceManager,SearchIndex?,ISMLocking?,EventListener*)>
+<!ELEMENT Workspace (FileSystem,PersistenceManager,SearchIndex?,ISMLocking?)>
 <!ATTLIST Workspace name CDATA #REQUIRED>
 
 <!--
@@ -180,17 +180,3 @@
 -->
 <!ELEMENT DataStore (param*)>
 <!ATTLIST DataStore class CDATA #REQUIRED>
-
-<!--
-    The EventListener element configures a user-defined event listener that
-    will be created and registered on workspace initialization.
--->
-<!ELEMENT EventListener (param*)>
-<!ATTLIST EventListener class        CDATA #REQUIRED
-                        eventTypes   CDATA #IMPLIED
-                        absPath      CDATA #IMPLIED
-                        isDeep       CDATA #IMPLIED
-                        uuid         CDATA #IMPLIED
-                        nodeTypeName CDATA #IMPLIED
-                        noLocal      CDATA #IMPLIED>
-



Mime
View raw message