You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2001/03/30 13:18:09 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/store AbstractStore.java StandardStore.java Store.java

juergen     01/03/30 03:18:09

  Modified:    src/share/org/apache/slide/common AbstractServiceBase.java
                        Namespace.java Service.java
               src/share/org/apache/slide/store AbstractStore.java
                        StandardStore.java Store.java
  Log:
  the parent/child stores know their scope they are working for.
  
  Revision  Changes    Path
  1.2       +16 -2     jakarta-slide/src/share/org/apache/slide/common/AbstractServiceBase.java
  
  Index: AbstractServiceBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/AbstractServiceBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractServiceBase.java	2001/02/12 05:55:46	1.1
  +++ AbstractServiceBase.java	2001/03/30 11:18:01	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/AbstractServiceBase.java,v 1.1 2001/02/12 05:55:46 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/02/12 05:55:46 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/AbstractServiceBase.java,v 1.2 2001/03/30 11:18:01 juergen Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/03/30 11:18:01 $
    *
    * ====================================================================
    *
  @@ -72,7 +72,7 @@
    * Slide Service abstract implementation.
    *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public abstract class AbstractServiceBase implements Service {
       
  @@ -89,7 +89,21 @@
       protected Namespace namespace;
       
       
  +    // the scope of this store as specified in domain.xml
  +    protected Scope scope;
  +    
  +    
       // -------------------------------------------------------- Service Methods
  +
  +    
  +        
  +    /**
  +     * Set the scope of the store as specified in domain.xml.
  +     */
  +    public void setScope(Scope scope) {
  +        this.scope = scope;
  +    }
  +    
       
       
       /**
  
  
  
  1.26      +22 -18    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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Namespace.java	2001/03/28 16:28:27	1.25
  +++ Namespace.java	2001/03/30 11:18:02	1.26
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Namespace.java,v 1.25 2001/03/28 16:28:27 juergen Exp $
  - * $Revision: 1.25 $
  - * $Date: 2001/03/28 16:28:27 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Namespace.java,v 1.26 2001/03/30 11:18:02 juergen Exp $
  + * $Revision: 1.26 $
  + * $Date: 2001/03/30 11:18:02 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * Namespace class.
    *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.25 $
  + * @version $Revision: 1.26 $
    */
   public final class Namespace {
       
  @@ -301,7 +301,7 @@
                   if (revisionDescriptorsStore instanceof String) {
                       store.setRevisionDescriptorsStore
                           ((RevisionDescriptorsStore) childStores
  -                         .get(revisionDescriptorsStore));
  +                             .get(revisionDescriptorsStore));
                   } else {
                       store.setRevisionDescriptorsStore
                           ((RevisionDescriptorsStore) revisionDescriptorsStore);
  @@ -312,7 +312,7 @@
                   if (revisionDescriptorStore instanceof String) {
                       store.setRevisionDescriptorStore
                           ((RevisionDescriptorStore) childStores
  -                         .get(revisionDescriptorStore));
  +                             .get(revisionDescriptorStore));
                   } else {
                       store.setRevisionDescriptorStore
                           ((RevisionDescriptorStore) revisionDescriptorStore);
  @@ -327,6 +327,9 @@
                       store.setContentStore((ContentStore) contentStore);
                   }
                   
  +                // set the scope in the father and child stores
  +                store.setScope(scope);
  +                
               } catch(InstantiationException e) {
                   throw new ServiceRegistrationFailedException
                       (storeClass);
  @@ -343,6 +346,7 @@
                   throw new ServiceRegistrationFailedException
                       (storeClass);
               }
  +            
           }
       }
       
  @@ -647,7 +651,7 @@
               // Log the event, and hope it was already done before.
               Domain.info
                   ("Unable to read Namespace base configuration file : "
  -                 + e.getMessage());
  +                     + e.getMessage());
           }
           
       }
  @@ -751,7 +755,7 @@
           // Now reading the "child" stores
           
           Hashtable currentStoreChildStores = new Hashtable();
  -
  +        
           // Loading node store (if any)
           try {
               Configuration nodeStoreDefinition =
  @@ -967,21 +971,21 @@
           
           if (storeName != null) {
               if ((!storesClass.containsKey(storeName)) ||
  -                (!storesParameters.containsKey(storeName))) {
  +                    (!storesParameters.containsKey(storeName))) {
                   throw new UnknownServiceDeclarationException(storeName);
               }
               registerStore(storeName,
  -                          (Class) storesClass.get(storeName),
  -                          (Hashtable) storesParameters.get(storeName),
  +                              (Class) storesClass.get(storeName),
  +                              (Hashtable) storesParameters.get(storeName),
                             new Scope(match),
  -                          (Hashtable) childStores.get(storeName));
  +                              (Hashtable) childStores.get(storeName));
               Domain.info("Registering Store "
  -                        + storeName
  -                        + " of class "
  -                        + storesClass.get(storeName)
  -                        + " with parameters "
  -                        + storesParameters.get(storeName)
  -                        + " on scope " + match);
  +                            + storeName
  +                            + " of class "
  +                            + storesClass.get(storeName)
  +                            + " with parameters "
  +                            + storesParameters.get(storeName)
  +                            + " on scope " + match);
           }
           
       }
  
  
  
  1.7       +40 -31    jakarta-slide/src/share/org/apache/slide/common/Service.java
  
  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Service.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Service.java	2001/02/12 05:55:46	1.6
  +++ Service.java	2001/03/30 11:18:02	1.7
  @@ -1,13 +1,13 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Service.java,v 1.6 2001/02/12 05:55:46 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/02/12 05:55:46 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Service.java,v 1.7 2001/03/30 11:18:02 juergen Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/03/30 11:18:02 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -15,7 +15,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -23,15 +23,15 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:  
  - *       "This product includes software developed by the 
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowlegement may appear in the software itself,
    *    if and wherever such third-party acknowlegements normally appear.
    *
    * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written 
  + *    from this software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache"
  @@ -59,7 +59,7 @@
    *
    * [Additional notices, if required by prior licensing conditions]
    *
  - */ 
  + */
   
   package org.apache.slide.common;
   
  @@ -70,9 +70,9 @@
   
   /**
    * Slide Service interface.
  - * 
  + *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public interface Service
       extends XAResource {
  @@ -82,6 +82,15 @@
       
       
       // ------------------------------------------------------ Interface Methods
  +
  +        
  +        
  +    /**
  +     * Set the scope of the store as specified in domain.xml.
  +     */
  +    void setScope(Scope scope);
  +    
  +    
       
       
       /**
  @@ -97,74 +106,74 @@
        * <li>Remote port
        * <li>JDBC driver whoich is to be used :-)
        * <li>Anything else ...
  -     * 
  -     * @param parameters Hashtable containing the parameters' names and 
  +     *
  +     * @param parameters Hashtable containing the parameters' names and
        * associated values
        * @exception ServiceParameterErrorException Incorrect service parameter
        * @exception ServiceParameterMissingException Service parameter missing
        */
       void setParameters(Hashtable parameters)
  -        throws ServiceParameterErrorException, 
  +        throws ServiceParameterErrorException,
           ServiceParameterMissingException;
       
       
       /**
        * Connects to the underlying data source (if any is needed).
  -     * 
  +     *
        * @exception ServiceConnectionFailedException Connection failed
        */
  -    void connect() 
  +    void connect()
           throws ServiceConnectionFailedException;
       
       
       /**
        * Disconnects from the underlying data source.
  -     * 
  +     *
        * @exception ServiceDisconnectionFailedException Disconnection failed
        */
  -    void disconnect() 
  +    void disconnect()
           throws ServiceDisconnectionFailedException;
       
       
       /**
        * Initializes service.
  -     * 
  -     * @param token Namespace access token, needed if the service needs to 
  +     *
  +     * @param token Namespace access token, needed if the service needs to
        * access objects or data within the namespace during its initialization
  -     * @exception ServiceInitializationFailedException May throw an exception 
  +     * @exception ServiceInitializationFailedException May throw an exception
        * if the service has already been initialized before
        */
  -    void initialize(NamespaceAccessToken token) 
  +    void initialize(NamespaceAccessToken token)
           throws ServiceInitializationFailedException;
       
       
       /**
        * Deletes service underlying data source, if possible (and meaningful).
  -     * 
  +     *
        * @exception ServiceResetFailedException Reset failed
        */
  -    void reset() 
  +    void reset()
           throws ServiceResetFailedException;
       
       
       /**
        * This function tells whether or not the service is connected.
  -     * 
  +     *
        * @return boolean true if we are connected
        * @exception ServiceAccessException Service access error
        */
  -    boolean isConnected() 
  +    boolean isConnected()
           throws ServiceAccessException;
       
       
       /**
        * Connects to the service, if we were not previously connected.
  -     * 
  +     *
        * @return boolean true if we were not already connected
        * @exception ServiceAccessException Unspecified service access error
        * @exception ServiceConnectionFailedException Connection failed
        */
  -    boolean connectIfNeeded() 
  +    boolean connectIfNeeded()
           throws ServiceConnectionFailedException, ServiceAccessException;
       
       
  @@ -173,7 +182,7 @@
        * cached. Useful if the service is fast enough, and / or if it already
        * includes its own custom caching mechanism, which might be more efficient
        * than the default one provided by the helpers.
  -     * 
  +     *
        * @return boolean True if results should be cached
        */
       boolean cacheResults();
  @@ -181,8 +190,8 @@
       
       /**
        * Get logger associated with the service.
  -     * 
  -     * @return The logger if one has been set for the associated namespace, 
  +     *
  +     * @return The logger if one has been set for the associated namespace,
        * or the Domain logger otherwise
        */
       Logger getLogger();
  
  
  
  1.11      +41 -4     jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java
  
  Index: AbstractStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractStore.java	2001/02/21 16:39:12	1.10
  +++ AbstractStore.java	2001/03/30 11:18:06	1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v 1.10 2001/02/21 16:39:12 juergen Exp $
  - * $Revision: 1.10 $
  - * $Date: 2001/02/21 16:39:12 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/AbstractStore.java,v 1.11 2001/03/30 11:18:06 juergen Exp $
  + * $Revision: 1.11 $
  + * $Date: 2001/03/30 11:18:06 $
    *
    * ====================================================================
    *
  @@ -88,7 +88,7 @@
    * Abstract implementation of a store. Handles all caching operations.
    *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    */
   public abstract class AbstractStore extends AbstractSimpleService
       implements Store {
  @@ -153,6 +153,43 @@
        * Active resource manager list.
        */
       protected Service resourceManagers[] = new Service[0];
  +    
  +
  +    
  +    // the scope of this store as specified in domain.xml
  +    protected Scope scope;
  +        
  +    /**
  +     * Set the scope of the store as specified in domain.xml.
  +     */
  +    public void setScope(Scope scope) {
  +        this.scope = scope;
  +        for (int i = 0; i < resourceManagers.length; i++) {
  +            resourceManagers[i].setScope(scope);
  +        }
  +    }
  +    
  +    
  +
  +    // the name of this store as specified in domain.xml
  +    private String name;
  +    
  +    /**
  +     * Set the name of the store as specified in domain.xml.
  +     */
  +    public void setName(String name) {
  +        this.name = name;
  +    }
  +    
  +    
  +    
  +    /**
  +     * Return the name of the store as specified in domain.xml.
  +     */
  +    public String getName() {
  +        return this.name;
  +    }
  +    
       
       
       // ---------------------------------------------------- ServiceImpl Methods
  
  
  
  1.10      +4 -24     jakarta-slide/src/share/org/apache/slide/store/StandardStore.java
  
  Index: StandardStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StandardStore.java	2001/03/28 16:15:42	1.9
  +++ StandardStore.java	2001/03/30 11:18:07	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v 1.9 2001/03/28 16:15:42 juergen Exp $
  - * $Revision: 1.9 $
  - * $Date: 2001/03/28 16:15:42 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v 1.10 2001/03/30 11:18:07 juergen Exp $
  + * $Revision: 1.10 $
  + * $Date: 2001/03/30 11:18:07 $
    *
    * ====================================================================
    *
  @@ -80,7 +80,7 @@
    * Abstract implementation of a store. Handles all caching operations.
    *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public class StandardStore extends AbstractStore {
       
  @@ -100,26 +100,6 @@
           descriptorsCache = new HashMapObjectCache(1000, 10000, 0.95);
           descriptorCache = new HashMapObjectCache(1000, 10000, 0.8);
       }
  -    // the name of this store as specified in domain.xml
  -    private String name;
  -    
  -    /**
  -     * Set the name of the store as specified in domain.xml.
  -     */
  -    public void setName(String name) {
  -        this.name = name;
  -    }
  -    
  -    
  -    
  -    /**
  -     * Return the name of the store as specified in domain.xml.
  -     */
  -    public String getName() {
  -        return this.name;
  -    }
  -    
  -    
       
       // ----------------------------------------------------- Instance Variables
       
  
  
  
  1.4       +10 -4     jakarta-slide/src/share/org/apache/slide/store/Store.java
  
  Index: Store.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/Store.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Store.java	2001/03/28 16:15:42	1.3
  +++ Store.java	2001/03/30 11:18:07	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/Store.java,v 1.3 2001/03/28 16:15:42 juergen Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/03/28 16:15:42 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/Store.java,v 1.4 2001/03/30 11:18:07 juergen Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/03/30 11:18:07 $
    *
    * ====================================================================
    *
  @@ -69,13 +69,19 @@
    * Represents a store which is used by the Slide API to access data.
    *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public interface Store extends ContentStore, LockStore, NodeStore,
       RevisionDescriptorStore, RevisionDescriptorsStore, SecurityStore  {
       
       
       // ------------------------------------------------------ Interface Methods
  +    
  +    /**
  +     * Set the scope of the store as specified in domain.xml.
  +     */
  +    void setScope(Scope scope);
  +    
       
       
       /**