pnever      2005/02/01 03:27:19

  Modified:    
proposals/tamino/src/store/org/apache/slide/store/tamino/datastore
                        Tag: TWS421_BRANCH XDbSession.java
               
proposals/tamino/src/store/org/apache/slide/store/tamino/tools/repairer
                        Tag: TWS421_BRANCH XTaminoClient.java
  Added:       
proposals/tamino/src/store/org/apache/slide/store/tamino/datastore
                        Tag: TWS421_BRANCH TaminoCodes.java
  Log:
  Added handling for Tamino codes to be able to abort on certain
  Tamino codes
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.4.3   +47 -13    
jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/datastore/XDbSession.java
  
  Index: XDbSession.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/datastore/XDbSession.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- XDbSession.java   22 Dec 2004 15:34:42 -0000      1.1.4.2
  +++ XDbSession.java   1 Feb 2005 11:27:19 -0000       1.1.4.3
  @@ -37,6 +37,7 @@
   import com.softwareag.tamino.db.api.objectModel.jdom.TJDOMObjectModel;
   import com.softwareag.tamino.db.api.response.TResponse;
   import org.apache.slide.common.Domain;
  +import org.apache.slide.store.tamino.datastore.TaminoCodes;
   import org.apache.slide.store.tamino.datastore.schema.XDoctype;
   import org.apache.slide.store.tamino.jdomobjects.XDescriptors;
   import org.apache.slide.store.tamino.store.ISlideAccessor;
  @@ -302,6 +303,7 @@
               throw new XForbiddenException ("Non-XML content not allowed");
           
           String result = null;
  +        TResponse response = null;
           String docType = content.getDocumentType();
           if( docType == null || "".equals(docType) )
               docType = "application/octet-stream";
  @@ -309,7 +311,11 @@
           try {
               TNonXMLObject nonXmlObject = 
content.getContentWrapper().getNonXMLObject(docType);
               xConnection.startTransactionIfNecessary();
  -            nonXMLContentAccessor.insert (nonXmlObject);
  +            response = nonXMLContentAccessor.insert (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
               result = nonXmlObject.getId();
           }
           catch (TException e) {
  @@ -318,7 +324,11 @@
                   docType = "application/octet-stream";
                   TNonXMLObject nonXmlObject = 
content.getContentWrapper().getNonXMLObject(docType);
                   xConnection.startTransactionIfNecessary();
  -                nonXMLContentAccessor.insert (nonXmlObject);
  +                response = nonXMLContentAccessor.insert (nonXmlObject);
  +                String code = response.getReturnValue();
  +                if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                    throw new XException("Tamino returned possibly aborting 
code: "+code);
  +                }
                   result = nonXmlObject.getId();
               }
               catch (TException x) {
  @@ -493,9 +503,12 @@
                               XProcessResultParser resultParser = new 
XProcessResultParser();
                               resultParser.parse (resultStream);
                               
  -                            String response = resultParser.getResponse();
  +                            String code = resultParser.getResponse();
  +                            if (!"0".equals(code) && 
!TaminoCodes.isNonaborting(code)) {
  +                                throw new XException("Tamino returned 
possibly aborting code: "+code);
  +                            }
                               
  -                            if (!"0".equals (response)) {
  +                            if (!"0".equals (code)) {
                                   if (allowNonXML) {
                                       docType = NONXML_CONTENT;
                                       id = createNonXmlContent (content);
  @@ -504,7 +517,7 @@
                                   else {
                                       throw new XForbiddenException(
                                           "Storing content as XML failed with 
Tamino error " +
  -                                            response + " and non-XML content 
not allowed" );
  +                                            code + " and non-XML content not 
allowed" );
                                   }
                               }
                               else {
  @@ -613,6 +626,11 @@
               xConnection.startTransactionIfNecessary();
               
               response = nonXMLContentAccessor.update (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
  +            
               inoIdReturnedFromTamino = nonXmlObject.getId();
               
               if (!inoIdReturnedFromTamino.equals (contentId.getId()))
  @@ -659,6 +677,10 @@
               xConnection.startTransactionIfNecessary();
               nonXmlObject.setId (contentId.getId());
               response = nonXMLContentAccessor.update (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
               result = nonXmlObject.getId();
           }
           catch (TException e) {
  @@ -668,6 +690,10 @@
                   xConnection.startTransactionIfNecessary();
                   nonXmlObject.setId (contentId.getId());
                   response = nonXMLContentAccessor.update (nonXmlObject);
  +                String code = response.getReturnValue();
  +                if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                    throw new XException("Tamino returned possibly aborting 
code: "+code);
  +                }
                   result = nonXmlObject.getId();
               }
               catch (TException x) {
  @@ -791,13 +817,21 @@
               inoId
           );
           
  +        TResponse response = null;
  +        
           try {
               xConnection.startTransactionIfNecessary();
               
  -            if (accessor instanceof TNonXMLObjectAccessor)
  -                    ((TNonXMLObjectAccessor)accessor).delete (xQuery);
  -            else
  -                    ((TXMLObjectAccessor)accessor).delete (xQuery);
  +            if (accessor instanceof TNonXMLObjectAccessor) {
  +                response = ((TNonXMLObjectAccessor)accessor).delete (xQuery);
  +            }
  +            else {
  +                response = ((TXMLObjectAccessor)accessor).delete (xQuery);
  +            }
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
           }
           catch (TException e) {
               throw new XDatastoreException ("xpath: " + xQuery, e);
  
  
  
  No                   revision
  
  Index: XDbSession.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/datastore/XDbSession.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- XDbSession.java   22 Dec 2004 15:34:42 -0000      1.1.4.2
  +++ XDbSession.java   1 Feb 2005 11:27:19 -0000       1.1.4.3
  @@ -37,6 +37,7 @@
   import com.softwareag.tamino.db.api.objectModel.jdom.TJDOMObjectModel;
   import com.softwareag.tamino.db.api.response.TResponse;
   import org.apache.slide.common.Domain;
  +import org.apache.slide.store.tamino.datastore.TaminoCodes;
   import org.apache.slide.store.tamino.datastore.schema.XDoctype;
   import org.apache.slide.store.tamino.jdomobjects.XDescriptors;
   import org.apache.slide.store.tamino.store.ISlideAccessor;
  @@ -302,6 +303,7 @@
               throw new XForbiddenException ("Non-XML content not allowed");
           
           String result = null;
  +        TResponse response = null;
           String docType = content.getDocumentType();
           if( docType == null || "".equals(docType) )
               docType = "application/octet-stream";
  @@ -309,7 +311,11 @@
           try {
               TNonXMLObject nonXmlObject = 
content.getContentWrapper().getNonXMLObject(docType);
               xConnection.startTransactionIfNecessary();
  -            nonXMLContentAccessor.insert (nonXmlObject);
  +            response = nonXMLContentAccessor.insert (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
               result = nonXmlObject.getId();
           }
           catch (TException e) {
  @@ -318,7 +324,11 @@
                   docType = "application/octet-stream";
                   TNonXMLObject nonXmlObject = 
content.getContentWrapper().getNonXMLObject(docType);
                   xConnection.startTransactionIfNecessary();
  -                nonXMLContentAccessor.insert (nonXmlObject);
  +                response = nonXMLContentAccessor.insert (nonXmlObject);
  +                String code = response.getReturnValue();
  +                if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                    throw new XException("Tamino returned possibly aborting 
code: "+code);
  +                }
                   result = nonXmlObject.getId();
               }
               catch (TException x) {
  @@ -493,9 +503,12 @@
                               XProcessResultParser resultParser = new 
XProcessResultParser();
                               resultParser.parse (resultStream);
                               
  -                            String response = resultParser.getResponse();
  +                            String code = resultParser.getResponse();
  +                            if (!"0".equals(code) && 
!TaminoCodes.isNonaborting(code)) {
  +                                throw new XException("Tamino returned 
possibly aborting code: "+code);
  +                            }
                               
  -                            if (!"0".equals (response)) {
  +                            if (!"0".equals (code)) {
                                   if (allowNonXML) {
                                       docType = NONXML_CONTENT;
                                       id = createNonXmlContent (content);
  @@ -504,7 +517,7 @@
                                   else {
                                       throw new XForbiddenException(
                                           "Storing content as XML failed with 
Tamino error " +
  -                                            response + " and non-XML content 
not allowed" );
  +                                            code + " and non-XML content not 
allowed" );
                                   }
                               }
                               else {
  @@ -613,6 +626,11 @@
               xConnection.startTransactionIfNecessary();
               
               response = nonXMLContentAccessor.update (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
  +            
               inoIdReturnedFromTamino = nonXmlObject.getId();
               
               if (!inoIdReturnedFromTamino.equals (contentId.getId()))
  @@ -659,6 +677,10 @@
               xConnection.startTransactionIfNecessary();
               nonXmlObject.setId (contentId.getId());
               response = nonXMLContentAccessor.update (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
               result = nonXmlObject.getId();
           }
           catch (TException e) {
  @@ -668,6 +690,10 @@
                   xConnection.startTransactionIfNecessary();
                   nonXmlObject.setId (contentId.getId());
                   response = nonXMLContentAccessor.update (nonXmlObject);
  +                String code = response.getReturnValue();
  +                if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                    throw new XException("Tamino returned possibly aborting 
code: "+code);
  +                }
                   result = nonXmlObject.getId();
               }
               catch (TException x) {
  @@ -791,13 +817,21 @@
               inoId
           );
           
  +        TResponse response = null;
  +        
           try {
               xConnection.startTransactionIfNecessary();
               
  -            if (accessor instanceof TNonXMLObjectAccessor)
  -                    ((TNonXMLObjectAccessor)accessor).delete (xQuery);
  -            else
  -                    ((TXMLObjectAccessor)accessor).delete (xQuery);
  +            if (accessor instanceof TNonXMLObjectAccessor) {
  +                response = ((TNonXMLObjectAccessor)accessor).delete (xQuery);
  +            }
  +            else {
  +                response = ((TXMLObjectAccessor)accessor).delete (xQuery);
  +            }
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
           }
           catch (TException e) {
               throw new XDatastoreException ("xpath: " + xQuery, e);
  
  
  
  No                   revision
  
  Index: XDbSession.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/datastore/XDbSession.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- XDbSession.java   22 Dec 2004 15:34:42 -0000      1.1.4.2
  +++ XDbSession.java   1 Feb 2005 11:27:19 -0000       1.1.4.3
  @@ -37,6 +37,7 @@
   import com.softwareag.tamino.db.api.objectModel.jdom.TJDOMObjectModel;
   import com.softwareag.tamino.db.api.response.TResponse;
   import org.apache.slide.common.Domain;
  +import org.apache.slide.store.tamino.datastore.TaminoCodes;
   import org.apache.slide.store.tamino.datastore.schema.XDoctype;
   import org.apache.slide.store.tamino.jdomobjects.XDescriptors;
   import org.apache.slide.store.tamino.store.ISlideAccessor;
  @@ -302,6 +303,7 @@
               throw new XForbiddenException ("Non-XML content not allowed");
           
           String result = null;
  +        TResponse response = null;
           String docType = content.getDocumentType();
           if( docType == null || "".equals(docType) )
               docType = "application/octet-stream";
  @@ -309,7 +311,11 @@
           try {
               TNonXMLObject nonXmlObject = 
content.getContentWrapper().getNonXMLObject(docType);
               xConnection.startTransactionIfNecessary();
  -            nonXMLContentAccessor.insert (nonXmlObject);
  +            response = nonXMLContentAccessor.insert (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
               result = nonXmlObject.getId();
           }
           catch (TException e) {
  @@ -318,7 +324,11 @@
                   docType = "application/octet-stream";
                   TNonXMLObject nonXmlObject = 
content.getContentWrapper().getNonXMLObject(docType);
                   xConnection.startTransactionIfNecessary();
  -                nonXMLContentAccessor.insert (nonXmlObject);
  +                response = nonXMLContentAccessor.insert (nonXmlObject);
  +                String code = response.getReturnValue();
  +                if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                    throw new XException("Tamino returned possibly aborting 
code: "+code);
  +                }
                   result = nonXmlObject.getId();
               }
               catch (TException x) {
  @@ -493,9 +503,12 @@
                               XProcessResultParser resultParser = new 
XProcessResultParser();
                               resultParser.parse (resultStream);
                               
  -                            String response = resultParser.getResponse();
  +                            String code = resultParser.getResponse();
  +                            if (!"0".equals(code) && 
!TaminoCodes.isNonaborting(code)) {
  +                                throw new XException("Tamino returned 
possibly aborting code: "+code);
  +                            }
                               
  -                            if (!"0".equals (response)) {
  +                            if (!"0".equals (code)) {
                                   if (allowNonXML) {
                                       docType = NONXML_CONTENT;
                                       id = createNonXmlContent (content);
  @@ -504,7 +517,7 @@
                                   else {
                                       throw new XForbiddenException(
                                           "Storing content as XML failed with 
Tamino error " +
  -                                            response + " and non-XML content 
not allowed" );
  +                                            code + " and non-XML content not 
allowed" );
                                   }
                               }
                               else {
  @@ -613,6 +626,11 @@
               xConnection.startTransactionIfNecessary();
               
               response = nonXMLContentAccessor.update (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
  +            
               inoIdReturnedFromTamino = nonXmlObject.getId();
               
               if (!inoIdReturnedFromTamino.equals (contentId.getId()))
  @@ -659,6 +677,10 @@
               xConnection.startTransactionIfNecessary();
               nonXmlObject.setId (contentId.getId());
               response = nonXMLContentAccessor.update (nonXmlObject);
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
               result = nonXmlObject.getId();
           }
           catch (TException e) {
  @@ -668,6 +690,10 @@
                   xConnection.startTransactionIfNecessary();
                   nonXmlObject.setId (contentId.getId());
                   response = nonXMLContentAccessor.update (nonXmlObject);
  +                String code = response.getReturnValue();
  +                if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                    throw new XException("Tamino returned possibly aborting 
code: "+code);
  +                }
                   result = nonXmlObject.getId();
               }
               catch (TException x) {
  @@ -791,13 +817,21 @@
               inoId
           );
           
  +        TResponse response = null;
  +        
           try {
               xConnection.startTransactionIfNecessary();
               
  -            if (accessor instanceof TNonXMLObjectAccessor)
  -                    ((TNonXMLObjectAccessor)accessor).delete (xQuery);
  -            else
  -                    ((TXMLObjectAccessor)accessor).delete (xQuery);
  +            if (accessor instanceof TNonXMLObjectAccessor) {
  +                response = ((TNonXMLObjectAccessor)accessor).delete (xQuery);
  +            }
  +            else {
  +                response = ((TXMLObjectAccessor)accessor).delete (xQuery);
  +            }
  +            String code = response.getReturnValue();
  +            if (!"0".equals(code) && !TaminoCodes.isNonaborting(code)) {
  +                throw new XException("Tamino returned possibly aborting 
code: "+code);
  +            }
           }
           catch (TException e) {
               throw new XDatastoreException ("xpath: " + xQuery, e);
  
  
  
  1.1.2.1   +90 -0     
jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/datastore/Attic/TaminoCodes.java
  
  
  
  
  No                   revision
  No                   revision
  1.1.4.3   +9 -6      
jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/tools/repairer/XTaminoClient.java
  
  Index: XTaminoClient.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/tools/repairer/XTaminoClient.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- XTaminoClient.java        13 Dec 2004 15:34:02 -0000      1.1.4.2
  +++ XTaminoClient.java        1 Feb 2005 11:27:19 -0000       1.1.4.3
  @@ -372,9 +372,12 @@
                               XProcessResultParser resultParser = new 
XProcessResultParser();
                               resultParser.parse (resultStream);
                               
  -                            String response = resultParser.getResponse();
  +                            String code = resultParser.getResponse();
  +                            if (!"0".equals(code) && 
!TaminoCodes.isNonaborting(code)) {
  +                                throw new XException("Tamino returned 
possibly aborting code: "+code);
  +                            }
                               
  -                            if (!"0".equals (response)) {
  +                            if (!"0".equals (code)) {
                                   if (allowNonXML) {
                                       docType = XGlobals.NONXML_CONTENT;
                                       id = createNonXmlContent (content);
  @@ -383,7 +386,7 @@
                                   else {
                                       throw new XForbiddenException(
                                           "Storing content as XML failed with 
Tamino error " +
  -                                            response + " and non-XML content 
not allowed" );
  +                                            code + " and non-XML content not 
allowed" );
                                   }
                               }
                               else {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to