[Yanel-commits] rev 48579 -
public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node
michi at wyona.com
michi at wyona.com
Fri Apr 9 15:06:14 CEST 2010
Author: michi
Date: 2010-04-09 15:06:14 +0200 (Fri, 09 Apr 2010)
New Revision: 48579
Modified:
public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java
Log:
last change reverted because discussion has not been clarified yet. We will create a separate resource type based on the file/node resource to experiment with and come back to probably enhancing this at some later stage
Modified: public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java
===================================================================
--- public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java 2010-04-09 12:48:20 UTC (rev 48578)
+++ public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/node/NodeResource.java 2010-04-09 13:06:14 UTC (rev 48579)
@@ -61,6 +61,12 @@
/**
*
*/
+ public NodeResource() {
+ }
+
+ /**
+ *
+ */
public ViewDescriptor[] getViewDescriptors() {
return null;
}
@@ -137,10 +143,10 @@
*/
public OutputStream getOutputStream() throws Exception {
log.error("TODO: Use existsNode() method!");
- if (!getRepository().existsNode(getPath())) {
+ if (!getRealm().getRepository().existsNode(getPath())) {
// TODO: create node recursively ...
log.error("TODO: Use getNode() method!");
- getRepository().getNode(new org.wyona.commons.io.Path(getPath()).getParent().toString()).addNode(new org.wyona.commons.io.Path(getPath()).getName().toString(), org.wyona.yarep.core.NodeType.RESOURCE);
+ getRealm().getRepository().getNode(new org.wyona.commons.io.Path(getPath()).getParent().toString()).addNode(new org.wyona.commons.io.Path(getPath()).getName().toString(), org.wyona.yarep.core.NodeType.RESOURCE);
}
return getNode().getOutputStream();
}
@@ -189,7 +195,7 @@
revisionInfos[i] = new RevisionInformation(revisions[i]);
}
if (revisions.length > 0) {
- log.warn("Node \"" + getPath() + "\" does not seem to have any revisions! The repository \"" + getRepository() + "\" might not support revisions!");
+ log.warn("Node \"" + getPath() + "\" does not seem to have any revisions! The repository \"" + getRealm().getRepository() + "\" might not support revisions!");
}
return revisionInfos;
}
@@ -262,7 +268,7 @@
}
public boolean exists() throws Exception {
- return getRepository().existsNode(getPath());
+ return getRealm().getRepository().existsNode(getPath());
}
/**
@@ -307,7 +313,7 @@
*/
public void create(HttpServletRequest request) {
try {
- Repository repo = getRepository();
+ Repository repo = getRealm().getRepository();
if (request instanceof HttpRequest) {
HttpRequest yanelRequest = (HttpRequest)request;
@@ -316,7 +322,7 @@
if (parameters.hasMoreElements()) {
String name = (String) parameters.nextElement();
- Node newNode = org.wyona.yarep.util.YarepUtil.addNodes(repo, getPath().toString(), org.wyona.yarep.core.NodeType.RESOURCE);
+ Node newNode = org.wyona.yanel.core.util.YarepUtil.addNodes(repo, getPath().toString(), org.wyona.yarep.core.NodeType.RESOURCE);
OutputStream output = newNode.getOutputStream();
InputStream is = yanelRequest.getInputStream(name);
Streams.copy(is, output, true);
@@ -588,23 +594,13 @@
path = getResourceConfigProperty("src");
}
try {
- return getRepository().getNode(path);
+ return getRealm().getRepository().getNode(path);
} catch (org.wyona.yarep.core.NoSuchNodeException e) {
throw new org.wyona.yanel.core.ResourceNotFoundException(path);
- //throw new org.wyona.yanel.core.ResourceNotFoundException(path, getRealm(), getRepository());
+ //throw new org.wyona.yanel.core.ResourceNotFoundException(path, getRealm(), getRealm().getRepository());
}
} catch (Exception e) {
throw new org.wyona.yanel.core.ResourceNotFoundException(e);
}
}
-
- private Repository getRepository() throws Exception {
- String repositoryID = getResourceConfigProperty("content-repository-id");
- if (log.isDebugEnabled()) log.debug("repositoryID: "+repositoryID); //FIXME
- if (repositoryID == null) {
- return getRealm().getRepository();
- }
- Repository repository = getRealm().getRepository(repositoryID);
- return repository;
- }
}
More information about the Yanel-commits
mailing list