[Yanel-commits] rev 21079 - in public/yanel/trunk/src/resources:
file/src/java/org/wyona/yanel/impl/resources
xml/src/java/org/wyona/yanel/impl/resources
michi at wyona.com
michi at wyona.com
Thu Dec 21 17:39:41 CET 2006
Author: michi
Date: 2006-12-21 17:39:40 +0100 (Thu, 21 Dec 2006)
New Revision: 21079
Modified:
public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/FileResource.java
public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
Log:
use getPath method instead path variable
Modified: public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/FileResource.java
===================================================================
--- public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/FileResource.java 2006-12-21 16:39:04 UTC (rev 21078)
+++ public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/FileResource.java 2006-12-21 16:39:40 UTC (rev 21079)
@@ -64,7 +64,7 @@
public View getView(String viewId) throws Exception {
View defaultView = new View();
- defaultView.setInputStream(getRealm().getRepository().getInputStream(path));
+ defaultView.setInputStream(getRealm().getRepository().getInputStream(getPath()));
defaultView.setMimeType(getMimeType(viewId));
return defaultView;
@@ -80,7 +80,7 @@
if (mimeType != null) return mimeType;
// TODO: Load config mime.types ...
- String suffix = path.getSuffix();
+ String suffix = getPath().getSuffix();
if (suffix != null) {
log.debug("SUFFIX: " + suffix);
if (suffix.equals("html")) {
@@ -120,7 +120,7 @@
mimeType = "application/octet-stream";
}
} else {
- log.warn("mime-type will be set to application/octet-stream, because no suffix for " + path);
+ log.warn("mime-type will be set to application/octet-stream, because no suffix for " + getPath());
mimeType = "application/octet-stream";
}
return mimeType;
@@ -130,14 +130,14 @@
*
*/
public Reader getReader() throws Exception {
- return getRealm().getRepository().getReader(path);
+ return getRealm().getRepository().getReader(getPath());
}
/**
*
*/
public InputStream getInputStream() throws Exception {
- return getRealm().getRepository().getInputStream(path);
+ return getRealm().getRepository().getInputStream(getPath());
}
/**
@@ -152,7 +152,7 @@
*
*/
public OutputStream getOutputStream() throws Exception {
- return getRealm().getRepository().getOutputStream(path);
+ return getRealm().getRepository().getOutputStream(getPath());
}
/**
@@ -166,21 +166,21 @@
*
*/
public long getLastModified() throws Exception {
- return getRealm().getRepository().getLastModified(path);
+ return getRealm().getRepository().getLastModified(getPath());
}
/**
*
*/
public boolean delete() throws Exception {
- return getRealm().getRepository().delete(path);
+ return getRealm().getRepository().delete(getPath());
}
/**
*
*/
public String[] getRevisions() throws Exception {
- return getRealm().getRepository().getRevisions(path);
+ return getRealm().getRepository().getRevisions(getPath());
}
public boolean exists() throws Exception {
@@ -192,6 +192,6 @@
*
*/
public long getSize() throws Exception {
- return getRealm().getRepository().getSize(path);
+ return getRealm().getRepository().getSize(getPath());
}
}
Modified: public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
===================================================================
--- public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java 2006-12-21 16:39:04 UTC (rev 21078)
+++ public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java 2006-12-21 16:39:40 UTC (rev 21079)
@@ -82,13 +82,13 @@
*/
public View getView(String viewId) {
View defaultView = new View();
- String mimeType = getMimeType(path, viewId);
+ String mimeType = getMimeType(getPath(), viewId);
defaultView.setMimeType(mimeType);
String yanelPath = getRTI().getProperty("yanel-path");
//if (yanelPath == null) yanelPath = path.toString();
- Path xsltPath = getXSLTPath(path);
+ Path xsltPath = getXSLTPath(getPath());
try {
Repository repo = getRealm().getRepository();
@@ -97,10 +97,11 @@
TransformerFactory tf = TransformerFactory.newInstance();
//tf.setURIResolver(null);
Transformer transformer = tf.newTransformer(new StreamSource(repo.getInputStream(xsltPath)));
- transformer.setParameter("yanel.path.name", path.getName());
- transformer.setParameter("yanel.path", path.toString());
- transformer.setParameter("yanel.back2context", backToRoot(path, ""));
- transformer.setParameter("yarep.back2realm", backToRoot(path, ""));
+ transformer.setParameter("yanel.path.name", getPath().getName());
+ transformer.setParameter("yanel.path", getPath().toString());
+ //TODO: There seems to be a bug re back2context ...
+ transformer.setParameter("yanel.back2context", backToRoot(getPath(), ""));
+ transformer.setParameter("yarep.back2realm", backToRoot(getPath(), ""));
// TODO: Is this the best way to generate an InputStream from an OutputStream?
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
@@ -165,14 +166,14 @@
// TODO: Shall the mime-type be transfered?
return view.getInputStream();
} else {
- log.warn("No XML like mime-type: " + path);
+ log.warn("No XML like mime-type: " + getPath());
}
} else {
- log.warn("Resource is not ViewableV1: " + path);
+ log.warn("Resource is not ViewableV1: " + getPath());
}
}
- return repo.getInputStream(path);
+ return repo.getInputStream(getPath());
}
/**
@@ -205,14 +206,14 @@
*
*/
public Reader getReader() throws Exception {
- return getRealm().getRepository().getReader(path);
+ return getRealm().getRepository().getReader(getPath());
}
/**
*
*/
public InputStream getInputStream() throws Exception {
- return getRealm().getRepository().getInputStream(path);
+ return getRealm().getRepository().getInputStream(getPath());
}
/**
@@ -227,7 +228,7 @@
*
*/
public OutputStream getOutputStream() throws Exception {
- return getRealm().getRepository().getOutputStream(path);
+ return getRealm().getRepository().getOutputStream(getPath());
}
/**
@@ -241,7 +242,7 @@
*
*/
public long getLastModified() throws Exception {
- return getRealm().getRepository().getLastModified(path);
+ return getRealm().getRepository().getLastModified(getPath());
}
/**
@@ -277,11 +278,11 @@
*
*/
public boolean delete() throws Exception {
- return getRealm().getRepository().delete(path);
+ return getRealm().getRepository().delete(getPath());
}
public String[] getRevisions() throws Exception {
- return getRealm().getRepository().getRevisions(path);
+ return getRealm().getRepository().getRevisions(getPath());
}
public boolean exists() throws Exception {
@@ -293,6 +294,6 @@
* Get size of generated page
*/
public long getSize() throws Exception {
- return getRealm().getRepository().getSize(path);
+ return getRealm().getRepository().getSize(getPath());
}
}
More information about the Yanel-commits
mailing list