Please create a Jira issue and add this as an attachment. When you do please make sure to check the box granting a license to the ASF.
Ralph On Oct 19, 2010, at 6:11 AM, Martin Gainty wrote: > > Hi Guys > > here is proposed for MonitorInputStream to implement SharedInputStream > taking remainder of the day to locate "paying work"..No work in the US but > Afghanistan looks promising > I'll checkin tommorrow to follow-up..thanks > > /* > * 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.commons.vfs.util; > > import java.io.BufferedInputStream; > import java.io.IOException; > import java.io.InputStream; > > import javax.mail.internet.SharedInputStream; > /** > * An InputStream that provides buffering and end-of-stream monitoring. > * > * @author <a href="mailto:[email protected]">Adam Murdoch</a> > * @version $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Wed, 29 Nov > 2006) $ > */ > public class MonitorInputStream extends BufferedInputStream implements > SharedInputStream /* MCG added SharedInputStream for mark capability */ > { > private boolean finished; > private long count; > public java.io.InputStream in; > public java.io.InputStream newStream(long l1, long l2) > { > this.in= new java.io.BufferedInputStream(in,(int)l1); > return in; > } > public MonitorInputStream(InputStream in) > { > super(in); > this.in=in; > count = 0; > } > public long position=0; > public long getPosition() > { > return this.position; > } > /** > * Reads a character. > */ > public int read() throws IOException > { > if (finished) > { > return -1; > } > > final int ch = super.read(); > if (ch != -1) > { > count++; > return ch; > } > > /* MCG check for mark MCG */ > if(readLimit!=0) return 0; > > close(); > return -1; > } > public int resetCount = 0; /* MCG for mark capability */ > public int readLimit=0; /* indicates a mark on the file */ > public synchronized void mark(int readlimit) > { > super.mark(readlimit); > this.readLimit = readLimit; > resetCount = 0; > } > > /** > * Reads bytes from this input stream.error occurs. > */ > public int read(final byte[] buffer, final int offset, final int length) > throws IOException > { > if (finished) > { > return -1; > } > > final int nread = super.read(buffer, offset, length); > if (nread != -1) > { > count += nread; > return nread; > } > > /* MCG check for mark MCG */ > if(readLimit!=0) return 0; > > close(); > return -1; > } > > /** > * Closes this input stream and releases any system resources > * associated with the stream. > */ > public void close() throws IOException > { > if (finished) > { > return; > } > > // Close the stream > IOException exc = null; > try > { > super.close(); > } > catch (final IOException ioe) > { > exc = ioe; > } > > // Notify that the stream has been closed > try > { > onClose(); > } > catch (final IOException ioe) > { > exc = ioe; > } > > finished = true; > if (exc != null) > { > throw exc; > } > } > > /** > * Called after the stream has been closed. This implementation does > * nothing. > */ > protected void onClose() throws IOException > { > } > > /** > * Get the nuber of bytes read by this input stream > */ > public long getCount() > { > return count; > } > } > > pom.xml used for compile,package and deploy > <?xml version="1.0" encoding="UTF-8"?> > > <!-- > 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. > --> > > <project xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/maven-v4_0_0.xsd"> > > <modelVersion>4.0.0</modelVersion> > <packaging>jar</packaging> > > <name>core</name> > <groupId>org.apache.commons</groupId> > <artifactId>commons-vfs</artifactId> > <version>1.0-RC8-SNAPSHOT</version> > <description>VFS is a Virtual File System library.</description> > > <organization> > <name>Apache Software Foundation</name> > <url>http://www.apache.org/</url> > </organization> > <licenses> > <license> > <name>The Apache Software License, Version 2.0</name> > <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> > <distribution>repo</distribution> > </license> > </licenses> > > <dependencies> > <dependency> > <groupId>org.jvnet.hudson.plugins</groupId> > <artifactId>email-ext</artifactId> > <version>2.10-SNAPSHOT</version> > </dependency> > <dependency> > <groupId>commons-logging</groupId> > <artifactId>commons-logging</artifactId> > <version>1.0.4</version> > </dependency> > <dependency> > <groupId>ant</groupId> > <artifactId>ant</artifactId> > <version>1.6.2</version> > <optional>true</optional> > </dependency> > <dependency> > <groupId>commons-net</groupId> > <artifactId>commons-net</artifactId> > <version>1.4.1</version> > <optional>true</optional> > </dependency> > <!--TODO:Revert to [compress] if/when released > <dependency> > <groupId>commons-compress</groupId> > <artifactId>commons-compress</artifactId> > <version>SNAPSHOT</version> > <optional>true</optional> > </dependency--> > <dependency> > <groupId>commons-collections</groupId> > <artifactId>commons-collections</artifactId> > <version>3.1</version> > <optional>true</optional> > </dependency> > <dependency> > <groupId>jdom</groupId> > <artifactId>jdom</artifactId> > <version>1.0</version> > <optional>true</optional> > </dependency> > <dependency> > <groupId>commons-httpclient</groupId> > <artifactId>commons-httpclient</artifactId> > <version>2.0.2</version> > <optional>true</optional> > </dependency> > <dependency> > <groupId>com.jcraft</groupId> > <artifactId>jsch</artifactId> > <version>0.1.23</version> > <optional>true</optional> > </dependency> > <dependency> > <groupId>xml-apis</groupId> > <artifactId>xml-apis</artifactId> > <version>1.0.b2</version> > <optional>true</optional> > </dependency> > <dependency> > <groupId>oro</groupId> > <artifactId>oro</artifactId> > <version>2.0.8</version> > <optional>true</optional> > </dependency> > <dependency> > <groupId>junit</groupId> > <artifactId>junit</artifactId> > <version>3.8.1</version> > <scope>test</scope> > </dependency> > </dependencies> > > <build> > <resources> > <resource> > <directory>src/main/java</directory> > <excludes> > <exclude>**/*.java</exclude> > </excludes> > </resource> > <resource> > <directory>..</directory> > <targetPath>META-INF</targetPath> > <includes> > <include>NOTICE.txt</include> > </includes> > </resource> > <resource> > <directory>..</directory> > <includes> > <include>LICENSE.txt</include> > </includes> > </resource> > </resources> > > <plugins> > > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-compiler-plugin</artifactId> > <configuration> > <target>1.3</target> > <source>1.3</source> > </configuration> > </plugin> > > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-jar-plugin</artifactId> > <executions> > <execution> > <goals> > <goal>test-jar</goal> > </goals> > </execution> > </executions> > </plugin> > > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-antrun-plugin</artifactId> > <executions> > <execution> > <phase>generate-test-resources</phase> > <configuration> > <tasks> > <echo message="Setup test-data environment" /> > <delete > dir="${project.build.outputDirectory}/../test-data"/> > <copy > todir="${project.build.outputDirectory}/../test-data"> > <fileset dir="src/test/test-data"> > <include name="**/*" /> > </fileset> > </copy> > </tasks> > </configuration> > </execution> > </executions> > </plugin> > > <plugin> > <!-- surfire do not honor suite(), see MSUREFIRE-131 why our > tests wont work with maven 2 --> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <configuration> > <systemProperties> > <property> > <name>test.basedir</name> > <value>target/test-data</value> > </property> > </systemProperties> > </configuration> > </plugin> > > </plugins> > > </build> > </project> > > HTH > Martin Gainty > ______________________________________________ > Please do not alter or disrupt this transmission. Thank You > > > > >> From: [email protected] >> To: [email protected] >> Date: Mon, 18 Oct 2010 17:51:30 -0700 >> Subject: RE: Commons Configuration 1.7 >> >> Hi Ralph, >> >> The issue is: >> >> https://issues.apache.org/jira/browse/VFS-301. >> >> It's still open...and I don't see any patches. >> >> This bug is a blocker for me and so I have to drop down to using >> java.io.File to do my actual file reading which is not desirable. >> >> Thanks, >> >> Ronak Patel >> >> -----Original Message----- >> From: Ralph Goers [mailto:[email protected]] >> Sent: Monday, October 18, 2010 5:47 PM >> To: Commons Users List >> Subject: Re: Commons Configuration 1.7 >> >> What is the issue number? Did it have a patch with it? >> >> Ralph >> >> On Oct 18, 2010, at 5:39 PM, Patel, Ronak Avinash (US SSA) wrote: >> >>> Hi Ralph, >>> >>> That's great news!! >>> >>> I was wondering if you also happened to fix the bug related to setting >>> marks and resetting the InputStream being returned by the >>> FileObject#FileContent object. >>> >>> Last I remember, it still wasn't addressed. >>> >>> Thanks, >>> >>> Ronak Patel >>> >>> -----Original Message----- >>> From: Ralph Goers [mailto:[email protected]] >>> Sent: Monday, October 18, 2010 5:36 PM >>> To: Commons Users List >>> Subject: Re: Commons Configuration 1.7 >>> >>> >>> On Oct 18, 2010, at 12:47 PM, Oliver Heger wrote: >>> >>>> Am 14.10.2010 02:02, schrieb Patel, Ronak Avinash (US SSA): >>>>> Hi, >>>>> >>>>> I have a situation where I need to use the >>>>> VFSFileMonitorReloadingStrategy class mentioned in this post: >>>>> https://issues.apache.org/jira/browse/CONFIGURATION-202. >>>>> However, there is no mention of when this class will be added to a >>>>> downloadable build of Commons Configuration. >>>>> >>>>> When is Commons Configuration 1.7 due to be out? >>>> >>>> The problem is that due to the VFS additions Commons Configuration now >>>> depends on a snapshot version of Commons VFS. So before Configuration 1.7 >>>> can be released VFS 2.0 has to be published. >>>> >>>> Unfortunately I don't know the status of this code base nor a timeline for >>>> a release. Can one of the VFS developers answer this? >>>> >>> >>> I consider VFS 2.0 ready for a release. It has been on my todo list >>> forever. I'll be at ApacheCon so maybe some of the other Commons folks can >>> work with me during the hackathon to get it done. >>> >>> Ralph >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
