You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/07/31 18:23:09 UTC
svn commit: r427154 - in /lenya/trunk/src:
impl/java/org/apache/lenya/cms/publication/ impl/test/org/apache/lenya/cms/
java/org/apache/lenya/cms/publication/ java/org/apache/lenya/cms/site/
modules/sitetree/java/src/org/apache/lenya/cms/site/usecases/ ...
Author: andreas
Date: Mon Jul 31 09:23:08 2006
New Revision: 427154
URL: http://svn.apache.org/viewvc?rev=427154&view=rev
Log:
Updated code to new Document API, fixed some errors about non-existing documents
Modified:
lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
lenya/trunk/src/impl/test/org/apache/lenya/cms/LenyaTestCase.java
lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentifier.java
lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java
lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/usecases/Nudge.java
lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java?rev=427154&r1=427153&r2=427154&view=diff
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java Mon Jul 31 09:23:08 2006
@@ -209,17 +209,7 @@
}
for (int i = 0; i < allLanguages.length; i++) {
- Document version;
- try {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Try to create document: " + allLanguages[i] + " " + this);
- }
- DocumentLocator loc = getLocator().getLanguageVersion(allLanguages[i]);
- version = getFactory().get(loc);
- } catch (DocumentBuildException e) {
- throw new DocumentException(e);
- }
- if (version.exists()) {
+ if (existsTranslation(allLanguages[i])) {
documentLanguages.add(allLanguages[i]);
}
}
Modified: lenya/trunk/src/impl/test/org/apache/lenya/cms/LenyaTestCase.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/test/org/apache/lenya/cms/LenyaTestCase.java?rev=427154&r1=427153&r2=427154&view=diff
==============================================================================
--- lenya/trunk/src/impl/test/org/apache/lenya/cms/LenyaTestCase.java (original)
+++ lenya/trunk/src/impl/test/org/apache/lenya/cms/LenyaTestCase.java Mon Jul 31 09:23:08 2006
@@ -17,7 +17,7 @@
package org.apache.lenya.cms;
import java.io.File;
-import java.net.URL;
+import java.io.FileInputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -56,6 +56,10 @@
File contextRootDir = new File(contextRoot);
context.put("context-root", contextRootDir);
+ String testPath = System.getProperty("testPath", "build/test");
+ File testRootDir = new File(testPath);
+ context.put("test-path", testRootDir);
+
Context envContext = new CommandLineContext(contextRoot);
ContainerUtil.enableLogging(envContext, getLogger());
context.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, envContext);
@@ -84,12 +88,13 @@
}
protected void prepare() throws Exception {
+ File testPath = (File) this.context.get("test-path");
final String resourceName = LenyaTestCase.class.getName().replace('.', '/') + ".xtest";
- URL resource = getClass().getClassLoader().getResource(resourceName);
-
- if (resource != null) {
- getLogger().debug("Loading resource " + resourceName);
- prepare(resource.openStream());
+ File resourceFile = new File(testPath, resourceName.replace('/', File.separatorChar));
+
+ if (resourceFile.isFile()) {
+ getLogger().debug("Loading resource " + resourceFile.getAbsolutePath());
+ prepare(new FileInputStream(resourceFile));
} else {
getLogger().debug("Resource not found " + resourceName);
}
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentifier.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentifier.java?rev=427154&r1=427153&r2=427154&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentifier.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentifier.java Mon Jul 31 09:23:08 2006
@@ -36,6 +36,11 @@
* @param uuid The UUID.
*/
public DocumentIdentifier(Publication publication, String area, String uuid, String language) {
+
+ if (uuid.startsWith("/") && uuid.indexOf("-") > -1) {
+ throw new IllegalStateException("The UUID must not begin with a '/' and contain a '-'!");
+ }
+
this.publication = publication;
this.area = area;
this.language = language;
Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java?rev=427154&r1=427153&r2=427154&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java Mon Jul 31 09:23:08 2006
@@ -152,8 +152,7 @@
Document document = map.get(node.getPublication(), node.getArea(), node.getPath());
String[] languages = document.getLanguages();
for (int i = 0; i < languages.length; i++) {
- DocumentLocator loc = document.getLocator().getLanguageVersion(languages[i]);
- Document version = document.getFactory().get(loc);
+ Document version = document.getTranslation(languages[i]);
set.add(version);
}
return set;
Modified: lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/usecases/Nudge.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/usecases/Nudge.java?rev=427154&r1=427153&r2=427154&view=diff
==============================================================================
--- lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/usecases/Nudge.java (original)
+++ lenya/trunk/src/modules/sitetree/java/src/org/apache/lenya/cms/site/usecases/Nudge.java Mon Jul 31 09:23:08 2006
@@ -61,7 +61,7 @@
if (structure instanceof SiteTree) {
SiteTree tree = (SiteTree) structure;
- SiteTreeNode node = tree.getNode(getSourceDocument().getId());
+ SiteTreeNode node = tree.getNode(SiteUtil.getPath(this.manager, getSourceDocument()));
SiteTreeNode[] siblings = null;
String direction = getParameterAsString(DIRECTION);
Modified: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java?rev=427154&r1=427153&r2=427154&view=diff
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java Mon Jul 31 09:23:08 2006
@@ -231,8 +231,6 @@
} else {
SourceUtil.delete(getRealSourceURI(), this.manager);
}
- removed();
-
} catch (Exception e) {
throw new RepositoryException(e);
}
@@ -327,9 +325,6 @@
out.write(buf, 0, read);
read = in.read(buf);
}
-
- changed();
-
} catch (Exception e) {
throw new RepositoryException(e);
} finally {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org