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 oz...@apache.org on 2004/05/05 14:28:52 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/structure StructureImpl.java Structure.java

ozeigermann    2004/05/05 05:28:52

  Modified:    src/share/org/apache/slide/structure StructureImpl.java
                        Structure.java
  Log:
  Augmented Structure helper to have sequence concept accessible
  
  Revision  Changes    Path
  1.43      +21 -5     jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java
  
  Index: StructureImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- StructureImpl.java	24 Feb 2004 16:47:09 -0000	1.42
  +++ StructureImpl.java	5 May 2004 12:28:52 -0000	1.43
  @@ -109,7 +109,23 @@
       
       // ------------------------------------------------------ Structure Methods
       
  -    
  +    public String generateUniqueUri(SlideToken token, String parentUri) throws ServiceAccessException {
  +        String sequenceName = parentUri.replace('/', '-');
  +
  +        Uri uri = namespace.getUri(token, parentUri);
  +        Store store = uri.getStore();
  +        if (!store.isSequenceSupported()) {
  +            return null;
  +        } else {
  +            if (!store.sequenceExists(sequenceName)) {
  +                store.createSequence(sequenceName);
  +            }
  +            long next = store.nextSequenceValue(sequenceName);
  +            String uniqueUri = parentUri + "/" + next;
  +            return uniqueUri;
  +        }
  +    }
  +        
       public Enumeration getChildren(SlideToken token, ObjectNode object)
           throws ServiceAccessException, ObjectNotFoundException,
           LinkedObjectNotFoundException, VetoException {
  
  
  
  1.17      +16 -4     jakarta-slide/src/share/org/apache/slide/structure/Structure.java
  
  Index: Structure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/Structure.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Structure.java	24 Feb 2004 16:47:09 -0000	1.16
  +++ Structure.java	5 May 2004 12:28:52 -0000	1.17
  @@ -44,6 +44,18 @@
       
       // ------------------------------------------------------ Interface Methods
       
  +    /**
  +     * Generates an URI that is guranteed to be unqiue globally. 
  +     * If this is not possible <code>null</code> will be returned. 
  +     * 
  +     * @param token the slide token
  +     * @param parentUri the parent of the unique URI that shall be created 
  +     * 
  +     * @return a globally unique URI or <code>null</code> if not possible
  +     * 
  +     * @exception ServiceAccessException low level service access exception
  +     */
  +    String generateUniqueUri(SlideToken token, String parentUri) throws ServiceAccessException;
       
       /**
        * Returns the children of a node.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Sequences #3

Posted by Oliver Zeigermann <oz...@c1-fse.de>.
I have implemented a sequence store for both MS SQLServer and Sybase. As 
I have no idea how to get the same thing done in MySQL and Postgres, 
please, could someone else do this? It should be pretty easy, just have 
a look at SQLServerRDBMSAdapter...

Cheers,

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: Sequences #2

Posted by Oliver Zeigermann <oz...@c1-fse.de>.
Migration
---------

When you want to switch to sequences without dropping your datastore you 
can just as well edit the sequence file that holds the sequence value to 
be the next available in the history folder.

Oliver Zeigermann wrote:
> - Sequences are now avaiable over the structure helper to generate 
> globally unique URIs - again, had to modify an Interface :(
> 
> - There is a sample implementation of a sequence based on the file 
> system both on the phyiscal as well as on the store level. Add something 
>  like
> 
>         <sequencestore 
> classname="org.apache.slide.store.txfile.FileSequenceStore">
>           <parameter name="rootpath">E:/tmp/test/seq</parameter>
>         </sequencestore>
> 
> to your store definition to make it work
> 
> - UriHandler uses the new structure helper methods to generate unique 
> resource names for both history and workingresource
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Sequences #2

Posted by Oliver Zeigermann <oz...@c1-fse.de>.
- Sequences are now avaiable over the structure helper to generate 
globally unique URIs - again, had to modify an Interface :(

- There is a sample implementation of a sequence based on the file 
system both on the phyiscal as well as on the store level. Add something 
  like

         <sequencestore 
classname="org.apache.slide.store.txfile.FileSequenceStore">
           <parameter name="rootpath">E:/tmp/test/seq</parameter>
         </sequencestore>

to your store definition to make it work

- UriHandler uses the new structure helper methods to generate unique 
resource names for both history and workingresource



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org