Author: linus
Date: 2007-05-11 23:46:05-0700
New Revision: 12606
Modified:
trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java
trunk/src_new/org/argouml/persistence/OldZargoFilePersister.java
trunk/src_new/org/argouml/persistence/XmiFilePersister.java
trunk/src_new/org/argouml/persistence/XmiInputStream.java
trunk/src_new/org/argouml/persistence/ZipFilePersister.java
Log:
Style issues.
Removed deprecated constructor for XmiInputStream.
Removed length field for XmiInputStream.
Modified: trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java?view=diff&rev=12606&p1=trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java&p2=trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java&r1=12605&r2=12606
==============================================================================
--- trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java 2007-05-11 23:46:05-0700
@@ -248,8 +248,11 @@
LOG.info("=======================================");
LOG.info("== READING MODEL " + url);
try {
- InputSource source = new InputSource(new XmiInputStream(
- url.openStream(), xmiExtensionParser, 10000000, 100000));
+ // TODO: What progressMgr is to be used here? Where does
+ // it come from?
+ InputSource source =
+ new InputSource(new XmiInputStream(
+ url.openStream(), xmiExtensionParser, 100000, null));
source.setSystemId(url.toString());
readModels(p, source);
Modified: trunk/src_new/org/argouml/persistence/OldZargoFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/OldZargoFilePersister.java?view=diff&rev=12606&p1=trunk/src_new/org/argouml/persistence/OldZargoFilePersister.java&p2=trunk/src_new/org/argouml/persistence/OldZargoFilePersister.java&r1=12605&r2=12606
==============================================================================
--- trunk/src_new/org/argouml/persistence/OldZargoFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/OldZargoFilePersister.java 2007-05-11 23:46:05-0700
@@ -135,7 +135,7 @@
// Save the .argo entry
ZipEntry zipEntry =
new ZipEntry(project.getBaseName()
- + FileConstants.UNCOMPRESSED_FILE_EXT);
+ + FileConstants.UNCOMPRESSED_FILE_EXT);
stream.putNextEntry(zipEntry);
Hashtable templates =
@@ -149,7 +149,7 @@
int counter = 0;
int size = project.getMembers().size();
- Collection names = new ArrayList();
+ Collection<String> names = new ArrayList<String>();
for (int i = 0; i < size; i++) {
ProjectMember projectMember =
(ProjectMember) project.getMembers().get(i);
@@ -168,7 +168,7 @@
stream.putNextEntry(new ZipEntry(name));
MemberFilePersister persister =
getMemberFilePersister(projectMember);
- persister.save(projectMember, writer, null);
+ persister.save(projectMember, writer, false);
writer.flush();
stream.closeEntry();
}
@@ -187,7 +187,7 @@
new ZipEntry(projectMember.getZipName()));
OldModelMemberFilePersister persister =
new OldModelMemberFilePersister();
- persister.save(projectMember, writer, null);
+ persister.save(projectMember, writer, false);
}
}
Modified: trunk/src_new/org/argouml/persistence/XmiFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/XmiFilePersister.java?view=diff&rev=12606&p1=trunk/src_new/org/argouml/persistence/XmiFilePersister.java&p2=trunk/src_new/org/argouml/persistence/XmiFilePersister.java&r1=12605&r2=12606
==============================================================================
--- trunk/src_new/org/argouml/persistence/XmiFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/XmiFilePersister.java 2007-05-11 23:46:05-0700
@@ -37,7 +37,7 @@
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.List;
import org.apache.log4j.Logger;
import org.argouml.i18n.Translator;
@@ -62,7 +62,7 @@
private static final Logger LOG =
Logger.getLogger(XmiFilePersister.class);
- private ArrayList pgmlStrings = new ArrayList();
+ private List<String> pgmlStrings = new ArrayList<String>();
private String todoString;
@@ -254,7 +254,7 @@
ThreadUtils.checkIfInterrupted();
InputSource source = new InputSource(new XmiInputStream(file
- .toURL().openStream(), this, length, phaseSpace,
+ .toURL().openStream(), this, phaseSpace,
progressMgr));
source.setSystemId(file.toURL().toString());
@@ -335,8 +335,7 @@
} else {
project.addMember(new ProjectMemberTodoList("", project));
}
- for (Iterator it = pgmlStrings.iterator(); it.hasNext(); ) {
- String pgml = (String) it.next();
+ for (String pgml : pgmlStrings) {
LOG.info("Parsing pgml " + pgml.length());
InputStream inputStream = new ByteArrayInputStream(pgml.getBytes());
MemberFilePersister persister =
Modified: trunk/src_new/org/argouml/persistence/XmiInputStream.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/XmiInputStream.java?view=diff&rev=12606&p1=trunk/src_new/org/argouml/persistence/XmiInputStream.java&p2=trunk/src_new/org/argouml/persistence/XmiInputStream.java&r1=12605&r2=12606
==============================================================================
--- trunk/src_new/org/argouml/persistence/XmiInputStream.java (original)
+++ trunk/src_new/org/argouml/persistence/XmiInputStream.java 2007-05-11 23:46:05-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -33,7 +33,7 @@
/**
* A BufferInputStream that is aware of XML structure.
- * It can searches for the first occurence of a named tag
+ * It can search for the first occurence of a named tag
* and reads only the data (inclusively) from that tag
* to the matching end tag or it can search for the first
* occurence of a named tag and read on the child tags.
@@ -69,59 +69,57 @@
/**
* The expected stream length.
*/
- private long length;
-
- /**
- * The expected stream length.
- */
private ProgressMgr progressMgr;
/**
* Construct a new XmlInputStream.
*
* @param inputStream the input stream to wrap.
- * @param xmiExtensionParser the parser to call to read any
+ * @param extParser the parser to call to read any
* XMI.extension elements
- * @param length the expected length of the input stream
- * @param eventSpacing the number of characers to read before
+ * @param len the expected length of the input stream
+ * @param spacing the number of characers to read before
* firing a progress event.
- * @param progressMgr the progress manager
+ * @param prgrssMgr the progress manager
*/
public XmiInputStream(
InputStream inputStream,
- XmiExtensionParser xmiExtensionParser,
- long length,
- long eventSpacing,
- ProgressMgr progressMgr) {
+ XmiExtensionParser extParser,
+ long spacing,
+ ProgressMgr prgrssMgr) {
super(inputStream);
- this.length = length;
- this.eventSpacing = eventSpacing;
- this.xmiExtensionParser = xmiExtensionParser;
- this.progressMgr = progressMgr;
+ eventSpacing = spacing;
+ xmiExtensionParser = extParser;
+ progressMgr = prgrssMgr;
}
/**
* Construct a new XmlInputStream.
*
* @param inputStream the input stream to wrap.
- * @param xmiExtensionParser the parser to call to read any
+ * @param extParser the parser to call to read any
* XMI.extension elements
- * @param length the expected length of the input stream
- * @param eventSpacing the number of characers to read before
+ * @param len the expected length of the input stream
+ * @param spacing the number of characers to read before
* firing a progress event.
- * @deprecated use version that supplies a ProgressMgr
+ * @param prgrssMgr the progress manager
+ * @deprecated by Linus Tolke for 0.25.3.
+ * Use the constructor
+ * {@link #XmiInputStream(InputStream, XmiExtensionParser,
+ * long, ProgressMgr)} that doesn't specify length
*/
public XmiInputStream(
InputStream inputStream,
- XmiExtensionParser xmiExtensionParser,
- long length,
- long eventSpacing) {
+ XmiExtensionParser extParser,
+ long len,
+ long spacing,
+ ProgressMgr prgrssMgr) {
super(inputStream);
- this.length = length;
- this.eventSpacing = eventSpacing;
- this.xmiExtensionParser = xmiExtensionParser;
+ eventSpacing = spacing;
+ xmiExtensionParser = extParser;
+ progressMgr = prgrssMgr;
}
-
+
/*
* @see java.io.InputStream#read()
*/
@@ -140,18 +138,19 @@
if (parsingExtension) {
stringBuffer.append((char) ch);
- }// else {
+ }
+ // else {
// TODO: Only progress when reading standard XMI
// extension parsers will continue progression.
- ++readCount;
- if (progressMgr != null && readCount == eventSpacing) {
- try {
- readCount = 0;
- progressMgr.nextPhase();
- } catch (InterruptedException e) {
- throw new InterruptedIOException(e);
- }
+ ++readCount;
+ if (progressMgr != null && readCount == eventSpacing) {
+ try {
+ readCount = 0;
+ progressMgr.nextPhase();
+ } catch (InterruptedException e) {
+ throw new InterruptedIOException(e);
}
+ }
// }
if (xmiExtensionParser != null) {
@@ -263,8 +262,8 @@
private InterruptedException cause;
- public InterruptedIOException(InterruptedException cause) {
- this.cause = cause;
+ public InterruptedIOException(InterruptedException theCause) {
+ cause = theCause;
}
public InterruptedException getInterruptedException() {
Modified: trunk/src_new/org/argouml/persistence/ZipFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ZipFilePersister.java?view=diff&rev=12606&p1=trunk/src_new/org/argouml/persistence/ZipFilePersister.java&p2=trunk/src_new/org/argouml/persistence/ZipFilePersister.java&r1=12605&r2=12606
==============================================================================
--- trunk/src_new/org/argouml/persistence/ZipFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/ZipFilePersister.java 2007-05-11 23:46:05-0700
@@ -146,7 +146,7 @@
}
MemberFilePersister persister
= new ModelMemberFilePersister();
- persister.save(projectMember, writer, null);
+ persister.save(projectMember, writer, false);
}
}
stream.close();
@@ -220,8 +220,12 @@
fileName.indexOf('.'),
fileName.lastIndexOf('.'));
InputStream stream = openZipStreamAt(file.toURL(), extension);
- InputSource is = new InputSource(
- new XmiInputStream(stream, this, 10000000, 100000));
+
+ // TODO: What progressMgr is to be used here? Where does
+ // it come from?
+ InputSource is =
+ new InputSource(
+ new XmiInputStream(stream, this, 100000, null));
is.setSystemId(file.toURL().toExternalForm());
// Add the path of the current model to the search path, so we can
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.