You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2010/05/24 15:48:07 UTC

svn commit: r947643 [1/2] - in /webservices/commons/trunk/modules/axiom: modules/axiom-api/src/main/java/org/apache/axiom/attachments/ modules/axiom-api/src/main/java/org/apache/axiom/ext/io/ modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/ m...

Author: veithen
Date: Mon May 24 13:48:06 2010
New Revision: 947643

URL: http://svn.apache.org/viewvc?rev=947643&view=rev
Log:
Setting svn:eol-style to native for Java classes and HTML.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/AttachmentCacheMonitor.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/ext/io/package.html   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/package.html   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/Behavior.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/ParserInputStreamDataSource.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/osgi/FactoryInjectionComponent.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/OverflowBlob.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/package.html   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/package.html   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderContainer.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/attachments/DeleteAttachmentTest.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/OverflowBlobTest.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestBase.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/TextFromElementReaderTest.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSerializableImpl.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi/axiom-osgi-build/src/main/java/org/apache/axiom/test/OMAbstractFactoryTest.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi/axiom-osgi-build/src/main/java/org/apache/axiom/test/ServiceTest.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-osgi/axiom-osgi-build/src/main/java/org/apache/axiom/test/StAXOMBuilderTest.java   (props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/ParserInputStreamDataSourceTests.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/Scenario.java   (contents, props changed)
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/util/stax/WrappedTextNodeStreamReaderTest.java   (props changed)
    webservices/commons/trunk/modules/axiom/src/site/resources/svn.html   (props changed)

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/AttachmentCacheMonitor.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/AttachmentCacheMonitor.java?rev=947643&r1=947642&r2=947643&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/AttachmentCacheMonitor.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/AttachmentCacheMonitor.java Mon May 24 13:48:06 2010
@@ -1,303 +1,303 @@
-/*
- * Copyright 2004, 2009 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axiom.attachments;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import java.io.File;
-
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The CacheMonitor is responsible for deleting temporary attachment files
- * after a timeout period has expired.
- * 
- * The register method is invoked when the attachment file is created.
- * The access method is invoked whenever the attachment file is accessed.
- * The checkForAgedFiles method is invoked whenever the monitor should look for 
- * files to cleanup (delete).
- * 
- */
-public final class AttachmentCacheMonitor {
-
-    static Log log =
-         LogFactory.getLog(AttachmentCacheMonitor.class.getName());
-
-    // Setting this property puts a limit on the lifetime of a cache file
-    // The default is "0", which is interpreted as forever
-    // The suggested value is 300 seconds
-    private int attachmentTimeoutSeconds = 0;  // Default is 0 (forever)
-    private int refreshSeconds = 0;
-    public static final String ATTACHMENT_TIMEOUT_PROPERTY = "org.apache.axiom.attachments.tempfile.expiration";
-
-    // HashMap
-    // Key String = Absolute file name
-    // Value Long = Last Access Time
-    private HashMap files = new HashMap();
-
-    // Delete detection is batched
-    private Long priorDeleteMillis = getTime();
-
-    private Timer timer = null;
-
-    private static AttachmentCacheMonitor _singleton = null;
-
-
-    /**
-     * Get or Create an AttachmentCacheMonitor singleton
-     * @return
-     */
-    public static synchronized AttachmentCacheMonitor getAttachmentCacheMonitor() {
-        if (_singleton == null) {
-            _singleton = new AttachmentCacheMonitor();
-        }
-        return _singleton;
-    }
-
-    /**
-     * Constructor
-     * Intentionally private.  Callers should use getAttachmentCacheMonitor
-     * @see getAttachmentCacheMonitor
-     */
-    private AttachmentCacheMonitor() {
-        String value = "";
-        try {
-            value = System.getProperty(ATTACHMENT_TIMEOUT_PROPERTY, "0");
-            attachmentTimeoutSeconds = Integer.valueOf(value).intValue();
-        } catch (Throwable t) {
-            // Swallow exception and use default, but log a warning message
-        	if (log.isDebugEnabled()) {
-        		log.debug("The value of " + value + " was not valid. The default " + 
-        		        attachmentTimeoutSeconds + " will be used instead.");
-        	}
-        }
-        refreshSeconds = attachmentTimeoutSeconds / 2;
-
-        if (log.isDebugEnabled()) {
-            log.debug("Custom Property Key =  " + ATTACHMENT_TIMEOUT_PROPERTY);
-            log.debug("              Value = " + attachmentTimeoutSeconds);
-        }
-
-        if (refreshSeconds > 0) {
-            timer = new Timer( true );
-            timer.schedule( new CleanupFilesTask(), 
-                    refreshSeconds * 1000, 
-                    refreshSeconds * 1000 );
-        }
-    }
-    
-    /**
-     * @return timeout value in seconds
-     */
-    public synchronized int getTimeout() {
-    	return attachmentTimeoutSeconds;
-    }
-    
-    /**
-     * This method should
-     * Set a new timeout value 
-     * @param timeout new timeout value in seconds
-     */
-    public synchronized void setTimeout(int timeout) {
-        // If the setting to the same value, simply return
-        if (timeout == attachmentTimeoutSeconds) {
-            return;
-        }
-        
-    	attachmentTimeoutSeconds = timeout;
-    	
-    	// Reset the refresh
-    	refreshSeconds = attachmentTimeoutSeconds / 2;
-    	
-    	// Make sure to cancel the prior timer
-    	if (timer != null) {
-            timer.cancel(); // Remove scheduled tasks from the prior timer
-            timer = null;
-        }
-    	
-    	// Make a new timer if necessary
-        if (refreshSeconds > 0) {
-        	timer = new Timer( true );
-            timer.schedule( new CleanupFilesTask(), 
-                    refreshSeconds * 1000, 
-                    refreshSeconds * 1000 );
-        }
-        
-        if (log.isDebugEnabled()) { 
-        	log.debug("New timeout = " + attachmentTimeoutSeconds);
-        	log.debug("New refresh = " + refreshSeconds);
-        }
-    }
-
-    /**
-     * Register a file name with the monitor.  
-     * This will allow the Monitor to remove the file after
-     * the timeout period.
-     * @param fileName
-     */
-    public void  register(String fileName) {
-        if (attachmentTimeoutSeconds    > 0) {
-            _register(fileName);
-            _checkForAgedFiles();
-        }
-    }
-    
-    /**
-     * Indicates that the file was accessed.
-     * @param fileName
-     */
-    public void access(String fileName) {
-        if (attachmentTimeoutSeconds    > 0) {
-            _access(fileName);
-            _checkForAgedFiles();
-        }
-    }
-    
-    /**
-     * Check for aged files and remove the aged ones.
-     */
-    public void checkForAgedFiles() {
-        if (attachmentTimeoutSeconds > 0) {
-            _checkForAgedFiles();
-        }
-    }
-
-    private synchronized void _register(String fileName) {
-        Long currentTime = getTime();
-        if (log.isDebugEnabled()) {
-            log.debug("Register file " + fileName);
-            log.debug("Time = " + currentTime); 
-        }
-        files.put(fileName, currentTime);
-    }
-
-    private synchronized void _access(String fileName) {
-        Long currentTime = getTime();
-        Long priorTime = (Long) files.get(fileName);
-        if (priorTime != null) {
-            files.put(fileName, currentTime);
-            if (log.isDebugEnabled()) {
-                log.debug("Access file " + fileName);
-                log.debug("Old Time = " + priorTime); 
-                log.debug("New Time = " + currentTime); 
-            }
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug("The following file was already deleted and is no longer available: " + 
-                          fileName);
-                log.debug("The value of " + ATTACHMENT_TIMEOUT_PROPERTY + 
-                          " is " + attachmentTimeoutSeconds);
-            }
-        }
-    }
-
-    private synchronized void _checkForAgedFiles() {
-        Long currentTime = getTime();
-        // Don't keep checking the map, only trigger
-        // the checking if it is plausible that 
-        // files will need to be deleted.
-        // I chose a value of ATTACHMENTT_TIMEOUT_SECONDS/4
-        if (isExpired(priorDeleteMillis,
-                      currentTime,
-                      refreshSeconds)) {
-            Iterator it = files.keySet().iterator();
-            while (it.hasNext()) {
-                String fileName = (String) it.next();
-                Long lastAccess = (Long) files.get(fileName);
-                if (isExpired(lastAccess,
-                              currentTime,
-                              attachmentTimeoutSeconds)) {
-
-                    if (log.isDebugEnabled()) {
-                        log.debug("Expired file " + fileName);
-                        log.debug("Old Time = " + lastAccess); 
-                        log.debug("New Time = " + currentTime); 
-                        log.debug("Elapsed Time (ms) = " + 
-                                  (currentTime.longValue() - lastAccess.longValue())); 
-                    }
-
-                    deleteFile(fileName);
-                    // Use the iterator to remove this
-                    // file from the map (this avoids
-                    // the dreaded ConcurrentModificationException
-                    it.remove(); 
-                }     
-            }
-               
-            // Reset the prior delete time
-            priorDeleteMillis = currentTime;
-        }
-    }
-
-    private boolean deleteFile(final String fileName ) {
-        Boolean privRet = (Boolean) AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    return _deleteFile(fileName);
-                }
-            });
-        return privRet.booleanValue();
-    }
-
-    private Boolean _deleteFile(String fileName) {
-        boolean ret = false;
-        File file = new File(fileName);
-        if (file.exists()) {
-            ret = file.delete();
-            if (log.isDebugEnabled()) {
-                log.debug("Deletion Successful ? " + ret);
-            }
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug("This file no longer exists = " + fileName);
-            }
-        }
-        return new Boolean(ret);
-    }
-
-
-    private Long getTime() {
-        return new Long(System.currentTimeMillis());
-    }
-
-    private boolean isExpired (Long oldTimeMillis, 
-                                      Long newTimeMillis, 
-                                      int thresholdSecs) {
-        long elapse = newTimeMillis.longValue() -
-            oldTimeMillis.longValue();
-        return (elapse > (thresholdSecs*1000));
-    }
-
-
-    private class CleanupFilesTask extends TimerTask {
-
-        /**
-         * Trigger a checkForAgedFiles event
-         */
-        public void run() {
-            checkForAgedFiles();
-        }
-    }
-}
+/*
+ * Copyright 2004, 2009 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import java.io.File;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The CacheMonitor is responsible for deleting temporary attachment files
+ * after a timeout period has expired.
+ * 
+ * The register method is invoked when the attachment file is created.
+ * The access method is invoked whenever the attachment file is accessed.
+ * The checkForAgedFiles method is invoked whenever the monitor should look for 
+ * files to cleanup (delete).
+ * 
+ */
+public final class AttachmentCacheMonitor {
+
+    static Log log =
+         LogFactory.getLog(AttachmentCacheMonitor.class.getName());
+
+    // Setting this property puts a limit on the lifetime of a cache file
+    // The default is "0", which is interpreted as forever
+    // The suggested value is 300 seconds
+    private int attachmentTimeoutSeconds = 0;  // Default is 0 (forever)
+    private int refreshSeconds = 0;
+    public static final String ATTACHMENT_TIMEOUT_PROPERTY = "org.apache.axiom.attachments.tempfile.expiration";
+
+    // HashMap
+    // Key String = Absolute file name
+    // Value Long = Last Access Time
+    private HashMap files = new HashMap();
+
+    // Delete detection is batched
+    private Long priorDeleteMillis = getTime();
+
+    private Timer timer = null;
+
+    private static AttachmentCacheMonitor _singleton = null;
+
+
+    /**
+     * Get or Create an AttachmentCacheMonitor singleton
+     * @return
+     */
+    public static synchronized AttachmentCacheMonitor getAttachmentCacheMonitor() {
+        if (_singleton == null) {
+            _singleton = new AttachmentCacheMonitor();
+        }
+        return _singleton;
+    }
+
+    /**
+     * Constructor
+     * Intentionally private.  Callers should use getAttachmentCacheMonitor
+     * @see getAttachmentCacheMonitor
+     */
+    private AttachmentCacheMonitor() {
+        String value = "";
+        try {
+            value = System.getProperty(ATTACHMENT_TIMEOUT_PROPERTY, "0");
+            attachmentTimeoutSeconds = Integer.valueOf(value).intValue();
+        } catch (Throwable t) {
+            // Swallow exception and use default, but log a warning message
+        	if (log.isDebugEnabled()) {
+        		log.debug("The value of " + value + " was not valid. The default " + 
+        		        attachmentTimeoutSeconds + " will be used instead.");
+        	}
+        }
+        refreshSeconds = attachmentTimeoutSeconds / 2;
+
+        if (log.isDebugEnabled()) {
+            log.debug("Custom Property Key =  " + ATTACHMENT_TIMEOUT_PROPERTY);
+            log.debug("              Value = " + attachmentTimeoutSeconds);
+        }
+
+        if (refreshSeconds > 0) {
+            timer = new Timer( true );
+            timer.schedule( new CleanupFilesTask(), 
+                    refreshSeconds * 1000, 
+                    refreshSeconds * 1000 );
+        }
+    }
+    
+    /**
+     * @return timeout value in seconds
+     */
+    public synchronized int getTimeout() {
+    	return attachmentTimeoutSeconds;
+    }
+    
+    /**
+     * This method should
+     * Set a new timeout value 
+     * @param timeout new timeout value in seconds
+     */
+    public synchronized void setTimeout(int timeout) {
+        // If the setting to the same value, simply return
+        if (timeout == attachmentTimeoutSeconds) {
+            return;
+        }
+        
+    	attachmentTimeoutSeconds = timeout;
+    	
+    	// Reset the refresh
+    	refreshSeconds = attachmentTimeoutSeconds / 2;
+    	
+    	// Make sure to cancel the prior timer
+    	if (timer != null) {
+            timer.cancel(); // Remove scheduled tasks from the prior timer
+            timer = null;
+        }
+    	
+    	// Make a new timer if necessary
+        if (refreshSeconds > 0) {
+        	timer = new Timer( true );
+            timer.schedule( new CleanupFilesTask(), 
+                    refreshSeconds * 1000, 
+                    refreshSeconds * 1000 );
+        }
+        
+        if (log.isDebugEnabled()) { 
+        	log.debug("New timeout = " + attachmentTimeoutSeconds);
+        	log.debug("New refresh = " + refreshSeconds);
+        }
+    }
+
+    /**
+     * Register a file name with the monitor.  
+     * This will allow the Monitor to remove the file after
+     * the timeout period.
+     * @param fileName
+     */
+    public void  register(String fileName) {
+        if (attachmentTimeoutSeconds    > 0) {
+            _register(fileName);
+            _checkForAgedFiles();
+        }
+    }
+    
+    /**
+     * Indicates that the file was accessed.
+     * @param fileName
+     */
+    public void access(String fileName) {
+        if (attachmentTimeoutSeconds    > 0) {
+            _access(fileName);
+            _checkForAgedFiles();
+        }
+    }
+    
+    /**
+     * Check for aged files and remove the aged ones.
+     */
+    public void checkForAgedFiles() {
+        if (attachmentTimeoutSeconds > 0) {
+            _checkForAgedFiles();
+        }
+    }
+
+    private synchronized void _register(String fileName) {
+        Long currentTime = getTime();
+        if (log.isDebugEnabled()) {
+            log.debug("Register file " + fileName);
+            log.debug("Time = " + currentTime); 
+        }
+        files.put(fileName, currentTime);
+    }
+
+    private synchronized void _access(String fileName) {
+        Long currentTime = getTime();
+        Long priorTime = (Long) files.get(fileName);
+        if (priorTime != null) {
+            files.put(fileName, currentTime);
+            if (log.isDebugEnabled()) {
+                log.debug("Access file " + fileName);
+                log.debug("Old Time = " + priorTime); 
+                log.debug("New Time = " + currentTime); 
+            }
+        } else {
+            if (log.isDebugEnabled()) {
+                log.debug("The following file was already deleted and is no longer available: " + 
+                          fileName);
+                log.debug("The value of " + ATTACHMENT_TIMEOUT_PROPERTY + 
+                          " is " + attachmentTimeoutSeconds);
+            }
+        }
+    }
+
+    private synchronized void _checkForAgedFiles() {
+        Long currentTime = getTime();
+        // Don't keep checking the map, only trigger
+        // the checking if it is plausible that 
+        // files will need to be deleted.
+        // I chose a value of ATTACHMENTT_TIMEOUT_SECONDS/4
+        if (isExpired(priorDeleteMillis,
+                      currentTime,
+                      refreshSeconds)) {
+            Iterator it = files.keySet().iterator();
+            while (it.hasNext()) {
+                String fileName = (String) it.next();
+                Long lastAccess = (Long) files.get(fileName);
+                if (isExpired(lastAccess,
+                              currentTime,
+                              attachmentTimeoutSeconds)) {
+
+                    if (log.isDebugEnabled()) {
+                        log.debug("Expired file " + fileName);
+                        log.debug("Old Time = " + lastAccess); 
+                        log.debug("New Time = " + currentTime); 
+                        log.debug("Elapsed Time (ms) = " + 
+                                  (currentTime.longValue() - lastAccess.longValue())); 
+                    }
+
+                    deleteFile(fileName);
+                    // Use the iterator to remove this
+                    // file from the map (this avoids
+                    // the dreaded ConcurrentModificationException
+                    it.remove(); 
+                }     
+            }
+               
+            // Reset the prior delete time
+            priorDeleteMillis = currentTime;
+        }
+    }
+
+    private boolean deleteFile(final String fileName ) {
+        Boolean privRet = (Boolean) AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return _deleteFile(fileName);
+                }
+            });
+        return privRet.booleanValue();
+    }
+
+    private Boolean _deleteFile(String fileName) {
+        boolean ret = false;
+        File file = new File(fileName);
+        if (file.exists()) {
+            ret = file.delete();
+            if (log.isDebugEnabled()) {
+                log.debug("Deletion Successful ? " + ret);
+            }
+        } else {
+            if (log.isDebugEnabled()) {
+                log.debug("This file no longer exists = " + fileName);
+            }
+        }
+        return new Boolean(ret);
+    }
+
+
+    private Long getTime() {
+        return new Long(System.currentTimeMillis());
+    }
+
+    private boolean isExpired (Long oldTimeMillis, 
+                                      Long newTimeMillis, 
+                                      int thresholdSecs) {
+        long elapse = newTimeMillis.longValue() -
+            oldTimeMillis.longValue();
+        return (elapse > (thresholdSecs*1000));
+    }
+
+
+    private class CleanupFilesTask extends TimerTask {
+
+        /**
+         * Trigger a checkForAgedFiles event
+         */
+        public void run() {
+            checkForAgedFiles();
+        }
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/AttachmentCacheMonitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/ext/io/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/ext/stax/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java?rev=947643&r1=947642&r2=947643&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java Mon May 24 13:48:06 2010
@@ -1,94 +1,94 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axiom.om;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * Information item that can be serialized (written to an XML stream writer) and
- * deserialized (retrieved from an XML parser) as a unit.
- * This is the common super-interface for {@link OMDocument} and {@link OMNode}.
- * Note that {@link OMAttribute} and {@link OMNamespace} are information items that don't
- * match the definition of this interface because they can only be read from the parser
- * as part of a larger unit, namely an element.
- * <p>
- * In accordance with the definition given above, this interface declares two sets of methods:
- * <ul>
- *   <li>Methods allowing to control whether the information item has been completely built,
- *       i.e. whether all events corresponding to the information item have been retrieved
- *       from the parser.</li>
- *   <li>Methods to write the StAX events corresponding to the information item to an
- *       {@link XMLStreamWriter}.</li>
- * </ul>
- */
-public interface OMSerializable {
-    /**
-     * Returns the OMFactory that created this object
-     */
-    OMFactory getOMFactory();
-
-    /**
-     * Indicates whether parser has parsed this information item completely or not. If some info are
-     * not available in the item, one has to check this attribute to make sure that, this item has been
-     * parsed completely or not.
-     *
-     * @return Returns boolean.
-     */
-    boolean isComplete();
-
-    /** Builds itself. */
-    void build();
-
-    /**
-     * If a builder and parser is associated with the node, it is closed.
-     * @param build if true, the object is built first before closing the builder/parser
-     */
-    void close(boolean build);
-
-    /**
-     * Serializes the information item with caching. This method has the same effect as
-     * {@link #serialize(XMLStreamWriter, boolean)} with <code>cache</code> set to
-     * <code>true</code>.
-     *
-     * @param xmlWriter
-     * @throws XMLStreamException
-     */
-    void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException;
-
-    /**
-     * Serializes the information item without caching. This method has the same effect as
-     * {@link #serialize(XMLStreamWriter, boolean)} with <code>cache</code> set to
-     * <code>false</code>.
-     *
-     * @param xmlWriter
-     * @throws XMLStreamException
-     */
-    void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException;
-    
-    /**
-     * Serializes the information item.
-     * 
-     * @param xmlWriter
-     * @param cache indicates if caching should be enabled
-     * @throws XMLStreamException
-     */
-    void serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axiom.om;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Information item that can be serialized (written to an XML stream writer) and
+ * deserialized (retrieved from an XML parser) as a unit.
+ * This is the common super-interface for {@link OMDocument} and {@link OMNode}.
+ * Note that {@link OMAttribute} and {@link OMNamespace} are information items that don't
+ * match the definition of this interface because they can only be read from the parser
+ * as part of a larger unit, namely an element.
+ * <p>
+ * In accordance with the definition given above, this interface declares two sets of methods:
+ * <ul>
+ *   <li>Methods allowing to control whether the information item has been completely built,
+ *       i.e. whether all events corresponding to the information item have been retrieved
+ *       from the parser.</li>
+ *   <li>Methods to write the StAX events corresponding to the information item to an
+ *       {@link XMLStreamWriter}.</li>
+ * </ul>
+ */
+public interface OMSerializable {
+    /**
+     * Returns the OMFactory that created this object
+     */
+    OMFactory getOMFactory();
+
+    /**
+     * Indicates whether parser has parsed this information item completely or not. If some info are
+     * not available in the item, one has to check this attribute to make sure that, this item has been
+     * parsed completely or not.
+     *
+     * @return Returns boolean.
+     */
+    boolean isComplete();
+
+    /** Builds itself. */
+    void build();
+
+    /**
+     * If a builder and parser is associated with the node, it is closed.
+     * @param build if true, the object is built first before closing the builder/parser
+     */
+    void close(boolean build);
+
+    /**
+     * Serializes the information item with caching. This method has the same effect as
+     * {@link #serialize(XMLStreamWriter, boolean)} with <code>cache</code> set to
+     * <code>true</code>.
+     *
+     * @param xmlWriter
+     * @throws XMLStreamException
+     */
+    void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException;
+
+    /**
+     * Serializes the information item without caching. This method has the same effect as
+     * {@link #serialize(XMLStreamWriter, boolean)} with <code>cache</code> set to
+     * <code>false</code>.
+     *
+     * @param xmlWriter
+     * @throws XMLStreamException
+     */
+    void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException;
+    
+    /**
+     * Serializes the information item.
+     * 
+     * @param xmlWriter
+     * @param cache indicates if caching should be enabled
+     * @throws XMLStreamException
+     */
+    void serialize(XMLStreamWriter xmlWriter, boolean cache) throws XMLStreamException;
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/Behavior.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/Behavior.java?rev=947643&r1=947642&r2=947643&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/Behavior.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/Behavior.java Mon May 24 13:48:06 2010
@@ -1,52 +1,52 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axiom.om.ds;
-
-public class Behavior {
-    // An OMDataSource must communicate whether the data source is
-    // can be queried without destruction.  OM makes decisions about
-    // caching (etc) based on whether the data source query is 
-    // destructive or not destructive.
-    // 
-    // The Behavior flag indicates the Behavior of this OMDataSource
-    // DESTRUCTIVE:
-    //    Indicates that the backing data can only be read one time.
-    //    AFFECT ON OM:
-    //    The OM tree will automatically make a OM cache of the 
-    //    the tree
-    // 
-    // NOT_DESTRUCTIVE
-    //    Indicates that the data may be queried multiple times.
-    //    The InputStream's data is either copied or marks are used to
-    //    allow the data to be read again.
-    //    AFFECT ON OM:
-    //    The OM tree will not automatically make a OM cache of the tree.
-    //
-    // ONE_USE_UNSAFE:
-    //    Indicates that the data may be queried only one time.  The
-    //    second query will cause an immediate failure.  This is an unsafe
-    //    mode because it violates the OM contract.  The implementation of 
-    //    this mode is done by lying to the OM model.  We tell it that the 
-    //    data is not destructive, and yet we don't make a copy.
-    //
-	
-    public static final int DESTRUCTIVE = 0;
-    public static final int NOT_DESTRUCTIVE = 1;
-    public static final int ONE_USE_UNSAFE = 2;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.ds;
+
+public class Behavior {
+    // An OMDataSource must communicate whether the data source is
+    // can be queried without destruction.  OM makes decisions about
+    // caching (etc) based on whether the data source query is 
+    // destructive or not destructive.
+    // 
+    // The Behavior flag indicates the Behavior of this OMDataSource
+    // DESTRUCTIVE:
+    //    Indicates that the backing data can only be read one time.
+    //    AFFECT ON OM:
+    //    The OM tree will automatically make a OM cache of the 
+    //    the tree
+    // 
+    // NOT_DESTRUCTIVE
+    //    Indicates that the data may be queried multiple times.
+    //    The InputStream's data is either copied or marks are used to
+    //    allow the data to be read again.
+    //    AFFECT ON OM:
+    //    The OM tree will not automatically make a OM cache of the tree.
+    //
+    // ONE_USE_UNSAFE:
+    //    Indicates that the data may be queried only one time.  The
+    //    second query will cause an immediate failure.  This is an unsafe
+    //    mode because it violates the OM contract.  The implementation of 
+    //    this mode is done by lying to the OM model.  We tell it that the 
+    //    data is not destructive, and yet we don't make a copy.
+    //
+	
+    public static final int DESTRUCTIVE = 0;
+    public static final int NOT_DESTRUCTIVE = 1;
+    public static final int ONE_USE_UNSAFE = 2;
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/Behavior.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/ParserInputStreamDataSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/ParserInputStreamDataSource.java?rev=947643&r1=947642&r2=947643&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/ParserInputStreamDataSource.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/ParserInputStreamDataSource.java Mon May 24 13:48:06 2010
@@ -1,433 +1,433 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axiom.om.ds;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.axiom.attachments.impl.BufferUtils;
-import org.apache.axiom.attachments.utils.BAAInputStream;
-import org.apache.axiom.attachments.utils.BAAOutputStream;
-import org.apache.axiom.om.OMDataSourceExt;
-import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.ds.OMDataSourceExtBase;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.util.CommonUtils;
-import org.apache.axiom.om.util.StAXUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-/**
- * A DataSource that is backed by an InputStream (read from a parser).
- * The Data in this Data source owns the payload inputStream. 
- */
-public class ParserInputStreamDataSource extends OMDataSourceExtBase {
-    private static final Log log = 
-        LogFactory.getLog(ParserInputStreamDataSource.class);
-    
-    // This is the backing storage. 
-    // The "data" object contains an InputStream that contains the actual bytes.
-    // Copying/Marking of the InputStream is controlled by the requested Behavior.
-    private Data data = null;
-    
-    // This behavior provides both safety and performance
-    private final static int defaultBehavior = Behavior.NOT_DESTRUCTIVE;
-    
-    /**
-     * This is the constructor that is normally called.
-     * 
-     * Note that the ParserInputStreamDataSource takes ownership of the 
-     * payload InputStream.  It may copy, mark or reset the stream.  
-     * Callers should not access the stream after this constructor is called
-     * 
-     * @param payload InputStream
-     * @param encoding
-     */
-    public ParserInputStreamDataSource(InputStream payload, String encoding) {
-        this(payload, 
-            encoding, defaultBehavior );
-    }
-    
-    /**
-     * This constructor is used to test the different Behavior settings.
-     * 
-     * Note that the ParserInputStreamDataSource takes ownership of the 
-     * payload InputStream.  It may copy, mark or reset the stream.  
-     * Callers should not access the stream after this constructor is called.
-     * 
-     * @param payload
-     * @param encoding
-     * @param behavior
-     */
-    public ParserInputStreamDataSource(InputStream payload, 
-            String encoding, 
-            int behavior) {
-        data = new  Data(payload,
-                        (encoding!=null)?encoding:"UTF-8",
-                         behavior);
-    }
-    
-
-    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        if(log.isDebugEnabled()){
-            log.debug("Entry ParserInputStreamDataSource.serialize(OutputStream, OMOutputFormat");
-        }
-        
-        String encoding = (format!=null)?format.getCharSetEncoding():null;
-        
-        try {
-            if (!data.encoding.equalsIgnoreCase(encoding)) {
-                byte[] bytes = getXMLBytes(encoding);
-                output.write(bytes);
-            } else {
-                // Write the input stream to the output stream
-                InputStream is = data.readParserInputStream();
-                if(is!=null){
-                    BufferUtils.inputStream2OutputStream(is, output);
-                }
-            }
-            if(log.isDebugEnabled()){
-                log.debug("Exit ParserInputStreamDataSource.serialize(OutputStream, OMOutputFormat");
-            }
-        } catch (UnsupportedEncodingException e) {
-            throw new XMLStreamException(e);
-        } catch (IOException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        if(log.isDebugEnabled()){
-            log.debug("Entry ParserInputStreamDataSource.serialize(XMLStreamWriter)");
-        }
-        super.serialize(xmlWriter);
-        if(log.isDebugEnabled()){
-            log.debug("Exit ParserInputStreamDataSource.serialize(XMLStreamWriter)");
-        }
-    }
-
-    public XMLStreamReader getReader() throws XMLStreamException {
-        if(log.isDebugEnabled()){
-            log.debug("Entry ParserInputStreamDataSource.getReader()");
-        }
-        InputStream is = data.readParserInputStream();
-        if(is == null){
-            //Parser content has already been read.
-            if(log.isDebugEnabled()){
-                log.warn("Parser content has already been read");
-            }
-        }
-        XMLStreamReader reader = StAXUtils.createXMLStreamReader(is, data.encoding);
-        if(log.isDebugEnabled()){
-            log.debug("Exit ParserInputStreamDataSource.getReader()");
-        }
-        return reader;
-    }
-
-    /* 
-     * Note that the returned InputStream may be different than the one
-     * passed in the constructor. 
-     * The caller may not used the mark or reset methods on the InputStream
-     * (non-Javadoc)
-     * @see org.apache.axiom.om.ds.OMDataSourceExtBase#getXMLInputStream(java.lang.String)
-     */
-    public InputStream getXMLInputStream(String encoding)  
-        throws UnsupportedEncodingException {
-        try{
-            return data.readParserInputStream();
-        }catch(XMLStreamException e){
-            throw new OMException(e);
-        }
-    }
-
-    public int numReads() {
-        return data.numReads;
-    }
-    
-    
-    public Object getObject() {
-        return data;
-    }
-
-    public boolean isDestructiveRead() {
-        // If DESTRUCTIVE return true
-        // If NOT_DESTRUCTIVE return false
-        // If ONE_USE_UNSAFE, we lie and tell the engine false
-        //      ...but we will intentionally fail on second access.
-        return (data.behavior == Behavior.DESTRUCTIVE);
-    }
-
-    public boolean isDestructiveWrite() {
-     // If DESTRUCTIVE return true
-        // If NOT_DESTRUCTIVE return false
-        // If ONE_USE_UNSAFE, we lie and tell the engine false
-        //      ...but we will intentionally fail on second access.
-        return (data.behavior == Behavior.DESTRUCTIVE);
-    }
-
-    public byte[] getXMLBytes(String encoding){
-        if(log.isDebugEnabled()){
-            log.debug("Entry ParserInputStreamDataSource.getXMLBytes(encoding)");
-        }
-        try{
-            InputStream is = data.readParserInputStream();
-            if(is != null){
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                OMOutputFormat format = new OMOutputFormat();
-                format.setCharSetEncoding(encoding);
-                try {
-                    BufferUtils.inputStream2OutputStream(is, baos);
-                    if(log.isDebugEnabled()){
-                        log.debug("Exit ParserInputStreamDataSource.getXMLBytes(encoding)");
-                    }
-                    return baos.toByteArray();
-                } catch (IOException e) {
-                    throw new OMException(e);
-                }
-            }else{
-                //Someone already read the parser, happens in serialize call. I expect user to invoke this
-                //via SerializeAndConsume call
-                if(log.isDebugEnabled()){
-                    log.warn("Parser was already read, recovering by just returning new byte[0]");
-                    log.debug("Exit ParserInputStreamDataSource.getXMLBytes(encoding)");
-                }
-                return new byte[0];
-            }
-        }catch(XMLStreamException e){
-            throw new OMException(e);
-        }
-    }
-
-    public void close() {
-        if(log.isDebugEnabled()){
-            log.debug("Entry ParserInputStreamDataSource.close()");
-        }
-        if (data.payload != null) {
-            try {
-                data.payload.close();
-            } catch (IOException e) {
-                throw new OMException(e);
-            }
-            data.payload = null;
-        }
-        if(log.isDebugEnabled()){
-            log.debug("Exit ParserInputStreamDataSource.close()");
-        }
-    }
-
-    /**
-     * Return a InputStreamDataSource backed by a ByteArrayInputStream
-     */
-    public OMDataSourceExt copy() {
-        if(log.isDebugEnabled()){
-            log.debug("Enter ParserInputStreamDataSource.copy()");
-        }
-        try {
-            BAAOutputStream baaos = new BAAOutputStream();
-            BufferUtils.inputStream2OutputStream(data.readParserInputStream(), baaos);
-            BAAInputStream baais = new BAAInputStream(baaos.buffers(), 
-                        baaos.length());
-            
-            if (log.isDebugEnabled()) {
-                log.debug("Exit ParserInputStreamDataSource.copy()");
-            }
-            return new ParserInputStreamDataSource(baais, data.encoding, data.behavior);
-        } catch (Throwable t) {
-            if(log.isDebugEnabled()){
-                log.debug("Error ParserInputStreamDataSource.copy(): ", t);
-            }
-            throw new OMException(t);
-        }
-        
-    }
-
-    /**
-     * @author scheu
-     *
-     */
-    public class Data{
-        
-        // The InputStream containing the byte data
-        private InputStream payload = null;
-        
-        // The encoding (i.e. UTF-8)
-        private String encoding = null;
-        
-        // The designated Behavior.  @see Behavior
-        private int behavior;
-        
-        // Track the number of read accesses.  
-        // ONE_USE_UNSAFE will intentionally fail on second read.
-        private int numReads = 0;
-        
-        // Track the first use when ONE_USE_UNSAFE is requested
-        private String firstUseStack = null;
-        
-        
-        
-        /** 
-         * Intentionally provide.  Only created by ParserInputStreamDataSource
-         * @param payload
-         * @param encoding
-         * @param behavior
-         */
-        private Data(InputStream payload,
-                String encoding,
-                int behavior) {
-            this.payload = payload;
-            this.encoding = encoding;
-            this.behavior = behavior;
-
-            setInputStream(payload);
-        }
-        
-        /**
-         * @return InputStream that consumer should use..this may be different
-         * than the InputStream initially handed to the ParsedDataEntitySource
-         * @throws XMLStreamException
-         * @throws OMException if second access and ONE_USE_UNSAFE or other problems occur
-         */
-        public InputStream readParserInputStream() throws XMLStreamException{
-            numReads++;
-            
-            // Dump our state
-            if(log.isDebugEnabled()){
-                log.debug("Entry readParserInputStream()");
-                log.debug("Data Encoding = "+encoding);
-                log.debug("numReads = "+numReads);
-                log.debug("behavior = "+behavior);
-                
-                // The call stack is helpful to identify non-performant call flows
-                String stack = CommonUtils.stackToString(new OMException());
-                log.debug("call stack:" + stack);
-            }
-            
-            
-            // TODO NLS 
-            if(payload == null){
-                throw new OMException("ParserInputStreamDataSource's InputStream is null.");
-            }   
-            
-            if (behavior == Behavior.NOT_DESTRUCTIVE) {
-                if (numReads > 1) {
-                    try {
-                        // For NOT_DESTRUCTIVE, the 
-                        // InputStream (either the original or copied InputStream)
-                        // is reset for reuse.
-                        if(log.isDebugEnabled()){
-                            log.debug("reset InputStream for reuse");
-                        }
-                        payload.reset();
-                    } catch (Throwable t) {
-                        throw new OMException(t);
-                    }
-                }
-            } else if (behavior == Behavior.ONE_USE_UNSAFE) {
-                
-                // For ONE_USE_UNSAFE, 
-                //    remember the first call
-                //    intentionally fail on the second call
-                if (numReads == 1) {
-                    firstUseStack = CommonUtils.stackToString(new OMException());
-                    if(log.isDebugEnabled()){
-                        log.debug("ONE_USE_UNSAFE mode stack:" + firstUseStack);
-                    }
-                } else {
-                    // TODO NLS
-                    OMException ome = 
-                        new OMException("A second read of ParserInputStreamDataSource is not allowed."
-                           + "The first read was done here: " + firstUseStack);
-                    if(log.isDebugEnabled()){
-                        log.debug("ONE_USE_UNSAFE second use exception:" + ome);
-                    }
-                    throw ome;
-                }
-            }
-            
-            
-            if(log.isDebugEnabled()){
-                log.debug("Exit readParserInputStream()");
-            }
-            return payload;
-        }
-        
-        public void setInputStream(InputStream inputStream) {
-            if(log.isDebugEnabled()){
-                String clsName = inputStream == null ? 
-                        null : 
-                            inputStream.getClass().getName();
-                log.debug("Enter setInputStream: The kind of InputStream is:" + clsName);
-            }
-            this.numReads = 0;
-            this.firstUseStack = null;
-            
-            if (inputStream == null) {
-                if(log.isDebugEnabled()){
-                    log.debug("The inputStream is null");
-                }
-                payload = null;
-            } else if (behavior == Behavior.NOT_DESTRUCTIVE) {
-                if (inputStream.markSupported()) {
-                    if(log.isDebugEnabled()){
-                        log.debug("The inputStream supports mark().  Setting mark()");
-                    }
-                    // use mark/reset
-                    payload = inputStream;
-                    payload.mark(Integer.MAX_VALUE);
-                } else {
-                    try {
-                        if(log.isDebugEnabled()){
-                            log.debug("The inputStream does not supports mark().  Copying Stream");
-                        }
-                        // make a non-contiguous resettable input stream
-                        BAAOutputStream baaos = new BAAOutputStream();
-                        BufferUtils.inputStream2OutputStream(inputStream, baaos);
-                        BAAInputStream baais = new BAAInputStream(baaos.buffers(), 
-                                    baaos.length());
-                        payload = baais;
-                        payload.mark(Integer.MAX_VALUE);
-                    } catch (Throwable t) {
-                        if(log.isDebugEnabled()){
-                            log.debug("Error:", t);
-                        }
-                        throw new OMException(t);
-                    }
-                }
-            } else {
-                payload = inputStream;
-            }
-            if(log.isDebugEnabled()){
-                log.debug("Exit setInputStream");
-            }
-        }
-   
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axiom.om.ds;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Iterator;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.attachments.impl.BufferUtils;
+import org.apache.axiom.attachments.utils.BAAInputStream;
+import org.apache.axiom.attachments.utils.BAAOutputStream;
+import org.apache.axiom.om.OMDataSourceExt;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.ds.OMDataSourceExtBase;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.CommonUtils;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+/**
+ * A DataSource that is backed by an InputStream (read from a parser).
+ * The Data in this Data source owns the payload inputStream. 
+ */
+public class ParserInputStreamDataSource extends OMDataSourceExtBase {
+    private static final Log log = 
+        LogFactory.getLog(ParserInputStreamDataSource.class);
+    
+    // This is the backing storage. 
+    // The "data" object contains an InputStream that contains the actual bytes.
+    // Copying/Marking of the InputStream is controlled by the requested Behavior.
+    private Data data = null;
+    
+    // This behavior provides both safety and performance
+    private final static int defaultBehavior = Behavior.NOT_DESTRUCTIVE;
+    
+    /**
+     * This is the constructor that is normally called.
+     * 
+     * Note that the ParserInputStreamDataSource takes ownership of the 
+     * payload InputStream.  It may copy, mark or reset the stream.  
+     * Callers should not access the stream after this constructor is called
+     * 
+     * @param payload InputStream
+     * @param encoding
+     */
+    public ParserInputStreamDataSource(InputStream payload, String encoding) {
+        this(payload, 
+            encoding, defaultBehavior );
+    }
+    
+    /**
+     * This constructor is used to test the different Behavior settings.
+     * 
+     * Note that the ParserInputStreamDataSource takes ownership of the 
+     * payload InputStream.  It may copy, mark or reset the stream.  
+     * Callers should not access the stream after this constructor is called.
+     * 
+     * @param payload
+     * @param encoding
+     * @param behavior
+     */
+    public ParserInputStreamDataSource(InputStream payload, 
+            String encoding, 
+            int behavior) {
+        data = new  Data(payload,
+                        (encoding!=null)?encoding:"UTF-8",
+                         behavior);
+    }
+    
+
+    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+        if(log.isDebugEnabled()){
+            log.debug("Entry ParserInputStreamDataSource.serialize(OutputStream, OMOutputFormat");
+        }
+        
+        String encoding = (format!=null)?format.getCharSetEncoding():null;
+        
+        try {
+            if (!data.encoding.equalsIgnoreCase(encoding)) {
+                byte[] bytes = getXMLBytes(encoding);
+                output.write(bytes);
+            } else {
+                // Write the input stream to the output stream
+                InputStream is = data.readParserInputStream();
+                if(is!=null){
+                    BufferUtils.inputStream2OutputStream(is, output);
+                }
+            }
+            if(log.isDebugEnabled()){
+                log.debug("Exit ParserInputStreamDataSource.serialize(OutputStream, OMOutputFormat");
+            }
+        } catch (UnsupportedEncodingException e) {
+            throw new XMLStreamException(e);
+        } catch (IOException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
+        if(log.isDebugEnabled()){
+            log.debug("Entry ParserInputStreamDataSource.serialize(XMLStreamWriter)");
+        }
+        super.serialize(xmlWriter);
+        if(log.isDebugEnabled()){
+            log.debug("Exit ParserInputStreamDataSource.serialize(XMLStreamWriter)");
+        }
+    }
+
+    public XMLStreamReader getReader() throws XMLStreamException {
+        if(log.isDebugEnabled()){
+            log.debug("Entry ParserInputStreamDataSource.getReader()");
+        }
+        InputStream is = data.readParserInputStream();
+        if(is == null){
+            //Parser content has already been read.
+            if(log.isDebugEnabled()){
+                log.warn("Parser content has already been read");
+            }
+        }
+        XMLStreamReader reader = StAXUtils.createXMLStreamReader(is, data.encoding);
+        if(log.isDebugEnabled()){
+            log.debug("Exit ParserInputStreamDataSource.getReader()");
+        }
+        return reader;
+    }
+
+    /* 
+     * Note that the returned InputStream may be different than the one
+     * passed in the constructor. 
+     * The caller may not used the mark or reset methods on the InputStream
+     * (non-Javadoc)
+     * @see org.apache.axiom.om.ds.OMDataSourceExtBase#getXMLInputStream(java.lang.String)
+     */
+    public InputStream getXMLInputStream(String encoding)  
+        throws UnsupportedEncodingException {
+        try{
+            return data.readParserInputStream();
+        }catch(XMLStreamException e){
+            throw new OMException(e);
+        }
+    }
+
+    public int numReads() {
+        return data.numReads;
+    }
+    
+    
+    public Object getObject() {
+        return data;
+    }
+
+    public boolean isDestructiveRead() {
+        // If DESTRUCTIVE return true
+        // If NOT_DESTRUCTIVE return false
+        // If ONE_USE_UNSAFE, we lie and tell the engine false
+        //      ...but we will intentionally fail on second access.
+        return (data.behavior == Behavior.DESTRUCTIVE);
+    }
+
+    public boolean isDestructiveWrite() {
+     // If DESTRUCTIVE return true
+        // If NOT_DESTRUCTIVE return false
+        // If ONE_USE_UNSAFE, we lie and tell the engine false
+        //      ...but we will intentionally fail on second access.
+        return (data.behavior == Behavior.DESTRUCTIVE);
+    }
+
+    public byte[] getXMLBytes(String encoding){
+        if(log.isDebugEnabled()){
+            log.debug("Entry ParserInputStreamDataSource.getXMLBytes(encoding)");
+        }
+        try{
+            InputStream is = data.readParserInputStream();
+            if(is != null){
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                OMOutputFormat format = new OMOutputFormat();
+                format.setCharSetEncoding(encoding);
+                try {
+                    BufferUtils.inputStream2OutputStream(is, baos);
+                    if(log.isDebugEnabled()){
+                        log.debug("Exit ParserInputStreamDataSource.getXMLBytes(encoding)");
+                    }
+                    return baos.toByteArray();
+                } catch (IOException e) {
+                    throw new OMException(e);
+                }
+            }else{
+                //Someone already read the parser, happens in serialize call. I expect user to invoke this
+                //via SerializeAndConsume call
+                if(log.isDebugEnabled()){
+                    log.warn("Parser was already read, recovering by just returning new byte[0]");
+                    log.debug("Exit ParserInputStreamDataSource.getXMLBytes(encoding)");
+                }
+                return new byte[0];
+            }
+        }catch(XMLStreamException e){
+            throw new OMException(e);
+        }
+    }
+
+    public void close() {
+        if(log.isDebugEnabled()){
+            log.debug("Entry ParserInputStreamDataSource.close()");
+        }
+        if (data.payload != null) {
+            try {
+                data.payload.close();
+            } catch (IOException e) {
+                throw new OMException(e);
+            }
+            data.payload = null;
+        }
+        if(log.isDebugEnabled()){
+            log.debug("Exit ParserInputStreamDataSource.close()");
+        }
+    }
+
+    /**
+     * Return a InputStreamDataSource backed by a ByteArrayInputStream
+     */
+    public OMDataSourceExt copy() {
+        if(log.isDebugEnabled()){
+            log.debug("Enter ParserInputStreamDataSource.copy()");
+        }
+        try {
+            BAAOutputStream baaos = new BAAOutputStream();
+            BufferUtils.inputStream2OutputStream(data.readParserInputStream(), baaos);
+            BAAInputStream baais = new BAAInputStream(baaos.buffers(), 
+                        baaos.length());
+            
+            if (log.isDebugEnabled()) {
+                log.debug("Exit ParserInputStreamDataSource.copy()");
+            }
+            return new ParserInputStreamDataSource(baais, data.encoding, data.behavior);
+        } catch (Throwable t) {
+            if(log.isDebugEnabled()){
+                log.debug("Error ParserInputStreamDataSource.copy(): ", t);
+            }
+            throw new OMException(t);
+        }
+        
+    }
+
+    /**
+     * @author scheu
+     *
+     */
+    public class Data{
+        
+        // The InputStream containing the byte data
+        private InputStream payload = null;
+        
+        // The encoding (i.e. UTF-8)
+        private String encoding = null;
+        
+        // The designated Behavior.  @see Behavior
+        private int behavior;
+        
+        // Track the number of read accesses.  
+        // ONE_USE_UNSAFE will intentionally fail on second read.
+        private int numReads = 0;
+        
+        // Track the first use when ONE_USE_UNSAFE is requested
+        private String firstUseStack = null;
+        
+        
+        
+        /** 
+         * Intentionally provide.  Only created by ParserInputStreamDataSource
+         * @param payload
+         * @param encoding
+         * @param behavior
+         */
+        private Data(InputStream payload,
+                String encoding,
+                int behavior) {
+            this.payload = payload;
+            this.encoding = encoding;
+            this.behavior = behavior;
+
+            setInputStream(payload);
+        }
+        
+        /**
+         * @return InputStream that consumer should use..this may be different
+         * than the InputStream initially handed to the ParsedDataEntitySource
+         * @throws XMLStreamException
+         * @throws OMException if second access and ONE_USE_UNSAFE or other problems occur
+         */
+        public InputStream readParserInputStream() throws XMLStreamException{
+            numReads++;
+            
+            // Dump our state
+            if(log.isDebugEnabled()){
+                log.debug("Entry readParserInputStream()");
+                log.debug("Data Encoding = "+encoding);
+                log.debug("numReads = "+numReads);
+                log.debug("behavior = "+behavior);
+                
+                // The call stack is helpful to identify non-performant call flows
+                String stack = CommonUtils.stackToString(new OMException());
+                log.debug("call stack:" + stack);
+            }
+            
+            
+            // TODO NLS 
+            if(payload == null){
+                throw new OMException("ParserInputStreamDataSource's InputStream is null.");
+            }   
+            
+            if (behavior == Behavior.NOT_DESTRUCTIVE) {
+                if (numReads > 1) {
+                    try {
+                        // For NOT_DESTRUCTIVE, the 
+                        // InputStream (either the original or copied InputStream)
+                        // is reset for reuse.
+                        if(log.isDebugEnabled()){
+                            log.debug("reset InputStream for reuse");
+                        }
+                        payload.reset();
+                    } catch (Throwable t) {
+                        throw new OMException(t);
+                    }
+                }
+            } else if (behavior == Behavior.ONE_USE_UNSAFE) {
+                
+                // For ONE_USE_UNSAFE, 
+                //    remember the first call
+                //    intentionally fail on the second call
+                if (numReads == 1) {
+                    firstUseStack = CommonUtils.stackToString(new OMException());
+                    if(log.isDebugEnabled()){
+                        log.debug("ONE_USE_UNSAFE mode stack:" + firstUseStack);
+                    }
+                } else {
+                    // TODO NLS
+                    OMException ome = 
+                        new OMException("A second read of ParserInputStreamDataSource is not allowed."
+                           + "The first read was done here: " + firstUseStack);
+                    if(log.isDebugEnabled()){
+                        log.debug("ONE_USE_UNSAFE second use exception:" + ome);
+                    }
+                    throw ome;
+                }
+            }
+            
+            
+            if(log.isDebugEnabled()){
+                log.debug("Exit readParserInputStream()");
+            }
+            return payload;
+        }
+        
+        public void setInputStream(InputStream inputStream) {
+            if(log.isDebugEnabled()){
+                String clsName = inputStream == null ? 
+                        null : 
+                            inputStream.getClass().getName();
+                log.debug("Enter setInputStream: The kind of InputStream is:" + clsName);
+            }
+            this.numReads = 0;
+            this.firstUseStack = null;
+            
+            if (inputStream == null) {
+                if(log.isDebugEnabled()){
+                    log.debug("The inputStream is null");
+                }
+                payload = null;
+            } else if (behavior == Behavior.NOT_DESTRUCTIVE) {
+                if (inputStream.markSupported()) {
+                    if(log.isDebugEnabled()){
+                        log.debug("The inputStream supports mark().  Setting mark()");
+                    }
+                    // use mark/reset
+                    payload = inputStream;
+                    payload.mark(Integer.MAX_VALUE);
+                } else {
+                    try {
+                        if(log.isDebugEnabled()){
+                            log.debug("The inputStream does not supports mark().  Copying Stream");
+                        }
+                        // make a non-contiguous resettable input stream
+                        BAAOutputStream baaos = new BAAOutputStream();
+                        BufferUtils.inputStream2OutputStream(inputStream, baaos);
+                        BAAInputStream baais = new BAAInputStream(baaos.buffers(), 
+                                    baaos.length());
+                        payload = baais;
+                        payload.mark(Integer.MAX_VALUE);
+                    } catch (Throwable t) {
+                        if(log.isDebugEnabled()){
+                            log.debug("Error:", t);
+                        }
+                        throw new OMException(t);
+                    }
+                }
+            } else {
+                payload = inputStream;
+            }
+            if(log.isDebugEnabled()){
+                log.debug("Exit setInputStream");
+            }
+        }
+   
+    }
+
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/ParserInputStreamDataSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/osgi/FactoryInjectionComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/OverflowBlob.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderContainer.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderContainer.java?rev=947643&r1=947642&r2=947643&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderContainer.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderContainer.java Mon May 24 13:48:06 2010
@@ -1,38 +1,38 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axiom.util.stax.wrapper;
-
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * Marker interface for Axiom {@link XMLStreamReader} classes that
- * wrap or delegate to another (parent) XMLStreamReader.
- * <p>
- * The marker interface is necessary so that consumers 
- * can access the original parser.
- * <p>
- * Note that the only the {@link #getParent()} method is applicable.
- * Please do not add a <code>setParent()</code> method since that would
- * violate the immutable characteristic of the {@link XMLStreamReaderWrapper}.
- * 
- * @see org.apache.axiom.util.stax.XMLStreamReaderUtils
- */
-public interface XMLStreamReaderContainer {
-    XMLStreamReader getParent();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.util.stax.wrapper;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Marker interface for Axiom {@link XMLStreamReader} classes that
+ * wrap or delegate to another (parent) XMLStreamReader.
+ * <p>
+ * The marker interface is necessary so that consumers 
+ * can access the original parser.
+ * <p>
+ * Note that the only the {@link #getParent()} method is applicable.
+ * Please do not add a <code>setParent()</code> method since that would
+ * violate the immutable characteristic of the {@link XMLStreamReaderWrapper}.
+ * 
+ * @see org.apache.axiom.util.stax.XMLStreamReaderUtils
+ */
+public interface XMLStreamReaderContainer {
+    XMLStreamReader getParent();
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/wrapper/XMLStreamReaderContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/attachments/DeleteAttachmentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/OverflowBlobTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/blob/WritableBlobTestBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/TextFromElementReaderTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/TextFromElementReaderTest.java?rev=947643&r1=947642&r2=947643&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/TextFromElementReaderTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/TextFromElementReaderTest.java Mon May 24 13:48:06 2010
@@ -1,46 +1,46 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axiom.util.stax;
-
-import java.io.Reader;
-import java.io.StringReader;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axiom.util.stax.TextFromElementReader;
-import org.apache.commons.io.IOUtils;
-
-// Note: this class only contains a single test method because most aspects of TextFromElementReader
-//       are actually tested by ElementHelperTest
-public class TextFromElementReaderTest extends TestCase {
-    /**
-     * Test that TextFromElementReader works correctly with a "naked" StAX parser.
-     * 
-     * @throws Exception
-     */
-    public void testStAX() throws Exception {
-        XMLStreamReader reader = StAXUtils.createXMLStreamReader(new StringReader("<a>test</a>"));
-        Reader in = new TextFromElementReader(reader);
-        assertEquals("test", IOUtils.toString(in));
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axiom.util.stax;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.util.stax.TextFromElementReader;
+import org.apache.commons.io.IOUtils;
+
+// Note: this class only contains a single test method because most aspects of TextFromElementReader
+//       are actually tested by ElementHelperTest
+public class TextFromElementReaderTest extends TestCase {
+    /**
+     * Test that TextFromElementReader works correctly with a "naked" StAX parser.
+     * 
+     * @throws Exception
+     */
+    public void testStAX() throws Exception {
+        XMLStreamReader reader = StAXUtils.createXMLStreamReader(new StringReader("<a>test</a>"));
+        Reader in = new TextFromElementReader(reader);
+        assertEquals("test", IOUtils.toString(in));
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/TextFromElementReaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native