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 2009/02/09 19:49:21 UTC
svn commit: r742672 [6/6] - in /lenya/trunk:
org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/ac/
org.apache.lenya.core.acusecases/src/main/java/org/apache/lenya/cms/ac/usecases/
org.apache.lenya.core.administration/src/main/java/org/apache/...
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/TreeSiteManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/TreeSiteManager.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/TreeSiteManager.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/TreeSiteManager.java Mon Feb 9 18:49:13 2009
@@ -23,10 +23,9 @@
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.publication.DocumentLocator;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.publication.Session;
import org.apache.lenya.cms.repository.RepositoryItemFactory;
import org.apache.lenya.cms.site.AbstractSiteManager;
import org.apache.lenya.cms.site.Link;
@@ -59,14 +58,15 @@
* @return A site tree.
* @throws SiteException if an error occurs.
*/
- public DefaultSiteTree getTree(DocumentFactory map, Publication publication, String area)
- throws SiteException {
+ public DefaultSiteTree getTree(Publication publication, String area) throws SiteException {
String key = getKey(publication, area);
DefaultSiteTree sitetree;
RepositoryItemFactory factory = new SiteTreeFactory(getLogger());
try {
- sitetree = (DefaultSiteTree) map.getSession().getRepositoryItem(factory, key);
+ org.apache.lenya.cms.repository.Session repoSession = (org.apache.lenya.cms.repository.Session) publication
+ .getSession();
+ sitetree = (DefaultSiteTree) repoSession.getRepositoryItem(factory, key);
} catch (Exception e) {
throw new SiteException(e);
}
@@ -75,7 +75,7 @@
}
protected DefaultSiteTree getTree(Document document) throws SiteException {
- return getTree(document.getFactory(), document.getPublication(), document.getArea());
+ return getTree(document.getPublication(), document.getArea());
}
/**
@@ -100,18 +100,14 @@
return ancestors;
}
- /**
- * @see org.apache.lenya.cms.site.SiteManager#requires(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.site.SiteNode, org.apache.lenya.cms.site.SiteNode)
- */
- public boolean requires(DocumentFactory map, SiteNode dependingResource,
- SiteNode requiredResource) throws SiteException {
+ public boolean requires(SiteNode dependingResource, SiteNode requiredResource)
+ throws SiteException {
return getAncestors(dependingResource).contains(requiredResource);
}
- public DocumentLocator[] getRequiredResources(DocumentFactory map, final DocumentLocator loc)
+ public DocumentLocator[] getRequiredResources(Session session, final DocumentLocator loc)
throws SiteException {
-
+
List ancestors = new ArrayList();
DocumentLocator locator = loc;
while (locator.getParent() != null) {
@@ -122,12 +118,7 @@
return (DocumentLocator[]) ancestors.toArray(new DocumentLocator[ancestors.size()]);
}
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getRequiringResources(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.site.SiteNode)
- */
- public SiteNode[] getRequiringResources(DocumentFactory map, SiteNode resource)
- throws SiteException {
+ public SiteNode[] getRequiringResources(SiteNode resource) throws SiteException {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Obtaining requiring resources of [" + resource + "]");
@@ -136,7 +127,7 @@
NodeSet nodes = new NodeSet();
Publication pub = resource.getStructure().getPublication();
String area = resource.getStructure().getArea();
- SiteTree tree = getTree(map, pub, area);
+ SiteTree tree = getTree(pub, area);
SiteTreeNodeImpl node = (SiteTreeNodeImpl) tree.getNode(resource.getPath());
if (node != null) {
@@ -212,29 +203,21 @@
+ " doesn't contain a label for language " + sourceDocument.getLanguage());
}
Link link = sourceNode.getLink(sourceDocument.getLanguage());
- SiteTreeNode destinationNode = (SiteTreeNode) destinationTree.getNode(destinationDocument.getPath());
+ SiteTreeNode destinationNode = (SiteTreeNode) destinationTree
+ .getNode(destinationDocument.getPath());
if (destinationNode == null) {
if (siblingPath == null) {
- destinationTree.addNode(destinationDocument.getPath(),
- destinationDocument.getUUID(),
- sourceNode.isVisible(),
- sourceNode.getHref(),
- sourceNode.getSuffix(),
- sourceNode.hasLink());
- destinationTree.addLabel(destinationDocument.getPath(),
- destinationDocument.getLanguage(),
- link.getLabel());
+ destinationTree.addNode(destinationDocument.getPath(), destinationDocument
+ .getUUID(), sourceNode.isVisible(), sourceNode.getHref(), sourceNode
+ .getSuffix(), sourceNode.hasLink());
+ destinationTree.addLabel(destinationDocument.getPath(), destinationDocument
+ .getLanguage(), link.getLabel());
} else {
- destinationTree.addNode(destinationDocument.getPath(),
- destinationDocument.getUUID(),
- sourceNode.isVisible(),
- sourceNode.getHref(),
- sourceNode.getSuffix(),
- sourceNode.hasLink(),
- siblingPath);
- destinationTree.addLabel(destinationDocument.getPath(),
- destinationDocument.getLanguage(),
- link.getLabel());
+ destinationTree.addNode(destinationDocument.getPath(), destinationDocument
+ .getUUID(), sourceNode.isVisible(), sourceNode.getHref(), sourceNode
+ .getSuffix(), sourceNode.hasLink(), siblingPath);
+ destinationTree.addLabel(destinationDocument.getPath(), destinationDocument
+ .getLanguage(), link.getLabel());
}
} else {
@@ -288,20 +271,16 @@
return label;
}
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getDocuments(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.publication.Publication, java.lang.String)
- */
- public Document[] getDocuments(DocumentFactory map, Publication publication, String area)
- throws SiteException {
+ public Document[] getDocuments(Publication publication, String area) throws SiteException {
try {
- SiteTreeNodeImpl root = (SiteTreeNodeImpl) getTree(map, publication, area).getNode("/");
+ SiteTreeNodeImpl root = (SiteTreeNodeImpl) getTree(publication, area).getNode("/");
List allNodes = root.preOrder();
List documents = new ArrayList();
for (int i = 1; i < allNodes.size(); i++) {
SiteTreeNode node = (SiteTreeNode) allNodes.get(i);
- Document doc = map.get(publication, area, node.getUuid());
+ Document doc = publication.getArea(area).getDocument(node.getUuid(),
+ publication.getDefaultLanguage());
String[] languages = doc.getLanguages();
for (int l = 0; l < languages.length; l++) {
documents.add(doc.getTranslation(languages[l]));
@@ -353,45 +332,29 @@
return publication.getId() + ":" + area;
}
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getSiteStructure(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.publication.Publication, java.lang.String)
- */
- public SiteStructure getSiteStructure(DocumentFactory map, Publication publiation, String area)
- throws SiteException {
- return getTree(map, publiation, area);
+ public SiteStructure getSiteStructure(Publication publiation, String area) throws SiteException {
+ return getTree(publiation, area);
}
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getAvailableLocator(DocumentFactory,
- * org.apache.lenya.cms.publication.DocumentLocator)
- */
- public DocumentLocator getAvailableLocator(DocumentFactory factory, DocumentLocator locator)
+ public DocumentLocator getAvailableLocator(Session session, DocumentLocator locator)
throws SiteException {
- return DocumentLocator.getLocator(locator.getPublicationId(),
- locator.getArea(),
- computeUniquePath(factory, locator),
- locator.getLanguage());
+ return DocumentLocator.getLocator(locator.getPublicationId(), locator.getArea(),
+ computeUniquePath(session, locator), locator.getLanguage());
}
/**
* compute an unique document id
- * @param factory The factory.
* @param locator The locator.
* @return the unique documentid
* @throws SiteException if an error occurs.
*/
- protected String computeUniquePath(DocumentFactory factory, DocumentLocator locator)
+ protected String computeUniquePath(Session session, DocumentLocator locator)
throws SiteException {
String path = locator.getPath();
Publication pub;
- try {
- pub = factory.getPublication(locator.getPublicationId());
- } catch (PublicationException e) {
- throw new SiteException(e);
- }
- SiteTree tree = getTree(factory, pub, locator.getArea());
+ pub = session.getPublication(locator.getPublicationId());
+ SiteTree tree = getTree(pub, locator.getArea());
String suffix = null;
int version = 0;
@@ -434,9 +397,9 @@
}
}
- protected String getPath(DocumentFactory factory, Publication pub, String area, String uuid,
- String language) throws SiteException {
- SiteTree tree = getTree(factory, pub, area);
+ protected String getPath(Publication pub, String area, String uuid, String language)
+ throws SiteException {
+ SiteTree tree = getTree(pub, area);
SiteNode node = tree.getByUuid(uuid, language).getNode();
if (node == null) {
throw new SiteException("No node found for [" + pub.getId() + ":" + area + ":" + uuid
@@ -445,9 +408,8 @@
return node.getPath();
}
- protected String getUUID(DocumentFactory factory, Publication pub, String area, String path)
- throws SiteException {
- SiteTree tree = getTree(factory, pub, area);
+ protected String getUUID(Publication pub, String area, String path) throws SiteException {
+ SiteTree tree = getTree(pub, area);
SiteNode node = tree.getNode(path);
if (node == null) {
throw new SiteException("No node found for [" + pub.getId() + ":" + area + ":" + path
@@ -456,15 +418,10 @@
return node.getUuid();
}
- protected boolean contains(DocumentFactory factory, DocumentLocator locator)
- throws SiteException {
+ protected boolean contains(Session session, DocumentLocator locator) throws SiteException {
Publication pub;
- try {
- pub = factory.getPublication(locator.getPublicationId());
- } catch (PublicationException e) {
- throw new SiteException(e);
- }
- SiteTree tree = getTree(factory, pub, locator.getArea());
+ pub = session.getPublication(locator.getPublicationId());
+ SiteTree tree = getTree(pub, locator.getArea());
if (tree.contains(locator.getPath())) {
SiteNode node = tree.getNode(locator.getPath());
return node.hasLink(locator.getLanguage());
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/DelegatingLink.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/DelegatingLink.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/DelegatingLink.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/DelegatingLink.java Mon Feb 9 18:49:13 2009
@@ -17,7 +17,6 @@
*/
package org.apache.lenya.cms.site.tree2;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.site.AbstractLink;
/**
@@ -26,13 +25,12 @@
public class DelegatingLink extends AbstractLink {
/**
- * @param factory The document factory.
* @param node The node which this link belongs to.
* @param label The label.
* @param language The language.
*/
- public DelegatingLink(DocumentFactory factory, DelegatingNode node, String label, String language) {
- super(factory, node, label, language);
+ public DelegatingLink(DelegatingNode node, String label, String language) {
+ super(node, label, language);
}
public void delete() {
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/DelegatingSiteTree.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/DelegatingSiteTree.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/DelegatingSiteTree.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/DelegatingSiteTree.java Mon Feb 9 18:49:13 2009
@@ -105,8 +105,8 @@
protected Link getLink(Link delegate) {
Link link = (Link) this.links.get(delegate);
if (link == null) {
- link = new DelegatingLink(this.area.getPublication().getFactory(), getNode(delegate
- .getNode()), delegate.getLabel(), delegate.getLanguage());
+ link = new DelegatingLink(getNode(delegate.getNode()), delegate.getLabel(), delegate
+ .getLanguage());
}
return link;
}
@@ -150,8 +150,8 @@
return (SiteNode[]) this.topLevelNodes.toArray(new SiteNode[this.topLevelNodes.size()]);
}
- public Session getSession() {
- return this.area.getPublication().getSession();
+ public Session getRepositorySession() {
+ return (Session) this.area.getPublication().getSession();
}
private NodeFactory nodeFactory;
@@ -166,7 +166,8 @@
public Node getRepositoryNode() {
try {
- return (Node) getSession().getRepositoryItem(getNodeFactory(), getSourceUri());
+ return (Node) getRepositorySession()
+ .getRepositoryItem(getNodeFactory(), getSourceUri());
} catch (RepositoryException e) {
throw new RuntimeException("Creating repository node failed: ", e);
}
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeFactory.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeFactory.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeFactory.java Mon Feb 9 18:49:13 2009
@@ -20,8 +20,6 @@
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.commons.logging.Log;
import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.repository.RepositoryException;
import org.apache.lenya.cms.repository.RepositoryItem;
@@ -53,8 +51,8 @@
String areaName = snippets[1];
SiteTree tree;
try {
- DocumentFactory factory = DocumentUtil.createDocumentFactory(session);
- Publication publication = factory.getPublication(publicationId);
+ org.apache.lenya.cms.publication.Session pubSession = (org.apache.lenya.cms.publication.Session) session;
+ Publication publication = pubSession.getPublication(publicationId);
Area area = publication.getArea(areaName);
Session storeSession = getSharedItemStore().getSession();
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeImpl.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeImpl.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeImpl.java Mon Feb 9 18:49:13 2009
@@ -310,8 +310,8 @@
return this.area.getPublication();
}
- public Session getSession() {
- return this.area.getPublication().getFactory().getSession();
+ public Session getRepositorySession() {
+ return (Session) this.area.getPublication().getSession();
}
private NodeFactory nodeFactory;
@@ -327,7 +327,7 @@
public Node getRepositoryNode() {
try {
- return (Node) getSession().getRepositoryItem(getNodeFactory(), getSourceUri());
+ return (Node) getRepositorySession().getRepositoryItem(getNodeFactory(), getSourceUri());
} catch (RepositoryException e) {
throw new RuntimeException("Creating repository node failed: ", e);
}
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeLink.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeLink.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeLink.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeLink.java Mon Feb 9 18:49:13 2009
@@ -17,7 +17,6 @@
*/
package org.apache.lenya.cms.site.tree2;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.site.AbstractLink;
import org.apache.lenya.cms.site.SiteNode;
@@ -25,17 +24,16 @@
* SiteTree link.
*/
public class SiteTreeLink extends AbstractLink {
-
- protected SiteTreeLink(DocumentFactory factory, SiteNode node,
- String label, String language) {
- super(factory, node, label, language);
+
+ protected SiteTreeLink(SiteNode node, String label, String language) {
+ super(node, label, language);
}
public void delete() {
TreeNodeImpl node = (TreeNodeImpl) getNode();
node.removeLink(getLanguage());
}
-
+
public void save() {
TreeNodeImpl node = (TreeNodeImpl) getNode();
node.changed();
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeNodeImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeNodeImpl.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeNodeImpl.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeNodeImpl.java Mon Feb 9 18:49:13 2009
@@ -67,16 +67,16 @@
if (this.language2link.keySet().size() > 0) {
throw new RuntimeException("Can't set the UUID if the node has links.");
}
-
+
if (this.uuid != null) {
String[] languages = getLanguages();
for (int i = 0; i < languages.length; i++) {
getTree().linkRemoved(this.uuid, languages[i]);
}
}
-
+
this.uuid = uuid;
-
+
String[] languages = getLanguages();
for (int i = 0; i < languages.length; i++) {
try {
@@ -132,8 +132,8 @@
return (SiteNode) this.parent;
}
- public String getPath() {
- if(path != null) {
+ public String getPath() {
+ if (path != null) {
return path;
}
String getPath = this.parent.getPath() + "/" + getName();
@@ -176,7 +176,7 @@
SiteNode[] children = this.parent.getChildren();
int pos = Arrays.asList(children).indexOf(this);
List siblings = new ArrayList();
- for (int i = 0; i < pos ; i++) {
+ for (int i = 0; i < pos; i++) {
siblings.add(children[i]);
}
return (SiteTreeNode[]) siblings.toArray(new TreeNodeImpl[siblings.size()]);
@@ -210,8 +210,7 @@
if (this.language2link.containsKey(lang)) {
throw new RuntimeException("The language [" + lang + "] is already contained.");
}
- DocumentFactory factory = getTree().getPublication().getFactory();
- Link link = new SiteTreeLink(factory, this, label, lang);
+ Link link = new SiteTreeLink(this, label, lang);
this.language2link.put(lang, link);
getTree().linkAdded(link);
return link;
@@ -346,5 +345,5 @@
public boolean hasLink() {
return false;
}
-
+
}
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeSiteManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeSiteManager.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeSiteManager.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeSiteManager.java Mon Feb 9 18:49:13 2009
@@ -23,10 +23,10 @@
import org.apache.lenya.cms.publication.Area;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.publication.DocumentLocator;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.publication.Session;
import org.apache.lenya.cms.repository.RepositoryItemFactory;
import org.apache.lenya.cms.site.AbstractSiteManager;
import org.apache.lenya.cms.site.Link;
@@ -56,8 +56,9 @@
SiteTree sitetree;
RepositoryItemFactory factory = new SiteTreeFactory(getLogger());
try {
- sitetree = (SiteTree) area.getPublication().getFactory().getSession()
- .getRepositoryItem(factory, key);
+ org.apache.lenya.cms.repository.Session session = (org.apache.lenya.cms.repository.Session) area
+ .getPublication().getSession();
+ sitetree = (SiteTree) session.getRepositoryItem(factory, key);
} catch (Exception e) {
throw new SiteException(e);
}
@@ -140,27 +141,27 @@
}
}
- public DocumentLocator getAvailableLocator(DocumentFactory factory, DocumentLocator locator)
+ public DocumentLocator getAvailableLocator(Session session, DocumentLocator locator)
throws SiteException {
return DocumentLocator.getLocator(locator.getPublicationId(), locator.getArea(),
- computeUniquePath(factory, locator), locator.getLanguage());
+ computeUniquePath(session, locator), locator.getLanguage());
}
/**
* compute an unique document id
- * @param factory The factory.
+ * @param session The session.
* @param locator The locator.
* @return the unique documentid
* @throws SiteException if an error occurs.
*/
- protected String computeUniquePath(DocumentFactory factory, DocumentLocator locator)
+ protected String computeUniquePath(Session session, DocumentLocator locator)
throws SiteException {
String path = locator.getPath();
Publication pub;
SiteTree tree;
try {
- pub = factory.getPublication(locator.getPublicationId());
+ pub = session.getPublication(locator.getPublicationId());
tree = getTree(pub.getArea(locator.getArea()));
} catch (PublicationException e) {
throw new SiteException(e);
@@ -196,14 +197,8 @@
return path;
}
- public Document[] getDocuments(DocumentFactory factory, Publication pub, String area)
- throws SiteException {
- Area areaObj;
- try {
- areaObj = pub.getArea(area);
- } catch (PublicationException e) {
- throw new SiteException(e);
- }
+ public Document[] getDocuments(Publication pub, String area) throws SiteException {
+ Area areaObj = pub.getArea(area);
SiteTree tree = getTree(areaObj);
SiteNode[] preOrder = tree.preOrder();
List docs = new ArrayList();
@@ -216,7 +211,7 @@
return (Document[]) docs.toArray(new Document[docs.size()]);
}
- public DocumentLocator[] getRequiredResources(DocumentFactory map, DocumentLocator loc)
+ public DocumentLocator[] getRequiredResources(Session session, DocumentLocator loc)
throws SiteException {
List ancestors = new ArrayList();
DocumentLocator locator = loc;
@@ -228,8 +223,7 @@
return (DocumentLocator[]) ancestors.toArray(new DocumentLocator[ancestors.size()]);
}
- public SiteNode[] getRequiringResources(DocumentFactory map, SiteNode resource)
- throws SiteException {
+ public SiteNode[] getRequiringResources(SiteNode resource) throws SiteException {
NodeSet nodes = new NodeSet();
SiteTree tree = (SiteTree) resource.getStructure();
@@ -247,7 +241,7 @@
return nodes.getNodes();
}
- public SiteStructure getSiteStructure(DocumentFactory map, Publication publication, String area)
+ public SiteStructure getSiteStructure(Publication publication, String area)
throws SiteException {
try {
return getTree(publication.getArea(area));
@@ -264,8 +258,7 @@
}
}
- public boolean requires(DocumentFactory map, SiteNode depending, SiteNode required)
- throws SiteException {
+ public boolean requires(SiteNode depending, SiteNode required) throws SiteException {
return depending.getPath().startsWith(required.getPath() + "/");
}
Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNode.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNode.java Mon Feb 9 18:49:13 2009
@@ -85,7 +85,7 @@
protected String getUserId() {
String userId = null;
- Identity identity = getSession().getIdentity();
+ Identity identity = getRepositorySession().getIdentity();
if (identity != null) {
User user = identity.getUser();
if (user != null) {
@@ -102,11 +102,11 @@
RCML rcml = getRcml();
synchronized (rcml) {
try {
- if (!rcml.isCheckedOutBySession(getSession())) {
+ if (!rcml.isCheckedOutBySession(getRepositorySession())) {
throw new RepositoryException("Cannot check in node [" + getSourceURI()
+ "]: not checked out by this session!");
}
- rcml.checkIn(this, exists(), getSession().isDirty(this));
+ rcml.checkIn(this, exists(), getRepositorySession().isDirty(this));
} catch (Exception e) {
throw new RepositoryException(e);
}
@@ -155,7 +155,7 @@
RCML rcml = getRcml();
synchronized (rcml) {
try {
- if (rcml.isCheckedOut() && !rcml.isCheckedOutBySession(getSession())) {
+ if (rcml.isCheckedOut() && !rcml.isCheckedOutBySession(getRepositorySession())) {
throw new RepositoryException("The node [" + this
+ "] is already checked out by another session!");
}
@@ -212,7 +212,7 @@
if (sourceUri.endsWith(".meta")) {
String documentSourceUri = sourceUri
.substring(0, sourceUri.length() - ".meta".length());
- node = (Node) getNodeFactory().buildItem(getSession(), documentSourceUri);
+ node = (Node) getNodeFactory().buildItem(getRepositorySession(), documentSourceUri);
} else {
node = this;
}
@@ -241,7 +241,7 @@
int metaRev = metaLoadRev == -1 ? currentRev : metaLoadRev;
int lockRev = Math.min(contentRev, metaRev);
- this.lock = getSession().createLock(this, lockRev);
+ this.lock = getRepositorySession().createLock(this, lockRev);
} catch (TransactionException e) {
throw new RepositoryException(e);
}
@@ -261,7 +261,7 @@
public void unlock() throws RepositoryException {
this.lock = null;
try {
- getSession().removeLock(this);
+ getRepositorySession().removeLock(this);
} catch (TransactionException e) {
throw new RepositoryException(e);
}
@@ -294,7 +294,7 @@
java.util.Vector newChildren = new java.util.Vector();
while (iterator.hasNext()) {
TraversableSource child = (TraversableSource) iterator.next();
- newChildren.add(new SourceNode(getSession(),
+ newChildren.add(new SourceNode(getRepositorySession(),
getSourceURI() + "/" + child.getName(), getSourceResolver(), getLogger()));
}
return newChildren;
@@ -327,16 +327,16 @@
private Session session;
/**
- * @see org.apache.lenya.cms.repository.Node#getSession()
+ * @see org.apache.lenya.cms.repository.Node#getRepositorySession()
*/
- public Session getSession() {
+ public Session getRepositorySession() {
return this.session;
}
public void registerDirty() throws RepositoryException {
try {
- if (!getSession().isDirty(this)) {
- getSession().registerDirty(this);
+ if (!getRepositorySession().isDirty(this)) {
+ getRepositorySession().registerDirty(this);
enqueueEvent(DocumentEvent.CHANGED);
}
} catch (TransactionException e) {
@@ -347,12 +347,12 @@
protected void enqueueEvent(Object descriptor) {
RepositoryEvent event = RepositoryEventFactory.createEvent(this, getLogger(),
descriptor);
- getSession().enqueueEvent(event);
+ getRepositorySession().enqueueEvent(event);
}
public void registerRemoved() throws RepositoryException {
try {
- getSession().registerRemoved(this);
+ getRepositorySession().registerRemoved(this);
enqueueEvent(DocumentEvent.REMOVED);
} catch (Exception e) {
throw new RepositoryException(e);
@@ -391,7 +391,7 @@
return true;
} else {
// before first check-in, the node exists only in the session that created it
- return entry.getSessionId().equals(getSession().getId());
+ return entry.getSessionId().equals(getRepositorySession().getId());
}
}
} catch (RevisionControlException e) {
@@ -473,7 +473,7 @@
if (wasLocked) {
// this is a hack: update the lock revision to the latest copied revision to avoid
// the "node has changed" error
- this.lock = getSession().createLock(this, getCurrentRevisionNumber());
+ this.lock = getRepositorySession().createLock(this, getCurrentRevisionNumber());
}
} catch (RevisionControlException e) {
throw new RepositoryException(e);
@@ -492,7 +492,7 @@
}
public boolean isCheckedOutBySession() throws TransactionException {
- return isCheckedOutBySession(getSession());
+ return isCheckedOutBySession(getRepositorySession());
}
public void setPersistable(Persistable item) throws RepositoryException {
Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRCML.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRCML.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRCML.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRCML.java Mon Feb 9 18:49:13 2009
@@ -143,7 +143,7 @@
public synchronized void checkOutIn(Node node, short type, long time, boolean backup,
boolean newVersion, boolean restrictedToSession) throws RevisionControlException {
- String identity = node.getSession().getIdentity().getUser().getId();
+ String identity = node.getRepositorySession().getIdentity().getUser().getId();
Vector entries = getEntries();
if (entries.size() == 0) {
@@ -165,7 +165,7 @@
sessionId = ALL_SESSIONS;
}
else {
- sessionId = node.getSession().getId();
+ sessionId = node.getRepositorySession().getId();
}
RCMLEntry entry;
Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRevision.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRevision.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRevision.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRevision.java Mon Feb 9 18:49:13 2009
@@ -124,7 +124,7 @@
}
protected String getMetaSourceUri() {
- String realSourceUri = SourceWrapper.computeRealSourceUri(getSourceResolver(), this.node.getSession(),
+ String realSourceUri = SourceWrapper.computeRealSourceUri(getSourceResolver(), this.node.getRepositorySession(),
this.node.getSourceURI(), getLogger());
return realSourceUri + ".meta." + getTime() + ".bak";
}
Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceWrapper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceWrapper.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceWrapper.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceWrapper.java Mon Feb 9 18:49:13 2009
@@ -28,15 +28,12 @@
import java.util.WeakHashMap;
import org.apache.avalon.framework.service.ServiceException;
-import org.apache.cocoon.spring.configurator.WebAppContextUtils;
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.commons.logging.Log;
import org.apache.excalibur.source.ModifiableSource;
import org.apache.excalibur.source.SourceResolver;
import org.apache.excalibur.source.TraversableSource;
import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentFactoryBuilder;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.util.Assert;
@@ -83,7 +80,7 @@
*/
protected String getRealSourceUri() {
if (this.realSourceUri == null) {
- this.realSourceUri = computeRealSourceUri(getSourceResolver(), getNode().getSession(),
+ this.realSourceUri = computeRealSourceUri(getSourceResolver(), getNode().getRepositorySession(),
this.sourceUri, getLogger());
}
return this.realSourceUri;
@@ -98,10 +95,8 @@
String publicationsPath = sourceUri.substring(pubBase.length());
int firstSlashIndex = publicationsPath.indexOf("/");
publicationId = publicationsPath.substring(0, firstSlashIndex);
- DocumentFactoryBuilder builder = (DocumentFactoryBuilder) WebAppContextUtils.getCurrentWebApplicationContext()
- .getBean(DocumentFactoryBuilder.class.getName());
- DocumentFactory factory = builder.createDocumentFactory(session);
- Publication pub = factory.getPublication(publicationId);
+ org.apache.lenya.cms.publication.Session pubSession = (org.apache.lenya.cms.publication.Session) session;
+ Publication pub = pubSession.getPublication(publicationId);
contentDir = pub.getContentDir();
} catch (Exception e) {
throw new RuntimeException(e);
Modified: lenya/trunk/org.apache.lenya.module.usecasedocument/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/UsecaseDocumentModule.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.usecasedocument/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/UsecaseDocumentModule.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.usecasedocument/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/UsecaseDocumentModule.java (original)
+++ lenya/trunk/org.apache.lenya.module.usecasedocument/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/UsecaseDocumentModule.java Mon Feb 9 18:49:13 2009
@@ -51,7 +51,7 @@
Request request = ObjectModelHelper.getRequest(objectModel);
Session session = this.repository.getSession(request);
String webappUrl = ServletHelper.getWebappURI(request);
- Document doc = session.getDocumentFactory().getFromURL(webappUrl);
+ Document doc = session.getUriHandler().getDocument(webappUrl);
org.w3c.dom.Document xmlDoc = DocumentHelper.readDocument(doc.getInputStream());
String usecaseName = xmlDoc.getDocumentElement().getAttribute(CreateUsecaseDocument.ATTRIBUTE_NAME);
value = usecaseName;
Modified: lenya/trunk/org.apache.lenya.module.webdav/src/main/java/org/apache/lenya/cms/usecases/webdav/Mkcol.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.webdav/src/main/java/org/apache/lenya/cms/usecases/webdav/Mkcol.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.webdav/src/main/java/org/apache/lenya/cms/usecases/webdav/Mkcol.java (original)
+++ lenya/trunk/org.apache.lenya.module.webdav/src/main/java/org/apache/lenya/cms/usecases/webdav/Mkcol.java Mon Feb 9 18:49:13 2009
@@ -24,7 +24,6 @@
import org.apache.lenya.cms.metadata.MetaDataException;
import org.apache.lenya.cms.metadata.dublincore.DublinCore;
import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.publication.DocumentManager;
import org.apache.lenya.cms.publication.ResourceType;
import org.apache.lenya.cms.publication.ResourceTypeResolver;
@@ -71,12 +70,11 @@
if (!doc.exists()) {
- DocumentFactory map = getDocumentFactory();
String path = doc.getPath();
resourceType = getResourceTypeResolver().getResourceType(TYPE);
ResourceType.Sample sample = resourceType.getSample(resourceType.getSampleNames()[0]);
- doc = getDocumentManager().add(map, resourceType, sample.getUri(), getPublication(),
+ doc = getDocumentManager().add(resourceType, sample.getUri(), getPublication(),
doc.getArea(), path, doc.getLanguage(), EXTENSION, doc.getName(), true);
doc.setMimeType(sample.getMimeType());
Modified: lenya/trunk/org.apache.lenya.module.webdav/src/main/java/org/apache/lenya/cms/usecases/webdav/Put.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.webdav/src/main/java/org/apache/lenya/cms/usecases/webdav/Put.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.webdav/src/main/java/org/apache/lenya/cms/usecases/webdav/Put.java (original)
+++ lenya/trunk/org.apache.lenya.module.webdav/src/main/java/org/apache/lenya/cms/usecases/webdav/Put.java Mon Feb 9 18:49:13 2009
@@ -108,11 +108,10 @@
// create new doc from PUT input
if (!doc.exists()) {
- DocumentFactory map = getDocumentFactory();
String path = doc.getPath();
ResourceType resourceType = lookUpExtension(extension);
ResourceType.Sample sample = resourceType.getSample(resourceType.getSampleNames()[0]);
- doc = getDocumentManager().add(map, resourceType, sample.getUri(), getPublication(),
+ doc = getDocumentManager().add(resourceType, sample.getUri(), getPublication(),
doc.getArea(), path, doc.getLanguage(), extension, doc.getName(), true);
doc.setMimeType(sample.getMimeType());
setMetaData(doc);
Modified: lenya/trunk/org.apache.lenya.optional.jcrsource/src/main/java/org/apache/lenya/cms/jcr/usecases/Import.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.optional.jcrsource/src/main/java/org/apache/lenya/cms/jcr/usecases/Import.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.optional.jcrsource/src/main/java/org/apache/lenya/cms/jcr/usecases/Import.java (original)
+++ lenya/trunk/org.apache.lenya.optional.jcrsource/src/main/java/org/apache/lenya/cms/jcr/usecases/Import.java Mon Feb 9 18:49:13 2009
@@ -26,7 +26,6 @@
import org.apache.lenya.cms.cocoon.source.SourceUtil;
import org.apache.lenya.cms.publication.Area;
import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.repository.Node;
import org.apache.lenya.cms.usecase.AbstractUsecase;
@@ -43,7 +42,7 @@
protected void initParameters() {
super.initParameters();
- Publication[] pubs = getDocumentFactory().getPublications();
+ Publication[] pubs = getSession().getPublications();
List pubList = Arrays.asList(pubs);
setParameter(PUBLICATIONS, pubList);
}
@@ -51,8 +50,7 @@
protected void doExecute() throws Exception {
super.doExecute();
String pubId = getParameterAsString(PUBLICATION);
- DocumentFactory factory = getDocumentFactory();
- Publication pub = factory.getPublication(pubId);
+ Publication pub = getSession().getPublication(pubId);
List nodes = new ArrayList();
Modified: lenya/trunk/org.apache.lenya.parent/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.parent/pom.xml?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.parent/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.parent/pom.xml Mon Feb 9 18:49:13 2009
@@ -527,6 +527,13 @@
</dependency>
<dependency>
<groupId>org.apache.lenya</groupId>
+ <artifactId>lenya-core-impl</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lenya</groupId>
<artifactId>lenya-core-ldap</artifactId>
<version>${project.version}</version>
</dependency>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org